[bitbake-devel,1/1] print which pkgs would be built

Submitted by Robert Yang on June 21, 2012, 2:28 a.m. | Patch ID: 30373


Message ID d4ec2885857ad121a3664a464a12d6de54a12f00.1340179047.git.liezhi.yang@windriver.com
State New
Headers show

Commit Message

Robert Yang June 21, 2012, 2:28 a.m.
This is for giving the user a clear list to show which pkg would be
built, we have the "bitbake -g", but it is not easy to read for people,
it is for "dot". Improve the "bitbake -g" to also save a pn-buildlist:

$ bitbake -g core-image-sato
NOTE: PN build list saved to 'pn-buildlist'

The contents of pn-buildlist:


[YOCTO #2404]

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
 bitbake/bin/bitbake      |    2 +-
 bitbake/lib/bb/cooker.py |    4 ++++
 2 files changed, 5 insertions(+), 1 deletions(-)

Patch hide | download patch | download mbox

diff --git a/bitbake/bin/bitbake b/bitbake/bin/bitbake
index 478ac06..5ddc28c 100755
--- a/bitbake/bin/bitbake
+++ b/bitbake/bin/bitbake
@@ -145,7 +145,7 @@  Default BBFILES are the .bb files in the current directory.""")
     parser.add_option("-e", "--environment", help = "show the global or per-package environment (this is what used to be bbread)",
                action = "store_true", dest = "show_environment", default = False)
-    parser.add_option("-g", "--graphviz", help = "emit the dependency trees of the specified packages in the dot syntax",
+    parser.add_option("-g", "--graphviz", help = "emit the dependency trees of the specified packages in the dot syntax, and the pn-buildlist to show the build list",
                 action = "store_true", dest = "dot_graph", default = False)
     parser.add_option("-I", "--ignore-deps", help = """Assume these dependencies don't exist and are already provided (equivalent to ASSUME_PROVIDED). Useful to make dependency graphs more appealing""",
diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py
index 928b600..a9aae5c 100644
--- a/bitbake/lib/bb/cooker.py
+++ b/bitbake/lib/bb/cooker.py
@@ -534,11 +534,15 @@  class BBCooker:
         # Prints a flattened form of package-depends below where subpackages of a package are merged into the main pn
         depends_file = file('pn-depends.dot', 'w' )
+        buildlist_file = file('pn-buildlist', 'w' )
         print("digraph depends {", file=depends_file)
         for pn in depgraph["pn"]:
             fn = depgraph["pn"][pn]["filename"]
             version = depgraph["pn"][pn]["version"]
             print('"%s" [label="%s %s\\n%s"]' % (pn, pn, version, fn), file=depends_file)
+            print("%s" % pn, file=buildlist_file)
+        buildlist_file.close()
+        logger.info("PN build list saved to 'pn-buildlist'")
         for pn in depgraph["depends"]:
             for depend in depgraph["depends"][pn]:
                 print('"%s" -> "%s"' % (pn, depend), file=depends_file)