[rtems-source-builder commit] sb/pkgconfig: Cache pkgconfig based on a file name not name

Chris Johns chrisj at rtems.org
Tue Mar 3 02:01:22 UTC 2020


Module:    rtems-source-builder
Branch:    master
Commit:    96d55ab432fabdacf5b5cb5881cee18235463f93
Changeset: http://git.rtems.org/rtems-source-builder/commit/?id=96d55ab432fabdacf5b5cb5881cee18235463f93

Author:    Chris Johns <chrisj at rtems.org>
Date:      Tue Mar  3 11:02:58 2020 +1100

sb/pkgconfig: Cache pkgconfig based on a file name not name

- Caching on name falsely assumed checks across different config
  instances in nested build sets as used in vertical stack
  building was valid. This stopped a valid check for a prefix
  seeing if a valid BSP config was present.

Updates #3893

---

 source-builder/sb/pkgconfig.py | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/source-builder/sb/pkgconfig.py b/source-builder/sb/pkgconfig.py
index 519e858..6437f2c 100755
--- a/source-builder/sb/pkgconfig.py
+++ b/source-builder/sb/pkgconfig.py
@@ -91,6 +91,7 @@ class package(object):
     no_dup_flags = ['-I', '-l', '-L']
     dual_opts = ['-D', '-U', '-I', '-l', '-L']
     lib_list_splitter = re.compile('[\s,]+')
+    loaded_prefixes = None
     loaded = {}
 
     @staticmethod
@@ -416,15 +417,15 @@ class package(object):
         return ok
 
     def load(self, name):
-        if name in package.loaded:
-            package._copy(package.loaded[name], self)
-            return
         self._log('loading: %s' % (name))
         if self.name_:
             self._clean()
         self.name_ = name
         file = self._find_package(name)
         if file:
+            if file in package.loaded:
+                package._copy(package.loaded[file], self)
+                return
             self._log('load: %s (%s)' % (name, file))
             if self.src:
                 self.src('==%s%s' % ('=' * 80, os.linesep))
@@ -474,8 +475,9 @@ class package(object):
             if requires:
                 for r in package.splitter(requires):
                     if r[0] not in self.nodes[nt]:
-                        if r[0] in package.loaded:
-                            pkg = package.loaded[r[0]]
+                        file = self._find_package(r[0])
+                        if file in package.loaded:
+                            pkg = package.loaded[file]
                         else:
                             pkg = package(r[0], self.prefix, self.output)
                         ver = pkg.get('version')
@@ -486,8 +488,8 @@ class package(object):
                             self._log('failed: %s (%s %s %s)' % (r[0], ver, r[1], r[2]))
                             self.nodes['failed'][r[0]] = pkg
         if self.exists():
-            self._log('load: exists')
-            package.loaded[name] = self
+            self._log('load: exists and loaded; cache as loaded')
+            package.loaded[self.file_] = self
 
     def get(self, label, private = True):
         self._log('get: %s (%s)' % (label, ','.join(self.fields)))



More information about the vc mailing list