All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/4] bitbake-layers show-cross-depends improvements
@ 2014-05-23 15:22 Paul Eggleton
  2014-05-23 15:22 ` [PATCH 1/4] bitbake-layers: show-cross-depends: add option to ignore a layer Paul Eggleton
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Paul Eggleton @ 2014-05-23 15:22 UTC (permalink / raw)
  To: bitbake-devel

The following changes since commit af3ce0fc0280e6642fa35de400f75fdbabf329b1:

  data_smart: Fix an unusual variable reference bug (2014-05-21 16:46:45 +0100)

are available in the git repository at:

  git://git.yoctoproject.org/poky-contrib paule/bitbake-layers
  http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=paule/bitbake-layers

Paul Eggleton (4):
  bitbake-layers: show-cross-depends: add option to ignore a layer
  bitbake-layers: show-cross-depends: ignore global inherits
  bitbake-layers: show-cross-depends: ignore self-satisfied RDEPENDS
  bitbake-layers: show-cross-depends: add support for RRECOMMENDS

 bin/bitbake-layers | 72 +++++++++++++++++++++++++++++++++++++++---------------
 1 file changed, 52 insertions(+), 20 deletions(-)

-- 
1.9.0



^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/4] bitbake-layers: show-cross-depends: add option to ignore a layer
  2014-05-23 15:22 [PATCH 0/4] bitbake-layers show-cross-depends improvements Paul Eggleton
@ 2014-05-23 15:22 ` Paul Eggleton
  2014-05-23 15:22 ` [PATCH 2/4] bitbake-layers: show-cross-depends: ignore global inherits Paul Eggleton
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Paul Eggleton @ 2014-05-23 15:22 UTC (permalink / raw)
  To: bitbake-devel

By default, show-cross-depends shows dependencies on OE-Core (i.e.
"meta") which is not particularly useful. Add an option to allow you to
hide those. For example, to hide all dependencies on OE-Core:

  bitbake-layers show-cross-depends -i meta

Multiple layers can be specified by using commas as separators (no
spaces).

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
---
 bin/bitbake-layers | 44 ++++++++++++++++++++++++--------------------
 1 file changed, 24 insertions(+), 20 deletions(-)

diff --git a/bin/bitbake-layers b/bin/bitbake-layers
index 2a7f829..826a3e7 100755
--- a/bin/bitbake-layers
+++ b/bin/bitbake-layers
@@ -566,26 +566,29 @@ 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 [-f]
+usage: show-cross-depends [-f] [-i layer1[,layer2[,layer3...]]]
 
 Figure out the dependency between recipes that crosses a layer boundary.
 
 Options:
   -f   show full file path
+  -i   ignore dependencies on items in the specified layer(s)
 
 NOTE:
 The .bbappend file can impact the dependency.
 """
-        self.init_bbhandler()
+        import optparse
 
-        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
+        parser = optparse.OptionParser(usage="show-cross-depends [-f] [-i layer1[,layer2[,layer3...]]]")
+        parser.add_option("-f", "",
+                action="store_true", dest="show_filenames")
+        parser.add_option("-i", "",
+                action="store", dest="ignore_layers", default="")
+
+        options, args = parser.parse_args(sys.argv)
+        ignore_layers = options.ignore_layers.split(',')
+
+        self.init_bbhandler()
 
         pkg_fn = self.bbhandler.cooker_data.pkg_fn
         bbpath = str(self.bbhandler.config_data.getVar('BBPATH', True))
@@ -607,7 +610,7 @@ The .bbappend file can impact the dependency.
                             self.bbhandler.config_data,
                             self.bbhandler.cooker_data,
                             self.bbhandler.cooker_data.pkg_pn)
-                    self.check_cross_depends("DEPENDS", layername, f, best[3], show_filenames)
+                    self.check_cross_depends("DEPENDS", layername, f, best[3], options.show_filenames, ignore_layers)
 
             # The RDPENDS
             all_rdeps = self.bbhandler.cooker_data.rundeps[f].values()
@@ -624,7 +627,7 @@ The .bbappend file can impact the dependency.
                     best = bb.providers.filterProvidersRunTime(all_p, rdep,
                                     self.bbhandler.config_data,
                                     self.bbhandler.cooker_data)[0][0]
-                    self.check_cross_depends("RDEPENDS", layername, f, best, show_filenames)
+                    self.check_cross_depends("RDEPENDS", layername, f, best, options.show_filenames, ignore_layers)
 
             # The inherit class
             cls_re = re.compile('classes/')
@@ -635,8 +638,8 @@ The .bbappend file can impact the dependency.
                     # ignore the classes/cls.
                     if not cls_re.match(cls):
                         inherit_layername = self.get_file_layer(cls)
-                        if inherit_layername != layername:
-                            if not show_filenames:
+                        if inherit_layername != layername and not inherit_layername in ignore_layers:
+                            if not options.show_filenames:
                                 f_short = self.remove_layer_prefix(f)
                                 cls = self.remove_layer_prefix(cls)
                             else:
@@ -656,7 +659,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, show_filenames)
+                    self.print_cross_files(bbpath, keyword, layername, f, needed_file, options.show_filenames, ignore_layers)
                 line = fnfile.readline()
             fnfile.close()
 
@@ -683,21 +686,22 @@ 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, show_filenames)
+                                self.print_cross_files(bbpath, keyword, layername, f, m.group(1) + bbclass, options.show_filenames, ignore_layers)
                             line = ffile.readline()
                         ffile.close()
 
-    def print_cross_files(self, bbpath, keyword, layername, f, needed_filename, show_filenames):
+    def print_cross_files(self, bbpath, keyword, layername, f, needed_filename, show_filenames, ignore_layers):
         """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 needed_layername != layername and not needed_layername in ignore_layers:
                 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"""
         return (self.inherit_re.match(line), "inherits")
@@ -711,11 +715,11 @@ The .bbappend file can impact the dependency.
             keyword = "includes"
         return (m, keyword)
 
-    def check_cross_depends(self, keyword, layername, f, needed_file, show_filenames):
+    def check_cross_depends(self, keyword, layername, f, needed_file, show_filenames, ignore_layers):
         """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 needed_layername != layername and not needed_layername in ignore_layers:
             if not show_filenames:
                 f = self.remove_layer_prefix(f)
                 best_realfn = self.remove_layer_prefix(best_realfn)
-- 
1.9.0



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/4] bitbake-layers: show-cross-depends: ignore global inherits
  2014-05-23 15:22 [PATCH 0/4] bitbake-layers show-cross-depends improvements Paul Eggleton
  2014-05-23 15:22 ` [PATCH 1/4] bitbake-layers: show-cross-depends: add option to ignore a layer Paul Eggleton
@ 2014-05-23 15:22 ` Paul Eggleton
  2014-05-23 15:22 ` [PATCH 3/4] bitbake-layers: show-cross-depends: ignore self-satisfied RDEPENDS Paul Eggleton
  2014-05-23 15:22 ` [PATCH 4/4] bitbake-layers: show-cross-depends: add support for RRECOMMENDS Paul Eggleton
  3 siblings, 0 replies; 5+ messages in thread
From: Paul Eggleton @ 2014-05-23 15:22 UTC (permalink / raw)
  To: bitbake-devel

It's not particularly useful to show globally inherited classes here
since they do not normally represent a dependency.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
---
 bin/bitbake-layers | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/bin/bitbake-layers b/bin/bitbake-layers
index 826a3e7..326239a 100755
--- a/bin/bitbake-layers
+++ b/bin/bitbake-layers
@@ -596,6 +596,8 @@ The .bbappend file can impact the dependency.
         self.include_re = re.compile(r"include\s+(.+)")
         self.inherit_re = re.compile(r"inherit\s+(.+)")
 
+        global_inherit = (self.bbhandler.config_data.getVar('INHERIT', True) or "").split()
+
         # The bb's DEPENDS and RDEPENDS
         for f in pkg_fn:
             f = bb.cache.Cache.virtualfn2realfn(f)[0]
@@ -637,6 +639,9 @@ The .bbappend file can impact the dependency.
                     # The inherits' format is [classes/cls, /path/to/classes/cls]
                     # ignore the classes/cls.
                     if not cls_re.match(cls):
+                        classname = os.path.splitext(os.path.basename(cls))[0]
+                        if classname in global_inherit:
+                            continue
                         inherit_layername = self.get_file_layer(cls)
                         if inherit_layername != layername and not inherit_layername in ignore_layers:
                             if not options.show_filenames:
-- 
1.9.0



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 3/4] bitbake-layers: show-cross-depends: ignore self-satisfied RDEPENDS
  2014-05-23 15:22 [PATCH 0/4] bitbake-layers show-cross-depends improvements Paul Eggleton
  2014-05-23 15:22 ` [PATCH 1/4] bitbake-layers: show-cross-depends: add option to ignore a layer Paul Eggleton
  2014-05-23 15:22 ` [PATCH 2/4] bitbake-layers: show-cross-depends: ignore global inherits Paul Eggleton
@ 2014-05-23 15:22 ` Paul Eggleton
  2014-05-23 15:22 ` [PATCH 4/4] bitbake-layers: show-cross-depends: add support for RRECOMMENDS Paul Eggleton
  3 siblings, 0 replies; 5+ messages in thread
From: Paul Eggleton @ 2014-05-23 15:22 UTC (permalink / raw)
  To: bitbake-devel

Overlayed recipes caused this to show false positives because the
overlaying version appeared to be satisfying the overlayed version's
RDEPENDS; but you'd never be building both at the same time.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
---
 bin/bitbake-layers | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/bin/bitbake-layers b/bin/bitbake-layers
index 326239a..135096b 100755
--- a/bin/bitbake-layers
+++ b/bin/bitbake-layers
@@ -626,6 +626,9 @@ The .bbappend file can impact the dependency.
             for rdep in all_rdeps:
                 all_p = bb.providers.getRuntimeProviders(self.bbhandler.cooker_data, rdep)
                 if all_p:
+                    if f in all_p:
+                        # The recipe provides this one itself, ignore
+                        continue
                     best = bb.providers.filterProvidersRunTime(all_p, rdep,
                                     self.bbhandler.config_data,
                                     self.bbhandler.cooker_data)[0][0]
-- 
1.9.0



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 4/4] bitbake-layers: show-cross-depends: add support for RRECOMMENDS
  2014-05-23 15:22 [PATCH 0/4] bitbake-layers show-cross-depends improvements Paul Eggleton
                   ` (2 preceding siblings ...)
  2014-05-23 15:22 ` [PATCH 3/4] bitbake-layers: show-cross-depends: ignore self-satisfied RDEPENDS Paul Eggleton
@ 2014-05-23 15:22 ` Paul Eggleton
  3 siblings, 0 replies; 5+ messages in thread
From: Paul Eggleton @ 2014-05-23 15:22 UTC (permalink / raw)
  To: bitbake-devel

RRECOMMENDS must be satisfied at build time, and these could cross layer
boundaries, so report these if they exist.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
---
 bin/bitbake-layers | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/bin/bitbake-layers b/bin/bitbake-layers
index 135096b..302f020 100755
--- a/bin/bitbake-layers
+++ b/bin/bitbake-layers
@@ -634,6 +634,26 @@ The .bbappend file can impact the dependency.
                                     self.bbhandler.cooker_data)[0][0]
                     self.check_cross_depends("RDEPENDS", layername, f, best, options.show_filenames, ignore_layers)
 
+            # The RRECOMMENDS
+            all_rrecs = self.bbhandler.cooker_data.runrecs[f].values()
+            # Remove the duplicated or null one.
+            sorted_rrecs = {}
+            # The all_rrecs is the list in list, so we need two for loops
+            for k1 in all_rrecs:
+                for k2 in k1:
+                    sorted_rrecs[k2] = 1
+            all_rrecs = sorted_rrecs.keys()
+            for rrec in all_rrecs:
+                all_p = bb.providers.getRuntimeProviders(self.bbhandler.cooker_data, rrec)
+                if all_p:
+                    if f in all_p:
+                        # The recipe provides this one itself, ignore
+                        continue
+                    best = bb.providers.filterProvidersRunTime(all_p, rrec,
+                                    self.bbhandler.config_data,
+                                    self.bbhandler.cooker_data)[0][0]
+                    self.check_cross_depends("RRECOMMENDS", layername, f, best, options.show_filenames, ignore_layers)
+
             # The inherit class
             cls_re = re.compile('classes/')
             if f in self.bbhandler.cooker_data.inherits:
-- 
1.9.0



^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-05-23 15:22 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-23 15:22 [PATCH 0/4] bitbake-layers show-cross-depends improvements Paul Eggleton
2014-05-23 15:22 ` [PATCH 1/4] bitbake-layers: show-cross-depends: add option to ignore a layer Paul Eggleton
2014-05-23 15:22 ` [PATCH 2/4] bitbake-layers: show-cross-depends: ignore global inherits Paul Eggleton
2014-05-23 15:22 ` [PATCH 3/4] bitbake-layers: show-cross-depends: ignore self-satisfied RDEPENDS Paul Eggleton
2014-05-23 15:22 ` [PATCH 4/4] bitbake-layers: show-cross-depends: add support for RRECOMMENDS Paul Eggleton

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.