summaryrefslogtreecommitdiffstats
path: root/bitbake/bin
diff options
context:
space:
mode:
authorRobert Yang <liezhi.yang@windriver.com>2013-02-06 17:28:16 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2013-02-15 12:12:37 +0000
commit86ac3b53b5ea9d74edab975adad9c831055da0ed (patch)
treec10fb5ebb96dbd929aa7bceef28d5d895a450100 /bitbake/bin
parent2c5ad4059ec504f8df481dbcd52210ae91544dbb (diff)
downloadpoky-86ac3b53b5ea9d74edab975adad9c831055da0ed.tar.gz
bitbake: 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 rev: df217701318d60559be0b10214b883b8ce4f5d2a) Signed-off-by: Robert Yang <liezhi.yang@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/bin')
-rwxr-xr-xbitbake/bin/bitbake-layers56
1 files changed, 48 insertions, 8 deletions
diff --git a/bitbake/bin/bitbake-layers b/bitbake/bin/bitbake-layers
index 774ce2db22..b48590f936 100755
--- a/bitbake/bin/bitbake-layers
+++ b/bitbake/bin/bitbake-layers
@@ -463,6 +463,21 @@ build results (as the layer priority order has effectively changed).
463 return self.get_layer_name(layerdir) 463 return self.get_layer_name(layerdir)
464 return "?" 464 return "?"
465 465
466 def get_file_layerdir(self, filename):
467 for layer, _, regex, _ in self.bbhandler.cooker.status.bbfile_config_priorities:
468 if regex.match(filename):
469 for layerdir in self.bblayers:
470 if regex.match(os.path.join(layerdir, 'test')) and re.match(layerdir, filename):
471 return layerdir
472 return "?"
473
474 def remove_layer_prefix(self, f):
475 """Remove the layer_dir prefix, e.g., f = /path/to/layer_dir/foo/blah, the
476 return value will be: layer_dir/foo/blah"""
477 f_layerdir = self.get_file_layerdir(f)
478 prefix = os.path.join(os.path.dirname(f_layerdir), '')
479 return f[len(prefix):] if f.startswith(prefix) else f
480
466 def get_layer_name(self, layerdir): 481 def get_layer_name(self, layerdir):
467 return os.path.basename(layerdir.rstrip(os.sep)) 482 return os.path.basename(layerdir.rstrip(os.sep))
468 483
@@ -545,14 +560,27 @@ Recipes are listed with the bbappends that apply to them as subitems.
545 def do_show_cross_depends(self, args): 560 def do_show_cross_depends(self, args):
546 """figure out the dependency between recipes that crosses a layer boundary. 561 """figure out the dependency between recipes that crosses a layer boundary.
547 562
548usage: show-cross-depends 563usage: show-cross-depends [-f]
549 564
550Figure out the dependency between recipes that crosses a layer boundary. 565Figure out the dependency between recipes that crosses a layer boundary.
551 566
567Options:
568 -f show full file path
569
552NOTE: 570NOTE:
553The .bbappend file can impact the dependency. 571The .bbappend file can impact the dependency.
554""" 572"""
555 self.bbhandler.prepare() 573 self.bbhandler.prepare()
574
575 show_filenames = False
576 for arg in args.split():
577 if arg == '-f':
578 show_filenames = True
579 else:
580 sys.stderr.write("show-cross-depends: invalid option %s\n" % arg)
581 self.do_help('')
582 return
583
556 pkg_fn = self.bbhandler.cooker_data.pkg_fn 584 pkg_fn = self.bbhandler.cooker_data.pkg_fn
557 bbpath = str(self.bbhandler.config_data.getVar('BBPATH', True)) 585 bbpath = str(self.bbhandler.config_data.getVar('BBPATH', True))
558 self.require_re = re.compile(r"require\s+(.+)") 586 self.require_re = re.compile(r"require\s+(.+)")
@@ -573,7 +601,7 @@ The .bbappend file can impact the dependency.
573 self.bbhandler.cooker.configuration.data, 601 self.bbhandler.cooker.configuration.data,
574 self.bbhandler.cooker_data, 602 self.bbhandler.cooker_data,
575 self.bbhandler.cooker_data.pkg_pn) 603 self.bbhandler.cooker_data.pkg_pn)
576 self.check_cross_depends("DEPENDS", layername, f, best[3]) 604 self.check_cross_depends("DEPENDS", layername, f, best[3], show_filenames)
577 605
578 # The RDPENDS 606 # The RDPENDS
579 all_rdeps = self.bbhandler.cooker_data.rundeps[f].values() 607 all_rdeps = self.bbhandler.cooker_data.rundeps[f].values()
@@ -590,7 +618,7 @@ The .bbappend file can impact the dependency.
590 best = bb.providers.filterProvidersRunTime(all_p, rdep, 618 best = bb.providers.filterProvidersRunTime(all_p, rdep,
591 self.bbhandler.cooker.configuration.data, 619 self.bbhandler.cooker.configuration.data,
592 self.bbhandler.cooker_data)[0][0] 620 self.bbhandler.cooker_data)[0][0]
593 self.check_cross_depends("RDEPENDS", layername, f, best) 621 self.check_cross_depends("RDEPENDS", layername, f, best, show_filenames)
594 622
595 # The inherit class 623 # The inherit class
596 cls_re = re.compile('classes/') 624 cls_re = re.compile('classes/')
@@ -602,7 +630,12 @@ The .bbappend file can impact the dependency.
602 if not cls_re.match(cls): 630 if not cls_re.match(cls):
603 inherit_layername = self.get_file_layer(cls) 631 inherit_layername = self.get_file_layer(cls)
604 if inherit_layername != layername: 632 if inherit_layername != layername:
605 logger.plain("%s inherits %s" % (f, cls)) 633 if not show_filenames:
634 f_short = self.remove_layer_prefix(f)
635 cls = self.remove_layer_prefix(cls)
636 else:
637 f_short = f
638 logger.plain("%s inherits %s" % (f_short, cls))
606 639
607 # The 'require/include xxx' in the bb file 640 # The 'require/include xxx' in the bb file
608 pv_re = re.compile(r"\${PV}") 641 pv_re = re.compile(r"\${PV}")
@@ -617,7 +650,7 @@ The .bbappend file can impact the dependency.
617 if pv_re.search(needed_file) and f in self.bbhandler.cooker_data.pkg_pepvpr: 650 if pv_re.search(needed_file) and f in self.bbhandler.cooker_data.pkg_pepvpr:
618 pv = self.bbhandler.cooker_data.pkg_pepvpr[f][1] 651 pv = self.bbhandler.cooker_data.pkg_pepvpr[f][1]
619 needed_file = re.sub(r"\${PV}", pv, needed_file) 652 needed_file = re.sub(r"\${PV}", pv, needed_file)
620 self.print_cross_files(bbpath, keyword, layername, f, needed_file) 653 self.print_cross_files(bbpath, keyword, layername, f, needed_file, show_filenames)
621 line = fnfile.readline() 654 line = fnfile.readline()
622 fnfile.close() 655 fnfile.close()
623 656
@@ -644,17 +677,20 @@ The .bbappend file can impact the dependency.
644 bbclass=".bbclass" 677 bbclass=".bbclass"
645 # Find a 'require/include xxxx' 678 # Find a 'require/include xxxx'
646 if m: 679 if m:
647 self.print_cross_files(bbpath, keyword, layername, f, m.group(1) + bbclass) 680 self.print_cross_files(bbpath, keyword, layername, f, m.group(1) + bbclass, show_filenames)
648 line = ffile.readline() 681 line = ffile.readline()
649 ffile.close() 682 ffile.close()
650 683
651 def print_cross_files(self, bbpath, keyword, layername, f, needed_filename): 684 def print_cross_files(self, bbpath, keyword, layername, f, needed_filename, show_filenames):
652 """Print the depends that crosses a layer boundary""" 685 """Print the depends that crosses a layer boundary"""
653 needed_file = bb.utils.which(bbpath, needed_filename) 686 needed_file = bb.utils.which(bbpath, needed_filename)
654 if needed_file: 687 if needed_file:
655 # Which layer is this file from 688 # Which layer is this file from
656 needed_layername = self.get_file_layer(needed_file) 689 needed_layername = self.get_file_layer(needed_file)
657 if needed_layername != layername: 690 if needed_layername != layername:
691 if not show_filenames:
692 f = self.remove_layer_prefix(f)
693 needed_file = self.remove_layer_prefix(needed_file)
658 logger.plain("%s %s %s" %(f, keyword, needed_file)) 694 logger.plain("%s %s %s" %(f, keyword, needed_file))
659 def match_inherit(self, line): 695 def match_inherit(self, line):
660 """Match the inherit xxx line""" 696 """Match the inherit xxx line"""
@@ -669,11 +705,15 @@ The .bbappend file can impact the dependency.
669 keyword = "includes" 705 keyword = "includes"
670 return (m, keyword) 706 return (m, keyword)
671 707
672 def check_cross_depends(self, keyword, layername, f, needed_file): 708 def check_cross_depends(self, keyword, layername, f, needed_file, show_filenames):
673 """Print the DEPENDS/RDEPENDS file that crosses a layer boundary""" 709 """Print the DEPENDS/RDEPENDS file that crosses a layer boundary"""
674 best_realfn = bb.cache.Cache.virtualfn2realfn(needed_file)[0] 710 best_realfn = bb.cache.Cache.virtualfn2realfn(needed_file)[0]
675 needed_layername = self.get_file_layer(best_realfn) 711 needed_layername = self.get_file_layer(best_realfn)
676 if needed_layername != layername: 712 if needed_layername != layername:
713 if not show_filenames:
714 f = self.remove_layer_prefix(f)
715 best_realfn = self.remove_layer_prefix(best_realfn)
716
677 logger.plain("%s %s %s" % (f, keyword, best_realfn)) 717 logger.plain("%s %s %s" % (f, keyword, best_realfn))
678 718
679if __name__ == '__main__': 719if __name__ == '__main__':