Openembedded Core Discussions
 help / color / mirror / Atom feed
* [PATCH 0/4] combo-layer improvements
@ 2012-02-14 13:44 Paul Eggleton
  2012-02-14 13:44 ` [PATCH 1/4] scripts/combo-layer: allow updating a specific component(s) only Paul Eggleton
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Paul Eggleton @ 2012-02-14 13:44 UTC (permalink / raw)
  To: openembedded-core

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(-)

-- 
1.7.5.4




^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/4] scripts/combo-layer: allow updating a specific component(s) only
  2012-02-14 13:44 [PATCH 0/4] combo-layer improvements Paul Eggleton
@ 2012-02-14 13:44 ` Paul Eggleton
  2012-02-14 13:44 ` [PATCH 2/4] scripts/combo-layer: avoid error when config file is outside repo Paul Eggleton
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Paul Eggleton @ 2012-02-14 13:44 UTC (permalink / raw)
  To: openembedded-core

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.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
---
 scripts/combo-layer |   31 +++++++++++++++++++++++--------
 1 files changed, 23 insertions(+), 8 deletions(-)

diff --git a/scripts/combo-layer b/scripts/combo-layer
index b4b1e48..2fac1c9 100755
--- a/scripts/combo-layer
+++ b/scripts/combo-layer
@@ -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")
-- 
1.7.5.4




^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/4] scripts/combo-layer: avoid error when config file is outside repo
  2012-02-14 13:44 [PATCH 0/4] combo-layer improvements Paul Eggleton
  2012-02-14 13:44 ` [PATCH 1/4] scripts/combo-layer: allow updating a specific component(s) only Paul Eggleton
@ 2012-02-14 13:44 ` Paul Eggleton
  2012-02-14 13:44 ` [PATCH 3/4] scripts/combo-layer: avoid saving last revision if unchanged Paul Eggleton
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Paul Eggleton @ 2012-02-14 13:44 UTC (permalink / raw)
  To: openembedded-core

Avoid 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).

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
---
 scripts/combo-layer |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/scripts/combo-layer b/scripts/combo-layer
index 2fac1c9..8fb27f6 100755
--- a/scripts/combo-layer
+++ b/scripts/combo-layer
@@ -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
-- 
1.7.5.4




^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 3/4] scripts/combo-layer: avoid saving last revision if unchanged
  2012-02-14 13:44 [PATCH 0/4] combo-layer improvements Paul Eggleton
  2012-02-14 13:44 ` [PATCH 1/4] scripts/combo-layer: allow updating a specific component(s) only Paul Eggleton
  2012-02-14 13:44 ` [PATCH 2/4] scripts/combo-layer: avoid error when config file is outside repo Paul Eggleton
@ 2012-02-14 13:44 ` Paul Eggleton
  2012-02-14 13:44 ` [PATCH 4/4] scripts/combo-layer: add branch option to example config Paul Eggleton
  2012-02-21 14:58 ` [PATCH 0/4] combo-layer improvements Richard Purdie
  4 siblings, 0 replies; 6+ messages in thread
From: Paul Eggleton @ 2012-02-14 13:44 UTC (permalink / raw)
  To: openembedded-core

If 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.)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
---
 scripts/combo-layer |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/scripts/combo-layer b/scripts/combo-layer
index 8fb27f6..7457ba2 100755
--- a/scripts/combo-layer
+++ b/scripts/combo-layer
@@ -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):
     """
-- 
1.7.5.4




^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 4/4] scripts/combo-layer: add branch option to example config
  2012-02-14 13:44 [PATCH 0/4] combo-layer improvements Paul Eggleton
                   ` (2 preceding siblings ...)
  2012-02-14 13:44 ` [PATCH 3/4] scripts/combo-layer: avoid saving last revision if unchanged Paul Eggleton
@ 2012-02-14 13:44 ` Paul Eggleton
  2012-02-21 14:58 ` [PATCH 0/4] combo-layer improvements Richard Purdie
  4 siblings, 0 replies; 6+ messages in thread
From: Paul Eggleton @ 2012-02-14 13:44 UTC (permalink / raw)
  To: openembedded-core

Minor 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

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
---
 scripts/combo-layer.conf.example |   13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/scripts/combo-layer.conf.example b/scripts/combo-layer.conf.example
index 3865829..010a692 100644
--- a/scripts/combo-layer.conf.example
+++ b/scripts/combo-layer.conf.example
@@ -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
-- 
1.7.5.4




^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 0/4] combo-layer improvements
  2012-02-14 13:44 [PATCH 0/4] combo-layer improvements Paul Eggleton
                   ` (3 preceding siblings ...)
  2012-02-14 13:44 ` [PATCH 4/4] scripts/combo-layer: add branch option to example config Paul Eggleton
@ 2012-02-21 14:58 ` Richard Purdie
  4 siblings, 0 replies; 6+ messages in thread
From: Richard Purdie @ 2012-02-21 14:58 UTC (permalink / raw)
  To: Patches and discussions about the oe-core layer

On Tue, 2012-02-14 at 13:44 +0000, Paul Eggleton wrote:
> 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

Merged to master, thanks.

Richard




^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2012-02-21 15:06 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-02-14 13:44 [PATCH 0/4] combo-layer improvements Paul Eggleton
2012-02-14 13:44 ` [PATCH 1/4] scripts/combo-layer: allow updating a specific component(s) only Paul Eggleton
2012-02-14 13:44 ` [PATCH 2/4] scripts/combo-layer: avoid error when config file is outside repo Paul Eggleton
2012-02-14 13:44 ` [PATCH 3/4] scripts/combo-layer: avoid saving last revision if unchanged Paul Eggleton
2012-02-14 13:44 ` [PATCH 4/4] scripts/combo-layer: add branch option to example config Paul Eggleton
2012-02-21 14:58 ` [PATCH 0/4] combo-layer improvements Richard Purdie

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox