summaryrefslogtreecommitdiff
path: root/meta
diff options
context:
space:
mode:
authorRichard Purdie <richard@openedhand.com>2008-08-18 08:01:41 +0000
committerRichard Purdie <richard@openedhand.com>2008-08-18 08:01:41 +0000
commitded39e22cde334c31f56ea1603942327b3cf0614 (patch)
treee803b9d883e1ba67c94c9e4c035e63d0aa536558 /meta
parentc87b3a87aa143eb2166da910b8553742617339a9 (diff)
downloadopenembedded-core-ded39e22cde334c31f56ea1603942327b3cf0614.tar.gz
openembedded-core-ded39e22cde334c31f56ea1603942327b3cf0614.tar.bz2
openembedded-core-ded39e22cde334c31f56ea1603942327b3cf0614.zip
package_rpm.bbclass: Update against recent packaging changes and start to implement dependency handling. Drop pointless rpm_core class.
git-svn-id: https://svn.o-hand.com/repos/poky/trunk@5067 311d38ba-8fff-0310-9ca6-ca027cbcb966
Diffstat (limited to 'meta')
-rw-r--r--meta/classes/package_rpm.bbclass82
-rw-r--r--meta/classes/rpm_core.bbclass16
2 files changed, 59 insertions, 39 deletions
diff --git a/meta/classes/package_rpm.bbclass b/meta/classes/package_rpm.bbclass
index 6713f8fcad..ac6ac2ca54 100644
--- a/meta/classes/package_rpm.bbclass
+++ b/meta/classes/package_rpm.bbclass
@@ -1,9 +1,16 @@
inherit package
-inherit rpm_core
+
+#IMAGE_PKGTYPE ?= "rpm"
RPMBUILD="rpmbuild --short-circuit ${RPMOPTS}"
IMAGE_PKGTYPE ?= "rpm"
+RPMBUILDPATH="${WORKDIR}/rpm"
+
+RPMOPTS="--rcfile=${WORKDIR}/rpmrc"
+RPMOPTS="--rcfile=${WORKDIR}/rpmrc --target ${TARGET_SYS}"
+RPM="rpm ${RPMOPTS}"
+
python write_specfile() {
from bb import data, build
import sys
@@ -57,7 +64,13 @@ python write_specfile() {
for var in out_vartranslate.keys():
if out_vartranslate[var][0] == "%":
continue
- fd.write("%s\t: %s\n" % (out_vartranslate[var], bb.data.getVar(var, d)))
+ val = bb.data.getVar(var, d, 1)
+ if var == "RDEPENDS":
+ val = val.split()[0]
+ fd.write("%s\t: %s\n" % (out_vartranslate[var], val))
+ rdepends = " ".join(bb.utils.explode_deps(bb.data.getVar('RDEPENDS', d, True)))
+ if rdepends:
+ fd.write("Requires: %s\n" % rdepends)
fd.write("Summary\t: .\n")
for var in out_vartranslate.keys():
@@ -74,6 +87,8 @@ python write_specfile() {
# call out rpm -bb on the .spec, thereby creating an rpm
+ bb.note(bb.data.expand("${RPMBUILD} -bb ${OUTSPECFILE}", d))
+
bb.data.setVar('BUILDSPEC', "${RPMBUILD} -bb ${OUTSPECFILE}\n", d)
bb.data.setVarFlag('BUILDSPEC', 'func', '1', d)
bb.build.exec_func('BUILDSPEC', d)
@@ -84,51 +99,69 @@ python write_specfile() {
bb.movefile(rpm, outrpm)
}
+
+rpm_prep() {
+ if [ ! -e ${WORKDIR}/rpmrc ]; then
+ mkdir -p ${RPMBUILDPATH}/{SPECS,RPMS/{i386,i586,i686,noarch,ppc,mips,mipsel,arm},SRPMS,SOURCES,BUILD}
+ echo 'macrofiles:/usr/lib/rpm/macros:${WORKDIR}/macros' > ${WORKDIR}/rpmrc
+ echo '%_topdir ${RPMBUILDPATH}' > ${WORKDIR}/macros
+ echo '%_repackage_dir ${WORKDIR}' >> ${WORKDIR}/macros
+ fi
+}
+
python do_package_rpm () {
- workdir = bb.data.getVar('WORKDIR', d)
+ workdir = bb.data.getVar('WORKDIR', d, 1)
if not workdir:
- raise bb.build.FuncFailed("WORKDIR not defined")
- workdir = bb.data.expand(workdir, d)
+ bb.error("WORKDIR not defined, unable to package")
+ return
import os # path manipulations
- outdir = bb.data.getVar('DEPLOY_DIR_RPM', d)
+ outdir = bb.data.getVar('DEPLOY_DIR_RPM', d, 1)
if not outdir:
- raise bb.build.FuncFailed("DEPLOY_DIR_RPM not defined")
- outdir = bb.data.expand(outdir, d)
+ bb.error("DEPLOY_DIR_RPM not defined, unable to package")
+ return
bb.mkdirhier(outdir)
- packages = bb.data.getVar('PACKAGES', d)
+ packages = bb.data.getVar('PACKAGES', d, 1)
if not packages:
- packages = "${PN}"
- bb.data.setVar('FILES', '', d)
- ddir = bb.data.expand(bb.data.getVar('D', d), d)
- bb.mkdirhier(ddir)
- bb.data.setVar(bb.data.expand('FILES_${PN}', d), ''.join([ "./%s" % x for x in os.listdir(ddir)]), d)
- packages = bb.data.expand(packages, d)
+ bb.debug(1, "PACKAGES not defined, nothing to package")
+ return
+
+ if packages == []:
+ bb.debug(1, "No packages; nothing to do")
+ return
+
+ # If "rpm" comes into overrides the presence of this function causes problems.
+ # Since we don't need it, remove it for now - hacky.
+ bb.data.delVar("do_package_write_rpm", d)
for pkg in packages.split():
localdata = bb.data.createCopy(d)
- root = "%s/install/%s" % (workdir, pkg)
+ pkgdest = bb.data.getVar('PKGDEST', d, 1)
+ root = "%s/%s" % (pkgdest, pkg)
+
+ lf = bb.utils.lockfile(root + ".lock")
bb.data.setVar('ROOT', '', localdata)
bb.data.setVar('ROOT_%s' % pkg, root, localdata)
- bb.data.setVar('PKG', pkg, localdata)
+ pkgname = bb.data.getVar('PKG_%s' % pkg, localdata, 1)
+ if not pkgname:
+ pkgname = pkg
+ bb.data.setVar('PKG', pkgname, localdata)
overrides = bb.data.getVar('OVERRIDES', localdata)
if not overrides:
raise bb.build.FuncFailed('OVERRIDES not defined')
overrides = bb.data.expand(overrides, localdata)
- bb.data.setVar('OVERRIDES', '%s:%s' % (overrides, pkg), localdata)
+ bb.data.setVar('OVERRIDES', overrides + ':' + pkg, localdata)
bb.data.update_data(localdata)
-
- root = bb.data.getVar('ROOT', localdata)
- basedir = os.path.dirname(root)
+ basedir = os.path.join(os.path.dirname(root))
pkgoutdir = outdir
bb.mkdirhier(pkgoutdir)
bb.data.setVar('OUTSPECFILE', os.path.join(workdir, "%s.spec" % pkg), localdata)
bb.build.exec_func('write_specfile', localdata)
- del localdata
+ bb.utils.unlockfile(lf)
}
python () {
@@ -143,7 +176,10 @@ python () {
python do_package_write_rpm () {
bb.build.exec_func("read_subpackage_metadata", d)
+ bb.build.exec_func("rpm_prep", d)
bb.build.exec_func("do_package_rpm", d)
}
+
do_package_write_rpm[dirs] = "${D}"
-addtask package_write_rpm before do_build after do_package
+addtask package_write_rpm before do_package_write after do_package
+
diff --git a/meta/classes/rpm_core.bbclass b/meta/classes/rpm_core.bbclass
deleted file mode 100644
index f28abbb1c3..0000000000
--- a/meta/classes/rpm_core.bbclass
+++ /dev/null
@@ -1,16 +0,0 @@
-RPMBUILDPATH="${WORKDIR}/rpm"
-
-RPMOPTS="--rcfile=${WORKDIR}/rpmrc"
-RPMOPTS="--rcfile=${WORKDIR}/rpmrc --target ${TARGET_SYS}"
-RPM="rpm ${RPMOPTS}"
-RPMBUILD="rpmbuild --buildroot ${D} --short-circuit ${RPMOPTS}"
-
-rpm_core_do_preprpm() {
- mkdir -p ${RPMBUILDPATH}/{SPECS,RPMS/{i386,i586,i686,noarch,ppc,mips,mipsel,arm},SRPMS,SOURCES,BUILD}
- echo 'macrofiles:/usr/lib/rpm/macros:${WORKDIR}/macros' > ${WORKDIR}/rpmrc
- echo '%_topdir ${RPMBUILDPATH}' > ${WORKDIR}/macros
- echo '%_repackage_dir ${WORKDIR}' >> ${WORKDIR}/macros
-}
-
-EXPORT_FUNCTIONS do_preprpm
-addtask preprpm before do_fetch