diff options
author | Richard Purdie <rpurdie@linux.intel.com> | 2009-10-29 23:41:24 +0000 |
---|---|---|
committer | Richard Purdie <rpurdie@linux.intel.com> | 2009-11-13 12:15:22 +0000 |
commit | 4f4a3da8432e31e6d5cec376155999fcc5f3e2bc (patch) | |
tree | ed4e744e8f829ad645d8c4cd2199800895aee694 | |
parent | 764f73a033b6686a50dff71881e2491f9e990c87 (diff) | |
download | openembedded-core-4f4a3da8432e31e6d5cec376155999fcc5f3e2bc.tar.gz openembedded-core-4f4a3da8432e31e6d5cec376155999fcc5f3e2bc.tar.bz2 openembedded-core-4f4a3da8432e31e6d5cec376155999fcc5f3e2bc.zip |
package.bbclass: Move variable checks to one place making the code more readable
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
-rw-r--r-- | meta/classes/package.bbclass | 52 |
1 files changed, 14 insertions, 38 deletions
diff --git a/meta/classes/package.bbclass b/meta/classes/package.bbclass index 523d7aeaee..ca23cc6472 100644 --- a/meta/classes/package.bbclass +++ b/meta/classes/package.bbclass @@ -31,9 +31,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() @@ -242,14 +239,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') @@ -293,32 +283,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) @@ -557,9 +532,6 @@ python package_do_shlibs() { targetos = bb.data.getVar('TARGET_OS', 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: @@ -765,12 +737,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) @@ -1009,6 +976,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) } |