summaryrefslogtreecommitdiff
path: root/classes/package.bbclass
diff options
context:
space:
mode:
Diffstat (limited to 'classes/package.bbclass')
-rw-r--r--classes/package.bbclass81
1 files changed, 36 insertions, 45 deletions
diff --git a/classes/package.bbclass b/classes/package.bbclass
index e7865754eb..1c14908f1a 100644
--- a/classes/package.bbclass
+++ b/classes/package.bbclass
@@ -2,7 +2,8 @@
# General packaging help functions
#
-PKGDEST = "${WORKDIR}/install"
+PKGD = "${WORKDIR}/package"
+PKGDEST = "${WORKDIR}/packages-split"
def legitimize_package_name(s):
"""
@@ -28,10 +29,7 @@ def do_split_packages(d, root, file_regex, output_pattern, description, postinst
"""
import os, os.path, bb
- dvar = bb.data.getVar('D', d, True)
- if not dvar:
- bb.error("D not defined")
- return
+ dvar = bb.data.getVar('PKGD', d, True)
packages = bb.data.getVar('PACKAGES', d, True).split()
@@ -302,15 +300,8 @@ python package_do_split_locales() {
bb.note("datadir not defined")
return
- dvar = bb.data.getVar('D', d, True)
- if not dvar:
- bb.error("D not defined")
- return
-
+ dvar = bb.data.getVar('PKGD', d, True)
pn = bb.data.getVar('PN', d, True)
- if not pn:
- bb.error("PN not defined")
- return
if pn + '-locale' in packages:
packages.remove(pn + '-locale')
@@ -343,34 +334,29 @@ python package_do_split_locales() {
bb.data.setVar('PACKAGES', ' '.join(packages), d)
}
-python populate_packages () {
- import glob, stat, errno, re
+python perform_packagecopy () {
+ import os
- workdir = bb.data.getVar('WORKDIR', d, True)
- if not workdir:
- bb.error("WORKDIR not defined, unable to package")
- return
+ dest = bb.data.getVar('D', d, True)
+ dvar = bb.data.getVar('PKGD', d, True)
- import os # path manipulations
- outdir = bb.data.getVar('DEPLOY_DIR', d, True)
- if not outdir:
- bb.error("DEPLOY_DIR not defined, unable to package")
- return
- bb.mkdirhier(outdir)
-
- dvar = bb.data.getVar('D', d, True)
- if not dvar:
- bb.error("D not defined, unable to package")
- return
bb.mkdirhier(dvar)
- packages = bb.data.getVar('PACKAGES', d, True)
+ # Start by package population by taking a copy of the installed
+ # files to operate on
+ os.system('cp -pPR %s/* %s/' % (dest, dvar))
+}
+
+python populate_packages () {
+ import os, glob, stat, errno, re
+ workdir = bb.data.getVar('WORKDIR', d, True)
+ outdir = bb.data.getVar('DEPLOY_DIR', d, True)
+ dvar = bb.data.getVar('PKGD', d, True)
+ packages = bb.data.getVar('PACKAGES', d, True)
pn = bb.data.getVar('PN', d, True)
- if not pn:
- bb.error("PN not defined")
- return
+ bb.mkdirhier(outdir)
os.chdir(dvar)
def isexec(path):
@@ -542,6 +528,7 @@ python emit_pkgdata() {
return
packages = bb.data.getVar('PACKAGES', d, True)
+ pkgdest = bb.data.getVar('PKGDEST', d, 1)
pkgdatadir = bb.data.getVar('PKGDATA_DIR', d, True)
pstageactive = bb.data.getVar('PSTAGING_ACTIVE', d, True)
@@ -585,7 +572,7 @@ python emit_pkgdata() {
allow_empty = bb.data.getVar('ALLOW_EMPTY_%s' % pkg, d, True)
if not allow_empty:
allow_empty = bb.data.getVar('ALLOW_EMPTY', d, True)
- root = "%s/install/%s" % (workdir, pkg)
+ root = "%s/%s" % (pkgdest, pkg)
os.chdir(root)
g = glob('*') + glob('.[!.]*')
if g or allow_empty == "1":
@@ -621,9 +608,6 @@ python package_do_shlibs() {
packages = bb.data.getVar('PACKAGES', d, True)
workdir = bb.data.getVar('WORKDIR', d, True)
- if not workdir:
- bb.error("WORKDIR not defined")
- return
ver = bb.data.getVar('PV', d, True)
if not ver:
@@ -787,12 +771,7 @@ python package_do_pkgconfig () {
import re, os
packages = bb.data.getVar('PACKAGES', d, True)
-
workdir = bb.data.getVar('WORKDIR', d, True)
- if not workdir:
- bb.error("WORKDIR not defined")
- return
-
pkgdest = bb.data.getVar('PKGDEST', d, True)
shlibs_dir = bb.data.getVar('SHLIBSDIR', d, True)
@@ -1012,8 +991,10 @@ python package_depchains() {
pkg_addrrecs(pkg, base, suffix, func, rdeps, d)
}
-
-PACKAGEFUNCS ?= "package_do_split_locales \
+PACKAGE_PREPROCESS_FUNCS ?= ""
+PACKAGEFUNCS ?= "perform_packagecopy \
+ ${PACKAGE_PREPROCESS_FUNCS} \
+ package_do_split_locales \
populate_packages \
package_do_shlibs \
package_do_pkgconfig \
@@ -1059,6 +1040,16 @@ python package_do_package () {
bb.debug(1, "No packages to build, skipping do_package")
return
+ workdir = bb.data.getVar('WORKDIR', d, True)
+ outdir = bb.data.getVar('DEPLOY_DIR', d, True)
+ dest = bb.data.getVar('D', d, True)
+ dvar = bb.data.getVar('PKGD', d, True)
+ pn = bb.data.getVar('PN', d, True)
+
+ if not workdir or not outdir or not dest or not dvar or not pn or not packages:
+ bb.error("WORKDIR, DEPLOY_DIR, D, PN and PKGD all must be defined, unable to package")
+ return
+
for f in (bb.data.getVar('PACKAGEFUNCS', d, True) or '').split():
bb.build.exec_func(f, d)
package_run_hooks(f, d)