public inbox for openembedded-core@lists.openembedded.org
 help / color / mirror / Atom feed
From: Steve Sakoman <steve@sakoman.com>
To: openembedded-core@lists.openembedded.org
Subject: [OE-core][kirkstone 17/19] combo-layer: add sync-revs command
Date: Sun, 18 Dec 2022 06:13:01 -1000	[thread overview]
Message-ID: <ba24231de6a3826558c9fcd403b075fc6772fffa.1671379841.git.steve@sakoman.com> (raw)
In-Reply-To: <cover.1671379841.git.steve@sakoman.com>

From: Ross Burton <ross.burton@arm.com>

When starting to use combo-layer, or if someone else is using it too,
the local last_revision may be incorrect.

This command will forcibly update the last_revision config values to the
latest SHA on the remote branch that is tracked.

Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit 2bb5d12ecd1b0273983f7c05699f34dd64b11c25)
Signed-off-by: Steve Sakoman <steve@sakoman.com>
---
 scripts/combo-layer | 27 +++++++++++++++++++++++----
 1 file changed, 23 insertions(+), 4 deletions(-)

diff --git a/scripts/combo-layer b/scripts/combo-layer
index e467f390c1..7f2020fca7 100755
--- a/scripts/combo-layer
+++ b/scripts/combo-layer
@@ -191,6 +191,23 @@ def runcmd(cmd,destdir=None,printerr=True,out=None,env=None):
     logger.debug("output: %s" % output.replace(chr(0), '\\0'))
     return output
 
+def action_sync_revs(conf, args):
+    """
+    Update the last_revision config option for each repo with the latest
+    revision in the remote's branch. Useful if multiple people are using
+    combo-layer.
+    """
+    repos = get_repos(conf, args[1:])
+
+    for name in repos:
+        repo = conf.repos[name]
+        ldir = repo['local_repo_dir']
+        branch = repo.get('branch', "master")
+        runcmd("git fetch", ldir)
+        lastrev = runcmd('git rev-parse origin/%s' % branch, ldir).strip()
+        print("Updating %s to %s" % (name, lastrev))
+        conf.update(name, "last_revision", lastrev)
+
 def action_init(conf, args):
     """
         Clone component repositories
@@ -1301,6 +1318,7 @@ actions = {
     "update": action_update,
     "pull": action_pull,
     "splitpatch": action_splitpatch,
+    "sync-revs": action_sync_revs,
 }
 
 def main():
@@ -1311,10 +1329,11 @@ def main():
 Create and update a combination layer repository from multiple component repositories.
 
 Action:
-  init                 initialise the combo layer repo
-  update [components]  get patches from component repos and apply them to the combo repo
-  pull [components]    just pull component repos only
-  splitpatch [commit]  generate commit patch and split per component, default commit is HEAD""")
+  init                   initialise the combo layer repo
+  update [components]    get patches from component repos and apply them to the combo repo
+  pull [components]      just pull component repos only
+  sync-revs [components] update the config file's last_revision for each repository
+  splitpatch [commit]    generate commit patch and split per component, default commit is HEAD""")
 
     parser.add_option("-c", "--conf", help = "specify the config file (conf/combo-layer.conf is the default).",
                action = "store", dest = "conffile", default = "conf/combo-layer.conf")
-- 
2.25.1



  parent reply	other threads:[~2022-12-18 16:13 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-18 16:12 [OE-core][kirkstone 00/19] Patch review Steve Sakoman
2022-12-18 16:12 ` [OE-core][kirkstone 01/19] golang: CVE-2022-41715 regexp/syntax: limit memory used by parsing regexps Steve Sakoman
2022-12-18 16:12 ` [OE-core][kirkstone 02/19] libxml2: Fix CVE-2022-40303 && CVE-2022-40304 Steve Sakoman
2022-12-18 16:12 ` [OE-core][kirkstone 03/19] dbus: Add missing CVE product name Steve Sakoman
2022-12-18 16:12 ` [OE-core][kirkstone 04/19] bind: upgrade 9.18.8 -> 9.18.9 Steve Sakoman
2022-12-18 16:12 ` [OE-core][kirkstone 05/19] mpfr: upgrade 4.1.0 -> 4.1.1 Steve Sakoman
2022-12-18 16:12 ` [OE-core][kirkstone 06/19] libxcrypt-compat: upgrade 4.4.30 -> 4.4.33 Steve Sakoman
2022-12-18 16:12 ` [OE-core][kirkstone 07/19] python3: upgrade 3.10.8 -> 3.10.9 Steve Sakoman
2022-12-18 16:12 ` [OE-core][kirkstone 08/19] bc: extend to nativesdk Steve Sakoman
2022-12-18 16:12 ` [OE-core][kirkstone 09/19] xwayland: libxshmfence is needed when dri3 is enabled Steve Sakoman
2022-12-18 16:12 ` [OE-core][kirkstone 10/19] lsof: add update-alternatives logic Steve Sakoman
2022-12-18 16:12 ` [OE-core][kirkstone 11/19] rm_work: adjust dependency to make do_rm_work_all depend on do_rm_work Steve Sakoman
2022-12-18 16:12 ` [OE-core][kirkstone 12/19] lib/buildstats: fix parsing of trees with reduced_proc_pressure directories Steve Sakoman
2022-12-18 16:12 ` [OE-core][kirkstone 13/19] externalsrc: fix lookup for .gitmodules Steve Sakoman
2022-12-18 16:12 ` [OE-core][kirkstone 14/19] oeqa/selftest/externalsrc: add test for srctree_hash_files Steve Sakoman
2022-12-18 16:12 ` [OE-core][kirkstone 15/19] combo-layer: remove unused import Steve Sakoman
2022-12-18 16:13 ` [OE-core][kirkstone 16/19] combo-layer: dont use bb.utils.rename Steve Sakoman
2022-12-18 16:13 ` Steve Sakoman [this message]
2022-12-18 16:13 ` [OE-core][kirkstone 18/19] yocto-check-layer: Allow OE-Core to be tested Steve Sakoman
2022-12-18 16:13 ` [OE-core][kirkstone 19/19] efibootmgr: update compilation with musl Steve Sakoman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ba24231de6a3826558c9fcd403b075fc6772fffa.1671379841.git.steve@sakoman.com \
    --to=steve@sakoman.com \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox