Skip to contentSkip to conversation

bitbake/cooker: Ensure matchFile returns full pathnames

PATCH Superseded Richard Purdie 1 participant 2 messages May 24, 2012

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 bitbake/cooker: Ensure matchFile returns full pathnames

We should always be passing full pathnames around within bitbake. If a file was referenced as a relative path to the current working directory, it might not get passed through the abspath call and hence the cwd would not get added as a prefix.

This change attempts to put everything through abspath and ignores failures. Any failure cases would mean the file simply wouldn't exist and then would get covered by the catchall code below.

[YOCTO #1465]

---

bitbake/lib/bb/cooker.py +3 -2
index 8ad4922..e036efb 100644
@@ -985,9 +985,10 @@ class BBCooker:
         """
         Find the .bb files which match the expression in 'buildfile'.
         """
-
-        if bf.startswith("/") or bf.startswith("../"):
+        try:
             bf = os.path.abspath(bf)
+        except:
+            pass
         filelist, masked = self.collect_bbfiles()
         try:
             os.stat(bf)
#1 lore raw

PATCH v2 1/1 bitbake/cooker: Ensure matchFile returns full pathnames

We should always be passing full pathnames around within bitbake. If a file was referenced as a relative path to the current working directory, it might not get passed through the abspath call and hence the cwd would not get added as a prefix.

This change adds a second pass at ensuring we only return absolute paths.

---

bitbake/lib/bb/cooker.py +1 -1
index 8ad4922..bafd832 100644
@@ -985,12 +985,12 @@ class BBCooker:
         """
         Find the .bb files which match the expression in 'buildfile'.
         """
-
         if bf.startswith("/") or bf.startswith("../"):
             bf = os.path.abspath(bf)
         filelist, masked = self.collect_bbfiles()
         try:
             os.stat(bf)
+            bf = os.path.abspath(bf)
             return [bf]
         except OSError:
             regexp = re.compile(bf)