diff options
author | Jacob Keller <jacob.e.keller@intel.com> | 2019-09-27 16:30:27 -0700 |
---|---|---|
committer | Masahiro Yamada <yamada.masahiro@socionext.com> | 2019-10-05 15:29:49 +0900 |
commit | 82fdd12b95727640c9a8233c09d602e4518e71f7 (patch) | |
tree | 89d11bb314aa2c1c6892f2f237ec03ae333c9b91 /Kbuild | |
parent | 01bb25156d856e3efb887a273c03f8ba66f8fb0f (diff) | |
download | talos-op-linux-82fdd12b95727640c9a8233c09d602e4518e71f7.tar.gz talos-op-linux-82fdd12b95727640c9a8233c09d602e4518e71f7.zip |
namespace: fix namespace.pl script to support relative paths
The namespace.pl script does not work properly if objtree is not set to
an absolute path. The do_nm function is run from within the find
function, which changes directories.
Because of this, appending objtree, $File::Find::dir, and $source, will
return a path which is not valid from the current directory.
This used to work when objtree was set to an absolute path when using
"make namespacecheck". It appears to have not worked when calling
./scripts/namespace.pl directly.
This behavior was changed in 7e1c04779efd ("kbuild: Use relative path
for $(objtree)", 2014-05-14)
Rather than fixing the Makefile to set objtree to an absolute path, just
fix namespace.pl to work when srctree and objtree are relative. Also fix
the script to use an absolute path for these by default.
Use the File::Spec module for this purpose. It's been part of perl
5 since 5.005.
The curdir() function is used to get the current directory when the
objtree and srctree aren't set in the environment.
rel2abs() is used to convert possibly relative objtree and srctree
environment variables to absolute paths.
Finally, the catfile() function is used instead of string appending
paths together, since this is more robust when joining paths together.
Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Acked-by: Randy Dunlap <rdunlap@infradead.org>
Tested-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Diffstat (limited to 'Kbuild')
0 files changed, 0 insertions, 0 deletions