summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Purdie <rpurdie@rpsys.net>2008-03-14 11:34:44 +0000
committerRichard Purdie <rpurdie@rpsys.net>2008-03-14 11:34:44 +0000
commit91ec5f43eb68a3bfca7161d9a6929453659dce9d (patch)
tree089744d525de0f426ca180c5ed45036cddc2eb11
parent9a0832d23c63e25e2b26f3fbc12119ba537450a7 (diff)
package.bbclass: Add in hooks for packaged staging in the shlibs and pkgconfig code.
-rw-r--r--classes/package.bbclass52
1 files changed, 47 insertions, 5 deletions
diff --git a/classes/package.bbclass b/classes/package.bbclass
index 325c0b52f5..f9d9193c32 100644
--- a/classes/package.bbclass
+++ b/classes/package.bbclass
@@ -459,6 +459,18 @@ python populate_packages () {
}
populate_packages[dirs] = "${D}"
+def package_stagefile(file, d):
+ import bb, os
+
+ pstageactive = bb.data.getVar('PSTAGING_ACTIVE', d, True)
+
+ if pstageactive == "1":
+ destfile = file.replace(bb.data.getVar("TMPDIR", d, 1), bb.data.getVar("PSTAGE_TMPDIR_STAGE", d, 1))
+ bb.mkdirhier(os.path.dirname(destfile))
+ #print "%s to %s" % (file, destfile)
+ bb.copyfile(file, destfile)
+
+
python emit_pkgdata() {
from glob import glob
@@ -472,24 +484,29 @@ python emit_pkgdata() {
if val:
f.write('%s_%s: %s\n' % (var, pkg, encode(val)))
- packages = bb.data.getVar('PACKAGES', d, 1)
+ packages = bb.data.getVar('PACKAGES', d, True)
+ pkgdatadir = bb.data.getVar('PKGDATA_DIR', d, True)
+
+ pstageactive = bb.data.getVar('PSTAGING_ACTIVE', d, True)
+ if pstageactive == "1":
+ lf = bb.utils.lockfile(bb.data.expand("${STAGING_DIR}/staging.lock", d))
- data_file = bb.data.expand("${PKGDATA_DIR}/${PN}", d)
+ data_file = pkgdatadir + bb.data.expand("/${PN}" , d)
f = open(data_file, 'w')
f.write("PACKAGES: %s\n" % packages)
f.close()
+ package_stagefile(data_file, d)
workdir = bb.data.getVar('WORKDIR', d, 1)
for pkg in packages.split():
- subdata_file = bb.data.expand("${PKGDATA_DIR}/runtime/%s" % pkg, d)
+ subdata_file = pkgdatadir + "/runtime/%s" % pkg
sf = open(subdata_file, 'w')
write_if_exists(sf, pkg, 'DESCRIPTION')
write_if_exists(sf, pkg, 'RDEPENDS')
write_if_exists(sf, pkg, 'RPROVIDES')
write_if_exists(sf, pkg, 'RRECOMMENDS')
write_if_exists(sf, pkg, 'RSUGGESTS')
- write_if_exists(sf, pkg, 'RPROVIDES')
write_if_exists(sf, pkg, 'RREPLACES')
write_if_exists(sf, pkg, 'RCONFLICTS')
write_if_exists(sf, pkg, 'PKG')
@@ -501,6 +518,10 @@ python emit_pkgdata() {
write_if_exists(sf, pkg, 'pkg_prerm')
sf.close()
+ package_stagefile(subdata_file, d)
+ #if pkgdatadir2:
+ # bb.copyfile(subdata_file, pkgdatadir2 + "/runtime/%s" % pkg)
+
allow_empty = bb.data.getVar('ALLOW_EMPTY_%s' % pkg, d, 1)
if not allow_empty:
allow_empty = bb.data.getVar('ALLOW_EMPTY', d, 1)
@@ -508,8 +529,11 @@ python emit_pkgdata() {
os.chdir(root)
g = glob('*')
if g or allow_empty == "1":
- packagedfile = bb.data.expand('${PKGDATA_DIR}/runtime/%s.packaged' % pkg, d)
+ packagedfile = pkgdatadir + '/runtime/%s.packaged' % pkg
file(packagedfile, 'w').close()
+ package_stagefile(packagedfile, d)
+ if pstageactive == "1":
+ bb.utils.unlockfile(lf)
}
emit_pkgdata[dirs] = "${PKGDATA_DIR}/runtime"
@@ -549,6 +573,10 @@ python package_do_shlibs() {
shlibs_dir = bb.data.getVar('SHLIBSDIR', d, 1)
bb.mkdirhier(shlibs_dir)
+ pstageactive = bb.data.getVar('PSTAGING_ACTIVE', d, True)
+ if pstageactive == "1":
+ lf = bb.utils.lockfile(bb.data.expand("${STAGING_DIR}/staging.lock", d))
+
needed = {}
private_libs = bb.data.getVar('PRIVATE_LIBS', d, 1)
for pkg in packages.split():
@@ -590,9 +618,11 @@ python package_do_shlibs() {
for s in sonames:
fd.write(s + '\n')
fd.close()
+ package_stagefile(shlibs_file, d)
fd = open(shver_file, 'w')
fd.write(ver + '\n')
fd.close()
+ package_stagefile(shver_file, d)
if needs_ldconfig:
bb.debug(1, 'adding ldconfig call to postinst for %s' % pkg)
postinst = bb.data.getVar('pkg_postinst_%s' % pkg, d, 1) or bb.data.getVar('pkg_postinst', d, 1)
@@ -601,6 +631,9 @@ python package_do_shlibs() {
postinst += bb.data.getVar('ldconfig_postinst_fragment', d, 1)
bb.data.setVar('pkg_postinst_%s' % pkg, postinst, d)
+ if pstageactive == "1":
+ bb.utils.unlockfile(lf)
+
shlib_provider = {}
list_re = re.compile('^(.*)\.list$')
for dir in [shlibs_dir]:
@@ -715,6 +748,10 @@ python package_do_pkgconfig () {
if hdr == 'Requires':
pkgconfig_needed[pkg] += exp.replace(',', ' ').split()
+ pstageactive = bb.data.getVar('PSTAGING_ACTIVE', d, True)
+ if pstageactive == "1":
+ lf = bb.utils.lockfile(bb.data.expand("${STAGING_DIR}/staging.lock", d))
+
for pkg in packages.split():
pkgs_file = os.path.join(shlibs_dir, pkg + ".pclist")
if os.path.exists(pkgs_file):
@@ -724,6 +761,7 @@ python package_do_pkgconfig () {
for p in pkgconfig_provided[pkg]:
f.write('%s\n' % p)
f.close()
+ package_stagefile(pkgs_file, d)
for dir in [shlibs_dir]:
if not os.path.exists(dir):
@@ -758,6 +796,10 @@ python package_do_pkgconfig () {
for dep in deps:
fd.write(dep + '\n')
fd.close()
+ package_stagefile(deps_file, d)
+
+ if pstageactive == "1":
+ bb.utils.unlockfile(lf)
}
python read_shlibdeps () {