package.bbclass: Sync with OE upstream

git-svn-id: https://svn.o-hand.com/repos/poky/trunk@808 311d38ba-8fff-0310-9ca6-ca027cbcb966
This commit is contained in:
Richard Purdie
2006-10-20 16:09:53 +00:00
parent e2b821a834
commit 866ab593a0

View File

@@ -111,6 +111,8 @@ def do_split_packages(d, root, file_regex, output_pattern, description, postinst
#PACKAGE_DEPENDS ?= "file-native" #PACKAGE_DEPENDS ?= "file-native"
#DEPENDS_prepend =+ "${PACKAGE_DEPENDS} " #DEPENDS_prepend =+ "${PACKAGE_DEPENDS} "
# file(1) output to match to consider a file an unstripped executable
FILE_UNSTRIPPED_MATCH ?= "not stripped"
#FIXME: this should be "" when any errors are gone! #FIXME: this should be "" when any errors are gone!
IGNORE_STRIP_ERRORS ?= "1" IGNORE_STRIP_ERRORS ?= "1"
@@ -120,12 +122,13 @@ runstrip() {
# is necessary for this stuff to work, hence the addition to PACKAGES_DEPENDS # is necessary for this stuff to work, hence the addition to PACKAGES_DEPENDS
local ro st local ro st
st=0 st=0
if { file "$1" || { if { file "$1" || {
oewarn "file $1: failed (forced strip)" >&2 oewarn "file $1: failed (forced strip)" >&2
echo 'not stripped' echo '${FILE_UNSTRIPPED_MATCH}'
} }
} | grep -q 'not stripped' } | grep -q '${FILE_UNSTRIPPED_MATCH}'
then then
oenote "${STRIP} $1" oenote "${STRIP} $1"
ro= ro=
@@ -133,7 +136,7 @@ runstrip() {
ro=1 ro=1
chmod +w "$1" chmod +w "$1"
} }
mkdir $(dirname "$1")/.debug mkdir -p $(dirname "$1")/.debug
debugfile="$(dirname "$1")/.debug/$(basename "$1")" debugfile="$(dirname "$1")/.debug/$(basename "$1")"
'${OBJCOPY}' --only-keep-debug "$1" "$debugfile" '${OBJCOPY}' --only-keep-debug "$1" "$debugfile"
'${STRIP}' "$1" '${STRIP}' "$1"
@@ -324,19 +327,23 @@ python populate_packages () {
return (s[stat.ST_MODE] & stat.S_IEXEC) return (s[stat.ST_MODE] & stat.S_IEXEC)
# Sanity check PACKAGES for duplicates - should be moved to # Sanity check PACKAGES for duplicates - should be moved to
# sanity.bbclass once we have he infrastucture # sanity.bbclass once we have the infrastucture
pkgs = [] package_list = []
for pkg in packages.split(): for pkg in packages.split():
if pkg in pkgs: if pkg in package_list:
bb.error("%s is listed in PACKAGES mutliple times. Undefined behaviour will result." % pkg) bb.error("-------------------")
pkgs += pkg bb.error("%s is listed in PACKAGES mutliple times, this leads to packaging errors." % pkg)
bb.error("Please fix the metadata/report this as bug to OE bugtracker.")
bb.error("-------------------")
else:
package_list.append(pkg)
if (bb.data.getVar('INHIBIT_PACKAGE_STRIP', d, 1) != '1'): if (bb.data.getVar('INHIBIT_PACKAGE_STRIP', d, 1) != '1'):
stripfunc = "" stripfunc = ""
for root, dirs, files in os.walk(dvar): for root, dirs, files in os.walk(dvar):
for f in files: for f in files:
file = os.path.join(root, f) file = os.path.join(root, f)
if not os.path.islink(file) and isexec(file): if not os.path.islink(file) and not os.path.isdir(file) and isexec(file):
stripfunc += "\trunstrip %s || st=1\n" % (file) stripfunc += "\trunstrip %s || st=1\n" % (file)
if not stripfunc == "": if not stripfunc == "":
from bb import build from bb import build
@@ -346,7 +353,7 @@ python populate_packages () {
bb.data.setVarFlag('RUNSTRIP', 'func', 1, localdata) bb.data.setVarFlag('RUNSTRIP', 'func', 1, localdata)
bb.build.exec_func('RUNSTRIP', localdata) bb.build.exec_func('RUNSTRIP', localdata)
for pkg in packages.split(): for pkg in package_list:
localdata = bb.data.createCopy(d) localdata = bb.data.createCopy(d)
root = os.path.join(workdir, "install", pkg) root = os.path.join(workdir, "install", pkg)
@@ -405,7 +412,7 @@ python populate_packages () {
bb.build.exec_func("package_name_hook", d) bb.build.exec_func("package_name_hook", d)
for pkg in packages.split(): for pkg in package_list:
pkgname = bb.data.getVar('PKG_%s' % pkg, d, 1) pkgname = bb.data.getVar('PKG_%s' % pkg, d, 1)
if pkgname is None: if pkgname is None:
bb.data.setVar('PKG_%s' % pkg, pkg, d) bb.data.setVar('PKG_%s' % pkg, pkg, d)
@@ -414,7 +421,7 @@ python populate_packages () {
dangling_links = {} dangling_links = {}
pkg_files = {} pkg_files = {}
for pkg in packages.split(): for pkg in package_list:
dangling_links[pkg] = [] dangling_links[pkg] = []
pkg_files[pkg] = [] pkg_files[pkg] = []
inst_root = os.path.join(workdir, "install", pkg) inst_root = os.path.join(workdir, "install", pkg)
@@ -433,12 +440,12 @@ python populate_packages () {
target = os.path.join(root[len(inst_root):], target) target = os.path.join(root[len(inst_root):], target)
dangling_links[pkg].append(os.path.normpath(target)) dangling_links[pkg].append(os.path.normpath(target))
for pkg in packages.split(): for pkg in package_list:
rdepends = explode_deps(bb.data.getVar('RDEPENDS_' + pkg, d, 1) or bb.data.getVar('RDEPENDS', d, 1) or "") rdepends = explode_deps(bb.data.getVar('RDEPENDS_' + pkg, d, 1) or bb.data.getVar('RDEPENDS', d, 1) or "")
for l in dangling_links[pkg]: for l in dangling_links[pkg]:
found = False found = False
bb.debug(1, "%s contains dangling link %s" % (pkg, l)) bb.debug(1, "%s contains dangling link %s" % (pkg, l))
for p in packages.split(): for p in package_list:
for f in pkg_files[p]: for f in pkg_files[p]:
if f == l: if f == l:
found = True found = True
@@ -773,58 +780,57 @@ python read_shlibdeps () {
} }
python package_depchains() { python package_depchains() {
""" """
For a given set of prefix and postfix modifiers, make those packages For a given set of prefix and postfix modifiers, make those packages
RRECOMMENDS on the corresponding packages for its DEPENDS. RRECOMMENDS on the corresponding packages for its DEPENDS.
Example: If package A depends upon package B, and A's .bb emits an Example: If package A depends upon package B, and A's .bb emits an
A-dev package, this would make A-dev Recommends: B-dev. A-dev package, this would make A-dev Recommends: B-dev.
""" """
packages = bb.data.getVar('PACKAGES', d, 1) packages = bb.data.getVar('PACKAGES', d, 1)
postfixes = (bb.data.getVar('DEPCHAIN_POST', d, 1) or '').split() postfixes = (bb.data.getVar('DEPCHAIN_POST', d, 1) or '').split()
prefixes = (bb.data.getVar('DEPCHAIN_PRE', d, 1) or '').split() prefixes = (bb.data.getVar('DEPCHAIN_PRE', d, 1) or '').split()
def pkg_addrrecs(pkg, base, func, d): def pkg_addrrecs(pkg, base, func, d):
rdepends = explode_deps(bb.data.getVar('RDEPENDS_' + base, d, 1) or bb.data.getVar('RDEPENDS', d, 1) or "") rdepends = explode_deps(bb.data.getVar('RDEPENDS_' + base, d, 1) or bb.data.getVar('RDEPENDS', d, 1) or "")
# bb.note('rdepends for %s is %s' % (base, rdepends)) # bb.note('rdepends for %s is %s' % (base, rdepends))
rreclist = [] rreclist = []
for depend in rdepends: for depend in rdepends:
split_depend = depend.split(' (') split_depend = depend.split(' (')
name = split_depend[0].strip() name = split_depend[0].strip()
func(rreclist, name) func(rreclist, name)
bb.data.setVar('RRECOMMENDS_%s' % pkg, ' '.join(rreclist), d) bb.data.setVar('RRECOMMENDS_%s' % pkg, ' '.join(rreclist), d)
def packaged(pkg, d): def packaged(pkg, d):
return os.access(bb.data.expand('${STAGING_DIR}/pkgdata/runtime/%s.packaged' % pkg, d), os.R_OK) return os.access(bb.data.expand('${STAGING_DIR}/pkgdata/runtime/%s.packaged' % pkg, d), os.R_OK)
for pkg in packages.split(): for pkg in packages.split():
for postfix in postfixes: for postfix in postfixes:
def func(list, name): def func(list, name):
pkg = '%s%s' % (name, postfix) pkg = '%s%s' % (name, postfix)
if packaged(pkg, d): if packaged(pkg, d):
list.append(pkg) list.append(pkg)
base = pkg[:-len(postfix)] base = pkg[:-len(postfix)]
if pkg.endswith(postfix): if pkg.endswith(postfix):
pkg_addrrecs(pkg, base, func, d) pkg_addrrecs(pkg, base, func, d)
continue continue
for prefix in prefixes: for prefix in prefixes:
def func(list, name): def func(list, name):
pkg = '%s%s' % (prefix, name) pkg = '%s%s' % (prefix, name)
if packaged(pkg, d): if packaged(pkg, d):
list.append(pkg) list.append(pkg)
base = pkg[len(prefix):] base = pkg[len(prefix):]
if pkg.startswith(prefix): if pkg.startswith(prefix):
pkg_addrrecs(pkg, base, func, d) pkg_addrrecs(pkg, base, func, d)
} }
PACKAGEFUNCS ?= "package_do_split_locales \ PACKAGEFUNCS ?= "package_do_split_locales \
populate_packages \ populate_packages \
package_do_shlibs \ package_do_shlibs \