[oe-commits] org.nslu2-linux.bitbake bitbake: patch 332 to handle foo (ver) in RDEPENDS and make the

jbowler commit openembedded-commits at lists.openembedded.org
Mon Oct 23 17:44:53 UTC 2006


bitbake: patch 332 to handle foo (ver) in RDEPENDS and make the
 monotone head build (temporary hack from RP)

Author: jbowler at nslu2-linux.org
Branch: org.nslu2-linux.bitbake
Revision: 17970596310cf5b084702b68f677b680fcc0d5b3
ViewMTN: http://monotone.openembedded.org/revision.psp?id=17970596310cf5b084702b68f677b680fcc0d5b3
Files:
1
bin/bitbake
lib/bb/utils.py
Diffs:

#
# mt diff -rcd0a4d6c9c743c1d4137094c5bd53a400f8faedf -r17970596310cf5b084702b68f677b680fcc0d5b3
#
# 
# 
# patch "bin/bitbake"
#  from [b76b834a7c16eefaedb0c8ef09394551541a4fac]
#    to [d39d47aac1a22bc0d210b1d322ae49d5b84a67ff]
# 
# patch "lib/bb/utils.py"
#  from [2c6b31ed7fc9391008222c531686623e785a1e4b]
#    to [57700a024b4313687805256e95231349e6c426c5]
# 
============================================================
--- bin/bitbake	b76b834a7c16eefaedb0c8ef09394551541a4fac
+++ bin/bitbake	d39d47aac1a22bc0d210b1d322ae49d5b84a67ff
@@ -46,6 +46,7 @@ class BBParsingStatus:
     def __init__(self):
         self.cache_dirty = False
         self.providers   = {}
+        self.rproviders = {}
         self.packages = {}
         self.packages_dynamic = {}
         self.bbfile_priority = {}
@@ -76,6 +77,7 @@ class BBParsingStatus:
         pr       = bb.data.getVar('PR', bb_data, True)
         dp       = int(bb.data.getVar('DEFAULT_PREFERENCE', bb_data, True) or "0")
         provides = Set([pn] + (bb.data.getVar("PROVIDES", bb_data, 1) or "").split())
+        rprovides = (bb.data.getVar("RPROVIDES", bb_data, 1) or "").split()
         depends  = (bb.data.getVar("DEPENDS", bb_data, True) or "").split()
         packages = (bb.data.getVar('PACKAGES', bb_data, True) or "").split()
         packages_dynamic = (bb.data.getVar('PACKAGES_DYNAMIC', bb_data, True) or "").split()
@@ -119,6 +121,11 @@ class BBParsingStatus:
                 self.packages_dynamic[package] = []
             self.packages_dynamic[package].append(file_name)
 
+        for rprovide in rprovides:
+            if not rprovide in self.rproviders:
+                self.rproviders[rprovide] = []
+            self.rproviders[rprovide].append(file_name)
+
         # Collect files we may need for possible world-dep
         # calculations
         if not bb.data.getVar('BROKEN', bb_data, True) and not bb.data.getVar('EXCLUDE_FROM_WORLD', bb_data, True):
@@ -211,6 +218,29 @@ class BBCooker:
             self.build_cache_fail.append(fn)
             raise
 
+    def regexpsMatch(self, regexps, substring):
+        for regexp in regexps:
+            if regexp.match(substring):
+                return 1
+        return 0
+
+    def removeSelfDeps(self, the_data, deps_list):
+        clean_deps = []
+        dpackagesRe = []
+        # Remove any dependencies which map to ourselves to avoid circular dependencies
+        packages = (bb.data.getVar('PACKAGES', the_data, 1) or "").split()
+        dpackages = (bb.data.getVar('PACKAGES_DYNAMIC', the_data, 1) or "").split()
+        bb.note("deps_list: %s" % " ".join(deps_list))
+        for dpackage in dpackages:
+            dpackagesRe.append(re.compile(dpackage))
+        for subdep in deps_list:
+            if subdep in packages:
+                continue
+            if not self.regexpsMatch(dpackagesRe, subdep):
+                clean_deps.append(subdep)
+        bb.note("clean %s" % ":".join(clean_deps))
+        return clean_deps
+
     def tryBuild( self, fn, virtual , buildAllDeps ):
         """Build a provider and its dependencies"""
         if fn in self.building_list:
@@ -226,19 +256,37 @@ class BBCooker:
         pathstr = "%s (%s)" % (item, virtual)
         self.build_path.append(pathstr)
 
-        depends_list = (bb.data.getVar('DEPENDS', the_data, 1) or "")
+        depends_list = (bb.data.getVar('DEPENDS', the_data, 1) or "").split()
         if not buildAllDeps:
             buildAllDeps = bb.data.getVar('BUILD_ALL_DEPS', the_data, 1) or False
 
+        bb.note("dependencies for %s are: %s" % (item, " ".join(depends_list)))
+
         if buildAllDeps:
-            depends_list = "%s %s %s" % (depends_list, (bb.data.getVar('RDEPENDS', the_data, 1) or ""), (bb.data.getVar('RRECOMMENDS', the_data, 1) or ""))
+            bb.note("building all deps")
+            subdeps = []
+            subdeps += bb.utils.explode_deps(bb.data.getVar('RDEPENDS', the_data, 1) or "")
+            subdeps += bb.utils.explode_deps(bb.data.getVar('RRECOMMENDS', the_data, 1) or "")
+            # Need to include subpackage dependencies but not circular ones
+            packages = (bb.data.getVar('PACKAGES', the_data, 1).split() or "")
+            for package in packages:
+                #if virtual != package:
+                    #bb.note("%s: %s not equal to %s, skipping" % (item, virtual, package))
+                    #continue
+    	        subdeps += bb.utils.explode_deps(bb.data.getVar("RDEPENDS_%s" % package, the_data, 1) or "")
+                subdeps += bb.utils.explode_deps(bb.data.getVar("RRECOMMENDS_%s" % package, the_data, 1) or "")
+            depends_list += self.removeSelfDeps(the_data, subdeps)
+        else:
+            bb.note("not building all deps")
 
+        bb.note("dependencies for %s are: %s" % (item, " ".join(depends_list)))
+
         if self.configuration.verbose:
             bb.note("current path: %s" % (" -> ".join(self.build_path)))
-            bb.note("dependencies for %s are: %s" % (item, depends_list))
+            bb.note("dependencies for %s are: %s" % (item, " ".join(depends_list)))
 
-        depends_list = depends_list.split()
 
+
         try:
             failed = False
 
@@ -412,6 +460,9 @@ class BBCooker:
         if not buildAllDeps:
             return False
 
+        if item in self.status.rproviders:
+            return self.status.rproviders[item]
+
         if item in self.status.packages:
             return self.status.packages[item]
 
============================================================
--- lib/bb/utils.py	2c6b31ed7fc9391008222c531686623e785a1e4b
+++ lib/bb/utils.py	57700a024b4313687805256e95231349e6c426c5
@@ -69,3 +69,21 @@ def vercmp(ta, tb):
     if (r == 0):
         r = vercmp_part(ra, rb)
     return r
+
+def explode_deps(s):
+    r = []
+    l = s.split()
+    flag = False
+    for i in l:
+        if i[0] == '(':
+            flag = True
+            j = []
+        if flag:
+            j.append(i)
+        if i.endswith(')'):
+            flag = False
+#            r[-1] += ' ' + ' '.join(j)
+# bitbake doesn't handle rdepends versions yet
+        else:
+            r.append(i)
+    return r






More information about the Openembedded-commits mailing list