From 035dab3a2edcb3698b44e64d44b6eecfbc0fb77c Mon Sep 17 00:00:00 2001 From: Denys Dmytriyenko Date: Sat, 19 Sep 2009 20:33:00 +0000 Subject: package.bbclass: export subpackage individual version, if different from main Fixes the wrong versioned runtime dependency for shlib subpackages with own versions. Consider this: PACKAGES = "libfoo libbar" PV_libfoo = "1" PV_libbar = "2" PV = "3" That will generate libfoo_1 and libbar_2 packages, but version 3 will be exported in shlibs database, leading to the following versioned runtime dependencies: RDEPENDS: libfoo (>=3) libbar (>=3) This fixes the problem. Signed-off-by: Denys Dmytriyenko Acked-by: Koen Kooi --- classes/package.bbclass | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'classes/package.bbclass') diff --git a/classes/package.bbclass b/classes/package.bbclass index 0cba1260d8..046351a415 100644 --- a/classes/package.bbclass +++ b/classes/package.bbclass @@ -652,6 +652,10 @@ python package_do_shlibs() { needs_ldconfig = False bb.debug(2, "calculating shlib provides for %s" % pkg) + pkgver = bb.data.getVar('PV_' + pkg, d, 1) + if not pkgver: + pkgver = ver + needed[pkg] = [] sonames = list() top = os.path.join(pkgdest, pkg) @@ -696,7 +700,7 @@ python package_do_shlibs() { fd.close() package_stagefile(shlibs_file, d) fd = open(shver_file, 'w') - fd.write(ver + '\n') + fd.write(pkgver + '\n') fd.close() package_stagefile(shver_file, d) if needs_ldconfig and use_ldconfig: -- cgit v1.2.3 From 3499e5b252d8e4b118f6ea6cc406be7e8c22765a Mon Sep 17 00:00:00 2001 From: Koen Kooi Date: Fri, 23 Oct 2009 11:37:26 +0200 Subject: package bbclass: don't strip static libs so aggressively --- classes/package.bbclass | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'classes/package.bbclass') diff --git a/classes/package.bbclass b/classes/package.bbclass index 046351a415..7a9b987c7c 100644 --- a/classes/package.bbclass +++ b/classes/package.bbclass @@ -159,7 +159,7 @@ def runstrip(file, d): if ret: bb.error("runstrip: 'file %s' failed (forced strip)" % file) - if "not stripped" not in result and not file.endswith(".a"): + if "not stripped" not in result: bb.debug(1, "runstrip: skip %s" % file) return 0 @@ -183,6 +183,9 @@ def runstrip(file, d): extraflags = "--remove-section=.comment --remove-section=.note --strip-unneeded" elif "shared" in result or "executable" in result: extraflags = "--remove-section=.comment --remove-section=.note" + elif file.endswith(".a"): + extraflags = "--remove-section=.comment --strip-debug" + bb.mkdirhier(os.path.join(os.path.dirname(file), ".debug")) debugfile=os.path.join(os.path.dirname(file), ".debug", os.path.basename(file)) @@ -393,7 +396,7 @@ python populate_packages () { for root, dirs, files in os.walk(dvar): for f in files: file = os.path.join(root, f) - if not os.path.islink(file) and not os.path.isdir(file) and (isexec(file) or ".a" in file): + if not os.path.islink(file) and not os.path.isdir(file) and isexec(file): runstrip(file, d) pkgdest = bb.data.getVar('PKGDEST', d, 1) -- cgit v1.2.3 From fcee557e1b0551d1743bbb3ad61102b9ccc4cba8 Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Thu, 29 Oct 2009 23:20:57 +0000 Subject: package.bbclass: Cleanup getVar syntax to use True, not 1 as third argument (from Poky) Signed-off-by: Richard Purdie --- classes/package.bbclass | 120 ++++++++++++++++++++++++------------------------ 1 file changed, 60 insertions(+), 60 deletions(-) (limited to 'classes/package.bbclass') diff --git a/classes/package.bbclass b/classes/package.bbclass index 7a9b987c7c..e7865754eb 100644 --- a/classes/package.bbclass +++ b/classes/package.bbclass @@ -28,12 +28,12 @@ def do_split_packages(d, root, file_regex, output_pattern, description, postinst """ import os, os.path, bb - dvar = bb.data.getVar('D', d, 1) + dvar = bb.data.getVar('D', d, True) if not dvar: bb.error("D not defined") return - packages = bb.data.getVar('PACKAGES', d, 1).split() + packages = bb.data.getVar('PACKAGES', d, True).split() if postinst: postinst = '#!/bin/sh\n' + postinst + '\n' @@ -94,7 +94,7 @@ def do_split_packages(d, root, file_regex, output_pattern, description, postinst the_files.append(aux_files_pattern_verbatim % m.group(1)) bb.data.setVar('FILES_' + pkg, " ".join(the_files), d) if extra_depends != '': - the_depends = bb.data.getVar('RDEPENDS_' + pkg, d, 1) + the_depends = bb.data.getVar('RDEPENDS_' + pkg, d, True) if the_depends: the_depends = '%s %s' % (the_depends, extra_depends) else: @@ -106,7 +106,7 @@ def do_split_packages(d, root, file_regex, output_pattern, description, postinst if postrm: bb.data.setVar('pkg_postrm_' + pkg, postrm, d) else: - oldfiles = bb.data.getVar('FILES_' + pkg, d, 1) + oldfiles = bb.data.getVar('FILES_' + pkg, d, True) if not oldfiles: bb.fatal("Package '%s' exists but has no files" % pkg) bb.data.setVar('FILES_' + pkg, oldfiles + " " + os.path.join(root, o), d) @@ -152,7 +152,7 @@ def runstrip(file, d): import bb, os, commands, stat - pathprefix = "export PATH=%s; " % bb.data.getVar('PATH', d, 1) + pathprefix = "export PATH=%s; " % bb.data.getVar('PATH', d, True) ret, result = commands.getstatusoutput("%sfile '%s'" % (pathprefix, file)) @@ -169,8 +169,8 @@ def runstrip(file, d): bb.debug(2, "Already ran strip on %s" % file) return 0 - strip = bb.data.getVar("STRIP", d, 1) - objcopy = bb.data.getVar("OBJCOPY", d, 1) + strip = bb.data.getVar("STRIP", d, True) + objcopy = bb.data.getVar("OBJCOPY", d, True) newmode = None if not os.access(file, os.W_OK): @@ -268,10 +268,10 @@ def get_package_mapping (pkg, d): def runtime_mapping_rename (varname, d): import bb, os - #bb.note("%s before: %s" % (varname, bb.data.getVar(varname, d, 1))) + #bb.note("%s before: %s" % (varname, bb.data.getVar(varname, d, True))) new_depends = [] - for depend in explode_deps(bb.data.getVar(varname, d, 1) or ""): + for depend in explode_deps(bb.data.getVar(varname, d, True) or ""): # Have to be careful with any version component of the depend split_depend = depend.split(' (') new_depend = get_package_mapping(split_depend[0].strip(), d) @@ -282,7 +282,7 @@ def runtime_mapping_rename (varname, d): bb.data.setVar(varname, " ".join(new_depends) or None, d) - #bb.note("%s after: %s" % (varname, bb.data.getVar(varname, d, 1))) + #bb.note("%s after: %s" % (varname, bb.data.getVar(varname, d, True))) # # Package functions suitable for inclusion in PACKAGEFUNCS @@ -291,23 +291,23 @@ def runtime_mapping_rename (varname, d): python package_do_split_locales() { import os - if (bb.data.getVar('PACKAGE_NO_LOCALE', d, 1) == '1'): + if (bb.data.getVar('PACKAGE_NO_LOCALE', d, True) == '1'): bb.debug(1, "package requested not splitting locales") return - packages = (bb.data.getVar('PACKAGES', d, 1) or "").split() + packages = (bb.data.getVar('PACKAGES', d, True) or "").split() - datadir = bb.data.getVar('datadir', d, 1) + datadir = bb.data.getVar('datadir', d, True) if not datadir: bb.note("datadir not defined") return - dvar = bb.data.getVar('D', d, 1) + dvar = bb.data.getVar('D', d, True) if not dvar: bb.error("D not defined") return - pn = bb.data.getVar('PN', d, 1) + pn = bb.data.getVar('PN', d, True) if not pn: bb.error("PN not defined") return @@ -346,27 +346,27 @@ python package_do_split_locales() { python populate_packages () { import glob, stat, errno, re - workdir = bb.data.getVar('WORKDIR', d, 1) + 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, 1) + 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, 1) + 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, 1) + packages = bb.data.getVar('PACKAGES', d, True) - pn = bb.data.getVar('PN', d, 1) + pn = bb.data.getVar('PN', d, True) if not pn: bb.error("PN not defined") return @@ -392,19 +392,19 @@ python populate_packages () { else: package_list.append(pkg) - if (bb.data.getVar('INHIBIT_PACKAGE_STRIP', d, 1) != '1'): + if (bb.data.getVar('INHIBIT_PACKAGE_STRIP', d, True) != '1'): for root, dirs, files in os.walk(dvar): for f in files: file = os.path.join(root, f) if not os.path.islink(file) and not os.path.isdir(file) and isexec(file): runstrip(file, d) - pkgdest = bb.data.getVar('PKGDEST', d, 1) + pkgdest = bb.data.getVar('PKGDEST', d, True) os.system('rm -rf %s' % pkgdest) seen = [] main_is_empty = 1 - main_pkg = bb.data.getVar('PN', d, 1) + main_pkg = bb.data.getVar('PN', d, True) for pkg in package_list: localdata = bb.data.createCopy(d) @@ -412,13 +412,13 @@ python populate_packages () { bb.mkdirhier(root) bb.data.setVar('PKG', pkg, localdata) - overrides = bb.data.getVar('OVERRIDES', localdata, 1) + overrides = bb.data.getVar('OVERRIDES', localdata, True) if not overrides: raise bb.build.FuncFailed('OVERRIDES not defined') bb.data.setVar('OVERRIDES', overrides + ':' + pkg, localdata) bb.data.update_data(localdata) - filesvar = bb.data.getVar('FILES', localdata, 1) or "" + filesvar = bb.data.getVar('FILES', localdata, True) or "" files = filesvar.split() for file in files: if os.path.isabs(file): @@ -473,7 +473,7 @@ python populate_packages () { bb.build.exec_func("package_name_hook", d) for pkg in package_list: - pkgname = bb.data.getVar('PKG_%s' % pkg, d, 1) + pkgname = bb.data.getVar('PKG_%s' % pkg, d, True) if pkgname is None: bb.data.setVar('PKG_%s' % pkg, pkg, d) @@ -532,11 +532,11 @@ python emit_pkgdata() { c = codecs.getencoder("string_escape") return c(str)[0] - val = bb.data.getVar('%s_%s' % (var, pkg), d, 1) + val = bb.data.getVar('%s_%s' % (var, pkg), d, True) if val: f.write('%s_%s: %s\n' % (var, pkg, encode(val))) return - val = bb.data.getVar('%s' % (var), d, 1) + val = bb.data.getVar('%s' % (var), d, True) if val: f.write('%s: %s\n' % (var, encode(val))) return @@ -554,7 +554,7 @@ python emit_pkgdata() { f.close() package_stagefile(data_file, d) - workdir = bb.data.getVar('WORKDIR', d, 1) + workdir = bb.data.getVar('WORKDIR', d, True) for pkg in packages.split(): subdata_file = pkgdatadir + "/runtime/%s" % pkg @@ -582,9 +582,9 @@ python emit_pkgdata() { #if pkgdatadir2: # bb.copyfile(subdata_file, pkgdatadir2 + "/runtime/%s" % pkg) - allow_empty = bb.data.getVar('ALLOW_EMPTY_%s' % pkg, d, 1) + allow_empty = bb.data.getVar('ALLOW_EMPTY_%s' % pkg, d, True) if not allow_empty: - allow_empty = bb.data.getVar('ALLOW_EMPTY', d, 1) + allow_empty = bb.data.getVar('ALLOW_EMPTY', d, True) root = "%s/install/%s" % (workdir, pkg) os.chdir(root) g = glob('*') + glob('.[!.]*') @@ -618,21 +618,21 @@ python package_do_shlibs() { lib_re = re.compile("^lib.*\.so") libdir_re = re.compile(".*/lib$") - packages = bb.data.getVar('PACKAGES', d, 1) + packages = bb.data.getVar('PACKAGES', d, True) - workdir = bb.data.getVar('WORKDIR', d, 1) + workdir = bb.data.getVar('WORKDIR', d, True) if not workdir: bb.error("WORKDIR not defined") return - ver = bb.data.getVar('PV', d, 1) + ver = bb.data.getVar('PV', d, True) if not ver: bb.error("PV not defined") return - pkgdest = bb.data.getVar('PKGDEST', d, 1) + pkgdest = bb.data.getVar('PKGDEST', d, True) - shlibs_dir = bb.data.getVar('SHLIBSDIR', d, 1) + shlibs_dir = bb.data.getVar('SHLIBSDIR', d, True) bb.mkdirhier(shlibs_dir) pstageactive = bb.data.getVar('PSTAGING_ACTIVE', d, True) @@ -650,12 +650,12 @@ python package_do_shlibs() { use_ldconfig = False needed = {} - private_libs = bb.data.getVar('PRIVATE_LIBS', d, 1) + private_libs = bb.data.getVar('PRIVATE_LIBS', d, True) for pkg in packages.split(): needs_ldconfig = False bb.debug(2, "calculating shlib provides for %s" % pkg) - pkgver = bb.data.getVar('PV_' + pkg, d, 1) + pkgver = bb.data.getVar('PV_' + pkg, d, True) if not pkgver: pkgver = ver @@ -668,8 +668,8 @@ python package_do_shlibs() { soname = None path = os.path.join(root, file) if (os.access(path, os.X_OK) or lib_re.match(file)) and not os.path.islink(path): - cmd = bb.data.getVar('OBJDUMP', d, 1) + " -p " + path + " 2>/dev/null" - cmd = "PATH=\"%s\" %s" % (bb.data.getVar('PATH', d, 1), cmd) + cmd = bb.data.getVar('OBJDUMP', d, True) + " -p " + path + " 2>/dev/null" + cmd = "PATH=\"%s\" %s" % (bb.data.getVar('PATH', d, True), cmd) fd = os.popen(cmd) lines = fd.readlines() fd.close() @@ -708,10 +708,10 @@ python package_do_shlibs() { package_stagefile(shver_file, d) if needs_ldconfig and use_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) + postinst = bb.data.getVar('pkg_postinst_%s' % pkg, d, True) or bb.data.getVar('pkg_postinst', d, True) if not postinst: postinst = '#!/bin/sh\n' - postinst += bb.data.getVar('ldconfig_postinst_fragment', d, 1) + postinst += bb.data.getVar('ldconfig_postinst_fragment', d, True) bb.data.setVar('pkg_postinst_%s' % pkg, postinst, d) if pstageactive == "1": @@ -738,7 +738,7 @@ python package_do_shlibs() { for l in lines: shlib_provider[l.rstrip()] = (dep_pkg, lib_ver) - assumed_libs = bb.data.getVar('ASSUME_SHLIBS', d, 1) + assumed_libs = bb.data.getVar('ASSUME_SHLIBS', d, True) if assumed_libs: for e in assumed_libs.split(): l, dep_pkg = e.split(":") @@ -786,16 +786,16 @@ python package_do_shlibs() { python package_do_pkgconfig () { import re, os - packages = bb.data.getVar('PACKAGES', d, 1) + packages = bb.data.getVar('PACKAGES', d, True) - workdir = bb.data.getVar('WORKDIR', d, 1) + workdir = bb.data.getVar('WORKDIR', d, True) if not workdir: bb.error("WORKDIR not defined") return - pkgdest = bb.data.getVar('PKGDEST', d, 1) + pkgdest = bb.data.getVar('PKGDEST', d, True) - shlibs_dir = bb.data.getVar('SHLIBSDIR', d, 1) + shlibs_dir = bb.data.getVar('SHLIBSDIR', d, True) bb.mkdirhier(shlibs_dir) pc_re = re.compile('(.*)\.pc$') @@ -890,7 +890,7 @@ python package_do_pkgconfig () { } python read_shlibdeps () { - packages = bb.data.getVar('PACKAGES', d, 1).split() + packages = bb.data.getVar('PACKAGES', d, True).split() for pkg in packages: rdepends = explode_deps(bb.data.getVar('RDEPENDS_' + pkg, d, 0) or bb.data.getVar('RDEPENDS', d, 0) or "") for extension in ".shlibdeps", ".pcdeps", ".clilibdeps": @@ -918,14 +918,14 @@ python package_depchains() { package. """ - packages = bb.data.getVar('PACKAGES', d, 1) - postfixes = (bb.data.getVar('DEPCHAIN_POST', d, 1) or '').split() - prefixes = (bb.data.getVar('DEPCHAIN_PRE', d, 1) or '').split() + packages = bb.data.getVar('PACKAGES', d, True) + postfixes = (bb.data.getVar('DEPCHAIN_POST', d, True) or '').split() + prefixes = (bb.data.getVar('DEPCHAIN_PRE', d, True) or '').split() def pkg_adddeprrecs(pkg, base, suffix, getname, depends, d): #bb.note('depends for %s is %s' % (base, depends)) - rreclist = explode_deps(bb.data.getVar('RRECOMMENDS_' + pkg, d, 1) or bb.data.getVar('RRECOMMENDS', d, 1) or "") + rreclist = explode_deps(bb.data.getVar('RRECOMMENDS_' + pkg, d, True) or bb.data.getVar('RRECOMMENDS', d, True) or "") for depend in depends: if depend.find('-native') != -1 or depend.find('-cross') != -1 or depend.startswith('virtual/'): @@ -946,7 +946,7 @@ python package_depchains() { def pkg_addrrecs(pkg, base, suffix, getname, rdepends, d): #bb.note('rdepends for %s is %s' % (base, rdepends)) - rreclist = explode_deps(bb.data.getVar('RRECOMMENDS_' + pkg, d, 1) or bb.data.getVar('RRECOMMENDS', d, 1) or "") + rreclist = explode_deps(bb.data.getVar('RRECOMMENDS_' + pkg, d, True) or bb.data.getVar('RRECOMMENDS', d, True) or "") for depend in rdepends: if depend.endswith('-dev'): @@ -966,15 +966,15 @@ python package_depchains() { list.append(dep) depends = [] - for dep in explode_deps(bb.data.getVar('DEPENDS', d, 1) or ""): + for dep in explode_deps(bb.data.getVar('DEPENDS', d, True) or ""): add_dep(depends, dep) rdepends = [] - for dep in explode_deps(bb.data.getVar('RDEPENDS', d, 1) or ""): + for dep in explode_deps(bb.data.getVar('RDEPENDS', d, True) or ""): add_dep(rdepends, dep) for pkg in packages.split(): - for dep in explode_deps(bb.data.getVar('RDEPENDS_' + pkg, d, 1) or ""): + for dep in explode_deps(bb.data.getVar('RDEPENDS_' + pkg, d, True) or ""): add_dep(rdepends, dep) #bb.note('rdepends is %s' % rdepends) @@ -1007,7 +1007,7 @@ python package_depchains() { pkg_addrrecs(pkg, base, suffix, func, rdepends, d) else: rdeps = [] - for dep in explode_deps(bb.data.getVar('RDEPENDS_' + base, d, 1) or bb.data.getVar('RDEPENDS', d, 1) or ""): + for dep in explode_deps(bb.data.getVar('RDEPENDS_' + base, d, True) or bb.data.getVar('RDEPENDS', d, True) or ""): add_dep(rdeps, dep) pkg_addrrecs(pkg, base, suffix, func, rdeps, d) } @@ -1035,7 +1035,7 @@ def package_run_hooks(f, d): bb.parse.parse_py.BBHandler.feeder(line, l, fn, os.path.basename(fn), d) line += 1 fp.close() - anonqueue = bb.data.getVar("__anonqueue", d, 1) or [] + anonqueue = bb.data.getVar("__anonqueue", d, True) or [] body = [x['content'] for x in anonqueue] flag = { 'python' : 1, 'func' : 1 } bb.data.setVar("__anonfunc", "\n".join(body), d) @@ -1054,12 +1054,12 @@ def package_run_hooks(f, d): bb.data.delVar("__anonfunc", d) python package_do_package () { - packages = (bb.data.getVar('PACKAGES', d, 1) or "").split() + packages = (bb.data.getVar('PACKAGES', d, True) or "").split() if len(packages) < 1: bb.debug(1, "No packages to build, skipping do_package") return - for f in (bb.data.getVar('PACKAGEFUNCS', d, 1) or '').split(): + for f in (bb.data.getVar('PACKAGEFUNCS', d, True) or '').split(): bb.build.exec_func(f, d) package_run_hooks(f, d) } -- cgit v1.2.3 From 056193c6638892ddde7bddbfc6f6f06a2288ba64 Mon Sep 17 00:00:00 2001 From: Frans Meulenbroeks Date: Fri, 30 Oct 2009 12:48:03 +0100 Subject: Revert "package.bbclass: Cleanup getVar syntax to use True, not 1 as third argument (from Poky)" This reverts commit fcee557e1b0551d1743bbb3ad61102b9ccc4cba8. --- classes/package.bbclass | 120 ++++++++++++++++++++++++------------------------ 1 file changed, 60 insertions(+), 60 deletions(-) (limited to 'classes/package.bbclass') diff --git a/classes/package.bbclass b/classes/package.bbclass index e7865754eb..7a9b987c7c 100644 --- a/classes/package.bbclass +++ b/classes/package.bbclass @@ -28,12 +28,12 @@ def do_split_packages(d, root, file_regex, output_pattern, description, postinst """ import os, os.path, bb - dvar = bb.data.getVar('D', d, True) + dvar = bb.data.getVar('D', d, 1) if not dvar: bb.error("D not defined") return - packages = bb.data.getVar('PACKAGES', d, True).split() + packages = bb.data.getVar('PACKAGES', d, 1).split() if postinst: postinst = '#!/bin/sh\n' + postinst + '\n' @@ -94,7 +94,7 @@ def do_split_packages(d, root, file_regex, output_pattern, description, postinst the_files.append(aux_files_pattern_verbatim % m.group(1)) bb.data.setVar('FILES_' + pkg, " ".join(the_files), d) if extra_depends != '': - the_depends = bb.data.getVar('RDEPENDS_' + pkg, d, True) + the_depends = bb.data.getVar('RDEPENDS_' + pkg, d, 1) if the_depends: the_depends = '%s %s' % (the_depends, extra_depends) else: @@ -106,7 +106,7 @@ def do_split_packages(d, root, file_regex, output_pattern, description, postinst if postrm: bb.data.setVar('pkg_postrm_' + pkg, postrm, d) else: - oldfiles = bb.data.getVar('FILES_' + pkg, d, True) + oldfiles = bb.data.getVar('FILES_' + pkg, d, 1) if not oldfiles: bb.fatal("Package '%s' exists but has no files" % pkg) bb.data.setVar('FILES_' + pkg, oldfiles + " " + os.path.join(root, o), d) @@ -152,7 +152,7 @@ def runstrip(file, d): import bb, os, commands, stat - pathprefix = "export PATH=%s; " % bb.data.getVar('PATH', d, True) + pathprefix = "export PATH=%s; " % bb.data.getVar('PATH', d, 1) ret, result = commands.getstatusoutput("%sfile '%s'" % (pathprefix, file)) @@ -169,8 +169,8 @@ def runstrip(file, d): bb.debug(2, "Already ran strip on %s" % file) return 0 - strip = bb.data.getVar("STRIP", d, True) - objcopy = bb.data.getVar("OBJCOPY", d, True) + strip = bb.data.getVar("STRIP", d, 1) + objcopy = bb.data.getVar("OBJCOPY", d, 1) newmode = None if not os.access(file, os.W_OK): @@ -268,10 +268,10 @@ def get_package_mapping (pkg, d): def runtime_mapping_rename (varname, d): import bb, os - #bb.note("%s before: %s" % (varname, bb.data.getVar(varname, d, True))) + #bb.note("%s before: %s" % (varname, bb.data.getVar(varname, d, 1))) new_depends = [] - for depend in explode_deps(bb.data.getVar(varname, d, True) or ""): + for depend in explode_deps(bb.data.getVar(varname, d, 1) or ""): # Have to be careful with any version component of the depend split_depend = depend.split(' (') new_depend = get_package_mapping(split_depend[0].strip(), d) @@ -282,7 +282,7 @@ def runtime_mapping_rename (varname, d): bb.data.setVar(varname, " ".join(new_depends) or None, d) - #bb.note("%s after: %s" % (varname, bb.data.getVar(varname, d, True))) + #bb.note("%s after: %s" % (varname, bb.data.getVar(varname, d, 1))) # # Package functions suitable for inclusion in PACKAGEFUNCS @@ -291,23 +291,23 @@ def runtime_mapping_rename (varname, d): python package_do_split_locales() { import os - if (bb.data.getVar('PACKAGE_NO_LOCALE', d, True) == '1'): + if (bb.data.getVar('PACKAGE_NO_LOCALE', d, 1) == '1'): bb.debug(1, "package requested not splitting locales") return - packages = (bb.data.getVar('PACKAGES', d, True) or "").split() + packages = (bb.data.getVar('PACKAGES', d, 1) or "").split() - datadir = bb.data.getVar('datadir', d, True) + datadir = bb.data.getVar('datadir', d, 1) if not datadir: bb.note("datadir not defined") return - dvar = bb.data.getVar('D', d, True) + dvar = bb.data.getVar('D', d, 1) if not dvar: bb.error("D not defined") return - pn = bb.data.getVar('PN', d, True) + pn = bb.data.getVar('PN', d, 1) if not pn: bb.error("PN not defined") return @@ -346,27 +346,27 @@ python package_do_split_locales() { python populate_packages () { import glob, stat, errno, re - workdir = bb.data.getVar('WORKDIR', d, True) + workdir = bb.data.getVar('WORKDIR', d, 1) if not workdir: bb.error("WORKDIR not defined, unable to package") return import os # path manipulations - outdir = bb.data.getVar('DEPLOY_DIR', d, True) + outdir = bb.data.getVar('DEPLOY_DIR', d, 1) if not outdir: bb.error("DEPLOY_DIR not defined, unable to package") return bb.mkdirhier(outdir) - dvar = bb.data.getVar('D', d, True) + dvar = bb.data.getVar('D', d, 1) if not dvar: bb.error("D not defined, unable to package") return bb.mkdirhier(dvar) - packages = bb.data.getVar('PACKAGES', d, True) + packages = bb.data.getVar('PACKAGES', d, 1) - pn = bb.data.getVar('PN', d, True) + pn = bb.data.getVar('PN', d, 1) if not pn: bb.error("PN not defined") return @@ -392,19 +392,19 @@ python populate_packages () { else: package_list.append(pkg) - if (bb.data.getVar('INHIBIT_PACKAGE_STRIP', d, True) != '1'): + if (bb.data.getVar('INHIBIT_PACKAGE_STRIP', d, 1) != '1'): for root, dirs, files in os.walk(dvar): for f in files: file = os.path.join(root, f) if not os.path.islink(file) and not os.path.isdir(file) and isexec(file): runstrip(file, d) - pkgdest = bb.data.getVar('PKGDEST', d, True) + pkgdest = bb.data.getVar('PKGDEST', d, 1) os.system('rm -rf %s' % pkgdest) seen = [] main_is_empty = 1 - main_pkg = bb.data.getVar('PN', d, True) + main_pkg = bb.data.getVar('PN', d, 1) for pkg in package_list: localdata = bb.data.createCopy(d) @@ -412,13 +412,13 @@ python populate_packages () { bb.mkdirhier(root) bb.data.setVar('PKG', pkg, localdata) - overrides = bb.data.getVar('OVERRIDES', localdata, True) + overrides = bb.data.getVar('OVERRIDES', localdata, 1) if not overrides: raise bb.build.FuncFailed('OVERRIDES not defined') bb.data.setVar('OVERRIDES', overrides + ':' + pkg, localdata) bb.data.update_data(localdata) - filesvar = bb.data.getVar('FILES', localdata, True) or "" + filesvar = bb.data.getVar('FILES', localdata, 1) or "" files = filesvar.split() for file in files: if os.path.isabs(file): @@ -473,7 +473,7 @@ python populate_packages () { bb.build.exec_func("package_name_hook", d) for pkg in package_list: - pkgname = bb.data.getVar('PKG_%s' % pkg, d, True) + pkgname = bb.data.getVar('PKG_%s' % pkg, d, 1) if pkgname is None: bb.data.setVar('PKG_%s' % pkg, pkg, d) @@ -532,11 +532,11 @@ python emit_pkgdata() { c = codecs.getencoder("string_escape") return c(str)[0] - val = bb.data.getVar('%s_%s' % (var, pkg), d, True) + val = bb.data.getVar('%s_%s' % (var, pkg), d, 1) if val: f.write('%s_%s: %s\n' % (var, pkg, encode(val))) return - val = bb.data.getVar('%s' % (var), d, True) + val = bb.data.getVar('%s' % (var), d, 1) if val: f.write('%s: %s\n' % (var, encode(val))) return @@ -554,7 +554,7 @@ python emit_pkgdata() { f.close() package_stagefile(data_file, d) - workdir = bb.data.getVar('WORKDIR', d, True) + workdir = bb.data.getVar('WORKDIR', d, 1) for pkg in packages.split(): subdata_file = pkgdatadir + "/runtime/%s" % pkg @@ -582,9 +582,9 @@ python emit_pkgdata() { #if pkgdatadir2: # bb.copyfile(subdata_file, pkgdatadir2 + "/runtime/%s" % pkg) - allow_empty = bb.data.getVar('ALLOW_EMPTY_%s' % pkg, d, True) + allow_empty = bb.data.getVar('ALLOW_EMPTY_%s' % pkg, d, 1) if not allow_empty: - allow_empty = bb.data.getVar('ALLOW_EMPTY', d, True) + allow_empty = bb.data.getVar('ALLOW_EMPTY', d, 1) root = "%s/install/%s" % (workdir, pkg) os.chdir(root) g = glob('*') + glob('.[!.]*') @@ -618,21 +618,21 @@ python package_do_shlibs() { lib_re = re.compile("^lib.*\.so") libdir_re = re.compile(".*/lib$") - packages = bb.data.getVar('PACKAGES', d, True) + packages = bb.data.getVar('PACKAGES', d, 1) - workdir = bb.data.getVar('WORKDIR', d, True) + workdir = bb.data.getVar('WORKDIR', d, 1) if not workdir: bb.error("WORKDIR not defined") return - ver = bb.data.getVar('PV', d, True) + ver = bb.data.getVar('PV', d, 1) if not ver: bb.error("PV not defined") return - pkgdest = bb.data.getVar('PKGDEST', d, True) + pkgdest = bb.data.getVar('PKGDEST', d, 1) - shlibs_dir = bb.data.getVar('SHLIBSDIR', d, True) + shlibs_dir = bb.data.getVar('SHLIBSDIR', d, 1) bb.mkdirhier(shlibs_dir) pstageactive = bb.data.getVar('PSTAGING_ACTIVE', d, True) @@ -650,12 +650,12 @@ python package_do_shlibs() { use_ldconfig = False needed = {} - private_libs = bb.data.getVar('PRIVATE_LIBS', d, True) + private_libs = bb.data.getVar('PRIVATE_LIBS', d, 1) for pkg in packages.split(): needs_ldconfig = False bb.debug(2, "calculating shlib provides for %s" % pkg) - pkgver = bb.data.getVar('PV_' + pkg, d, True) + pkgver = bb.data.getVar('PV_' + pkg, d, 1) if not pkgver: pkgver = ver @@ -668,8 +668,8 @@ python package_do_shlibs() { soname = None path = os.path.join(root, file) if (os.access(path, os.X_OK) or lib_re.match(file)) and not os.path.islink(path): - cmd = bb.data.getVar('OBJDUMP', d, True) + " -p " + path + " 2>/dev/null" - cmd = "PATH=\"%s\" %s" % (bb.data.getVar('PATH', d, True), cmd) + cmd = bb.data.getVar('OBJDUMP', d, 1) + " -p " + path + " 2>/dev/null" + cmd = "PATH=\"%s\" %s" % (bb.data.getVar('PATH', d, 1), cmd) fd = os.popen(cmd) lines = fd.readlines() fd.close() @@ -708,10 +708,10 @@ python package_do_shlibs() { package_stagefile(shver_file, d) if needs_ldconfig and use_ldconfig: bb.debug(1, 'adding ldconfig call to postinst for %s' % pkg) - postinst = bb.data.getVar('pkg_postinst_%s' % pkg, d, True) or bb.data.getVar('pkg_postinst', d, True) + postinst = bb.data.getVar('pkg_postinst_%s' % pkg, d, 1) or bb.data.getVar('pkg_postinst', d, 1) if not postinst: postinst = '#!/bin/sh\n' - postinst += bb.data.getVar('ldconfig_postinst_fragment', d, True) + postinst += bb.data.getVar('ldconfig_postinst_fragment', d, 1) bb.data.setVar('pkg_postinst_%s' % pkg, postinst, d) if pstageactive == "1": @@ -738,7 +738,7 @@ python package_do_shlibs() { for l in lines: shlib_provider[l.rstrip()] = (dep_pkg, lib_ver) - assumed_libs = bb.data.getVar('ASSUME_SHLIBS', d, True) + assumed_libs = bb.data.getVar('ASSUME_SHLIBS', d, 1) if assumed_libs: for e in assumed_libs.split(): l, dep_pkg = e.split(":") @@ -786,16 +786,16 @@ python package_do_shlibs() { python package_do_pkgconfig () { import re, os - packages = bb.data.getVar('PACKAGES', d, True) + packages = bb.data.getVar('PACKAGES', d, 1) - workdir = bb.data.getVar('WORKDIR', d, True) + workdir = bb.data.getVar('WORKDIR', d, 1) if not workdir: bb.error("WORKDIR not defined") return - pkgdest = bb.data.getVar('PKGDEST', d, True) + pkgdest = bb.data.getVar('PKGDEST', d, 1) - shlibs_dir = bb.data.getVar('SHLIBSDIR', d, True) + shlibs_dir = bb.data.getVar('SHLIBSDIR', d, 1) bb.mkdirhier(shlibs_dir) pc_re = re.compile('(.*)\.pc$') @@ -890,7 +890,7 @@ python package_do_pkgconfig () { } python read_shlibdeps () { - packages = bb.data.getVar('PACKAGES', d, True).split() + packages = bb.data.getVar('PACKAGES', d, 1).split() for pkg in packages: rdepends = explode_deps(bb.data.getVar('RDEPENDS_' + pkg, d, 0) or bb.data.getVar('RDEPENDS', d, 0) or "") for extension in ".shlibdeps", ".pcdeps", ".clilibdeps": @@ -918,14 +918,14 @@ python package_depchains() { package. """ - packages = bb.data.getVar('PACKAGES', d, True) - postfixes = (bb.data.getVar('DEPCHAIN_POST', d, True) or '').split() - prefixes = (bb.data.getVar('DEPCHAIN_PRE', d, True) or '').split() + packages = bb.data.getVar('PACKAGES', d, 1) + postfixes = (bb.data.getVar('DEPCHAIN_POST', d, 1) or '').split() + prefixes = (bb.data.getVar('DEPCHAIN_PRE', d, 1) or '').split() def pkg_adddeprrecs(pkg, base, suffix, getname, depends, d): #bb.note('depends for %s is %s' % (base, depends)) - rreclist = explode_deps(bb.data.getVar('RRECOMMENDS_' + pkg, d, True) or bb.data.getVar('RRECOMMENDS', d, True) or "") + rreclist = explode_deps(bb.data.getVar('RRECOMMENDS_' + pkg, d, 1) or bb.data.getVar('RRECOMMENDS', d, 1) or "") for depend in depends: if depend.find('-native') != -1 or depend.find('-cross') != -1 or depend.startswith('virtual/'): @@ -946,7 +946,7 @@ python package_depchains() { def pkg_addrrecs(pkg, base, suffix, getname, rdepends, d): #bb.note('rdepends for %s is %s' % (base, rdepends)) - rreclist = explode_deps(bb.data.getVar('RRECOMMENDS_' + pkg, d, True) or bb.data.getVar('RRECOMMENDS', d, True) or "") + rreclist = explode_deps(bb.data.getVar('RRECOMMENDS_' + pkg, d, 1) or bb.data.getVar('RRECOMMENDS', d, 1) or "") for depend in rdepends: if depend.endswith('-dev'): @@ -966,15 +966,15 @@ python package_depchains() { list.append(dep) depends = [] - for dep in explode_deps(bb.data.getVar('DEPENDS', d, True) or ""): + for dep in explode_deps(bb.data.getVar('DEPENDS', d, 1) or ""): add_dep(depends, dep) rdepends = [] - for dep in explode_deps(bb.data.getVar('RDEPENDS', d, True) or ""): + for dep in explode_deps(bb.data.getVar('RDEPENDS', d, 1) or ""): add_dep(rdepends, dep) for pkg in packages.split(): - for dep in explode_deps(bb.data.getVar('RDEPENDS_' + pkg, d, True) or ""): + for dep in explode_deps(bb.data.getVar('RDEPENDS_' + pkg, d, 1) or ""): add_dep(rdepends, dep) #bb.note('rdepends is %s' % rdepends) @@ -1007,7 +1007,7 @@ python package_depchains() { pkg_addrrecs(pkg, base, suffix, func, rdepends, d) else: rdeps = [] - for dep in explode_deps(bb.data.getVar('RDEPENDS_' + base, d, True) or bb.data.getVar('RDEPENDS', d, True) or ""): + for dep in explode_deps(bb.data.getVar('RDEPENDS_' + base, d, 1) or bb.data.getVar('RDEPENDS', d, 1) or ""): add_dep(rdeps, dep) pkg_addrrecs(pkg, base, suffix, func, rdeps, d) } @@ -1035,7 +1035,7 @@ def package_run_hooks(f, d): bb.parse.parse_py.BBHandler.feeder(line, l, fn, os.path.basename(fn), d) line += 1 fp.close() - anonqueue = bb.data.getVar("__anonqueue", d, True) or [] + anonqueue = bb.data.getVar("__anonqueue", d, 1) or [] body = [x['content'] for x in anonqueue] flag = { 'python' : 1, 'func' : 1 } bb.data.setVar("__anonfunc", "\n".join(body), d) @@ -1054,12 +1054,12 @@ def package_run_hooks(f, d): bb.data.delVar("__anonfunc", d) python package_do_package () { - packages = (bb.data.getVar('PACKAGES', d, True) or "").split() + packages = (bb.data.getVar('PACKAGES', d, 1) or "").split() if len(packages) < 1: bb.debug(1, "No packages to build, skipping do_package") return - for f in (bb.data.getVar('PACKAGEFUNCS', d, True) or '').split(): + for f in (bb.data.getVar('PACKAGEFUNCS', d, 1) or '').split(): bb.build.exec_func(f, d) package_run_hooks(f, d) } -- cgit v1.2.3 From 138f792724e42d5b87668d470e3162ba4148ed14 Mon Sep 17 00:00:00 2001 From: Frans Meulenbroeks Date: Sat, 31 Oct 2009 13:52:45 +0100 Subject: Revert "Revert "package.bbclass: Cleanup getVar syntax to use True, not 1 as third argument (from Poky)"" Oops, accidently reverted a patch, reverting the revert. Sorry for any inconvenience This reverts commit 056193c6638892ddde7bddbfc6f6f06a2288ba64. --- classes/package.bbclass | 120 ++++++++++++++++++++++++------------------------ 1 file changed, 60 insertions(+), 60 deletions(-) (limited to 'classes/package.bbclass') diff --git a/classes/package.bbclass b/classes/package.bbclass index 7a9b987c7c..e7865754eb 100644 --- a/classes/package.bbclass +++ b/classes/package.bbclass @@ -28,12 +28,12 @@ def do_split_packages(d, root, file_regex, output_pattern, description, postinst """ import os, os.path, bb - dvar = bb.data.getVar('D', d, 1) + dvar = bb.data.getVar('D', d, True) if not dvar: bb.error("D not defined") return - packages = bb.data.getVar('PACKAGES', d, 1).split() + packages = bb.data.getVar('PACKAGES', d, True).split() if postinst: postinst = '#!/bin/sh\n' + postinst + '\n' @@ -94,7 +94,7 @@ def do_split_packages(d, root, file_regex, output_pattern, description, postinst the_files.append(aux_files_pattern_verbatim % m.group(1)) bb.data.setVar('FILES_' + pkg, " ".join(the_files), d) if extra_depends != '': - the_depends = bb.data.getVar('RDEPENDS_' + pkg, d, 1) + the_depends = bb.data.getVar('RDEPENDS_' + pkg, d, True) if the_depends: the_depends = '%s %s' % (the_depends, extra_depends) else: @@ -106,7 +106,7 @@ def do_split_packages(d, root, file_regex, output_pattern, description, postinst if postrm: bb.data.setVar('pkg_postrm_' + pkg, postrm, d) else: - oldfiles = bb.data.getVar('FILES_' + pkg, d, 1) + oldfiles = bb.data.getVar('FILES_' + pkg, d, True) if not oldfiles: bb.fatal("Package '%s' exists but has no files" % pkg) bb.data.setVar('FILES_' + pkg, oldfiles + " " + os.path.join(root, o), d) @@ -152,7 +152,7 @@ def runstrip(file, d): import bb, os, commands, stat - pathprefix = "export PATH=%s; " % bb.data.getVar('PATH', d, 1) + pathprefix = "export PATH=%s; " % bb.data.getVar('PATH', d, True) ret, result = commands.getstatusoutput("%sfile '%s'" % (pathprefix, file)) @@ -169,8 +169,8 @@ def runstrip(file, d): bb.debug(2, "Already ran strip on %s" % file) return 0 - strip = bb.data.getVar("STRIP", d, 1) - objcopy = bb.data.getVar("OBJCOPY", d, 1) + strip = bb.data.getVar("STRIP", d, True) + objcopy = bb.data.getVar("OBJCOPY", d, True) newmode = None if not os.access(file, os.W_OK): @@ -268,10 +268,10 @@ def get_package_mapping (pkg, d): def runtime_mapping_rename (varname, d): import bb, os - #bb.note("%s before: %s" % (varname, bb.data.getVar(varname, d, 1))) + #bb.note("%s before: %s" % (varname, bb.data.getVar(varname, d, True))) new_depends = [] - for depend in explode_deps(bb.data.getVar(varname, d, 1) or ""): + for depend in explode_deps(bb.data.getVar(varname, d, True) or ""): # Have to be careful with any version component of the depend split_depend = depend.split(' (') new_depend = get_package_mapping(split_depend[0].strip(), d) @@ -282,7 +282,7 @@ def runtime_mapping_rename (varname, d): bb.data.setVar(varname, " ".join(new_depends) or None, d) - #bb.note("%s after: %s" % (varname, bb.data.getVar(varname, d, 1))) + #bb.note("%s after: %s" % (varname, bb.data.getVar(varname, d, True))) # # Package functions suitable for inclusion in PACKAGEFUNCS @@ -291,23 +291,23 @@ def runtime_mapping_rename (varname, d): python package_do_split_locales() { import os - if (bb.data.getVar('PACKAGE_NO_LOCALE', d, 1) == '1'): + if (bb.data.getVar('PACKAGE_NO_LOCALE', d, True) == '1'): bb.debug(1, "package requested not splitting locales") return - packages = (bb.data.getVar('PACKAGES', d, 1) or "").split() + packages = (bb.data.getVar('PACKAGES', d, True) or "").split() - datadir = bb.data.getVar('datadir', d, 1) + datadir = bb.data.getVar('datadir', d, True) if not datadir: bb.note("datadir not defined") return - dvar = bb.data.getVar('D', d, 1) + dvar = bb.data.getVar('D', d, True) if not dvar: bb.error("D not defined") return - pn = bb.data.getVar('PN', d, 1) + pn = bb.data.getVar('PN', d, True) if not pn: bb.error("PN not defined") return @@ -346,27 +346,27 @@ python package_do_split_locales() { python populate_packages () { import glob, stat, errno, re - workdir = bb.data.getVar('WORKDIR', d, 1) + 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, 1) + 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, 1) + 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, 1) + packages = bb.data.getVar('PACKAGES', d, True) - pn = bb.data.getVar('PN', d, 1) + pn = bb.data.getVar('PN', d, True) if not pn: bb.error("PN not defined") return @@ -392,19 +392,19 @@ python populate_packages () { else: package_list.append(pkg) - if (bb.data.getVar('INHIBIT_PACKAGE_STRIP', d, 1) != '1'): + if (bb.data.getVar('INHIBIT_PACKAGE_STRIP', d, True) != '1'): for root, dirs, files in os.walk(dvar): for f in files: file = os.path.join(root, f) if not os.path.islink(file) and not os.path.isdir(file) and isexec(file): runstrip(file, d) - pkgdest = bb.data.getVar('PKGDEST', d, 1) + pkgdest = bb.data.getVar('PKGDEST', d, True) os.system('rm -rf %s' % pkgdest) seen = [] main_is_empty = 1 - main_pkg = bb.data.getVar('PN', d, 1) + main_pkg = bb.data.getVar('PN', d, True) for pkg in package_list: localdata = bb.data.createCopy(d) @@ -412,13 +412,13 @@ python populate_packages () { bb.mkdirhier(root) bb.data.setVar('PKG', pkg, localdata) - overrides = bb.data.getVar('OVERRIDES', localdata, 1) + overrides = bb.data.getVar('OVERRIDES', localdata, True) if not overrides: raise bb.build.FuncFailed('OVERRIDES not defined') bb.data.setVar('OVERRIDES', overrides + ':' + pkg, localdata) bb.data.update_data(localdata) - filesvar = bb.data.getVar('FILES', localdata, 1) or "" + filesvar = bb.data.getVar('FILES', localdata, True) or "" files = filesvar.split() for file in files: if os.path.isabs(file): @@ -473,7 +473,7 @@ python populate_packages () { bb.build.exec_func("package_name_hook", d) for pkg in package_list: - pkgname = bb.data.getVar('PKG_%s' % pkg, d, 1) + pkgname = bb.data.getVar('PKG_%s' % pkg, d, True) if pkgname is None: bb.data.setVar('PKG_%s' % pkg, pkg, d) @@ -532,11 +532,11 @@ python emit_pkgdata() { c = codecs.getencoder("string_escape") return c(str)[0] - val = bb.data.getVar('%s_%s' % (var, pkg), d, 1) + val = bb.data.getVar('%s_%s' % (var, pkg), d, True) if val: f.write('%s_%s: %s\n' % (var, pkg, encode(val))) return - val = bb.data.getVar('%s' % (var), d, 1) + val = bb.data.getVar('%s' % (var), d, True) if val: f.write('%s: %s\n' % (var, encode(val))) return @@ -554,7 +554,7 @@ python emit_pkgdata() { f.close() package_stagefile(data_file, d) - workdir = bb.data.getVar('WORKDIR', d, 1) + workdir = bb.data.getVar('WORKDIR', d, True) for pkg in packages.split(): subdata_file = pkgdatadir + "/runtime/%s" % pkg @@ -582,9 +582,9 @@ python emit_pkgdata() { #if pkgdatadir2: # bb.copyfile(subdata_file, pkgdatadir2 + "/runtime/%s" % pkg) - allow_empty = bb.data.getVar('ALLOW_EMPTY_%s' % pkg, d, 1) + allow_empty = bb.data.getVar('ALLOW_EMPTY_%s' % pkg, d, True) if not allow_empty: - allow_empty = bb.data.getVar('ALLOW_EMPTY', d, 1) + allow_empty = bb.data.getVar('ALLOW_EMPTY', d, True) root = "%s/install/%s" % (workdir, pkg) os.chdir(root) g = glob('*') + glob('.[!.]*') @@ -618,21 +618,21 @@ python package_do_shlibs() { lib_re = re.compile("^lib.*\.so") libdir_re = re.compile(".*/lib$") - packages = bb.data.getVar('PACKAGES', d, 1) + packages = bb.data.getVar('PACKAGES', d, True) - workdir = bb.data.getVar('WORKDIR', d, 1) + workdir = bb.data.getVar('WORKDIR', d, True) if not workdir: bb.error("WORKDIR not defined") return - ver = bb.data.getVar('PV', d, 1) + ver = bb.data.getVar('PV', d, True) if not ver: bb.error("PV not defined") return - pkgdest = bb.data.getVar('PKGDEST', d, 1) + pkgdest = bb.data.getVar('PKGDEST', d, True) - shlibs_dir = bb.data.getVar('SHLIBSDIR', d, 1) + shlibs_dir = bb.data.getVar('SHLIBSDIR', d, True) bb.mkdirhier(shlibs_dir) pstageactive = bb.data.getVar('PSTAGING_ACTIVE', d, True) @@ -650,12 +650,12 @@ python package_do_shlibs() { use_ldconfig = False needed = {} - private_libs = bb.data.getVar('PRIVATE_LIBS', d, 1) + private_libs = bb.data.getVar('PRIVATE_LIBS', d, True) for pkg in packages.split(): needs_ldconfig = False bb.debug(2, "calculating shlib provides for %s" % pkg) - pkgver = bb.data.getVar('PV_' + pkg, d, 1) + pkgver = bb.data.getVar('PV_' + pkg, d, True) if not pkgver: pkgver = ver @@ -668,8 +668,8 @@ python package_do_shlibs() { soname = None path = os.path.join(root, file) if (os.access(path, os.X_OK) or lib_re.match(file)) and not os.path.islink(path): - cmd = bb.data.getVar('OBJDUMP', d, 1) + " -p " + path + " 2>/dev/null" - cmd = "PATH=\"%s\" %s" % (bb.data.getVar('PATH', d, 1), cmd) + cmd = bb.data.getVar('OBJDUMP', d, True) + " -p " + path + " 2>/dev/null" + cmd = "PATH=\"%s\" %s" % (bb.data.getVar('PATH', d, True), cmd) fd = os.popen(cmd) lines = fd.readlines() fd.close() @@ -708,10 +708,10 @@ python package_do_shlibs() { package_stagefile(shver_file, d) if needs_ldconfig and use_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) + postinst = bb.data.getVar('pkg_postinst_%s' % pkg, d, True) or bb.data.getVar('pkg_postinst', d, True) if not postinst: postinst = '#!/bin/sh\n' - postinst += bb.data.getVar('ldconfig_postinst_fragment', d, 1) + postinst += bb.data.getVar('ldconfig_postinst_fragment', d, True) bb.data.setVar('pkg_postinst_%s' % pkg, postinst, d) if pstageactive == "1": @@ -738,7 +738,7 @@ python package_do_shlibs() { for l in lines: shlib_provider[l.rstrip()] = (dep_pkg, lib_ver) - assumed_libs = bb.data.getVar('ASSUME_SHLIBS', d, 1) + assumed_libs = bb.data.getVar('ASSUME_SHLIBS', d, True) if assumed_libs: for e in assumed_libs.split(): l, dep_pkg = e.split(":") @@ -786,16 +786,16 @@ python package_do_shlibs() { python package_do_pkgconfig () { import re, os - packages = bb.data.getVar('PACKAGES', d, 1) + packages = bb.data.getVar('PACKAGES', d, True) - workdir = bb.data.getVar('WORKDIR', d, 1) + workdir = bb.data.getVar('WORKDIR', d, True) if not workdir: bb.error("WORKDIR not defined") return - pkgdest = bb.data.getVar('PKGDEST', d, 1) + pkgdest = bb.data.getVar('PKGDEST', d, True) - shlibs_dir = bb.data.getVar('SHLIBSDIR', d, 1) + shlibs_dir = bb.data.getVar('SHLIBSDIR', d, True) bb.mkdirhier(shlibs_dir) pc_re = re.compile('(.*)\.pc$') @@ -890,7 +890,7 @@ python package_do_pkgconfig () { } python read_shlibdeps () { - packages = bb.data.getVar('PACKAGES', d, 1).split() + packages = bb.data.getVar('PACKAGES', d, True).split() for pkg in packages: rdepends = explode_deps(bb.data.getVar('RDEPENDS_' + pkg, d, 0) or bb.data.getVar('RDEPENDS', d, 0) or "") for extension in ".shlibdeps", ".pcdeps", ".clilibdeps": @@ -918,14 +918,14 @@ python package_depchains() { package. """ - packages = bb.data.getVar('PACKAGES', d, 1) - postfixes = (bb.data.getVar('DEPCHAIN_POST', d, 1) or '').split() - prefixes = (bb.data.getVar('DEPCHAIN_PRE', d, 1) or '').split() + packages = bb.data.getVar('PACKAGES', d, True) + postfixes = (bb.data.getVar('DEPCHAIN_POST', d, True) or '').split() + prefixes = (bb.data.getVar('DEPCHAIN_PRE', d, True) or '').split() def pkg_adddeprrecs(pkg, base, suffix, getname, depends, d): #bb.note('depends for %s is %s' % (base, depends)) - rreclist = explode_deps(bb.data.getVar('RRECOMMENDS_' + pkg, d, 1) or bb.data.getVar('RRECOMMENDS', d, 1) or "") + rreclist = explode_deps(bb.data.getVar('RRECOMMENDS_' + pkg, d, True) or bb.data.getVar('RRECOMMENDS', d, True) or "") for depend in depends: if depend.find('-native') != -1 or depend.find('-cross') != -1 or depend.startswith('virtual/'): @@ -946,7 +946,7 @@ python package_depchains() { def pkg_addrrecs(pkg, base, suffix, getname, rdepends, d): #bb.note('rdepends for %s is %s' % (base, rdepends)) - rreclist = explode_deps(bb.data.getVar('RRECOMMENDS_' + pkg, d, 1) or bb.data.getVar('RRECOMMENDS', d, 1) or "") + rreclist = explode_deps(bb.data.getVar('RRECOMMENDS_' + pkg, d, True) or bb.data.getVar('RRECOMMENDS', d, True) or "") for depend in rdepends: if depend.endswith('-dev'): @@ -966,15 +966,15 @@ python package_depchains() { list.append(dep) depends = [] - for dep in explode_deps(bb.data.getVar('DEPENDS', d, 1) or ""): + for dep in explode_deps(bb.data.getVar('DEPENDS', d, True) or ""): add_dep(depends, dep) rdepends = [] - for dep in explode_deps(bb.data.getVar('RDEPENDS', d, 1) or ""): + for dep in explode_deps(bb.data.getVar('RDEPENDS', d, True) or ""): add_dep(rdepends, dep) for pkg in packages.split(): - for dep in explode_deps(bb.data.getVar('RDEPENDS_' + pkg, d, 1) or ""): + for dep in explode_deps(bb.data.getVar('RDEPENDS_' + pkg, d, True) or ""): add_dep(rdepends, dep) #bb.note('rdepends is %s' % rdepends) @@ -1007,7 +1007,7 @@ python package_depchains() { pkg_addrrecs(pkg, base, suffix, func, rdepends, d) else: rdeps = [] - for dep in explode_deps(bb.data.getVar('RDEPENDS_' + base, d, 1) or bb.data.getVar('RDEPENDS', d, 1) or ""): + for dep in explode_deps(bb.data.getVar('RDEPENDS_' + base, d, True) or bb.data.getVar('RDEPENDS', d, True) or ""): add_dep(rdeps, dep) pkg_addrrecs(pkg, base, suffix, func, rdeps, d) } @@ -1035,7 +1035,7 @@ def package_run_hooks(f, d): bb.parse.parse_py.BBHandler.feeder(line, l, fn, os.path.basename(fn), d) line += 1 fp.close() - anonqueue = bb.data.getVar("__anonqueue", d, 1) or [] + anonqueue = bb.data.getVar("__anonqueue", d, True) or [] body = [x['content'] for x in anonqueue] flag = { 'python' : 1, 'func' : 1 } bb.data.setVar("__anonfunc", "\n".join(body), d) @@ -1054,12 +1054,12 @@ def package_run_hooks(f, d): bb.data.delVar("__anonfunc", d) python package_do_package () { - packages = (bb.data.getVar('PACKAGES', d, 1) or "").split() + packages = (bb.data.getVar('PACKAGES', d, True) or "").split() if len(packages) < 1: bb.debug(1, "No packages to build, skipping do_package") return - for f in (bb.data.getVar('PACKAGEFUNCS', d, 1) or '').split(): + for f in (bb.data.getVar('PACKAGEFUNCS', d, True) or '').split(): bb.build.exec_func(f, d) package_run_hooks(f, d) } -- cgit v1.2.3 From 353ba77e54bdd3d2af60e31590860b4a1e0b76a6 Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Thu, 29 Oct 2009 23:39:34 +0000 Subject: package.bbclass: Move variable checks to one place making the code more readable (from Poky) Signed-off-by: Richard Purdie --- classes/package.bbclass | 52 +++++++++++++------------------------------------ 1 file changed, 14 insertions(+), 38 deletions(-) (limited to 'classes/package.bbclass') 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) -- cgit v1.2.3 From c41e3631d31a1932fcbb0098eab0520f90711cc3 Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Thu, 29 Oct 2009 23:42:11 +0000 Subject: package.bbclass: Remove hardcoded use of PKGDEST variable (from Poky) Signed-off-by: Richard Purdie --- classes/package.bbclass | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'classes/package.bbclass') diff --git a/classes/package.bbclass b/classes/package.bbclass index f4a881ab57..2c085be797 100644 --- a/classes/package.bbclass +++ b/classes/package.bbclass @@ -517,6 +517,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) @@ -560,7 +561,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": -- cgit v1.2.3 From 29c7d3351f43678c6e93b707b301832009f64b31 Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Fri, 30 Oct 2009 00:08:19 +0000 Subject: package.bbclass: Change to operate on a copy of the install directory instead of directly. Also take the opportunity to rename the temp directories so their function is clear (from Poky) Signed-off-by: Richard Purdie --- classes/package.bbclass | 35 ++++++++++++++++++++++++----------- 1 file changed, 24 insertions(+), 11 deletions(-) (limited to 'classes/package.bbclass') diff --git a/classes/package.bbclass b/classes/package.bbclass index 2c085be797..03618ba6fc 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,7 +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) + dvar = bb.data.getVar('PKGD', d, True) packages = bb.data.getVar('PACKAGES', d, True).split() @@ -299,7 +300,7 @@ python package_do_split_locales() { bb.note("datadir not defined") return - dvar = bb.data.getVar('D', d, True) + dvar = bb.data.getVar('PKGD', d, True) pn = bb.data.getVar('PN', d, True) if pn + '-locale' in packages: @@ -333,19 +334,29 @@ python package_do_split_locales() { bb.data.setVar('PACKAGES', ' '.join(packages), d) } +python perform_packagecopy () { + import os + + dest = bb.data.getVar('D', d, True) + dvar = bb.data.getVar('PKGD', d, True) + + bb.mkdirhier(dvar) + + # 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('D', d, True) + dvar = bb.data.getVar('PKGD', d, True) packages = bb.data.getVar('PACKAGES', d, True) pn = bb.data.getVar('PN', d, True) bb.mkdirhier(outdir) - bb.mkdirhier(dvar) - - os.chdir(dvar) def isexec(path): @@ -981,7 +992,8 @@ python package_depchains() { } -PACKAGEFUNCS ?= "package_do_split_locales \ +PACKAGEFUNCS ?= "perform_packagecopy \ + package_do_split_locales \ populate_packages \ package_do_shlibs \ package_do_pkgconfig \ @@ -1029,11 +1041,12 @@ python package_do_package () { workdir = bb.data.getVar('WORKDIR', d, True) outdir = bb.data.getVar('DEPLOY_DIR', d, True) - dvar = bb.data.getVar('D', 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 dvar or not pn or not packages: - bb.error("WORKDIR, DEPLOY_DIR, D, and PN all must be defined, unable to package") + 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(): -- cgit v1.2.3 From 6111d7132a0c7aa0b4827a3bcca05156a7d20d57 Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Fri, 30 Oct 2009 00:31:21 +0000 Subject: package.bbclass: Add the option to declare package preprocess function hooks (from Poky) Signed-off-by: Richard Purdie --- classes/package.bbclass | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'classes/package.bbclass') diff --git a/classes/package.bbclass b/classes/package.bbclass index 03618ba6fc..1c14908f1a 100644 --- a/classes/package.bbclass +++ b/classes/package.bbclass @@ -991,8 +991,9 @@ python package_depchains() { pkg_addrrecs(pkg, base, suffix, func, rdeps, d) } - +PACKAGE_PREPROCESS_FUNCS ?= "" PACKAGEFUNCS ?= "perform_packagecopy \ + ${PACKAGE_PREPROCESS_FUNCS} \ package_do_split_locales \ populate_packages \ package_do_shlibs \ -- cgit v1.2.3 From bc465d83ad8665211b6f9664b418f4eafcc5ca6c Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Mon, 16 Nov 2009 10:45:23 +0000 Subject: classes: Drop a number of unneeded import calls (from Poky) Signed-off-by: Richard Purdie --- classes/package.bbclass | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) (limited to 'classes/package.bbclass') diff --git a/classes/package.bbclass b/classes/package.bbclass index 1c14908f1a..5de48d6bfb 100644 --- a/classes/package.bbclass +++ b/classes/package.bbclass @@ -27,7 +27,6 @@ def do_split_packages(d, root, file_regex, output_pattern, description, postinst Used in .bb files to split up dynamically generated subpackages of a given package, usually plugins or modules. """ - import os, os.path, bb dvar = bb.data.getVar('PKGD', d, True) @@ -130,7 +129,6 @@ def package_stash_hook(func, name, d): f.close() python () { - import bb if bb.data.getVar('PACKAGES', d, True) != '': deps = bb.data.getVarFlag('do_package', 'depends', d) or "" for dep in (bb.data.getVar('PACKAGE_DEPENDS', d, True) or "").split(): @@ -148,7 +146,7 @@ def runstrip(file, d): # A working 'file' (one which works on the target architecture) # is necessary for this stuff to work, hence the addition to do_package[depends] - import bb, os, commands, stat + import commands, stat pathprefix = "export PATH=%s; " % bb.data.getVar('PATH', d, True) @@ -253,8 +251,6 @@ def write_package_md5sums (root, outfile, ignorepaths): # def get_package_mapping (pkg, d): - import bb, os - data = read_subpkgdata(pkg, d) key = "PKG_%s" % pkg @@ -264,8 +260,6 @@ def get_package_mapping (pkg, d): return pkg def runtime_mapping_rename (varname, d): - import bb, os - #bb.note("%s before: %s" % (varname, bb.data.getVar(varname, d, True))) new_depends = [] @@ -287,8 +281,6 @@ def runtime_mapping_rename (varname, d): # python package_do_split_locales() { - import os - if (bb.data.getVar('PACKAGE_NO_LOCALE', d, True) == '1'): bb.debug(1, "package requested not splitting locales") return @@ -335,8 +327,6 @@ python package_do_split_locales() { } python perform_packagecopy () { - import os - dest = bb.data.getVar('D', d, True) dvar = bb.data.getVar('PKGD', d, True) @@ -348,7 +338,7 @@ python perform_packagecopy () { } python populate_packages () { - import os, glob, stat, errno, re + import glob, stat, errno, re workdir = bb.data.getVar('WORKDIR', d, True) outdir = bb.data.getVar('DEPLOY_DIR', d, True) @@ -595,7 +585,7 @@ fi SHLIBSDIR = "${STAGING_DIR_HOST}/shlibs" python package_do_shlibs() { - import os, re, os.path + import re exclude_shlibs = bb.data.getVar('EXCLUDE_FROM_SHLIBS', d, 0) if exclude_shlibs: @@ -768,7 +758,7 @@ python package_do_shlibs() { } python package_do_pkgconfig () { - import re, os + import re packages = bb.data.getVar('PACKAGES', d, True) workdir = bb.data.getVar('WORKDIR', d, True) -- cgit v1.2.3 From 9cbd93cd04ffa16a6b9aee5b6d63751777b91b16 Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Mon, 16 Nov 2009 12:46:10 +0000 Subject: package.bbclass: Add back import os until further metadata cleanups happen Signed-off-by: Richard Purdie --- classes/package.bbclass | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'classes/package.bbclass') diff --git a/classes/package.bbclass b/classes/package.bbclass index 5de48d6bfb..246ecd4ecc 100644 --- a/classes/package.bbclass +++ b/classes/package.bbclass @@ -338,7 +338,7 @@ python perform_packagecopy () { } python populate_packages () { - import glob, stat, errno, re + import glob, stat, errno, re,os workdir = bb.data.getVar('WORKDIR', d, True) outdir = bb.data.getVar('DEPLOY_DIR', d, True) -- cgit v1.2.3