[OE-core] [PATCH 27/36] package_rpm.bbclass: prevent rpm from using sysroot paths that it was originally compiled with
Alexander Kanavin
alexander.kanavin at linux.intel.com
Mon Feb 13 15:05:57 UTC 2017
Signed-off-by: Alexander Kanavin <alexander.kanavin at linux.intel.com>
---
meta/classes/package_rpm.bbclass | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/meta/classes/package_rpm.bbclass b/meta/classes/package_rpm.bbclass
index 1bf155a92ea..a972f0bb7d5 100644
--- a/meta/classes/package_rpm.bbclass
+++ b/meta/classes/package_rpm.bbclass
@@ -699,6 +699,14 @@ python do_package_rpm () {
bb.utils.mkdirhier(pkgwritedir)
os.chmod(pkgwritedir, 0o755)
+ # Direct rpm-native to read configuration from our sysroot, not the one it was compiled in
+ # libmagic also has sysroot path contamination, so override it
+ export_cmd = """
+export RPM_CONFIGDIR=%s
+export RPM_ETCCONFIGDIR=%s
+export MAGIC=%s
+""" %(oe.path.join(d.getVar('STAGING_LIBDIR_NATIVE'), "rpm"),d.getVar('STAGING_DIR_NATIVE'), magicfile)
+
cmd = rpmbuild
cmd = cmd + " --nodeps --short-circuit --target " + pkgarch + " --buildroot " + pkgd
cmd = cmd + " --define '_topdir " + workdir + "' --define '_rpmdir " + pkgwritedir + "'"
@@ -713,20 +721,19 @@ python do_package_rpm () {
cmd = cmd + " --define '__find_provides %{nil}'"
cmd = cmd + " --define '_unpackaged_files_terminate_build 0'"
cmd = cmd + " --define 'debug_package %{nil}'"
- cmd = cmd + " --define '_rpmfc_magic_path " + magicfile + "'"
cmd = cmd + " --define '_tmppath " + workdir + "'"
if d.getVarFlag('ARCHIVER_MODE', 'srpm') == '1' and bb.data.inherits_class('archiver', d):
cmd = cmd + " --define '_sourcedir " + d.getVar('ARCHIVER_OUTDIR') + "'"
cmdsrpm = cmd + " --define '_srcrpmdir " + d.getVar('ARCHIVER_OUTDIR') + "'"
cmdsrpm = cmdsrpm + " -bs " + outspecfile
# Build the .src.rpm
- d.setVar('SBUILDSPEC', cmdsrpm + "\n")
+ d.setVar('SBUILDSPEC', export_cmd + "\n"+ cmdsrpm + "\n")
d.setVarFlag('SBUILDSPEC', 'func', '1')
bb.build.exec_func('SBUILDSPEC', d)
cmd = cmd + " -bb " + outspecfile
# Build the rpm package!
- d.setVar('BUILDSPEC', cmd + "\n")
+ d.setVar('BUILDSPEC', export_cmd + "\n" + cmd + "\n")
d.setVarFlag('BUILDSPEC', 'func', '1')
bb.build.exec_func('BUILDSPEC', d)
--
2.11.0
More information about the Openembedded-core
mailing list