combo-layer improvements
cover combo-layer improvements
Allow updating only a single component, fix a couple of minor bugs and update the example config file.
The following changes since commit e5ad03093dfc4364d1407183f458df79f347c7a1:
guile: fix cross configure failure (2012-02-10 13:38:16 +0000)
are available in the git repository at:
git://git.openembedded.org/openembedded-core-contrib paule/combo-layer-fixes3
http://cgit.openembedded.org/cgit.cgi/openembedded-core-contrib/log/?h=paule/combo-layer-fixes3
Paul Eggleton (4):
scripts/combo-layer: allow updating a specific component(s) only scripts/combo-layer: avoid error when config file is outside repo scripts/combo-layer: avoid saving last revision if unchanged scripts/combo-layer: add branch option to example config
scripts/combo-layer | 41 ++++++++++++++++++++++++++----------- scripts/combo-layer.conf.example | 13 ++++++++--- 2 files changed, 38 insertions(+), 16 deletions(-)
Signature · 1 line
1.7.5.4
PATCH 1/4 scripts/combo-layer: allow updating a specific component(s) only
If you specify one or more components to update immediately following the "update" command, only these components will be updated as opposed to the default behaviour of updating all of them.
--- scripts/combo-layer | 31 +++++++++++++++++++++++-------- 1 files changed, 23 insertions(+), 8 deletions(-)
scripts/combo-layer +23 -8
@@ -26,7 +26,7 @@ import logging import subprocess import ConfigParser -__version__ = "0.2.0" +__version__ = "0.2.1" def logger_create(): logger = logging.getLogger("")
@@ -158,7 +158,22 @@ def action_update(conf, args): patch_dir = "patch-%s" % uuid.uuid4() os.mkdir(patch_dir) - for name in conf.repos: + repos = [] + if len(args) > 1: + for arg in args[1:]: + if arg.startswith('-'): + break + else: + repos.append(arg) + for repo in repos: + if not repo in conf.repos: + logger.error("Specified component '%s' not found in configuration" % repo) + sys.exit(0) + + if not repos: + repos = conf.repos + + for name in repos: repo = conf.repos[name] ldir = repo['local_repo_dir'] dest_dir = repo['dest_dir']
@@ -227,7 +242,7 @@ def action_update(conf, args): sys.exit(0) # Step 6: apply the generated and revised patch - action_apply_patch(conf, args) + apply_patchlist(conf, repos) runcmd("rm -rf %s" % patch_dir) # Step 7: commit the updated config file if it's being tracked
@@ -242,11 +257,11 @@ def action_update(conf, args): if output.lstrip().startswith("M"): runcmd('git commit -m "Automatic commit to update last_revision" %s' % relpath) -def action_apply_patch(conf, args): +def apply_patchlist(conf, repos): """ apply the generated patch list to combo repo """ - for name in conf.repos: + for name in repos: repo = conf.repos[name] lastrev = repo["last_revision"] for line in open(repo['patchlist']):
@@ -325,9 +340,9 @@ def main(): Create and update a combination layer repository from multiple component repositories. Action: - init initialise the combo layer repo - update get patches from component repos and apply them to the combo repo - 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 + 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")
Signature · 1 line
1.7.5.4
PATCH 2/4 scripts/combo-layer: avoid error when config file is outside repo
In reply to Paul EggletonAvoid displaying the error from the "git status" command we use to check the status of the config file if the config file is outside of the repository (a situation that is already handled).
--- scripts/combo-layer | 7 ++++--- 1 files changed, 4 insertions(+), 3 deletions(-)
scripts/combo-layer +4 -3
@@ -79,7 +79,7 @@ class Configuration(object): logger.error("ERROR: patchutils package is missing, please install it (e.g. # apt-get install patchutils)") sys.exit(1) -def runcmd(cmd,destdir=None): +def runcmd(cmd,destdir=None,printerr=True): """ execute command, raise CalledProcessError if fail return output if succeed
@@ -90,7 +90,8 @@ def runcmd(cmd,destdir=None): subprocess.check_call(cmd, stdout=out, stderr=out, cwd=destdir, shell=True) except subprocess.CalledProcessError,e: out.seek(0) - logger.error("%s" % out.read()) + if printerr: + logger.error("%s" % out.read()) raise e out.seek(0)
@@ -248,7 +249,7 @@ def action_update(conf, args): # Step 7: commit the updated config file if it's being tracked relpath = os.path.relpath(conf.conffile) try: - output = runcmd("git status --porcelain %s" % relpath) + output = runcmd("git status --porcelain %s" % relpath, printerr=False) except: # Outside the repository output = None
Signature · 1 line
1.7.5.4
PATCH 3/4 scripts/combo-layer: avoid saving last revision if unchanged
In reply to Paul EggletonIf we are running an update and the last revision hasn't changed since the last update, don't write to the configuration file. This avoids committing the config file with no changes other than spontaneous reordering of sections, which sometimes occurs due to the behaviour of the internal dictionary in Python's ConfigParser class. (This can be fixed properly but the fix is only easy in Python 2.7+ due to the availability there of the collections.OrderedDict class, and we currently want to be compatible with 2.6.x as well.)
--- scripts/combo-layer | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
scripts/combo-layer +2 -1
@@ -283,7 +283,8 @@ def apply_patchlist(conf, repos): logger.info("After applying, run this tool again to apply the remaining patches") conf.update(name, "last_revision", lastrev) sys.exit(0) - conf.update(name, "last_revision", lastrev) + if lastrev != repo['last_revision']: + conf.update(name, "last_revision", lastrev) def action_splitpatch(conf, args): """
Signature · 1 line
1.7.5.4
PATCH 4/4 scripts/combo-layer: add branch option to example config
In reply to Paul EggletonMinor improvements to the example combo-layer config file:
* Add the recently added branch option to the optional options section
* Mention in comments that last_revision gets updated during "update"
* Tidy up some more grammar
--- scripts/combo-layer.conf.example | 13 +++++++++---- 1 files changed, 9 insertions(+), 4 deletions(-)
scripts/combo-layer.conf.example +9 -4
@@ -14,13 +14,18 @@ local_repo_dir = /home/kyu3/src/test/bitbake dest_dir = bitbake # the last update revision. -# "init" will set this automatically, however if it is empty when "update" -# is run, the tool will start from the first commit. +# "init" will set this to the latest revision automatically, however if it +# is empty when "update" is run, the tool will start from the first commit. +# Note that this value will get updated by "update" if the component repo's +# latest revision changed and the operation completes successfully. last_revision = -# optional options +# optional options: -# file_filter: only include the interested file +# branch: specify the branch in the component repo to pull from +# (master if not specified) + +# file_filter: only include the specified file(s) # file_filter = [path] [path] ... # example: # file_filter = src/ : only include the subdir src
Signature · 1 line
1.7.5.4
Richard Purdie
AppliedQuoted 11 lines · Paul Eggleton
Allow updating only a single component, fix a couple of minor bugs and update the example config file.
The following changes since commit
e5ad03093dfc4364d1407183f458df79f347c7a1:guile: fix cross configure failure (2012-02-10 13:38:16 +0000)
are available in the git repository at:
git://git.openembedded.org/openembedded-core-contribpaule/combo-layer-fixes3
http://cgit.openembedded.org/cgit.cgi/openembedded-core-contrib/log/?h=paule/combo-layer-fixes3
Quoted 5 lines
Paul Eggleton (4):
scripts/combo-layer: allow updating a specific component(s) onlyscripts/combo-layer: avoid error when config file is outside reposcripts/combo-layer: avoid saving last revision if unchangedscripts/combo-layer: add branch option to example config
Merged to master, thanks.
Richard