Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH v2 0/3] graph-depends: allow to exclude host packages
@ 2016-01-27 20:32 Thomas Petazzoni
  2016-01-27 20:32 ` [Buildroot] [PATCH v2 1/3] graph-depends: fix handling of "virtual" in exclude_list Thomas Petazzoni
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Thomas Petazzoni @ 2016-01-27 20:32 UTC (permalink / raw)
  To: buildroot

Hello,

Here is a v2 of the small patch series that allows to exclude host
packages. It fixes a major bug in the previous implementation, which
was stopping drawing the list of dependencies as soon as one host
package was encountered, rather than just skipping that one package.

This new implementation hopefully fixes that problem.

Thanks,

Thomas

Thomas Petazzoni (3):
  graph-depends: fix handling of "virtual" in exclude_list
  graph-depends: add support for excluding host packages
  docs/manual: update graph-depends documentation about --stop-on

 docs/manual/common-usage.txt  |  7 ++++---
 support/scripts/graph-depends | 16 ++++++++++------
 2 files changed, 14 insertions(+), 9 deletions(-)

-- 
2.6.4

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

* [Buildroot] [PATCH v2 1/3] graph-depends: fix handling of "virtual" in exclude_list
  2016-01-27 20:32 [Buildroot] [PATCH v2 0/3] graph-depends: allow to exclude host packages Thomas Petazzoni
@ 2016-01-27 20:32 ` Thomas Petazzoni
  2016-01-28 22:40   ` Yann E. MORIN
  2016-01-27 20:32 ` [Buildroot] [PATCH v2 2/3] graph-depends: add support for excluding host packages Thomas Petazzoni
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 9+ messages in thread
From: Thomas Petazzoni @ 2016-01-27 20:32 UTC (permalink / raw)
  To: buildroot

The condition to determine if a virtual package should be excluded
from the list due to "virtual" being passed in --exclude is under a
loop iterating over each entry of the exclude_list, but it doesn't use
the iterator of this list.

Indeed, the condition contains:

	"virtual" in exclude_list

which checks automatically if "virtual" was passed in the list. Due to
this, there is no need for this check to be within the "for p in
exclude_list" iteration. This commit fixes that by moving the check
outside of the loop.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
 support/scripts/graph-depends | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/support/scripts/graph-depends b/support/scripts/graph-depends
index fd8ad2f..cfb4f82 100755
--- a/support/scripts/graph-depends
+++ b/support/scripts/graph-depends
@@ -359,15 +359,14 @@ def print_pkg_deps(depth, pkg):
         return
     if max_depth == 0 or depth < max_depth:
         for d in dict_deps[pkg]:
+            if dict_version.get(d) == "virtual" \
+               and "virtual" in exclude_list:
+                continue
             add = True
             for p in exclude_list:
                 if fnmatch(d,p):
                     add = False
                     break
-                if dict_version.get(d) == "virtual" \
-                and "virtual" in exclude_list:
-                    add = False
-                    break
             if add:
                 print("%s -> %s" % (pkg_node_name(pkg), pkg_node_name(d)))
                 print_pkg_deps(depth+1, d)
-- 
2.6.4

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

* [Buildroot] [PATCH v2 2/3] graph-depends: add support for excluding host packages
  2016-01-27 20:32 [Buildroot] [PATCH v2 0/3] graph-depends: allow to exclude host packages Thomas Petazzoni
  2016-01-27 20:32 ` [Buildroot] [PATCH v2 1/3] graph-depends: fix handling of "virtual" in exclude_list Thomas Petazzoni
@ 2016-01-27 20:32 ` Thomas Petazzoni
  2016-01-28 22:44   ` Yann E. MORIN
  2016-01-27 20:32 ` [Buildroot] [PATCH v2 3/3] docs/manual: update graph-depends documentation about --stop-on Thomas Petazzoni
  2016-02-08 21:38 ` [Buildroot] [PATCH v2 0/3] graph-depends: allow to exclude host packages Thomas Petazzoni
  3 siblings, 1 reply; 9+ messages in thread
From: Thomas Petazzoni @ 2016-01-27 20:32 UTC (permalink / raw)
  To: buildroot

Just like the --stop-on and --exclude options allow to stop on or
exclude virtual packages from the list by passing the "virtual" magic
value, this commit extends the graph-depends logic to support a "host"
magic value for --stop-on and --exclude. This will allow to draw the
graph by stopping on host packages, or by excluding host packages.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
 support/scripts/graph-depends | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/support/scripts/graph-depends b/support/scripts/graph-depends
index cfb4f82..e4a230f 100755
--- a/support/scripts/graph-depends
+++ b/support/scripts/graph-depends
@@ -44,8 +44,9 @@ parser.add_argument("--depth", '-d', metavar="DEPTH", dest="depth", type=int, de
                     help="Limit the dependency graph to DEPTH levels; 0 means no limit.")
 parser.add_argument("--stop-on", "-s", metavar="PACKAGE", dest="stop_list", action="append",
                     help="Do not graph past this package (can be given multiple times)." \
-                       + " Can be a package name or a glob, or" \
-                       + " 'virtual' to stop on virtual packages.")
+                       + " Can be a package name or a glob, " \
+                       + " 'virtual' to stop on virtual packages, or " \
+                       + "'host' to stop on host packages.")
 parser.add_argument("--exclude", "-x", metavar="PACKAGE", dest="exclude_list", action="append",
                     help="Like --stop-on, but do not add PACKAGE to the graph.")
 parser.add_argument("--colours", "-c", metavar="COLOR_LIST", dest="colours",
@@ -357,11 +358,15 @@ def print_pkg_deps(depth, pkg):
             return
     if dict_version.get(pkg) == "virtual" and "virtual" in stop_list:
         return
+    if pkg.startswith("host-") and "host" in stop_list:
+        return
     if max_depth == 0 or depth < max_depth:
         for d in dict_deps[pkg]:
             if dict_version.get(d) == "virtual" \
                and "virtual" in exclude_list:
                 continue
+            if d.startswith("host-") and "host" in exclude_list:
+                continue
             add = True
             for p in exclude_list:
                 if fnmatch(d,p):
-- 
2.6.4

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

* [Buildroot] [PATCH v2 3/3] docs/manual: update graph-depends documentation about --stop-on
  2016-01-27 20:32 [Buildroot] [PATCH v2 0/3] graph-depends: allow to exclude host packages Thomas Petazzoni
  2016-01-27 20:32 ` [Buildroot] [PATCH v2 1/3] graph-depends: fix handling of "virtual" in exclude_list Thomas Petazzoni
  2016-01-27 20:32 ` [Buildroot] [PATCH v2 2/3] graph-depends: add support for excluding host packages Thomas Petazzoni
@ 2016-01-27 20:32 ` Thomas Petazzoni
  2016-01-28 22:47   ` Yann E. MORIN
  2016-02-08 21:38 ` [Buildroot] [PATCH v2 0/3] graph-depends: allow to exclude host packages Thomas Petazzoni
  3 siblings, 1 reply; 9+ messages in thread
From: Thomas Petazzoni @ 2016-01-27 20:32 UTC (permalink / raw)
  To: buildroot

This commit updates the graph-depends documentation to take into
account the new 'host' keyword that can be passed to the --stop-on and
--exclude options.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
 docs/manual/common-usage.txt | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/docs/manual/common-usage.txt b/docs/manual/common-usage.txt
index bca99f4..01cd31e 100644
--- a/docs/manual/common-usage.txt
+++ b/docs/manual/common-usage.txt
@@ -212,9 +212,10 @@ The +graph-depends+ behaviour can be controlled by setting options in the
   default, +0+, means no limit.
 
 * +--stop-on PKG+, +-s PKG+, to stop the graph on the package +PKG+.
-  +PKG+ can be an actual package name, a glob, or the keyword 'virtual'
-  (to stop on virtual packages). The package is still present on the
-  graph, but its dependencies are not.
+  +PKG+ can be an actual package name, a glob, the keyword 'virtual'
+  (to stop on virtual packages), or the keyword 'host' (to stop on
+  host packages). The package is still present on the graph, but its
+  dependencies are not.
 
 * +--exclude PKG+, +-x PKG+, like +--stop-on+, but also omits +PKG+ from
   the graph.
-- 
2.6.4

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

* [Buildroot] [PATCH v2 1/3] graph-depends: fix handling of "virtual" in exclude_list
  2016-01-27 20:32 ` [Buildroot] [PATCH v2 1/3] graph-depends: fix handling of "virtual" in exclude_list Thomas Petazzoni
@ 2016-01-28 22:40   ` Yann E. MORIN
  0 siblings, 0 replies; 9+ messages in thread
From: Yann E. MORIN @ 2016-01-28 22:40 UTC (permalink / raw)
  To: buildroot

Thomas, All,

On 2016-01-27 21:32 +0100, Thomas Petazzoni spake thusly:
> The condition to determine if a virtual package should be excluded
> from the list due to "virtual" being passed in --exclude is under a
> loop iterating over each entry of the exclude_list, but it doesn't use
> the iterator of this list.
> 
> Indeed, the condition contains:
> 
> 	"virtual" in exclude_list
> 
> which checks automatically if "virtual" was passed in the list. Due to
> this, there is no need for this check to be within the "for p in
> exclude_list" iteration. This commit fixes that by moving the check
> outside of the loop.
> 
> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>

Tested-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Acked-by: "Yann E. MORIN" <yann.morin.1998@free.fr>

Regards,
Yann E. MORIN.

> ---
>  support/scripts/graph-depends | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/support/scripts/graph-depends b/support/scripts/graph-depends
> index fd8ad2f..cfb4f82 100755
> --- a/support/scripts/graph-depends
> +++ b/support/scripts/graph-depends
> @@ -359,15 +359,14 @@ def print_pkg_deps(depth, pkg):
>          return
>      if max_depth == 0 or depth < max_depth:
>          for d in dict_deps[pkg]:
> +            if dict_version.get(d) == "virtual" \
> +               and "virtual" in exclude_list:
> +                continue
>              add = True
>              for p in exclude_list:
>                  if fnmatch(d,p):
>                      add = False
>                      break
> -                if dict_version.get(d) == "virtual" \
> -                and "virtual" in exclude_list:
> -                    add = False
> -                    break
>              if add:
>                  print("%s -> %s" % (pkg_node_name(pkg), pkg_node_name(d)))
>                  print_pkg_deps(depth+1, d)
> -- 
> 2.6.4
> 
> _______________________________________________
> buildroot mailing list
> buildroot at busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'

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

* [Buildroot] [PATCH v2 2/3] graph-depends: add support for excluding host packages
  2016-01-27 20:32 ` [Buildroot] [PATCH v2 2/3] graph-depends: add support for excluding host packages Thomas Petazzoni
@ 2016-01-28 22:44   ` Yann E. MORIN
  2016-01-29  8:14     ` Thomas Petazzoni
  0 siblings, 1 reply; 9+ messages in thread
From: Yann E. MORIN @ 2016-01-28 22:44 UTC (permalink / raw)
  To: buildroot

Thomas, All,

On 2016-01-27 21:32 +0100, Thomas Petazzoni spake thusly:
> Just like the --stop-on and --exclude options allow to stop on or
> exclude virtual packages from the list by passing the "virtual" magic
> value, this commit extends the graph-depends logic to support a "host"
> magic value for --stop-on and --exclude. This will allow to draw the
> graph by stopping on host packages, or by excluding host packages.
> 
> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>

Tested-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Reviewed-by: "Yann E. MORIN" <yann.morin.1998@free.fr>

However, see below for a minor comment...

> ---
>  support/scripts/graph-depends | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/support/scripts/graph-depends b/support/scripts/graph-depends
> index cfb4f82..e4a230f 100755
> --- a/support/scripts/graph-depends
> +++ b/support/scripts/graph-depends
> @@ -44,8 +44,9 @@ parser.add_argument("--depth", '-d', metavar="DEPTH", dest="depth", type=int, de
>                      help="Limit the dependency graph to DEPTH levels; 0 means no limit.")
>  parser.add_argument("--stop-on", "-s", metavar="PACKAGE", dest="stop_list", action="append",
>                      help="Do not graph past this package (can be given multiple times)." \
> -                       + " Can be a package name or a glob, or" \
> -                       + " 'virtual' to stop on virtual packages.")
> +                       + " Can be a package name or a glob, " \
> +                       + " 'virtual' to stop on virtual packages, or " \
> +                       + "'host' to stop on host packages.")
>  parser.add_argument("--exclude", "-x", metavar="PACKAGE", dest="exclude_list", action="append",
>                      help="Like --stop-on, but do not add PACKAGE to the graph.")
>  parser.add_argument("--colours", "-c", metavar="COLOR_LIST", dest="colours",
> @@ -357,11 +358,15 @@ def print_pkg_deps(depth, pkg):
>              return
>      if dict_version.get(pkg) == "virtual" and "virtual" in stop_list:
>          return
> +    if pkg.startswith("host-") and "host" in stop_list:
> +        return
>      if max_depth == 0 or depth < max_depth:
>          for d in dict_deps[pkg]:
>              if dict_version.get(d) == "virtual" \
>                 and "virtual" in exclude_list:
>                  continue
> +            if d.startswith("host-") and "host" in exclude_list:

Can we make that line look like the corresponding line for the virtual
packages, two-and-three lines above?

Regards,
Yann E. MORIN.

> +                continue
>              add = True
>              for p in exclude_list:
>                  if fnmatch(d,p):
> -- 
> 2.6.4
> 
> _______________________________________________
> buildroot mailing list
> buildroot at busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'

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

* [Buildroot] [PATCH v2 3/3] docs/manual: update graph-depends documentation about --stop-on
  2016-01-27 20:32 ` [Buildroot] [PATCH v2 3/3] docs/manual: update graph-depends documentation about --stop-on Thomas Petazzoni
@ 2016-01-28 22:47   ` Yann E. MORIN
  0 siblings, 0 replies; 9+ messages in thread
From: Yann E. MORIN @ 2016-01-28 22:47 UTC (permalink / raw)
  To: buildroot

Thomas, All,

On 2016-01-27 21:32 +0100, Thomas Petazzoni spake thusly:
> This commit updates the graph-depends documentation to take into
> account the new 'host' keyword that can be passed to the --stop-on and
> --exclude options.
> 
> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>

Acked-by: "Yann E. MORIN" <yann.morin.1998@free.fr>

Regards,
Yann E. MORIN.

> ---
>  docs/manual/common-usage.txt | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/docs/manual/common-usage.txt b/docs/manual/common-usage.txt
> index bca99f4..01cd31e 100644
> --- a/docs/manual/common-usage.txt
> +++ b/docs/manual/common-usage.txt
> @@ -212,9 +212,10 @@ The +graph-depends+ behaviour can be controlled by setting options in the
>    default, +0+, means no limit.
>  
>  * +--stop-on PKG+, +-s PKG+, to stop the graph on the package +PKG+.
> -  +PKG+ can be an actual package name, a glob, or the keyword 'virtual'
> -  (to stop on virtual packages). The package is still present on the
> -  graph, but its dependencies are not.
> +  +PKG+ can be an actual package name, a glob, the keyword 'virtual'
> +  (to stop on virtual packages), or the keyword 'host' (to stop on
> +  host packages). The package is still present on the graph, but its
> +  dependencies are not.
>  
>  * +--exclude PKG+, +-x PKG+, like +--stop-on+, but also omits +PKG+ from
>    the graph.
> -- 
> 2.6.4
> 
> _______________________________________________
> buildroot mailing list
> buildroot at busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'

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

* [Buildroot] [PATCH v2 2/3] graph-depends: add support for excluding host packages
  2016-01-28 22:44   ` Yann E. MORIN
@ 2016-01-29  8:14     ` Thomas Petazzoni
  0 siblings, 0 replies; 9+ messages in thread
From: Thomas Petazzoni @ 2016-01-29  8:14 UTC (permalink / raw)
  To: buildroot

Dear Yann E. MORIN,

On Thu, 28 Jan 2016 23:44:33 +0100, Yann E. MORIN wrote:

> > +    if pkg.startswith("host-") and "host" in stop_list:
> > +        return
> >      if max_depth == 0 or depth < max_depth:
> >          for d in dict_deps[pkg]:
> >              if dict_version.get(d) == "virtual" \
> >                 and "virtual" in exclude_list:
> >                  continue
> > +            if d.startswith("host-") and "host" in exclude_list:
> 
> Can we make that line look like the corresponding line for the virtual
> packages, two-and-three lines above?

In what way? Are you just talking about breaking the condition like
this:

	if d.startswith("host-") \
		and "host" in exclude_list:

or something else ?

Thanks for the review!

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

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

* [Buildroot] [PATCH v2 0/3] graph-depends: allow to exclude host packages
  2016-01-27 20:32 [Buildroot] [PATCH v2 0/3] graph-depends: allow to exclude host packages Thomas Petazzoni
                   ` (2 preceding siblings ...)
  2016-01-27 20:32 ` [Buildroot] [PATCH v2 3/3] docs/manual: update graph-depends documentation about --stop-on Thomas Petazzoni
@ 2016-02-08 21:38 ` Thomas Petazzoni
  3 siblings, 0 replies; 9+ messages in thread
From: Thomas Petazzoni @ 2016-02-08 21:38 UTC (permalink / raw)
  To: buildroot

Hello,

On Wed, 27 Jan 2016 21:32:12 +0100, Thomas Petazzoni wrote:

> Here is a v2 of the small patch series that allows to exclude host
> packages. It fixes a major bug in the previous implementation, which
> was stopping drawing the list of dependencies as soon as one host
> package was encountered, rather than just skipping that one package.
> 
> This new implementation hopefully fixes that problem.
> 
> Thanks,
> 
> Thomas
> 
> Thomas Petazzoni (3):
>   graph-depends: fix handling of "virtual" in exclude_list
>   graph-depends: add support for excluding host packages
>   docs/manual: update graph-depends documentation about --stop-on

I've applied those three patches, after fixing the minor nit pointed by
Yann on PATCH 2/3.

Thanks,

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

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

end of thread, other threads:[~2016-02-08 21:38 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-27 20:32 [Buildroot] [PATCH v2 0/3] graph-depends: allow to exclude host packages Thomas Petazzoni
2016-01-27 20:32 ` [Buildroot] [PATCH v2 1/3] graph-depends: fix handling of "virtual" in exclude_list Thomas Petazzoni
2016-01-28 22:40   ` Yann E. MORIN
2016-01-27 20:32 ` [Buildroot] [PATCH v2 2/3] graph-depends: add support for excluding host packages Thomas Petazzoni
2016-01-28 22:44   ` Yann E. MORIN
2016-01-29  8:14     ` Thomas Petazzoni
2016-01-27 20:32 ` [Buildroot] [PATCH v2 3/3] docs/manual: update graph-depends documentation about --stop-on Thomas Petazzoni
2016-01-28 22:47   ` Yann E. MORIN
2016-02-08 21:38 ` [Buildroot] [PATCH v2 0/3] graph-depends: allow to exclude host packages Thomas Petazzoni

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