All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/2] combo-layer: support updating up to arbitrary commit
@ 2015-01-07 16:00 Markus Lehtonen
  2015-01-07 16:00 ` [PATCH v2 1/2] combo-layer: minor refactor Markus Lehtonen
  2015-01-07 16:00 ` [PATCH v2 2/2] combo-layer: support updating up to arbitrary commit Markus Lehtonen
  0 siblings, 2 replies; 6+ messages in thread
From: Markus Lehtonen @ 2015-01-07 16:00 UTC (permalink / raw)
  To: openembedded-core; +Cc: paul.eggleton

I split my changeset into two separate patches. Also, fixed a bug when doing
calling pull inside the update action.

Markus Lehtonen (2):
  combo-layer: minor refactor
  combo-layer: support updating up to arbitrary commit

 scripts/combo-layer | 45 +++++++++++++++++++++++++++------------------
 1 file changed, 27 insertions(+), 18 deletions(-)

-- 
1.8.4.5



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

* [PATCH v2 1/2] combo-layer: minor refactor
  2015-01-07 16:00 [PATCH v2 0/2] combo-layer: support updating up to arbitrary commit Markus Lehtonen
@ 2015-01-07 16:00 ` Markus Lehtonen
  2015-01-07 16:00 ` [PATCH v2 2/2] combo-layer: support updating up to arbitrary commit Markus Lehtonen
  1 sibling, 0 replies; 6+ messages in thread
From: Markus Lehtonen @ 2015-01-07 16:00 UTC (permalink / raw)
  To: openembedded-core; +Cc: paul.eggleton

Change get_repos() to assume a list of repository names instead of full
list of command line arguments.

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
---
 scripts/combo-layer | 25 ++++++++++++-------------
 1 file changed, 12 insertions(+), 13 deletions(-)

diff --git a/scripts/combo-layer b/scripts/combo-layer
index 19d64e6..37d1f47 100755
--- a/scripts/combo-layer
+++ b/scripts/combo-layer
@@ -305,18 +305,17 @@ def check_rev_branch(component, repodir, rev, branch):
         return False
     return True
 
-def get_repos(conf, args):
+def get_repos(conf, repo_names):
     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)
+    for name in repo_names:
+        if name.startswith('-'):
+            break
+        else:
+            repos.append(name)
+    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
@@ -327,7 +326,7 @@ def action_pull(conf, args):
     """
         update the component repos only
     """
-    repos = get_repos(conf, args)
+    repos = get_repos(conf, args[1:])
 
     # make sure all repos are clean
     for name in repos:
@@ -348,7 +347,7 @@ def action_update(conf, args):
         generate the patch list
         apply the generated patches
     """
-    repos = get_repos(conf, args)
+    repos = get_repos(conf, args[1:])
 
     # make sure combo repo is clean
     check_repo_clean(os.getcwd())
-- 
1.8.4.5



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

* [PATCH v2 2/2] combo-layer: support updating up to arbitrary commit
  2015-01-07 16:00 [PATCH v2 0/2] combo-layer: support updating up to arbitrary commit Markus Lehtonen
  2015-01-07 16:00 ` [PATCH v2 1/2] combo-layer: minor refactor Markus Lehtonen
@ 2015-01-07 16:00 ` Markus Lehtonen
  2015-01-12 11:46   ` Paul Eggleton
  1 sibling, 1 reply; 6+ messages in thread
From: Markus Lehtonen @ 2015-01-07 16:00 UTC (permalink / raw)
  To: openembedded-core; +Cc: paul.eggleton

Support defining the top commit up to which to update. In other words,
this makes it possible to update up to certain point other than the
branch head. The update point (git commitish) is given on the command
line by appending the component name(s) with a colon and the commitish,
e.g.
 $ combo-layer update my_component:sha1

Only the "update" action supports this.

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
---
 scripts/combo-layer | 22 ++++++++++++++++------
 1 file changed, 16 insertions(+), 6 deletions(-)

diff --git a/scripts/combo-layer b/scripts/combo-layer
index 37d1f47..851003d 100755
--- a/scripts/combo-layer
+++ b/scripts/combo-layer
@@ -26,6 +26,7 @@ import logging
 import subprocess
 import ConfigParser
 import re
+from collections import OrderedDict
 
 __version__ = "0.2.1"
 
@@ -347,7 +348,13 @@ def action_update(conf, args):
         generate the patch list
         apply the generated patches
     """
-    repos = get_repos(conf, args[1:])
+    components = [arg.split(':')[0] for arg in args[1:]]
+    revisions = []
+    for arg in args[1:]:
+        revision= arg.split(':', 1)[1] if ':' in arg else None
+        revisions.append(revision)
+    # Map commitishes to repos
+    repos = OrderedDict(zip(get_repos(conf, components), revisions))
 
     # make sure combo repo is clean
     check_repo_clean(os.getcwd())
@@ -361,9 +368,9 @@ def action_update(conf, args):
     if conf.nopull:
         logger.info("Skipping pull (-n)")
     else:
-        action_pull(conf, args)
+        action_pull(conf, ['arg0'] + components)
 
-    for name in repos:
+    for name, revision in repos.iteritems():
         repo = conf.repos[name]
         ldir = repo['local_repo_dir']
         dest_dir = repo['dest_dir']
@@ -372,18 +379,21 @@ def action_update(conf, args):
 
         # Step 2: generate the patch list and store to patch dir
         logger.info("Generating patches from %s..." % name)
+        top_revision = revision or branch
+        if not check_rev_branch(name, ldir, top_revision, branch):
+            sys.exit(1)
         if dest_dir != ".":
             prefix = "--src-prefix=a/%s/ --dst-prefix=b/%s/" % (dest_dir, dest_dir)
         else:
             prefix = ""
         if repo['last_revision'] == "":
             logger.info("Warning: last_revision of component %s is not set, starting from the first commit" % name)
-            patch_cmd_range = "--root %s" % branch
-            rev_cmd_range = branch
+            patch_cmd_range = "--root %s" % top_revision
+            rev_cmd_range = top_revision
         else:
             if not check_rev_branch(name, ldir, repo['last_revision'], branch):
                 sys.exit(1)
-            patch_cmd_range = "%s..%s" % (repo['last_revision'], branch)
+            patch_cmd_range = "%s..%s" % (repo['last_revision'], top_revision)
             rev_cmd_range = patch_cmd_range
 
         file_filter = repo.get('file_filter',"")
-- 
1.8.4.5



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

* Re: [PATCH v2 2/2] combo-layer: support updating up to arbitrary commit
  2015-01-07 16:00 ` [PATCH v2 2/2] combo-layer: support updating up to arbitrary commit Markus Lehtonen
@ 2015-01-12 11:46   ` Paul Eggleton
  2015-01-27 14:17     ` Markus Lehtonen
  0 siblings, 1 reply; 6+ messages in thread
From: Paul Eggleton @ 2015-01-12 11:46 UTC (permalink / raw)
  To: Markus Lehtonen; +Cc: openembedded-core

Hi Markus,

On Wednesday 07 January 2015 18:00:42 Markus Lehtonen wrote:
> Support defining the top commit up to which to update. In other words,
> this makes it possible to update up to certain point other than the
> branch head. The update point (git commitish) is given on the command
> line by appending the component name(s) with a colon and the commitish,
> e.g.
>  $ combo-layer update my_component:sha1
> 
> Only the "update" action supports this.
> 
> Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
> ---
>  scripts/combo-layer | 22 ++++++++++++++++------
>  1 file changed, 16 insertions(+), 6 deletions(-)
> 
> diff --git a/scripts/combo-layer b/scripts/combo-layer
> index 37d1f47..851003d 100755
> --- a/scripts/combo-layer
> +++ b/scripts/combo-layer
> @@ -26,6 +26,7 @@ import logging
>  import subprocess
>  import ConfigParser
>  import re
> +from collections import OrderedDict
> 
>  __version__ = "0.2.1"
> 
> @@ -347,7 +348,13 @@ def action_update(conf, args):
>          generate the patch list
>          apply the generated patches
>      """
> -    repos = get_repos(conf, args[1:])
> +    components = [arg.split(':')[0] for arg in args[1:]]
> +    revisions = []
> +    for arg in args[1:]:
> +        revision= arg.split(':', 1)[1] if ':' in arg else None
> +        revisions.append(revision)
> +    # Map commitishes to repos
> +    repos = OrderedDict(zip(get_repos(conf, components), revisions))
> 
>      # make sure combo repo is clean
>      check_repo_clean(os.getcwd())
> @@ -361,9 +368,9 @@ def action_update(conf, args):
>      if conf.nopull:
>          logger.info("Skipping pull (-n)")
>      else:
> -        action_pull(conf, args)
> +        action_pull(conf, ['arg0'] + components)

What's this 'arg0' ?

Cheers,
Paul

-- 

Paul Eggleton
Intel Open Source Technology Centre


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

* Re: [PATCH v2 2/2] combo-layer: support updating up to arbitrary commit
  2015-01-12 11:46   ` Paul Eggleton
@ 2015-01-27 14:17     ` Markus Lehtonen
  2015-01-27 14:52       ` Paul Eggleton
  0 siblings, 1 reply; 6+ messages in thread
From: Markus Lehtonen @ 2015-01-27 14:17 UTC (permalink / raw)
  To: Paul Eggleton; +Cc: openembedded-core

On Mon, 2015-01-12 at 11:46 +0000, Paul Eggleton wrote:
> Hi Markus,
> 
> On Wednesday 07 January 2015 18:00:42 Markus Lehtonen wrote:
> > Support defining the top commit up to which to update. In other words,
> > this makes it possible to update up to certain point other than the
> > branch head. The update point (git commitish) is given on the command
> > line by appending the component name(s) with a colon and the commitish,
> > e.g.
> >  $ combo-layer update my_component:sha1
> > 
> > Only the "update" action supports this.
> > 
> > Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
> > ---
> >  scripts/combo-layer | 22 ++++++++++++++++------
> >  1 file changed, 16 insertions(+), 6 deletions(-)
> > 
> > diff --git a/scripts/combo-layer b/scripts/combo-layer
> > index 37d1f47..851003d 100755
> > --- a/scripts/combo-layer
> > +++ b/scripts/combo-layer
> > @@ -26,6 +26,7 @@ import logging
> >  import subprocess
> >  import ConfigParser
> >  import re
> > +from collections import OrderedDict
> > 
> >  __version__ = "0.2.1"
> > 
> > @@ -347,7 +348,13 @@ def action_update(conf, args):
> >          generate the patch list
> >          apply the generated patches
> >      """
> > -    repos = get_repos(conf, args[1:])
> > +    components = [arg.split(':')[0] for arg in args[1:]]
> > +    revisions = []
> > +    for arg in args[1:]:
> > +        revision= arg.split(':', 1)[1] if ':' in arg else None
> > +        revisions.append(revision)
> > +    # Map commitishes to repos
> > +    repos = OrderedDict(zip(get_repos(conf, components), revisions))
> > 
> >      # make sure combo repo is clean
> >      check_repo_clean(os.getcwd())
> > @@ -361,9 +368,9 @@ def action_update(conf, args):
> >      if conf.nopull:
> >          logger.info("Skipping pull (-n)")
> >      else:
> > -        action_pull(conf, args)
> > +        action_pull(conf, ['arg0'] + components)
> 
> What's this 'arg0' ?

It's a dummy "args[0] placeholder". Needed because action_pull() assumes
a "full" command line args list where args[0] would contain the command
name (which is not used for anything, though).

Thanks,
  Markus



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

* Re: [PATCH v2 2/2] combo-layer: support updating up to arbitrary commit
  2015-01-27 14:17     ` Markus Lehtonen
@ 2015-01-27 14:52       ` Paul Eggleton
  0 siblings, 0 replies; 6+ messages in thread
From: Paul Eggleton @ 2015-01-27 14:52 UTC (permalink / raw)
  To: openembedded-core

On Tuesday 27 January 2015 16:17:33 Markus Lehtonen wrote:
> On Mon, 2015-01-12 at 11:46 +0000, Paul Eggleton wrote:
> > On Wednesday 07 January 2015 18:00:42 Markus Lehtonen wrote:
> > > Support defining the top commit up to which to update. In other words,
> > > this makes it possible to update up to certain point other than the
> > > branch head. The update point (git commitish) is given on the command
> > > line by appending the component name(s) with a colon and the commitish,
> > > e.g.
> > > 
> > >  $ combo-layer update my_component:sha1
> > > 
> > > Only the "update" action supports this.
> > > 
> > > Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
> > > ---
> > > 
> > >  scripts/combo-layer | 22 ++++++++++++++++------
> > >  1 file changed, 16 insertions(+), 6 deletions(-)
> > > 
> > > diff --git a/scripts/combo-layer b/scripts/combo-layer
> > > index 37d1f47..851003d 100755
> > > --- a/scripts/combo-layer
> > > +++ b/scripts/combo-layer
> > > @@ -26,6 +26,7 @@ import logging
> > > 
> > >  import subprocess
> > >  import ConfigParser
> > >  import re
> > > 
> > > +from collections import OrderedDict
> > > 
> > >  __version__ = "0.2.1"
> > > 
> > > @@ -347,7 +348,13 @@ def action_update(conf, args):
> > >          generate the patch list
> > >          apply the generated patches
> > >      
> > >      """
> > > 
> > > -    repos = get_repos(conf, args[1:])
> > > +    components = [arg.split(':')[0] for arg in args[1:]]
> > > +    revisions = []
> > > +    for arg in args[1:]:
> > > +        revision= arg.split(':', 1)[1] if ':' in arg else None
> > > +        revisions.append(revision)
> > > +    # Map commitishes to repos
> > > +    repos = OrderedDict(zip(get_repos(conf, components), revisions))
> > > 
> > >      # make sure combo repo is clean
> > >      check_repo_clean(os.getcwd())
> > > 
> > > @@ -361,9 +368,9 @@ def action_update(conf, args):
> > >      if conf.nopull:
> > >          logger.info("Skipping pull (-n)")
> > >      
> > >      else:
> > > -        action_pull(conf, args)
> > > +        action_pull(conf, ['arg0'] + components)
> > 
> > What's this 'arg0' ?
> 
> It's a dummy "args[0] placeholder". Needed because action_pull() assumes
> a "full" command line args list where args[0] would contain the command
> name (which is not used for anything, though).

Right, OK - I would have used args[0] but I don't think it really matters as 
you point out. In which case:

Acked-by: Paul Eggleton <paul.eggleton@linux.intel.com>

Cheers,
Paul

-- 

Paul Eggleton
Intel Open Source Technology Centre


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

end of thread, other threads:[~2015-01-27 14:52 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-07 16:00 [PATCH v2 0/2] combo-layer: support updating up to arbitrary commit Markus Lehtonen
2015-01-07 16:00 ` [PATCH v2 1/2] combo-layer: minor refactor Markus Lehtonen
2015-01-07 16:00 ` [PATCH v2 2/2] combo-layer: support updating up to arbitrary commit Markus Lehtonen
2015-01-12 11:46   ` Paul Eggleton
2015-01-27 14:17     ` Markus Lehtonen
2015-01-27 14:52       ` Paul Eggleton

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.