Commit Graph

19 Commits

Author SHA1 Message Date
Joshua Lock c4e2c59088 meta: remove True option to getVar calls
getVar() now defaults to expanding by default, thus remove the True
option from getVar() calls with a regex search and replace.

Search made with the following regex: getVar ?\(( ?[^,()]*), True\)

(From OE-Core rev: 7c552996597faaee2fbee185b250c0ee30ea3b5f)

Signed-off-by: Joshua Lock <joshua.g.lock@intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-12-16 10:23:23 +00:00
Richard Purdie 21a5e74eb5 chrpath: Remove standard search paths from RPATHS
(From OE-Core rev: 6b94569d5d8e8bdd575d12e260abf10d3ac11cfd)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-11-15 15:19:53 +00:00
Ulf Magnusson fe7a7836ed chrpath.bbclass: Use bb.fatal() instead of raising FuncFailed
This sets a good example and avoids unnecessarily contributing to
perceived complexity and cargo culting.

Motivating quote below:

< kergoth> the *original* intent was for the function/task to error via
           whatever appropriate means, bb.fatal, whatever, and
           funcfailed was what you'd catch if you were calling
           exec_func/exec_task. that is, it's what those functions
           raise, not what metadata functions should be raising
< kergoth> it didn't end up being used that way
< kergoth> but there's really never a reason to raise it yourself

FuncFailed.__init__ takes a 'name' argument rather than a 'msg'
argument, which also shows that the original purpose got lost.

(From OE-Core rev: 20e669f56489b2c8a9bc6a0e6f3eac81ef35445a)

Signed-off-by: Ulf Magnusson <ulfalizer@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-10-04 16:29:05 +01:00
Vladimir Zapolskiy b30aeb3e32 chrpath: correct subprocess.Popen.communicate() return values
This is a non-functional change, which intends to correct element
names of a tuple returned by Popen.communicate().

Both in python2 and python3 subprocess.Popen.communicate() method
returns a tuple (stdoutdata, stderrdata), thus old assignments and
collateral comments are incorrect from human's point of view, however
formally there is no error in the code.

The change is desired to have to avoid copy-paste errors in future.

(From OE-Core rev: f8c21df86bae5a85e221b69b91b347aeba6be4c3)

Signed-off-by: Vladimir Zapolskiy <vz@mleia.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-08-10 10:46:33 +01:00
Richard Purdie a7309d5790 classes/lib: Update to use python3 command pipeline decoding
In python3, strings are unicode by default. We need to encode/decode
from command pipelines and other places where we interface with the
real world using the correct locales. This patch updates various
call sites to use the correct encoding/decodings.

(From OE-Core rev: bb4685af1bffe17b3aa92a6d21398f38a44ea874)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-06-02 08:24:00 +01:00
Maxin B. John a205c4ce1d bbclass: fix spelling mistakes
Fix some spelling mistakes in bbclass files

(From OE-Core rev: ed484c06f436eea62c5d0b1a2964f219f3e5cb61)

Signed-off-by: Maxin B. John <maxin.john@intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-11-24 15:50:27 +00:00
Richard Purdie 86d30d756a meta: Add explict getVar param for (non) expansion
Rather than just use d.getVar(X), use the more explict d.getVar(X, False)
since at some point in the future, having the default of expansion would
be nice. This is the first step towards that.

This patch was mostly made using the command:

sed -e 's:\(getVar([^,()]*\)\s*):\1, False):g' -i `grep -ril getVar *`

(From OE-Core rev: ab7c1d239b122c8e549e8112c88fd46c9e2b061b)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-06-23 11:57:25 +01:00
Andre McCurdy 9157c1b0aa chrpath.bbclass: handle RUNPATH as well as RPATH
Binaries linked with gold may contain a RUNPATH instead of an RPATH.
Update chrpath.bbclass process_file_linux() to handle both cases.

(From OE-Core rev: 46ceb4d035e4f49e6b4a3a83bf604944d2b991c1)

Signed-off-by: Andre McCurdy <armccurdy@gmail.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-03-16 17:41:56 +00:00
Richard Purdie 59b0f7f01b chrpath: Drop warning from darwn builds
This was old debug which can safely be removed for less noisy builds.

(From OE-Core rev: d0be4b37743492fc9c178fd6f9ef73a5eb2fd9c3)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-08-17 10:01:36 +01:00
Matt Cowell 1b82c73df4 chrpath: properly handle rootdir with '..' in path
When there is a '..' in the rootdir path, rootdir will not be a substring of
fpath.  This causes an incorrect rpath of the difference between the workdir
and the sysroot to be computed, which is incorrect.  Normalizing basedir
fixes this issue.

(From OE-Core rev: 753cfcadd8cc683e69b6707b823dc49dfb34ab0b)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-05-11 12:27:21 +01:00
Richard Purdie 6fcb96076c chrpath: Improve crazy code
The current code is a little bit overcomplicated, deficient and also
possibly broken.

Issues include:

a) Not maximally optisming rpaths (e.g. a lib in usr/lib might get an
   rpath of $ORIGIN/../../usr/lib)
b) The return in the middle of the for loop look suspiciously like
   it might break on some binaries
c) The depth function, loops of "../" prepending and so on can
   be replaced with a call to os.path.relpath

This patch cleans up the above issues.

Running binaries should result in less "../" resolutions which can't
hurt performance either.

[YOCTO #3989]

(From OE-Core rev: feea54df6768036649ca6c57524e2a1f480ad249)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-11-29 09:52:57 +00:00
Richard Purdie 9f67e31ab2 chrpath: Add support for relocating darwin binaries
On darwin, install_name_tool can be used to relocate binaries/libraries. This
adds support for adjusting them with relative paths rather than hardcoded ones.
The Linux code is factored out into a function but is otherwise unchanged.

(From OE-Core rev: ed5ace3437eb0f751172e6b93399639c94b89e59)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-08-23 16:20:14 +01:00
Andrei Gherzan 0231336247 chrpath.bbclass: Normalize rpath only of it doesn't contain ORIGIN variable
If we normalize a rpath which contains ORIGIN variable, the binary will end
up without those rpaths at all. So check first if rpath contains ORIGIN variable
and if not, move on and normalize it.

(From OE-Core rev: 46dc514ff5a3d2693546cf95c5481e0539c43580)

Signed-off-by: Andrei Gherzan <andrei.gherzan@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-12-14 08:53:41 +00:00
Saul Wold 8669fec353 chrpath: normalize the paths
By normalizing the paths the path comparing code works correct
to generate the right RPATH even when there is a A/../A in TMPDIR

[YOCTO #3408]

(From OE-Core rev: 50327f2bba9f479dd209cdc54646b9d551e84c59)

Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-12-13 16:54:31 +00:00
Khem Raj 650227eea3 chrpath.bbclass: Account for case when ORIGIN is in RPATH
This fixes a case when RPATH embedded in program have one of
its path already relative to ORIGIN. We were losing that path
if such a path existed. This patch appends it to the new edited
rpath being created when we see it.

so RPATH like below

(RPATH)              Library rpath:
[$ORIGIN/../lib/amd64/jli:$ORIGIN/../jre/lib/amd64/jli]

would end up being empty

but after this patch its kept intact

(From OE-Core rev: 43600df0d4efc976a9451163dd334b4763937932)

Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-08-17 17:45:12 +01:00
Richard Purdie b0b92d7916 chrpath.bbclass: Ensure we only process tmpdir in paths which actually contain that path
Without this change, a path to "/lib/xxx" or "/usr/lib/xxx" would also
attempt to be remapped to be relative to $ORIGIN which makes no sense.

(From OE-Core rev: 73e2c12534856f14c1a94fb51874e9ba1655f07b)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-08-17 17:45:12 +01:00
Paul Eggleton 62f1ccbbbd classes/chrpath: improve chrpath failure handling
When chrpath fails, prefix the error message with the name of the recipe
that is being processed, and include the the output from chrpath, as
well as making the calling task actually fail.

(From OE-Core rev: 99815eddd4e1eb5d939831704231537dd5a995ad)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-08-17 15:25:13 +01:00
Paul Eggleton 70b874019c classes/chrpath: trigger an error if chrpath fails
If chrpath failed here we were just silently ignoring it.

(From OE-Core rev: 24babf9316da50c8a4d2f328c4336cb8cd6cf667)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-08-15 17:51:10 +01:00
Laurentiu Palcu 476ced15c2 relocatable.bbclass: split it up, to reuse code
Most of the code in relocatable.bbclass will be used for relocating the
SDK binaries. So, create another class chrpath.bbclass that will contain
the core of the relocatable.bbclass, so we can reuse it.

(From OE-Core rev: b50677b1641b201fd69942fd82a360907338234d)

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-08-02 15:28:39 +01:00