Skip to contentSkip to conversation

graph-depends: allow to exclude host packages

PATCH Superseded Thomas Petazzoni 2 participants 9 messages Jan 27, 2016 – Feb 8, 2016

lore
Share & tools
lore
#0 lore raw

v2 cover graph-depends: allow to exclude host packages

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(-)
Signature · 1 line
2.6.4
#1 lore raw

PATCH v2 1/3 graph-depends: fix handling of "virtual" in exclude_list

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.

---
 support/scripts/graph-depends | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
support/scripts/graph-depends +3 -4
index fd8ad2f..cfb4f82 100755
@@ -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)
Signature · 1 line
2.6.4
#2 lore raw

PATCH v2 1/3 graph-depends: fix handling of "virtual" in exclude_list

Thomas, All,

On 2016-01-27 21:32 +0100, Thomas Petazzoni spake thusly:

Quoted 7 lines

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:

Quoted 8 lines

"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.

Regards,
Yann E. MORIN.

Quoted 34 lines
---
 support/scripts/graph-depends | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
support/scripts/graph-depends +3 -4
index fd8ad2f..cfb4f82 100755
@@ -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)
Signature · 6 lines
2.6.4

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  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.  |
'------------------------------^-------^------------------^--------------------'
#3 lore raw

PATCH v2 2/3 graph-depends: add support for excluding host packages

In reply to Thomas Petazzoni

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.

---
 support/scripts/graph-depends | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
support/scripts/graph-depends +7 -2
index cfb4f82..e4a230f 100755
@@ -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):
Signature · 1 line
2.6.4
#4 lore raw

PATCH v2 2/3 graph-depends: add support for excluding host packages

Thomas, All,

On 2016-01-27 21:32 +0100, Thomas Petazzoni spake thusly:

Quoted 7 lines

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.

However, see below for a minor comment...

Quoted 22 lines
---
 support/scripts/graph-depends | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
support/scripts/graph-depends +3 -2
index cfb4f82..e4a230f 100755
@@ -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

support/scripts/graph-depends def print_pkg_deps(depth, pkg): · line 368

Quoted 10 lines
support/scripts/graph-depends +3 -0
     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.

Quoted 11 lines
support/scripts/graph-depends +1 -0
+                continue
             add = True
             for p in exclude_list:
                 if fnmatch(d,p):
Signature · 6 lines
2.6.4

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  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.  |
'------------------------------^-------^------------------^--------------------'
#5 lore raw

PATCH v2 2/3 graph-depends: add support for excluding host packages

Dear Yann E. MORIN,

Quoted 11 lines · Yann E. MORIN

support/scripts/graph-depends def print_pkg_deps(depth, pkg): · line 368

Quoted 8 lines
support/scripts/graph-depends +3 -0
+    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

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#6 lore raw

PATCH v2 3/3 docs/manual: update graph-depends documentation about --stop-on

In reply to Thomas Petazzoni

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.

---
 docs/manual/common-usage.txt | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
docs/manual/common-usage.txt +4 -3
index bca99f4..01cd31e 100644
@@ -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.
Signature · 1 line
2.6.4
#7 lore raw

PATCH v2 3/3 docs/manual: update graph-depends documentation about --stop-on

Thomas, All,

On 2016-01-27 21:32 +0100, Thomas Petazzoni spake thusly:

Quoted 5 lines

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.

Regards,
Yann E. MORIN.

Quoted 29 lines
---
 docs/manual/common-usage.txt | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
docs/manual/common-usage.txt +4 -3
index bca99f4..01cd31e 100644
@@ -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.
Signature · 6 lines
2.6.4

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  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.  |
'------------------------------^-------^------------------^--------------------'
#8 lore raw

v2 cover graph-depends: allow to exclude host packages

In reply to Thomas Petazzoni

Hello,

Quoted 7 lines · Thomas Petazzoni

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.

Quoted 8 lines

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

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