diff options
author | Ross Burton <ross.burton@arm.com> | 2022-12-07 16:36:50 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-12-08 10:50:30 +0000 |
commit | 85ec78cc24346f8e0d45ca947a2fecf17913b535 (patch) | |
tree | f2aa52666f51a7890c12ce7ac5e4b8a402637057 | |
parent | cee485d1672d13499cc8f084e083adbe071f0bf6 (diff) | |
download | poky-85ec78cc24346f8e0d45ca947a2fecf17913b535.tar.gz |
combo-layer: add sync-revs command
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.
(From OE-Core rev: 2bb5d12ecd1b0273983f7c05699f34dd64b11c25)
Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rwxr-xr-x | scripts/combo-layer | 27 |
1 files 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): | |||
191 | logger.debug("output: %s" % output.replace(chr(0), '\\0')) | 191 | logger.debug("output: %s" % output.replace(chr(0), '\\0')) |
192 | return output | 192 | return output |
193 | 193 | ||
194 | def action_sync_revs(conf, args): | ||
195 | """ | ||
196 | Update the last_revision config option for each repo with the latest | ||
197 | revision in the remote's branch. Useful if multiple people are using | ||
198 | combo-layer. | ||
199 | """ | ||
200 | repos = get_repos(conf, args[1:]) | ||
201 | |||
202 | for name in repos: | ||
203 | repo = conf.repos[name] | ||
204 | ldir = repo['local_repo_dir'] | ||
205 | branch = repo.get('branch', "master") | ||
206 | runcmd("git fetch", ldir) | ||
207 | lastrev = runcmd('git rev-parse origin/%s' % branch, ldir).strip() | ||
208 | print("Updating %s to %s" % (name, lastrev)) | ||
209 | conf.update(name, "last_revision", lastrev) | ||
210 | |||
194 | def action_init(conf, args): | 211 | def action_init(conf, args): |
195 | """ | 212 | """ |
196 | Clone component repositories | 213 | Clone component repositories |
@@ -1301,6 +1318,7 @@ actions = { | |||
1301 | "update": action_update, | 1318 | "update": action_update, |
1302 | "pull": action_pull, | 1319 | "pull": action_pull, |
1303 | "splitpatch": action_splitpatch, | 1320 | "splitpatch": action_splitpatch, |
1321 | "sync-revs": action_sync_revs, | ||
1304 | } | 1322 | } |
1305 | 1323 | ||
1306 | def main(): | 1324 | def main(): |
@@ -1311,10 +1329,11 @@ def main(): | |||
1311 | Create and update a combination layer repository from multiple component repositories. | 1329 | Create and update a combination layer repository from multiple component repositories. |
1312 | 1330 | ||
1313 | Action: | 1331 | Action: |
1314 | init initialise the combo layer repo | 1332 | init initialise the combo layer repo |
1315 | update [components] get patches from component repos and apply them to the combo repo | 1333 | update [components] get patches from component repos and apply them to the combo repo |
1316 | pull [components] just pull component repos only | 1334 | pull [components] just pull component repos only |
1317 | splitpatch [commit] generate commit patch and split per component, default commit is HEAD""") | 1335 | sync-revs [components] update the config file's last_revision for each repository |
1336 | splitpatch [commit] generate commit patch and split per component, default commit is HEAD""") | ||
1318 | 1337 | ||
1319 | parser.add_option("-c", "--conf", help = "specify the config file (conf/combo-layer.conf is the default).", | 1338 | parser.add_option("-c", "--conf", help = "specify the config file (conf/combo-layer.conf is the default).", |
1320 | action = "store", dest = "conffile", default = "conf/combo-layer.conf") | 1339 | action = "store", dest = "conffile", default = "conf/combo-layer.conf") |