summaryrefslogtreecommitdiff
path: root/classes
diff options
context:
space:
mode:
authorRichard Purdie <rpurdie@rpsys.net>2007-09-01 23:40:47 +0000
committerRichard Purdie <rpurdie@rpsys.net>2007-09-01 23:40:47 +0000
commit60ee4a5f135a084051d75dc34ac8987c31703d80 (patch)
treeb573b486fb01d95f1690b031795c67ab2de90857 /classes
parent6d53edfbc3cc84c6ebf88de33fc4fa462ccce825 (diff)
package_x.bbclass: Sync with poky preparing for individual package writing tasks
Diffstat (limited to 'classes')
-rw-r--r--classes/package_deb.bbclass33
-rw-r--r--classes/package_rpm.bbclass17
-rw-r--r--classes/package_tar.bbclass14
3 files changed, 58 insertions, 6 deletions
diff --git a/classes/package_deb.bbclass b/classes/package_deb.bbclass
index c322af1f15..94db9238c2 100644
--- a/classes/package_deb.bbclass
+++ b/classes/package_deb.bbclass
@@ -64,9 +64,7 @@ python do_package_deb_install () {
}
python do_package_deb () {
- import copy # to back up env data
- import sys
- import re
+ import sys, re, fcntl, copy
workdir = bb.data.getVar('WORKDIR', d, 1)
if not workdir:
@@ -99,10 +97,21 @@ python do_package_deb () {
bb.debug(1, "No packages; nothing to do")
return
+ def lockfile(name):
+ lf = open(name, "a+")
+ fcntl.flock(lf.fileno(), fcntl.LOCK_EX)
+ return lf
+
+ def unlockfile(lf):
+ fcntl.flock(lf.fileno(), fcntl.LOCK_UN)
+ lf.close
+
for pkg in packages.split():
localdata = bb.data.createCopy(d)
root = "%s/install/%s" % (workdir, pkg)
+ lf = lockfile(root + ".lock")
+
bb.data.setVar('ROOT', '', localdata)
bb.data.setVar('ROOT_%s' % pkg, root, localdata)
pkgname = bb.data.getVar('PKG_%s' % pkg, localdata, 1)
@@ -133,6 +142,7 @@ python do_package_deb () {
if not g and bb.data.getVar('ALLOW_EMPTY', localdata) != "1":
from bb import note
note("Not creating empty archive for %s-%s-%s" % (pkg, bb.data.getVar('PV', localdata, 1), bb.data.getVar('PR', localdata, 1)))
+ unlockfile(lf)
continue
controldir = os.path.join(root, 'DEBIAN')
bb.mkdirhier(controldir)
@@ -246,5 +256,20 @@ python do_package_deb () {
os.rmdir(controldir)
except OSError:
pass
- del localdata
+
+ unlockfile(lf)
}
+
+python () {
+ import bb
+ if bb.data.getVar('PACKAGES', d, True) != '':
+ bb.data.setVarFlag('do_package_write_deb', 'depends', 'dpkg-native:do_populate_staging fakeroot-native:do_populate_staging', d)
+}
+
+python do_package_write_deb () {
+ bb.build.exec_func("read_subpackage_metadata", d)
+ bb.build.exec_func("do_package_deb", d)
+}
+do_package_write_deb[dirs] = "${D}"
+#addtask package_write_deb before do_package_write after do_package
+
diff --git a/classes/package_rpm.bbclass b/classes/package_rpm.bbclass
index 4955792916..bd4a0c2798 100644
--- a/classes/package_rpm.bbclass
+++ b/classes/package_rpm.bbclass
@@ -54,7 +54,6 @@ python write_specfile() {
except OSError:
raise bb.build.FuncFailed("unable to open spec file for writing.")
-# fd = sys.__stdout__
fd = specfile
for var in out_vartranslate.keys():
if out_vartranslate[var][0] == "%":
@@ -123,7 +122,7 @@ python do_package_rpm () {
bb.data.setVar('OVERRIDES', '%s:%s' % (overrides, pkg), localdata)
bb.data.update_data(localdata)
-# stuff
+
root = bb.data.getVar('ROOT', localdata)
basedir = os.path.dirname(root)
pkgoutdir = outdir
@@ -132,3 +131,17 @@ python do_package_rpm () {
bb.build.exec_func('write_specfile', localdata)
del localdata
}
+
+python () {
+ import bb
+ if bb.data.getVar('PACKAGES', d, True) != '':
+ bb.data.setVarFlag('do_package_write_rpm', 'depends', 'rpm-native:do_populate_staging', d)
+}
+
+
+python do_package_write_rpm () {
+ bb.build.exec_func("read_subpackage_metadata", 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
diff --git a/classes/package_tar.bbclass b/classes/package_tar.bbclass
index ced7400ac8..a56f2e2b00 100644
--- a/classes/package_tar.bbclass
+++ b/classes/package_tar.bbclass
@@ -98,3 +98,17 @@ python do_package_tar () {
if ret != 0:
bb.error("Creation of tar %s failed." % tarfn)
}
+
+python () {
+ import bb
+ if bb.data.getVar('PACKAGES', d, True) != '':
+ bb.data.setVarFlag('do_package_write_tar', 'depends', 'tar-native:do_populate_staging', d)
+}
+
+
+python do_package_write_tar () {
+ bb.build.exec_func("read_subpackage_metadata", d)
+ bb.build.exec_func("do_package_tar", d)
+}
+do_package_write_tar[dirs] = "${D}"
+#addtask package_write_tar before do_build after do_package