* [PATCH] bitbake/cooker: Ensure matchFile returns full pathnames
@ 2012-05-24 10:02 Richard Purdie
2012-05-24 12:56 ` [PATCH v2] " Richard Purdie
0 siblings, 1 reply; 3+ messages in thread
From: Richard Purdie @ 2012-05-24 10:02 UTC (permalink / raw)
To: bitbake-devel
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]
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---
diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py
index 8ad4922..e036efb 100644
--- a/bitbake/lib/bb/cooker.py
+++ b/bitbake/lib/bb/cooker.py
@@ -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)
^ permalink raw reply related [flat|nested] 3+ messages in thread* [PATCH v2] bitbake/cooker: Ensure matchFile returns full pathnames
2012-05-24 10:02 [PATCH] bitbake/cooker: Ensure matchFile returns full pathnames Richard Purdie
@ 2012-05-24 12:56 ` Richard Purdie
0 siblings, 0 replies; 3+ messages in thread
From: Richard Purdie @ 2012-05-24 12:56 UTC (permalink / raw)
To: bitbake-devel
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.
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---
diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py
index 8ad4922..bafd832 100644
--- a/bitbake/lib/bb/cooker.py
+++ b/bitbake/lib/bb/cooker.py
@@ -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)
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH] bitbake/cooker: Ensure matchFile returns full pathnames
@ 2012-05-24 10:01 Richard Purdie
0 siblings, 0 replies; 3+ messages in thread
From: Richard Purdie @ 2012-05-24 10:01 UTC (permalink / raw)
To: bitbake-devel
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]
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---
diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py
index 8ad4922..e036efb 100644
--- a/bitbake/lib/bb/cooker.py
+++ b/bitbake/lib/bb/cooker.py
@@ -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)
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-05-24 13:06 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-24 10:02 [PATCH] bitbake/cooker: Ensure matchFile returns full pathnames Richard Purdie
2012-05-24 12:56 ` [PATCH v2] " Richard Purdie
-- strict thread matches above, loose matches on Subject: below --
2012-05-24 10:01 [PATCH] " Richard Purdie
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.