Skip to contentSkip to conversation

Add new option --environment-more

PATCH In review Lianhao Lu 2 participants 4 messages Feb 23, 2012 – Feb 24, 2012

lore
Share & tools
lore

Lianhao Lu

author
#0 lore raw

cover Add new option --environment-more

This patch adds a new option --environment-more to bitbake to display additional file dependency information. This kind of information can be used by other recipe editors, e.g. the Eclipse bitbake commander plugin, to decide when to reparse the recipes.

The following changes since commit d8b3718303c3d56394c722059f1a73bd79131d0a:
Zhai Edwin (1):
texi2html: Fix for multilib

are available in the git repository at:

git://git.pokylinux.org/poky-contrib llu/bitbake_showmore
http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=llu/bitbake_showmore

Lianhao Lu (1):
bitbake: Add new otpion --environment-more

 bitbake/bin/bitbake       |    3 +++
 bitbake/lib/bb/command.py |    6 ++++--
 bitbake/lib/bb/cooker.py  |   22 ++++++++++++++++++----
 scripts/bitbake           |    2 +-
 4 files changed, 26 insertions(+), 7 deletions(-)
author
#1 lore raw

PATCH 1/1 bitbake: Add new otpion --environment-more

Added a new otpion --environment-more, similar to --environment but displaying addtional file dependency informations in the shell variable "__depends".

---
 bitbake/bin/bitbake       |    3 +++
 bitbake/lib/bb/command.py |    6 ++++--
 bitbake/lib/bb/cooker.py  |   22 ++++++++++++++++++----
 scripts/bitbake           |    2 +-
 4 files changed, 26 insertions(+), 7 deletions(-)
bitbake/bin/bitbake +3 -0
index 6da4980..efe9980 100755
@@ -144,6 +144,9 @@ 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("", "--environment-more", help = "same as --environment, but with more information",
+               action = "store_true", dest = "show_environment_more", default = False)
+
     parser.add_option("-g", "--graphviz", help = "emit the dependency trees of the specified packages in the dot syntax",
                 action = "store_true", dest = "dot_graph", default = False)
 
bitbake/lib/bb/command.py +4 -2
index 2a3a3af..d2dd99c 100644
@@ -299,8 +299,9 @@ class CommandsAsync:
         (needs the cache to work out which recipe to use)
         """
         pkg = params[0]
+        more = params[1]
 
-        command.cooker.showEnvironment(None, pkg)
+        command.cooker.showEnvironment(None, pkg, more)
         command.finishAsyncCommand()
     showEnvironmentTarget.needcache = True
 
@@ -310,8 +311,9 @@ class CommandsAsync:
         or if specified the environment for a specified recipe
         """
         bfile = params[0]
+        more = params[1]
 
-        command.cooker.showEnvironment(bfile)
+        command.cooker.showEnvironment(bfile, [], more)
         command.finishAsyncCommand()
     showEnvironment.needcache = False
 
bitbake/lib/bb/cooker.py +18 -4
index f0778e5..b241bc0 100644
@@ -212,7 +212,7 @@ class BBCooker:
     def parseCommandLine(self):
         # Parse any commandline into actions
         self.commandlineAction = {'action':None, 'msg':None}
-        if self.configuration.show_environment:
+        if self.configuration.show_environment or self.configuration.show_environment_more:
             if 'world' in self.configuration.pkgs_to_build:
                 self.commandlineAction['msg'] = "'world' is not a valid target for --environment."
             elif 'universe' in self.configuration.pkgs_to_build:
@@ -222,9 +222,9 @@ class BBCooker:
             elif self.configuration.buildfile and len(self.configuration.pkgs_to_build) > 0:
                 self.commandlineAction['msg'] = "No target should be used with the --environment and --buildfile options."
             elif len(self.configuration.pkgs_to_build) > 0:
-                self.commandlineAction['action'] = ["showEnvironmentTarget", self.configuration.pkgs_to_build]
+                self.commandlineAction['action'] = ["showEnvironmentTarget", self.configuration.pkgs_to_build, self.configuration.show_environment_more]
             else:
-                self.commandlineAction['action'] = ["showEnvironment", self.configuration.buildfile]
+                self.commandlineAction['action'] = ["showEnvironment", self.configuration.buildfile, self.configuration.show_environment_more]
         elif self.configuration.buildfile is not None:
             self.commandlineAction['action'] = ["buildFile", self.configuration.buildfile, self.configuration.cmd]
         elif self.configuration.revisions_changed:
@@ -277,7 +277,7 @@ class BBCooker:
 
             logger.plain("%-35s %25s %25s", p, lateststr, prefstr)
 
-    def showEnvironment(self, buildfile = None, pkgs_to_build = []):
+    def showEnvironment(self, buildfile = None, pkgs_to_build = [], more = False):
         """
         Show the outer or per-package environment
         """
@@ -330,6 +330,20 @@ class BBCooker:
             if data.getVarFlag( e, 'python', envdata ):
                 logger.plain("\npython %s () {\n%s}\n", e, data.getVar(e, envdata, 1))
 
+        # more depends data
+        if more:
+            if fn:
+                realfn, _ = bb.cache.Cache.virtualfn2realfn(fn)
+                logger.plain("\n__file=\"%s\"", realfn)
+            dep_files = []
+            depends = envdata.getVar('__depends', True) or set()
+            depends = depends.union(self.configuration.data.getVar('__base_depends', True) or set())
+            depends = depends.union(self.configuration.data.getVar('__depends', True) or set())
+            for (fn, ctime) in depends:
+                dep_files.append(os.path.abspath(fn))
+            if dep_files:
+                logger.plain("__depends=\"%s\"\n" , " ".join(dep_files))
+
     def prepareTreeData(self, pkgs_to_build, task):
         """
         Prepare a runqueue and taskdata object for iteration over pkgs_to_build
scripts/bitbake +1 -1
index dda3b26..d77ecb5 100755
@@ -3,7 +3,7 @@
 export BBFETCH2=True
 export BB_ENV_EXTRAWHITE="PSEUDO_BUILD PSEUDO_DISABLED $BB_ENV_EXTRAWHITE"
 
-NO_BUILD_OPTS="--version -h --help -p --parse-only -s --show-versions -e --environment -g --graphviz"
+NO_BUILD_OPTS="--version -h --help -p --parse-only -s --show-versions -e --environment --environment-more -g --graphviz"
 PASSTHROUGH_OPTS="-D -DD -DDD -DDDD -v"
 needpseudo="1"
 for opt in $@; do
Signature · 1 line
1.7.0.4
#2 lore raw
In reply to Lianhao Lu
Quoted 9 lines · Lianhao Lu

This patch adds a new option --environment-more to bitbake to display additional file dependency information. This kind of information can be used by other recipe editors, e.g. the Eclipse bitbake commander plugin, to decide when to reparse the recipes.

The following changes since commit d8b3718303c3d56394c722059f1a73bd79131d0a:
Zhai Edwin (1):
texi2html: Fix for multilib

Quoted 7 lines

are available in the git repository at:

git://git.pokylinux.org/poky-contrib llu/bitbake_showmore
http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=llu/bitbake_showmore

Lianhao Lu (1):
bitbake: Add new otpion --environment-more

Rather than add a new option specifically for this, I'm tempted just to add the variables to the -e output...

The trouble is that variables starting "__" are considered internal use by bitbake. Would it work if we merge __base_depends and __depends and print this as some specific variable like BBINCLUDES ? I can imagine that being useful elsewhere too and we don't expose the internal split of the variable that way...

Cheers,

Richard

#3 lore raw

Richard Purdie wrote on 2012-02-23:

Quoted 16 lines · Lianhao Lu
Quoted 10 lines

This patch adds a new option --environment-more to bitbake to display additional file dependency information. This kind of information can be used by other recipe editors, e.g. the Eclipse bitbake commander plugin, to decide when to reparse the recipes.

The following changes since commit d8b3718303c3d56394c722059f1a73bd79131d0a:
Zhai Edwin (1):
texi2html: Fix for multilib
are available in the git repository at:

Quoted 4 lines

git://git.pokylinux.org/poky-contrib llu/bitbake_showmore
http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=llu/bitbake_showmore
Lianhao Lu (1):
bitbake: Add new otpion --environment-more

Quoted 9 lines

Rather than add a new option specifically for this, I'm tempted just to add the variables to the -e output...

The trouble is that variables starting "__" are considered internal use by bitbake. Would it work if we merge __base_depends and __depends and print this as some specific variable like BBINCLUDES ? I can imagine that being useful elsewhere too and we don't expose the internal split of the variable that way...

I added a new variable BBINCLUDES in the oe-core meta layer. Please ignore this one and see the patch in oe-core mailing list instead.

Best Regards,
Lianhao