bitbake-layers: make show-cross-depends avoid long path
cover bitbake-layers: make show-cross-depends avoid long path
Hi Paul,
I added a "-f" option for the show-cross-depends, please feel free to give your comments. BTW., I will be on vacation from Feb. 7th to 17th because of the Chinese Spring Festival, and I will go back to my hometown where has no network, so I can't reply the email until Feb. 18th.
// Robert
The following changes since commit ee1f126ad5cb2c6af66815e55720257a1efc5a49:
bitbake: bitbake: fetch2: Print the complete SRCREV variable name when INVALID (2013-02-05 15:22:45 +0000)
are available in the git repository at:
git://git.pokylinux.org/poky-contrib robert/bbl_long_path
http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=robert/bbl_long_path
Robert Yang (1):
bitbake-layers: make show-cross-depends avoid long path
bitbake/bin/bitbake-layers | 56 +++++++++++++++++++++++++++++++++++++++------- 1 file changed, 48 insertions(+), 8 deletions(-)
Signature · 1 line
1.7.11.2
PATCH 1/1 bitbake-layers: make show-cross-depends avoid long path
The "bitbake-layers show-cross-depends" print the absolute path in the past, now it will print the relative path (relative to the layer dir) by default, and add the "-f" option to make it print the absolute path.
For example:
$ bitbake-layers show-cross-depends [snip] meta-intel/meta-jasperforest/conf/machine/jasperforest.conf requires meta/conf/machine/include/ia32-base.inc [snip]
$ bitbake-layers show-cross-depends -f [snip] /path/to/poky/meta-intel/meta-jasperforest/conf/machine/jasperforest.conf requires /path/to/poky/meta/conf/machine/include/ia32-base.inc [snip]
[YOCTO #3824]
--- bitbake/bin/bitbake-layers | 56 +++++++++++++++++++++++++++++++++++++++------- 1 file changed, 48 insertions(+), 8 deletions(-)
bitbake/bin/bitbake-layers +48 -8
@@ -463,6 +463,21 @@ build results (as the layer priority order has effectively changed). return self.get_layer_name(layerdir) return "?" + def get_file_layerdir(self, filename): + for layer, _, regex, _ in self.bbhandler.cooker.status.bbfile_config_priorities: + if regex.match(filename): + for layerdir in self.bblayers: + if regex.match(os.path.join(layerdir, 'test')) and re.match(layerdir, filename): + return layerdir + return "?" + + def remove_layer_prefix(self, f): + """Remove the layer_dir prefix, e.g., f = /path/to/layer_dir/foo/blah, the + return value will be: layer_dir/foo/blah""" + f_layerdir = self.get_file_layerdir(f) + prefix = os.path.join(os.path.dirname(f_layerdir), '') + return f[len(prefix):] if f.startswith(prefix) else f + def get_layer_name(self, layerdir): return os.path.basename(layerdir.rstrip(os.sep))
@@ -545,14 +560,27 @@ Recipes are listed with the bbappends that apply to them as subitems. def do_show_cross_depends(self, args): """figure out the dependency between recipes that crosses a layer boundary. -usage: show-cross-depends +usage: show-cross-depends [-f] Figure out the dependency between recipes that crosses a layer boundary. +Options: + -f show full file path + NOTE: The .bbappend file can impact the dependency. """ self.bbhandler.prepare() + + show_filenames = False + for arg in args.split(): + if arg == '-f': + show_filenames = True + else: + sys.stderr.write("show-cross-depends: invalid option %s\n" % arg) + self.do_help('') + return + pkg_fn = self.bbhandler.cooker_data.pkg_fn bbpath = str(self.bbhandler.config_data.getVar('BBPATH', True)) self.require_re = re.compile(r"require\s+(.+)")
@@ -573,7 +601,7 @@ The .bbappend file can impact the dependency. self.bbhandler.cooker.configuration.data, self.bbhandler.cooker_data, self.bbhandler.cooker_data.pkg_pn) - self.check_cross_depends("DEPENDS", layername, f, best[3]) + self.check_cross_depends("DEPENDS", layername, f, best[3], show_filenames) # The RDPENDS all_rdeps = self.bbhandler.cooker_data.rundeps[f].values()
@@ -590,7 +618,7 @@ The .bbappend file can impact the dependency. best = bb.providers.filterProvidersRunTime(all_p, rdep, self.bbhandler.cooker.configuration.data, self.bbhandler.cooker_data)[0][0] - self.check_cross_depends("RDEPENDS", layername, f, best) + self.check_cross_depends("RDEPENDS", layername, f, best, show_filenames) # The inherit class cls_re = re.compile('classes/')
@@ -602,7 +630,12 @@ The .bbappend file can impact the dependency. if not cls_re.match(cls): inherit_layername = self.get_file_layer(cls) if inherit_layername != layername: - logger.plain("%s inherits %s" % (f, cls)) + if not show_filenames: + f_short = self.remove_layer_prefix(f) + cls = self.remove_layer_prefix(cls) + else: + f_short = f + logger.plain("%s inherits %s" % (f_short, cls)) # The 'require/include xxx' in the bb file pv_re = re.compile(r"\${PV}")
@@ -617,7 +650,7 @@ The .bbappend file can impact the dependency. if pv_re.search(needed_file) and f in self.bbhandler.cooker_data.pkg_pepvpr: pv = self.bbhandler.cooker_data.pkg_pepvpr[f][1] needed_file = re.sub(r"\${PV}", pv, needed_file) - self.print_cross_files(bbpath, keyword, layername, f, needed_file) + self.print_cross_files(bbpath, keyword, layername, f, needed_file, show_filenames) line = fnfile.readline() fnfile.close()
@@ -644,17 +677,20 @@ The .bbappend file can impact the dependency. bbclass=".bbclass" # Find a 'require/include xxxx' if m: - self.print_cross_files(bbpath, keyword, layername, f, m.group(1) + bbclass) + self.print_cross_files(bbpath, keyword, layername, f, m.group(1) + bbclass, show_filenames) line = ffile.readline() ffile.close() - def print_cross_files(self, bbpath, keyword, layername, f, needed_filename): + def print_cross_files(self, bbpath, keyword, layername, f, needed_filename, show_filenames): """Print the depends that crosses a layer boundary""" needed_file = bb.utils.which(bbpath, needed_filename) if needed_file: # Which layer is this file from needed_layername = self.get_file_layer(needed_file) if needed_layername != layername: + if not show_filenames: + f = self.remove_layer_prefix(f) + needed_file = self.remove_layer_prefix(needed_file) logger.plain("%s %s %s" %(f, keyword, needed_file)) def match_inherit(self, line): """Match the inherit xxx line"""
@@ -669,11 +705,15 @@ The .bbappend file can impact the dependency. keyword = "includes" return (m, keyword) - def check_cross_depends(self, keyword, layername, f, needed_file): + def check_cross_depends(self, keyword, layername, f, needed_file, show_filenames): """Print the DEPENDS/RDEPENDS file that crosses a layer boundary""" best_realfn = bb.cache.Cache.virtualfn2realfn(needed_file)[0] needed_layername = self.get_file_layer(best_realfn) if needed_layername != layername: + if not show_filenames: + f = self.remove_layer_prefix(f) + best_realfn = self.remove_layer_prefix(best_realfn) + logger.plain("%s %s %s" % (f, keyword, best_realfn)) if __name__ == '__main__':
Signature · 1 line
1.7.11.2