2 # General packaging help functions
5 def legitimize_package_name(s):
7 Make sure package names are legitimate strings
14 return ('\u%s' % cp).decode('unicode_escape').encode('utf-8')
16 # Handle unicode codepoints encoded as <U0123>, as in glibc locale files.
17 s = re.sub('<U([0-9A-Fa-f]{1,4})>', fixutf, s)
19 # Remaining package name validity fixes
20 return s.lower().replace('_', '-').replace('@', '+').replace(',', '+').replace('/', '-')
22 def do_split_packages(d, root, file_regex, output_pattern, description, postinst=None, recursive=False, hook=None, extra_depends=None, aux_files_pattern=None, postrm=None, allow_dirs=False, prepend=False, match_path=False, aux_files_pattern_verbatim=None):
24 Used in .bb files to split up dynamically generated subpackages of a
25 given package, usually plugins or modules.
27 import os, os.path, bb
29 dvar = bb.data.getVar('D', d, 1)
31 bb.error("D not defined")
34 packages = bb.data.getVar('PACKAGES', d, 1).split()
40 postinst = '#!/bin/sh\n' + postinst + '\n'
42 postrm = '#!/bin/sh\n' + postrm + '\n'
44 objs = os.listdir(dvar + root)
47 for walkroot, dirs, files in os.walk(dvar + root):
49 relpath = os.path.join(walkroot, file).replace(dvar + root + '/', '', 1)
53 if extra_depends == None:
54 # This is *really* broken
56 # At least try and patch it up I guess...
57 if mainpkg.find('-dbg'):
58 mainpkg = mainpkg.replace('-dbg', '')
59 if mainpkg.find('-dev'):
60 mainpkg = mainpkg.replace('-dev', '')
61 extra_depends = mainpkg
66 m = re.match(file_regex, o)
68 m = re.match(file_regex, os.path.basename(o))
72 f = os.path.join(dvar + root, o)
73 mode = os.lstat(f).st_mode
74 if not (stat.S_ISREG(mode) or (allow_dirs and stat.S_ISDIR(mode))):
76 on = legitimize_package_name(m.group(1))
77 pkg = output_pattern % on
78 if not pkg in packages:
80 packages = [pkg] + packages
83 the_files = [os.path.join(root, o)]
85 if type(aux_files_pattern) is list:
86 for fp in aux_files_pattern:
87 the_files.append(fp % on)
89 the_files.append(aux_files_pattern % on)
90 if aux_files_pattern_verbatim:
91 if type(aux_files_pattern_verbatim) is list:
92 for fp in aux_files_pattern_verbatim:
93 the_files.append(fp % m.group(1))
95 the_files.append(aux_files_pattern_verbatim % m.group(1))
96 bb.data.setVar('FILES_' + pkg, " ".join(the_files), d)
97 if extra_depends != '':
98 the_depends = bb.data.getVar('RDEPENDS_' + pkg, d, 1)
100 the_depends = '%s %s' % (the_depends, extra_depends)
102 the_depends = extra_depends
103 bb.data.setVar('RDEPENDS_' + pkg, the_depends, d)
104 bb.data.setVar('DESCRIPTION_' + pkg, description % on, d)
106 bb.data.setVar('pkg_postinst_' + pkg, postinst, d)
108 bb.data.setVar('pkg_postrm_' + pkg, postrm, d)
110 oldfiles = bb.data.getVar('FILES_' + pkg, d, 1)
112 bb.fatal("Package '%s' exists but has no files" % pkg)
113 bb.data.setVar('FILES_' + pkg, oldfiles + " " + os.path.join(root, o), d)
115 hook(f, pkg, file_regex, output_pattern, m.group(1))
117 bb.data.setVar('PACKAGES', ' '.join(packages), d)
119 PACKAGE_DEPENDS ?= "file-native"
120 DEPENDS_prepend =+ "${PACKAGE_DEPENDS} "
121 # file(1) output to match to consider a file an unstripped executable
122 FILE_UNSTRIPPED_MATCH ?= "not stripped"
123 #FIXME: this should be "" when any errors are gone!
124 IGNORE_STRIP_ERRORS ?= "1"
127 # Function to strip a single file, called from RUNSTRIP in populate_packages below
128 # A working 'file' (one which works on the target architecture)
129 # is necessary for this stuff to work, hence the addition to PACKAGES_DEPENDS
135 oewarn "file $1: failed (forced strip)" >&2
136 echo '${FILE_UNSTRIPPED_MATCH}'
138 } | grep -q '${FILE_UNSTRIPPED_MATCH}'
146 mkdir -p $(dirname "$1")/.debug
147 debugfile="$(dirname "$1")/.debug/$(basename "$1")"
148 '${OBJCOPY}' --only-keep-debug "$1" "$debugfile"
151 '${OBJCOPY}' --add-gnu-debuglink="$debugfile" "$1"
152 test -n "$ro" && chmod -w "$1"
155 oewarn "runstrip: ${STRIP} $1: strip failed" >&2
156 if [ x${IGNORE_STRIP_ERRORS} == x1 ]
158 #FIXME: remove this, it's for error detection
159 if file "$1" 2>/dev/null >&2
161 (oefatal "${STRIP} $1: command failed" >/dev/tty)
163 (oefatal "file $1: command failed" >/dev/tty)
169 oenote "runstrip: skip $1"
176 # Package data handling routines
179 STAGING_PKGMAPS_DIR ?= "${STAGING_DIR}/pkgmaps"
181 def add_package_mapping (pkg, new_name, d):
186 c = codecs.getencoder("string_escape")
189 pmap_dir = bb.data.getVar('STAGING_PKGMAPS_DIR', d, 1)
191 bb.mkdirhier(pmap_dir)
193 data_file = os.path.join(pmap_dir, pkg)
195 f = open(data_file, 'w')
196 f.write("%s\n" % encode(new_name))
199 def get_package_mapping (pkg, d):
204 c = codecs.getdecoder("string_escape")
207 data_file = bb.data.expand("${STAGING_PKGMAPS_DIR}/%s" % pkg, d)
209 if os.access(data_file, os.R_OK):
210 f = file(data_file, 'r')
211 lines = f.readlines()
214 return decode(l).strip()
217 def runtime_mapping_rename (varname, d):
220 #bb.note("%s before: %s" % (varname, bb.data.getVar(varname, d, 1)))
223 for depend in explode_deps(bb.data.getVar(varname, d, 1) or ""):
224 # Have to be careful with any version component of the depend
225 split_depend = depend.split(' (')
226 new_depend = get_package_mapping(split_depend[0].strip(), d)
227 if len(split_depend) > 1:
228 new_depends.append("%s (%s" % (new_depend, split_depend[1]))
230 new_depends.append(new_depend)
232 bb.data.setVar(varname, " ".join(new_depends) or None, d)
234 #bb.note("%s after: %s" % (varname, bb.data.getVar(varname, d, 1)))
237 # Package functions suitable for inclusion in PACKAGEFUNCS
240 python package_do_split_locales() {
243 if (bb.data.getVar('PACKAGE_NO_LOCALE', d, 1) == '1'):
244 bb.debug(1, "package requested not splitting locales")
247 packages = (bb.data.getVar('PACKAGES', d, 1) or "").split()
249 bb.debug(1, "no packages to build; not splitting locales")
252 datadir = bb.data.getVar('datadir', d, 1)
254 bb.note("datadir not defined")
257 dvar = bb.data.getVar('D', d, 1)
259 bb.error("D not defined")
262 pn = bb.data.getVar('PN', d, 1)
264 bb.error("PN not defined")
267 if pn + '-locale' in packages:
268 packages.remove(pn + '-locale')
270 localedir = os.path.join(dvar + datadir, 'locale')
272 if not os.path.isdir(localedir):
273 bb.debug(1, "No locale files in this package")
276 locales = os.listdir(localedir)
278 # This is *really* broken
279 mainpkg = packages[0]
280 # At least try and patch it up I guess...
281 if mainpkg.find('-dbg'):
282 mainpkg = mainpkg.replace('-dbg', '')
283 if mainpkg.find('-dev'):
284 mainpkg = mainpkg.replace('-dev', '')
287 ln = legitimize_package_name(l)
288 pkg = pn + '-locale-' + ln
290 bb.data.setVar('FILES_' + pkg, os.path.join(datadir, 'locale', l), d)
291 bb.data.setVar('RDEPENDS_' + pkg, '%s virtual-locale-%s' % (mainpkg, ln), d)
292 bb.data.setVar('RPROVIDES_' + pkg, '%s-locale %s-translation' % (pn, ln), d)
293 bb.data.setVar('DESCRIPTION_' + pkg, '%s translation for %s' % (l, pn), d)
295 bb.data.setVar('PACKAGES', ' '.join(packages), d)
297 rdep = (bb.data.getVar('RDEPENDS_%s' % mainpkg, d, 1) or bb.data.getVar('RDEPENDS', d, 1) or "").split()
298 rdep.append('%s-locale*' % pn)
299 bb.data.setVar('RDEPENDS_%s' % mainpkg, ' '.join(rdep), d)
302 python populate_packages () {
303 import glob, stat, errno, re
305 workdir = bb.data.getVar('WORKDIR', d, 1)
307 bb.error("WORKDIR not defined, unable to package")
310 import os # path manipulations
311 outdir = bb.data.getVar('DEPLOY_DIR', d, 1)
313 bb.error("DEPLOY_DIR not defined, unable to package")
317 dvar = bb.data.getVar('D', d, 1)
319 bb.error("D not defined, unable to package")
323 packages = bb.data.getVar('PACKAGES', d, 1)
325 bb.debug(1, "PACKAGES not defined, nothing to package")
328 pn = bb.data.getVar('PN', d, 1)
330 bb.error("PN not defined")
338 except (os.error, AttributeError):
340 return (s[stat.ST_MODE] & stat.S_IEXEC)
342 # Sanity check PACKAGES for duplicates - should be moved to
343 # sanity.bbclass once we have the infrastucture
345 for pkg in packages.split():
346 if pkg in package_list:
347 bb.error("-------------------")
348 bb.error("%s is listed in PACKAGES mutliple times, this leads to packaging errors." % pkg)
349 bb.error("Please fix the metadata/report this as bug to OE bugtracker.")
350 bb.error("-------------------")
352 package_list.append(pkg)
354 if (bb.data.getVar('INHIBIT_PACKAGE_STRIP', d, 1) != '1'):
356 for root, dirs, files in os.walk(dvar):
358 file = os.path.join(root, f)
359 if not os.path.islink(file) and not os.path.isdir(file) and isexec(file):
360 stripfunc += "\trunstrip %s || st=1\n" % (file)
361 if not stripfunc == "":
363 localdata = bb.data.createCopy(d)
365 bb.data.setVar('RUNSTRIP', '\tlocal st\n\tst=0\n%s\treturn $st' % stripfunc, localdata)
366 bb.data.setVarFlag('RUNSTRIP', 'func', 1, localdata)
367 bb.build.exec_func('RUNSTRIP', localdata)
369 for pkg in package_list:
370 localdata = bb.data.createCopy(d)
371 root = os.path.join(workdir, "install", pkg)
373 os.system('rm -rf %s' % root)
375 bb.data.setVar('ROOT', '', localdata)
376 bb.data.setVar('ROOT_%s' % pkg, root, localdata)
377 bb.data.setVar('PKG', pkg, localdata)
379 overrides = bb.data.getVar('OVERRIDES', localdata, 1)
381 raise bb.build.FuncFailed('OVERRIDES not defined')
382 bb.data.setVar('OVERRIDES', overrides+':'+pkg, localdata)
384 bb.data.update_data(localdata)
386 root = bb.data.getVar('ROOT', localdata, 1)
388 filesvar = bb.data.getVar('FILES', localdata, 1) or ""
389 files = filesvar.split()
391 if os.path.isabs(file):
393 if not os.path.islink(file):
394 if os.path.isdir(file):
395 newfiles = [ os.path.join(file,x) for x in os.listdir(file) ]
399 globbed = glob.glob(file)
401 if [ file ] != globbed:
404 if (not os.path.islink(file)) and (not os.path.exists(file)):
406 fpath = os.path.join(root,file)
407 dpath = os.path.dirname(fpath)
409 ret = bb.movefile(file,fpath)
410 if ret is None or ret == 0:
411 raise bb.build.FuncFailed("File population failed")
416 for root, dirs, files in os.walk(dvar):
418 path = os.path.join(root[len(dvar):], f)
419 unshipped.append(path)
422 bb.note("the following files were installed but not shipped in any package:")
426 bb.build.exec_func("package_name_hook", d)
428 for pkg in package_list:
429 pkgname = bb.data.getVar('PKG_%s' % pkg, d, 1)
431 bb.data.setVar('PKG_%s' % pkg, pkg, d)
433 add_package_mapping(pkg, pkgname, d)
437 for pkg in package_list:
438 dangling_links[pkg] = []
440 inst_root = os.path.join(workdir, "install", pkg)
441 for root, dirs, files in os.walk(inst_root):
443 path = os.path.join(root, f)
444 rpath = path[len(inst_root):]
445 pkg_files[pkg].append(rpath)
448 except OSError, (err, strerror):
449 if err != errno.ENOENT:
451 target = os.readlink(path)
453 target = os.path.join(root[len(inst_root):], target)
454 dangling_links[pkg].append(os.path.normpath(target))
456 for pkg in package_list:
457 rdepends = explode_deps(bb.data.getVar('RDEPENDS_' + pkg, d, 1) or bb.data.getVar('RDEPENDS', d, 1) or "")
458 for l in dangling_links[pkg]:
460 bb.debug(1, "%s contains dangling link %s" % (pkg, l))
461 for p in package_list:
462 for f in pkg_files[p]:
465 bb.debug(1, "target found in %s" % p)
468 if not p in rdepends:
472 bb.note("%s contains dangling symlink to %s" % (pkg, l))
473 bb.data.setVar('RDEPENDS_' + pkg, " " + " ".join(rdepends), d)
475 populate_packages[dirs] = "${D}"
477 python emit_pkgdata() {
478 def write_if_exists(f, pkg, var):
481 c = codecs.getencoder("string_escape")
484 val = bb.data.getVar('%s_%s' % (var, pkg), d, 1)
486 f.write('%s_%s: %s\n' % (var, pkg, encode(val)))
488 packages = bb.data.getVar('PACKAGES', d, 1)
492 data_file = bb.data.expand("${STAGING_DIR}/pkgdata/${PN}", d)
493 f = open(data_file, 'w')
494 f.write("PACKAGES: %s\n" % packages)
497 for pkg in packages.split():
498 subdata_file = bb.data.expand("${STAGING_DIR}/pkgdata/runtime/%s" % pkg, d)
499 sf = open(subdata_file, 'w')
500 write_if_exists(sf, pkg, 'DESCRIPTION')
501 write_if_exists(sf, pkg, 'RDEPENDS')
502 write_if_exists(sf, pkg, 'RPROVIDES')
503 write_if_exists(sf, pkg, 'RRECOMMENDS')
504 write_if_exists(sf, pkg, 'RSUGGESTS')
505 write_if_exists(sf, pkg, 'RPROVIDES')
506 write_if_exists(sf, pkg, 'RREPLACES')
507 write_if_exists(sf, pkg, 'RCONFLICTS')
508 write_if_exists(sf, pkg, 'PKG')
509 write_if_exists(sf, pkg, 'ALLOW_EMPTY')
510 write_if_exists(sf, pkg, 'FILES')
511 write_if_exists(sf, pkg, 'pkg_postinst')
512 write_if_exists(sf, pkg, 'pkg_postrm')
513 write_if_exists(sf, pkg, 'pkg_preinst')
514 write_if_exists(sf, pkg, 'pkg_prerm')
517 emit_pkgdata[dirs] = "${STAGING_DIR}/pkgdata/runtime"
519 ldconfig_postinst_fragment() {
520 if [ x"$D" = "x" ]; then
525 python package_do_shlibs() {
526 import os, re, os.path
528 exclude_shlibs = bb.data.getVar('EXCLUDE_FROM_SHLIBS', d, 0)
530 bb.note("not generating shlibs")
533 lib_re = re.compile("^lib.*\.so")
534 libdir_re = re.compile(".*/lib$")
536 packages = bb.data.getVar('PACKAGES', d, 1)
538 bb.debug(1, "no packages to build; not calculating shlibs")
541 workdir = bb.data.getVar('WORKDIR', d, 1)
543 bb.error("WORKDIR not defined")
546 staging = bb.data.getVar('STAGING_DIR', d, 1)
548 bb.error("STAGING_DIR not defined")
551 ver = bb.data.getVar('PV', d, 1)
553 bb.error("PV not defined")
556 target_sys = bb.data.getVar('TARGET_SYS', d, 1)
558 bb.error("TARGET_SYS not defined")
561 shlibs_dir = os.path.join(staging, target_sys, "shlibs")
562 old_shlibs_dir = os.path.join(staging, "shlibs")
563 bb.mkdirhier(shlibs_dir)
566 for pkg in packages.split():
567 needs_ldconfig = False
568 bb.debug(2, "calculating shlib provides for %s" % pkg)
572 top = os.path.join(workdir, "install", pkg)
573 for root, dirs, files in os.walk(top):
576 path = os.path.join(root, file)
577 if os.access(path, os.X_OK) or lib_re.match(file):
578 cmd = (bb.data.getVar('BUILD_PREFIX', d, 1) or "") + "objdump -p " + path + " 2>/dev/null"
580 lines = fd.readlines()
583 m = re.match("\s+NEEDED\s+([^\s]*)", l)
585 needed[pkg].append(m.group(1))
586 m = re.match("\s+SONAME\s+([^\s]*)", l)
587 if m and not m.group(1) in sonames:
588 sonames.append(m.group(1))
589 if m and libdir_re.match(root):
590 needs_ldconfig = True
591 shlibs_file = os.path.join(shlibs_dir, pkg + ".list")
592 if os.path.exists(shlibs_file):
593 os.remove(shlibs_file)
594 shver_file = os.path.join(shlibs_dir, pkg + ".ver")
595 if os.path.exists(shver_file):
596 os.remove(shver_file)
598 fd = open(shlibs_file, 'w')
602 fd = open(shver_file, 'w')
606 bb.debug(1, 'adding ldconfig call to postinst for %s' % pkg)
607 postinst = bb.data.getVar('pkg_postinst_%s' % pkg, d, 1) or bb.data.getVar('pkg_postinst', d, 1)
609 postinst = '#!/bin/sh\n'
610 postinst += bb.data.getVar('ldconfig_postinst_fragment', d, 1)
611 bb.data.setVar('pkg_postinst_%s' % pkg, postinst, d)
614 list_re = re.compile('^(.*)\.list$')
615 for dir in [old_shlibs_dir, shlibs_dir]:
616 if not os.path.exists(dir):
618 for file in os.listdir(dir):
619 m = list_re.match(file)
622 fd = open(os.path.join(dir, file))
623 lines = fd.readlines()
625 ver_file = os.path.join(dir, dep_pkg + '.ver')
627 if os.path.exists(ver_file):
629 lib_ver = fd.readline().rstrip()
632 shlib_provider[l.rstrip()] = (dep_pkg, lib_ver)
635 for pkg in packages.split():
636 bb.debug(2, "calculating shlib requirements for %s" % pkg)
639 for n in needed[pkg]:
640 if n in shlib_provider.keys():
641 (dep_pkg, ver_needed) = shlib_provider[n]
647 dep = "%s (>= %s)" % (dep_pkg, ver_needed)
653 bb.note("Couldn't find shared library provider for %s" % n)
655 deps_file = os.path.join(workdir, "install", pkg + ".shlibdeps")
656 if os.path.exists(deps_file):
659 fd = open(deps_file, 'w')
665 python package_do_pkgconfig () {
668 packages = bb.data.getVar('PACKAGES', d, 1)
670 bb.debug(1, "no packages to build; not calculating pkgconfig dependencies")
673 workdir = bb.data.getVar('WORKDIR', d, 1)
675 bb.error("WORKDIR not defined")
678 staging = bb.data.getVar('STAGING_DIR', d, 1)
680 bb.error("STAGING_DIR not defined")
683 target_sys = bb.data.getVar('TARGET_SYS', d, 1)
685 bb.error("TARGET_SYS not defined")
688 shlibs_dir = os.path.join(staging, target_sys, "shlibs")
689 old_shlibs_dir = os.path.join(staging, "shlibs")
690 bb.mkdirhier(shlibs_dir)
692 pc_re = re.compile('(.*)\.pc$')
693 var_re = re.compile('(.*)=(.*)')
694 field_re = re.compile('(.*): (.*)')
696 pkgconfig_provided = {}
697 pkgconfig_needed = {}
698 for pkg in packages.split():
699 pkgconfig_provided[pkg] = []
700 pkgconfig_needed[pkg] = []
701 top = os.path.join(workdir, "install", pkg)
702 for root, dirs, files in os.walk(top):
704 m = pc_re.match(file)
708 pkgconfig_provided[pkg].append(name)
709 path = os.path.join(root, file)
710 if not os.access(path, os.R_OK):
713 lines = f.readlines()
720 bb.data.setVar(name, bb.data.expand(val, pd), pd)
722 m = field_re.match(l)
725 exp = bb.data.expand(m.group(2), pd)
726 if hdr == 'Requires':
727 pkgconfig_needed[pkg] += exp.replace(',', ' ').split()
729 for pkg in packages.split():
730 pkgs_file = os.path.join(shlibs_dir, pkg + ".pclist")
731 if os.path.exists(pkgs_file):
733 if pkgconfig_provided[pkg] != []:
734 f = open(pkgs_file, 'w')
735 for p in pkgconfig_provided[pkg]:
739 for dir in [old_shlibs_dir, shlibs_dir]:
740 if not os.path.exists(dir):
742 for file in os.listdir(dir):
743 m = re.match('^(.*)\.pclist$', file)
746 fd = open(os.path.join(dir, file))
747 lines = fd.readlines()
749 pkgconfig_provided[pkg] = []
751 pkgconfig_provided[pkg].append(l.rstrip())
753 for pkg in packages.split():
755 for n in pkgconfig_needed[pkg]:
757 for k in pkgconfig_provided.keys():
758 if n in pkgconfig_provided[k]:
759 if k != pkg and not (k in deps):
763 bb.note("couldn't find pkgconfig module '%s' in any package" % n)
764 deps_file = os.path.join(workdir, "install", pkg + ".pcdeps")
765 if os.path.exists(deps_file):
768 fd = open(deps_file, 'w')
774 python read_shlibdeps () {
775 packages = (bb.data.getVar('PACKAGES', d, 1) or "").split()
777 rdepends = explode_deps(bb.data.getVar('RDEPENDS_' + pkg, d, 0) or bb.data.getVar('RDEPENDS', d, 0) or "")
778 shlibsfile = bb.data.expand("${WORKDIR}/install/" + pkg + ".shlibdeps", d)
779 if os.access(shlibsfile, os.R_OK):
780 fd = file(shlibsfile)
781 lines = fd.readlines()
784 rdepends.append(l.rstrip())
785 pcfile = bb.data.expand("${WORKDIR}/install/" + pkg + ".pcdeps", d)
786 if os.access(pcfile, os.R_OK):
788 lines = fd.readlines()
791 rdepends.append(l.rstrip())
792 bb.data.setVar('RDEPENDS_' + pkg, " " + " ".join(rdepends), d)
795 python package_depchains() {
797 For a given set of prefix and postfix modifiers, make those packages
798 RRECOMMENDS on the corresponding packages for its DEPENDS.
800 Example: If package A depends upon package B, and A's .bb emits an
801 A-dev package, this would make A-dev Recommends: B-dev.
804 packages = bb.data.getVar('PACKAGES', d, 1)
805 postfixes = (bb.data.getVar('DEPCHAIN_POST', d, 1) or '').split()
806 prefixes = (bb.data.getVar('DEPCHAIN_PRE', d, 1) or '').split()
808 def pkg_addrrecs(pkg, base, func, d):
809 rdepends = explode_deps(bb.data.getVar('RDEPENDS_' + base, d, 1) or bb.data.getVar('RDEPENDS', d, 1) or "")
810 # bb.note('rdepends for %s is %s' % (base, rdepends))
811 rreclist = explode_deps(bb.data.getVar('RRECOMMENDS_' + pkg, d, 1) or bb.data.getVar('RRECOMMENDS', d, 1) or "")
813 for depend in rdepends:
814 split_depend = depend.split(' (')
815 name = split_depend[0].strip()
818 bb.data.setVar('RRECOMMENDS_%s' % pkg, ' '.join(rreclist), d)
820 def packaged(pkg, d):
821 return os.access(bb.data.expand('${STAGING_DIR}/pkgdata/runtime/%s.packaged' % pkg, d), os.R_OK)
823 for pkg in packages.split():
824 for postfix in postfixes:
825 def func(list, name):
826 pkg = '%s%s' % (name, postfix)
831 base = pkg[:-len(postfix)]
832 if pkg.endswith(postfix):
833 pkg_addrrecs(pkg, base, func, d)
836 for prefix in prefixes:
837 def func(list, name):
838 pkg = '%s%s' % (prefix, name)
843 base = pkg[len(prefix):]
844 if pkg.startswith(prefix):
845 pkg_addrrecs(pkg, base, func, d)
849 PACKAGEFUNCS ?= "package_do_split_locales \
852 package_do_pkgconfig \
857 python package_do_package () {
858 for f in (bb.data.getVar('PACKAGEFUNCS', d, 1) or '').split():
859 bb.build.exec_func(f, d)
861 # shlibs requires any DEPENDS to have already packaged for the *.list files
862 do_package[deptask] = "do_package"
863 do_package[dirs] = "${D}"
864 addtask package before do_build after do_install
868 PACKAGE_WRITE_FUNCS ?= "read_subpackage_metadata"
870 python package_do_package_write () {
871 for f in (bb.data.getVar('PACKAGE_WRITE_FUNCS', d, 1) or '').split():
872 bb.build.exec_func(f, d)
874 do_package_write[dirs] = "${D}"
875 addtask package_write before do_build after do_package
878 EXPORT_FUNCTIONS do_package do_package_write
882 # Helper functions for the package writing classes
885 python package_mapping_rename_hook () {
887 Rewrite variables to account for package renaming in things
888 like debian.bbclass or manual PKG variable name changes
890 runtime_mapping_rename("RDEPENDS", d)
891 runtime_mapping_rename("RRECOMMENDS", d)
892 runtime_mapping_rename("RSUGGESTS", d)
893 runtime_mapping_rename("RPROVIDES", d)
894 runtime_mapping_rename("RREPLACES", d)
895 runtime_mapping_rename("RCONFLICTS", d)
898 EXPORT_FUNCTIONS mapping_rename_hook