graph-depends: support calling from recursive make
PATCH 1/2 graph-depends: support calling from recursive make
The graph-depends script calls make. If the outer make was called recursively, or if it was called with '-C <somedir>', then the environment will contain "MAKEFLAGS=w --". Therefore, the recursive make prints 'Entering' and 'Leaving' messages, which clobbers the output for dot.
To avoid this, add "--no-print-directory" to the recursive make arguments. Since we require GNU make 3.81, we can be sure that this option is available.
---
Tested with:
echo '======== In-tree'
make defconfig
make graph-depends
echo '======== Out-of-tree, called out of top-dir, relative'
cd ..
make -C buildroot O=../br.build-2 defconfig
make -C buildroot O=../br.build-2 graph-depends
echo '======== Out-of-tree, called from top-dir, relative'
cd buildroot
make O=../br.build-3 defconfig
make O=../br.build-3 graph-depends
echo '======== Out-of-tree, called from O-dir, absolute'
cd ..
mkdir br.build-4
cd br.build-4
make -C ../buildroot O=$(pwd) defconfig
make graph-depends
echo '======== Out-of-tree, called out of top-dir, absolute '
cd ..
mkdir br.build-5
make -C buildroot O=$(pwd)/br.build-5 defconfig
make -C buildroot O=$(pwd)/br.build-5 graph-depends
echo '======== Out-of-tree, called fromother dir, absolute-relative'
mkdir br.build-6.1
cd br.build-6.1
make -C ../buildroot O=$(pwd)/../br.build-6.2 defconfig
make -C ../buildroot O=$(pwd)/../br.build-6.2 graph-depends
cd ..--- support/scripts/graph-depends | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
support/scripts/graph-depends +2 -2
@@ -81,7 +81,7 @@ allpkgs = [] # list is used as the starting point for full dependency graphs def get_targets(): sys.stderr.write("Getting targets\n") - cmd = ["make", "-s", "show-targets"] + cmd = ["make", "-s", "--no-print-directory", "show-targets"] p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True) output = p.communicate()[0].strip() if p.returncode != 0:
@@ -95,7 +95,7 @@ def get_targets(): # dependencies formatted as a Python dictionary. def get_depends(pkgs): sys.stderr.write("Getting dependencies for %s\n" % pkgs) - cmd = ["make", "-s" ] + cmd = ["make", "-s", "--no-print-directory" ] for pkg in pkgs: cmd.append("%s-show-depends" % pkg) p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True)
Signature · 1 line
2.0.0
PATCH 2/2 graph-depends: remove unnecessary redirect of stderr
It hides any error messages reported by make.
--- support/scripts/graph-depends | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
support/scripts/graph-depends +2 -2
@@ -82,7 +82,7 @@ allpkgs = [] def get_targets(): sys.stderr.write("Getting targets\n") cmd = ["make", "-s", "--no-print-directory", "show-targets"] - p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True) + p = subprocess.Popen(cmd, stdout=subprocess.PIPE, universal_newlines=True) output = p.communicate()[0].strip() if p.returncode != 0: return None
@@ -98,7 +98,7 @@ def get_depends(pkgs): cmd = ["make", "-s", "--no-print-directory" ] for pkg in pkgs: cmd.append("%s-show-depends" % pkg) - p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True) + p = subprocess.Popen(cmd, stdout=subprocess.PIPE, universal_newlines=True) output = p.communicate()[0] if p.returncode != 0: sys.stderr.write("Error getting dependencies %s\n" % pkgs)
Signature · 1 line
2.0.0
PATCH 2/2 graph-depends: remove unnecessary redirect of stderr
Arnout, All,
On 2014-06-23 22:11 +0200, Arnout Vandecappelle (Essensium/Mind) spake thusly:
Quoted 3 lines
It hides any error messages reported by make.
Not sure what the test-case for that one would be, but it looks sane.
Regards,
Yann E. MORIN.
Quoted 33 lines
--- support/scripts/graph-depends | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)support/scripts/graph-depends +2
-2@@ -82,7 +82,7 @@ allpkgs = [] def get_targets(): sys.stderr.write("Getting targets\n") cmd = ["make", "-s", "--no-print-directory", "show-targets"] - p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True) + p = subprocess.Popen(cmd, stdout=subprocess.PIPE, universal_newlines=True) output = p.communicate()[0].strip() if p.returncode != 0: return None@@ -98,7 +98,7 @@ def get_depends(pkgs): cmd = ["make", "-s", "--no-print-directory" ] for pkg in pkgs: cmd.append("%s-show-depends" % pkg) - p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True) + p = subprocess.Popen(cmd, stdout=subprocess.PIPE, universal_newlines=True) output = p.communicate()[0] if p.returncode != 0: sys.stderr.write("Error getting dependencies %s\n" % pkgs)Signature · 6 lines
2.0.0 _______________________________________________ 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. | '------------------------------^-------^------------------^--------------------'
PATCH 2/2 graph-depends: remove unnecessary redirect of stderr
Arnout, Yann, all,
Quoted 8 lines · Yann E. MORIN
Arnout, All,
On 2014-06-23 22:11 +0200, Arnout Vandecappelle (Essensium/Mind) spake thusly:
Quoted 3 lines
It hides any error messages reported by make.
Not sure what the test-case for that one would be, but it looks sane.
A test-case is when checking the graph-depends script using:
----
$ python3 ./support/script/graph-depends -p <foo> Getting dependencies for ['<foo>'] Error getting dependencies ['<foo>'] ---- after a rebase (and with some legacy option selected), sadly fails with no clue at all in the output to help understanding what is wrong :-( I had to fire up pdb ;-)
But that true, who else uses the graph-depends script outside the BR make wrapper? ;-)
Quoted 2 lines
Reviewed-by "Yann E. MORIN" <[email protected]>
Regards,
Signature · 1 line
Samuel
PATCH 1/2 graph-depends: support calling from recursive make
In reply to Arnout Vandecappelle (Essensium/Mind)Arnout, All,
On 2014-06-23 22:11 +0200, Arnout Vandecappelle (Essensium/Mind) spake thusly:
Quoted 11 lines
The graph-depends script calls make. If the outer make was called recursively, or if it was called with '-C <somedir>', then the environment will contain "MAKEFLAGS=w --". Therefore, the recursive make prints 'Entering' and 'Leaving' messages, which clobbers the output for dot.
To avoid this, add "--no-print-directory" to the recursive make arguments. Since we require GNU make 3.81, we can be sure that this option is available.
I wonder why we did not think opf that earlier... Good catch! :-)
Regards,
Yann E. MORIN.
Quoted 71 lines
---
Tested with:echo '======== In-tree' make defconfig make graph-depends echo '======== Out-of-tree, called out of top-dir, relative' cd .. make -C buildroot O=../br.build-2 defconfig make -C buildroot O=../br.build-2 graph-depends echo '======== Out-of-tree, called from top-dir, relative' cd buildroot make O=../br.build-3 defconfig make O=../br.build-3 graph-depends echo '======== Out-of-tree, called from O-dir, absolute' cd .. mkdir br.build-4 cd br.build-4 make -C ../buildroot O=$(pwd) defconfig make graph-depends echo '======== Out-of-tree, called out of top-dir, absolute ' cd .. mkdir br.build-5 make -C buildroot O=$(pwd)/br.build-5 defconfig make -C buildroot O=$(pwd)/br.build-5 graph-depends echo '======== Out-of-tree, called fromother dir, absolute-relative' mkdir br.build-6.1 cd br.build-6.1 make -C ../buildroot O=$(pwd)/../br.build-6.2 defconfig make -C ../buildroot O=$(pwd)/../br.build-6.2 graph-depends cd ..--- support/scripts/graph-depends | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)support/scripts/graph-depends +2
-2@@ -81,7 +81,7 @@ allpkgs = [] # list is used as the starting point for full dependency graphs def get_targets(): sys.stderr.write("Getting targets\n") - cmd = ["make", "-s", "show-targets"] + cmd = ["make", "-s", "--no-print-directory", "show-targets"] p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True) output = p.communicate()[0].strip() if p.returncode != 0:@@ -95,7 +95,7 @@ def get_targets(): # dependencies formatted as a Python dictionary. def get_depends(pkgs): sys.stderr.write("Getting dependencies for %s\n" % pkgs) - cmd = ["make", "-s" ] + cmd = ["make", "-s", "--no-print-directory" ] for pkg in pkgs: cmd.append("%s-show-depends" % pkg) p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True)Signature · 6 lines
2.0.0 _______________________________________________ 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. | '------------------------------^-------^------------------^--------------------'
PATCH 1/2 graph-depends: support calling from recursive make
In reply to Arnout Vandecappelle (Essensium/Mind)Dear Arnout Vandecappelle (Essensium/Mind),
Quoted 11 lines · Arnout Vandecappelle (Essensium/Mind)
The graph-depends script calls make. If the outer make was called recursively, or if it was called with '-C <somedir>', then the environment will contain "MAKEFLAGS=w --". Therefore, the recursive make prints 'Entering' and 'Leaving' messages, which clobbers the output for dot.
To avoid this, add "--no-print-directory" to the recursive make arguments. Since we require GNU make 3.81, we can be sure that this option is available.
Patches 1/2 and 2/2 applied, thanks!
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com