package_rpm.bbclass: instruct rpm to not remove the buildroot directory

This is the ${W}/package directory which may be reused in subsequent builds.

Also clean up various default directories rpm 4 creates.

(From OE-Core rev: bdebe0d50a210438730ee7797968eafe169ded23)

Signed-off-by: Alexander Kanavin <alexander.kanavin@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Alexander Kanavin 2017-02-02 15:20:41 +02:00 committed by Richard Purdie
parent ea4bac7e45
commit d94b98fe30
1 changed files with 5 additions and 2 deletions

View File

@ -697,7 +697,7 @@ python do_package_rpm () {
os.chmod(pkgwritedir, 0o755)
cmd = rpmbuild
cmd = cmd + " --nodeps --short-circuit --target " + pkgarch + " --buildroot " + pkgd
cmd = cmd + " --noclean --nodeps --short-circuit --target " + pkgarch + " --buildroot " + pkgd
cmd = cmd + " --define '_topdir " + workdir + "' --define '_rpmdir " + pkgwritedir + "'"
cmd = cmd + " --define '_builddir " + d.getVar('S') + "'"
cmd = cmd + " --define '_build_name_fmt %%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm'"
@ -721,8 +721,11 @@ python do_package_rpm () {
bb.build.exec_func('SBUILDSPEC', d)
cmd = cmd + " -bb " + outspecfile
# rpm 4 creates various empty directories in _topdir, let's clean them up
cleanupcmd = "rm -rf %s/BUILDROOT %s/SOURCES %s/SPECS %s/SRPMS" % (workdir, workdir, workdir, workdir)
# Build the rpm package!
d.setVar('BUILDSPEC', cmd + "\n")
d.setVar('BUILDSPEC', cmd + "\n" + cleanupcmd + "\n")
d.setVarFlag('BUILDSPEC', 'func', '1')
bb.build.exec_func('BUILDSPEC', d)