summaryrefslogtreecommitdiff
path: root/classes
diff options
context:
space:
mode:
authorRichard Purdie <rpurdie@linux.intel.com>2009-10-29 23:39:34 +0000
committerRichard Purdie <rpurdie@linux.intel.com>2009-11-09 12:32:20 +0000
commit353ba77e54bdd3d2af60e31590860b4a1e0b76a6 (patch)
tree83f1c6b4ea81b2423776d7a84987c6fdd601419b /classes
parent9a5937f6c6417ba8fd3464f03c69782d29813bbc (diff)
package.bbclass: Move variable checks to one place making the code more readable (from Poky)
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
Diffstat (limited to 'classes')
-rw-r--r--classes/package.bbclass52
1 files changed, 14 insertions, 38 deletions
diff --git a/classes/package.bbclass b/classes/package.bbclass
index e7865754eb..f4a881ab57 100644
--- a/classes/package.bbclass
+++ b/classes/package.bbclass
@@ -29,9 +29,6 @@ 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
packages = bb.data.getVar('PACKAGES', d, True).split()
@@ -303,14 +300,7 @@ python package_do_split_locales() {
return
dvar = bb.data.getVar('D', d, True)
- if not dvar:
- bb.error("D not defined")
- return
-
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')
@@ -344,32 +334,17 @@ python package_do_split_locales() {
}
python populate_packages () {
- import glob, stat, errno, re
+ import os, glob, stat, errno, re
workdir = bb.data.getVar('WORKDIR', d, True)
- if not workdir:
- bb.error("WORKDIR not defined, unable to package")
- return
-
- 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)
-
pn = bb.data.getVar('PN', d, True)
- if not pn:
- bb.error("PN not defined")
- return
+
+ bb.mkdirhier(outdir)
+ bb.mkdirhier(dvar)
+
os.chdir(dvar)
@@ -621,9 +596,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 +759,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)
@@ -1059,6 +1026,15 @@ 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)
+ dvar = bb.data.getVar('D', d, True)
+ pn = bb.data.getVar('PN', d, True)
+
+ if not workdir or not outdir or not dvar or not pn or not packages:
+ bb.error("WORKDIR, DEPLOY_DIR, D, and PN 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)