summaryrefslogtreecommitdiff
path: root/kconfiglib.py
diff options
context:
space:
mode:
authorUlf Magnusson <ulfalizer@gmail.com>2017-09-24 13:47:04 +0200
committerUlf Magnusson <ulfalizer@gmail.com>2017-09-24 14:03:41 +0200
commitb9509c0fbc13679393389611a5c4b88b0324306a (patch)
tree0fdc411bb8beca88bc2c48899b87f7ceea9e5a27 /kconfiglib.py
parent62c63e03ec968f0a38fb6d05222336c4e738dcd2 (diff)
Fix defconfig srctree absolute/relative mixup bug
This code in zconf.l says !=, not ==. Thought the behavior seemed weird. if (!f && name != NULL && name[0] != '/') { env = getenv(SRCTREE); if (env) { sprintf(fullname, "%s/%s", env, name); f = fopen(fullname, "r"); } } return f; Thankfully only broken for a short while. Also gives much simpler code.
Diffstat (limited to 'kconfiglib.py')
-rw-r--r--kconfiglib.py15
1 files changed, 5 insertions, 10 deletions
diff --git a/kconfiglib.py b/kconfiglib.py
index fab1fb9..d87f9cc 100644
--- a/kconfiglib.py
+++ b/kconfiglib.py
@@ -292,9 +292,9 @@ class Config(object):
past the first one (and prints a warning).
If the environment variable 'srctree' was set when the Config was
- created, each defconfig specified with an absolute path will be
+ created, each defconfig specified with a relative path will be
searched for in $srcdir if it is not found at the specified path (i.e.,
- if /foo/defconfig is not found, $srctree/foo/defconfig will be looked
+ if foo/defconfig is not found, $srctree/foo/defconfig will be looked
up).
WARNING: A wart here is that scripts/kconfig/Makefile sometimes uses
@@ -311,15 +311,10 @@ class Config(object):
filename = self._expand_sym_refs(filename)
if os.path.exists(filename):
return filename
- # defconfig not found. If the path is an absolute path and
+ # defconfig not found. If the path is a relative path and
# $srctree is set, we also look in $srctree.
- if os.path.isabs(filename) and self.srctree is not None:
- # The os.path.relpath() de-absolutizes the path, e.g.
- # /foo/bar/baz -> foo/bar/baz. os.path.join() ignores the
- # first argument if the second argument is an absolute
- # path.
- filename = os.path.join(self.srctree,
- os.path.relpath(filename, os.sep))
+ if not os.path.isabs(filename) and self.srctree is not None:
+ filename = os.path.join(self.srctree, filename)
if os.path.exists(filename):
return filename