summaryrefslogtreecommitdiffstats
path: root/meta/classes/package.bbclass
diff options
context:
space:
mode:
Diffstat (limited to 'meta/classes/package.bbclass')
-rw-r--r--meta/classes/package.bbclass132
1 files changed, 69 insertions, 63 deletions
diff --git a/meta/classes/package.bbclass b/meta/classes/package.bbclass
index a429e43c44..603f79895d 100644
--- a/meta/classes/package.bbclass
+++ b/meta/classes/package.bbclass
@@ -111,6 +111,8 @@ def do_split_packages(d, root, file_regex, output_pattern, description, postinst
111 111
112#PACKAGE_DEPENDS ?= "file-native" 112#PACKAGE_DEPENDS ?= "file-native"
113#DEPENDS_prepend =+ "${PACKAGE_DEPENDS} " 113#DEPENDS_prepend =+ "${PACKAGE_DEPENDS} "
114# file(1) output to match to consider a file an unstripped executable
115FILE_UNSTRIPPED_MATCH ?= "not stripped"
114#FIXME: this should be "" when any errors are gone! 116#FIXME: this should be "" when any errors are gone!
115IGNORE_STRIP_ERRORS ?= "1" 117IGNORE_STRIP_ERRORS ?= "1"
116 118
@@ -120,12 +122,13 @@ runstrip() {
120 # is necessary for this stuff to work, hence the addition to PACKAGES_DEPENDS 122 # is necessary for this stuff to work, hence the addition to PACKAGES_DEPENDS
121 123
122 local ro st 124 local ro st
125
123 st=0 126 st=0
124 if { file "$1" || { 127 if { file "$1" || {
125 oewarn "file $1: failed (forced strip)" >&2 128 oewarn "file $1: failed (forced strip)" >&2
126 echo 'not stripped' 129 echo '${FILE_UNSTRIPPED_MATCH}'
127 } 130 }
128 } | grep -q 'not stripped' 131 } | grep -q '${FILE_UNSTRIPPED_MATCH}'
129 then 132 then
130 oenote "${STRIP} $1" 133 oenote "${STRIP} $1"
131 ro= 134 ro=
@@ -133,7 +136,7 @@ runstrip() {
133 ro=1 136 ro=1
134 chmod +w "$1" 137 chmod +w "$1"
135 } 138 }
136 mkdir $(dirname "$1")/.debug 139 mkdir -p $(dirname "$1")/.debug
137 debugfile="$(dirname "$1")/.debug/$(basename "$1")" 140 debugfile="$(dirname "$1")/.debug/$(basename "$1")"
138 '${OBJCOPY}' --only-keep-debug "$1" "$debugfile" 141 '${OBJCOPY}' --only-keep-debug "$1" "$debugfile"
139 '${STRIP}' "$1" 142 '${STRIP}' "$1"
@@ -324,19 +327,23 @@ python populate_packages () {
324 return (s[stat.ST_MODE] & stat.S_IEXEC) 327 return (s[stat.ST_MODE] & stat.S_IEXEC)
325 328
326 # Sanity check PACKAGES for duplicates - should be moved to 329 # Sanity check PACKAGES for duplicates - should be moved to
327 # sanity.bbclass once we have he infrastucture 330 # sanity.bbclass once we have the infrastucture
328 pkgs = [] 331 package_list = []
329 for pkg in packages.split(): 332 for pkg in packages.split():
330 if pkg in pkgs: 333 if pkg in package_list:
331 bb.error("%s is listed in PACKAGES mutliple times. Undefined behaviour will result." % pkg) 334 bb.error("-------------------")
332 pkgs += pkg 335 bb.error("%s is listed in PACKAGES mutliple times, this leads to packaging errors." % pkg)
336 bb.error("Please fix the metadata/report this as bug to OE bugtracker.")
337 bb.error("-------------------")
338 else:
339 package_list.append(pkg)
333 340
334 if (bb.data.getVar('INHIBIT_PACKAGE_STRIP', d, 1) != '1'): 341 if (bb.data.getVar('INHIBIT_PACKAGE_STRIP', d, 1) != '1'):
335 stripfunc = "" 342 stripfunc = ""
336 for root, dirs, files in os.walk(dvar): 343 for root, dirs, files in os.walk(dvar):
337 for f in files: 344 for f in files:
338 file = os.path.join(root, f) 345 file = os.path.join(root, f)
339 if not os.path.islink(file) and isexec(file): 346 if not os.path.islink(file) and not os.path.isdir(file) and isexec(file):
340 stripfunc += "\trunstrip %s || st=1\n" % (file) 347 stripfunc += "\trunstrip %s || st=1\n" % (file)
341 if not stripfunc == "": 348 if not stripfunc == "":
342 from bb import build 349 from bb import build
@@ -346,7 +353,7 @@ python populate_packages () {
346 bb.data.setVarFlag('RUNSTRIP', 'func', 1, localdata) 353 bb.data.setVarFlag('RUNSTRIP', 'func', 1, localdata)
347 bb.build.exec_func('RUNSTRIP', localdata) 354 bb.build.exec_func('RUNSTRIP', localdata)
348 355
349 for pkg in packages.split(): 356 for pkg in package_list:
350 localdata = bb.data.createCopy(d) 357 localdata = bb.data.createCopy(d)
351 root = os.path.join(workdir, "install", pkg) 358 root = os.path.join(workdir, "install", pkg)
352 359
@@ -405,7 +412,7 @@ python populate_packages () {
405 412
406 bb.build.exec_func("package_name_hook", d) 413 bb.build.exec_func("package_name_hook", d)
407 414
408 for pkg in packages.split(): 415 for pkg in package_list:
409 pkgname = bb.data.getVar('PKG_%s' % pkg, d, 1) 416 pkgname = bb.data.getVar('PKG_%s' % pkg, d, 1)
410 if pkgname is None: 417 if pkgname is None:
411 bb.data.setVar('PKG_%s' % pkg, pkg, d) 418 bb.data.setVar('PKG_%s' % pkg, pkg, d)
@@ -414,7 +421,7 @@ python populate_packages () {
414 421
415 dangling_links = {} 422 dangling_links = {}
416 pkg_files = {} 423 pkg_files = {}
417 for pkg in packages.split(): 424 for pkg in package_list:
418 dangling_links[pkg] = [] 425 dangling_links[pkg] = []
419 pkg_files[pkg] = [] 426 pkg_files[pkg] = []
420 inst_root = os.path.join(workdir, "install", pkg) 427 inst_root = os.path.join(workdir, "install", pkg)
@@ -433,12 +440,12 @@ python populate_packages () {
433 target = os.path.join(root[len(inst_root):], target) 440 target = os.path.join(root[len(inst_root):], target)
434 dangling_links[pkg].append(os.path.normpath(target)) 441 dangling_links[pkg].append(os.path.normpath(target))
435 442
436 for pkg in packages.split(): 443 for pkg in package_list:
437 rdepends = explode_deps(bb.data.getVar('RDEPENDS_' + pkg, d, 1) or bb.data.getVar('RDEPENDS', d, 1) or "") 444 rdepends = explode_deps(bb.data.getVar('RDEPENDS_' + pkg, d, 1) or bb.data.getVar('RDEPENDS', d, 1) or "")
438 for l in dangling_links[pkg]: 445 for l in dangling_links[pkg]:
439 found = False 446 found = False
440 bb.debug(1, "%s contains dangling link %s" % (pkg, l)) 447 bb.debug(1, "%s contains dangling link %s" % (pkg, l))
441 for p in packages.split(): 448 for p in package_list:
442 for f in pkg_files[p]: 449 for f in pkg_files[p]:
443 if f == l: 450 if f == l:
444 found = True 451 found = True
@@ -773,56 +780,55 @@ python read_shlibdeps () {
773} 780}
774 781
775python package_depchains() { 782python package_depchains() {
776 """ 783 """
777 For a given set of prefix and postfix modifiers, make those packages 784 For a given set of prefix and postfix modifiers, make those packages
778 RRECOMMENDS on the corresponding packages for its DEPENDS. 785 RRECOMMENDS on the corresponding packages for its DEPENDS.
779 786
780 Example: If package A depends upon package B, and A's .bb emits an 787 Example: If package A depends upon package B, and A's .bb emits an
781 A-dev package, this would make A-dev Recommends: B-dev. 788 A-dev package, this would make A-dev Recommends: B-dev.
782 """ 789 """
783
784 packages = bb.data.getVar('PACKAGES', d, 1)
785 postfixes = (bb.data.getVar('DEPCHAIN_POST', d, 1) or '').split()
786 prefixes = (bb.data.getVar('DEPCHAIN_PRE', d, 1) or '').split()
787
788 def pkg_addrrecs(pkg, base, func, d):
789 rdepends = explode_deps(bb.data.getVar('RDEPENDS_' + base, d, 1) or bb.data.getVar('RDEPENDS', d, 1) or "")
790 # bb.note('rdepends for %s is %s' % (base, rdepends))
791 rreclist = []
792
793 for depend in rdepends:
794 split_depend = depend.split(' (')
795 name = split_depend[0].strip()
796 func(rreclist, name)
797
798 bb.data.setVar('RRECOMMENDS_%s' % pkg, ' '.join(rreclist), d)
799
800 def packaged(pkg, d):
801 return os.access(bb.data.expand('${STAGING_DIR}/pkgdata/runtime/%s.packaged' % pkg, d), os.R_OK)
802
803 for pkg in packages.split():
804 for postfix in postfixes:
805 def func(list, name):
806 pkg = '%s%s' % (name, postfix)
807 if packaged(pkg, d):
808 list.append(pkg)
809
810 base = pkg[:-len(postfix)]
811 if pkg.endswith(postfix):
812 pkg_addrrecs(pkg, base, func, d)
813 continue
814
815 for prefix in prefixes:
816 def func(list, name):
817 pkg = '%s%s' % (prefix, name)
818 if packaged(pkg, d):
819 list.append(pkg)
820
821 base = pkg[len(prefix):]
822 if pkg.startswith(prefix):
823 pkg_addrrecs(pkg, base, func, d)
824}
825 790
791 packages = bb.data.getVar('PACKAGES', d, 1)
792 postfixes = (bb.data.getVar('DEPCHAIN_POST', d, 1) or '').split()
793 prefixes = (bb.data.getVar('DEPCHAIN_PRE', d, 1) or '').split()
794
795 def pkg_addrrecs(pkg, base, func, d):
796 rdepends = explode_deps(bb.data.getVar('RDEPENDS_' + base, d, 1) or bb.data.getVar('RDEPENDS', d, 1) or "")
797 # bb.note('rdepends for %s is %s' % (base, rdepends))
798 rreclist = []
799
800 for depend in rdepends:
801 split_depend = depend.split(' (')
802 name = split_depend[0].strip()
803 func(rreclist, name)
804
805 bb.data.setVar('RRECOMMENDS_%s' % pkg, ' '.join(rreclist), d)
806
807 def packaged(pkg, d):
808 return os.access(bb.data.expand('${STAGING_DIR}/pkgdata/runtime/%s.packaged' % pkg, d), os.R_OK)
809
810 for pkg in packages.split():
811 for postfix in postfixes:
812 def func(list, name):
813 pkg = '%s%s' % (name, postfix)
814 if packaged(pkg, d):
815 list.append(pkg)
816
817 base = pkg[:-len(postfix)]
818 if pkg.endswith(postfix):
819 pkg_addrrecs(pkg, base, func, d)
820 continue
821
822 for prefix in prefixes:
823 def func(list, name):
824 pkg = '%s%s' % (prefix, name)
825 if packaged(pkg, d):
826 list.append(pkg)
827
828 base = pkg[len(prefix):]
829 if pkg.startswith(prefix):
830 pkg_addrrecs(pkg, base, func, d)
831}
826 832
827 833
828PACKAGEFUNCS ?= "package_do_split_locales \ 834PACKAGEFUNCS ?= "package_do_split_locales \