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('OBJDUMP', d, 1) + " -p " + path + " 2>/dev/null"
579 cmd = "PATH=\"%s\" %s" % (bb.data.getVar('PATH', d, 1), cmd)
581 lines = fd.readlines()
584 m = re.match("\s+NEEDED\s+([^\s]*)", l)
586 needed[pkg].append(m.group(1))
587 m = re.match("\s+SONAME\s+([^\s]*)", l)
588 if m and not m.group(1) in sonames:
589 sonames.append(m.group(1))
590 if m and libdir_re.match(root):
591 needs_ldconfig = True
592 shlibs_file = os.path.join(shlibs_dir, pkg + ".list")
593 if os.path.exists(shlibs_file):
594 os.remove(shlibs_file)
595 shver_file = os.path.join(shlibs_dir, pkg + ".ver")
596 if os.path.exists(shver_file):
597 os.remove(shver_file)
599 fd = open(shlibs_file, 'w')
603 fd = open(shver_file, 'w')
607 bb.debug(1, 'adding ldconfig call to postinst for %s' % pkg)
608 postinst = bb.data.getVar('pkg_postinst_%s' % pkg, d, 1) or bb.data.getVar('pkg_postinst', d, 1)
610 postinst = '#!/bin/sh\n'
611 postinst += bb.data.getVar('ldconfig_postinst_fragment', d, 1)
612 bb.data.setVar('pkg_postinst_%s' % pkg, postinst, d)
615 list_re = re.compile('^(.*)\.list$')
616 for dir in [old_shlibs_dir, shlibs_dir]:
617 if not os.path.exists(dir):
619 for file in os.listdir(dir):
620 m = list_re.match(file)
623 fd = open(os.path.join(dir, file))
624 lines = fd.readlines()
626 ver_file = os.path.join(dir, dep_pkg + '.ver')
628 if os.path.exists(ver_file):
630 lib_ver = fd.readline().rstrip()
633 shlib_provider[l.rstrip()] = (dep_pkg, lib_ver)
636 for pkg in packages.split():
637 bb.debug(2, "calculating shlib requirements for %s" % pkg)
640 for n in needed[pkg]:
641 if n in shlib_provider.keys():
642 (dep_pkg, ver_needed) = shlib_provider[n]
648 dep = "%s (>= %s)" % (dep_pkg, ver_needed)
654 bb.note("Couldn't find shared library provider for %s" % n)
656 deps_file = os.path.join(workdir, "install", pkg + ".shlibdeps")
657 if os.path.exists(deps_file):
660 fd = open(deps_file, 'w')
666 python package_do_pkgconfig () {
669 packages = bb.data.getVar('PACKAGES', d, 1)
671 bb.debug(1, "no packages to build; not calculating pkgconfig dependencies")
674 workdir = bb.data.getVar('WORKDIR', d, 1)
676 bb.error("WORKDIR not defined")
679 staging = bb.data.getVar('STAGING_DIR', d, 1)
681 bb.error("STAGING_DIR not defined")
684 target_sys = bb.data.getVar('TARGET_SYS', d, 1)
686 bb.error("TARGET_SYS not defined")
689 shlibs_dir = os.path.join(staging, target_sys, "shlibs")
690 old_shlibs_dir = os.path.join(staging, "shlibs")
691 bb.mkdirhier(shlibs_dir)
693 pc_re = re.compile('(.*)\.pc$')
694 var_re = re.compile('(.*)=(.*)')
695 field_re = re.compile('(.*): (.*)')
697 pkgconfig_provided = {}
698 pkgconfig_needed = {}
699 for pkg in packages.split():
700 pkgconfig_provided[pkg] = []
701 pkgconfig_needed[pkg] = []
702 top = os.path.join(workdir, "install", pkg)
703 for root, dirs, files in os.walk(top):
705 m = pc_re.match(file)
709 pkgconfig_provided[pkg].append(name)
710 path = os.path.join(root, file)
711 if not os.access(path, os.R_OK):
714 lines = f.readlines()
721 bb.data.setVar(name, bb.data.expand(val, pd), pd)
723 m = field_re.match(l)
726 exp = bb.data.expand(m.group(2), pd)
727 if hdr == 'Requires':
728 pkgconfig_needed[pkg] += exp.replace(',', ' ').split()
730 for pkg in packages.split():
731 pkgs_file = os.path.join(shlibs_dir, pkg + ".pclist")
732 if os.path.exists(pkgs_file):
734 if pkgconfig_provided[pkg] != []:
735 f = open(pkgs_file, 'w')
736 for p in pkgconfig_provided[pkg]:
740 for dir in [old_shlibs_dir, shlibs_dir]:
741 if not os.path.exists(dir):
743 for file in os.listdir(dir):
744 m = re.match('^(.*)\.pclist$', file)
747 fd = open(os.path.join(dir, file))
748 lines = fd.readlines()
750 pkgconfig_provided[pkg] = []
752 pkgconfig_provided[pkg].append(l.rstrip())
754 for pkg in packages.split():
756 for n in pkgconfig_needed[pkg]:
758 for k in pkgconfig_provided.keys():
759 if n in pkgconfig_provided[k]:
760 if k != pkg and not (k in deps):
764 bb.note("couldn't find pkgconfig module '%s' in any package" % n)
765 deps_file = os.path.join(workdir, "install", pkg + ".pcdeps")
766 if os.path.exists(deps_file):
769 fd = open(deps_file, 'w')
775 python read_shlibdeps () {
776 packages = (bb.data.getVar('PACKAGES', d, 1) or "").split()
778 rdepends = explode_deps(bb.data.getVar('RDEPENDS_' + pkg, d, 0) or bb.data.getVar('RDEPENDS', d, 0) or "")
779 shlibsfile = bb.data.expand("${WORKDIR}/install/" + pkg + ".shlibdeps", d)
780 if os.access(shlibsfile, os.R_OK):
781 fd = file(shlibsfile)
782 lines = fd.readlines()
785 rdepends.append(l.rstrip())
786 pcfile = bb.data.expand("${WORKDIR}/install/" + pkg + ".pcdeps", d)
787 if os.access(pcfile, os.R_OK):
789 lines = fd.readlines()
792 rdepends.append(l.rstrip())
793 bb.data.setVar('RDEPENDS_' + pkg, " " + " ".join(rdepends), d)
796 python package_depchains() {
798 For a given set of prefix and postfix modifiers, make those packages
799 RRECOMMENDS on the corresponding packages for its DEPENDS.
801 Example: If package A depends upon package B, and A's .bb emits an
802 A-dev package, this would make A-dev Recommends: B-dev.
805 packages = bb.data.getVar('PACKAGES', d, 1)
806 postfixes = (bb.data.getVar('DEPCHAIN_POST', d, 1) or '').split()
807 prefixes = (bb.data.getVar('DEPCHAIN_PRE', d, 1) or '').split()
809 def pkg_addrrecs(pkg, base, func, d):
810 rdepends = explode_deps(bb.data.getVar('RDEPENDS_' + base, d, 1) or bb.data.getVar('RDEPENDS', d, 1) or "")
811 # bb.note('rdepends for %s is %s' % (base, rdepends))
812 rreclist = explode_deps(bb.data.getVar('RRECOMMENDS_' + pkg, d, 1) or bb.data.getVar('RRECOMMENDS', d, 1) or "")
814 for depend in rdepends:
815 split_depend = depend.split(' (')
816 name = split_depend[0].strip()
819 bb.data.setVar('RRECOMMENDS_%s' % pkg, ' '.join(rreclist), d)
821 def packaged(pkg, d):
822 return os.access(bb.data.expand('${STAGING_DIR}/pkgdata/runtime/%s.packaged' % pkg, d), os.R_OK)
824 for pkg in packages.split():
825 for postfix in postfixes:
826 def func(list, name):
827 pkg = '%s%s' % (name, postfix)
832 base = pkg[:-len(postfix)]
833 if pkg.endswith(postfix):
834 pkg_addrrecs(pkg, base, func, d)
837 for prefix in prefixes:
838 def func(list, name):
839 pkg = '%s%s' % (prefix, name)
844 base = pkg[len(prefix):]
845 if pkg.startswith(prefix):
846 pkg_addrrecs(pkg, base, func, d)
850 PACKAGEFUNCS ?= "package_do_split_locales \
853 package_do_pkgconfig \
858 python package_do_package () {
859 for f in (bb.data.getVar('PACKAGEFUNCS', d, 1) or '').split():
860 bb.build.exec_func(f, d)
862 # shlibs requires any DEPENDS to have already packaged for the *.list files
863 do_package[deptask] = "do_package"
864 do_package[dirs] = "${D}"
865 addtask package before do_build after do_install
869 PACKAGE_WRITE_FUNCS ?= "read_subpackage_metadata"
871 python package_do_package_write () {
872 for f in (bb.data.getVar('PACKAGE_WRITE_FUNCS', d, 1) or '').split():
873 bb.build.exec_func(f, d)
875 do_package_write[dirs] = "${D}"
876 addtask package_write before do_build after do_package
879 EXPORT_FUNCTIONS do_package do_package_write
883 # Helper functions for the package writing classes
886 python package_mapping_rename_hook () {
888 Rewrite variables to account for package renaming in things
889 like debian.bbclass or manual PKG variable name changes
891 runtime_mapping_rename("RDEPENDS", d)
892 runtime_mapping_rename("RRECOMMENDS", d)
893 runtime_mapping_rename("RSUGGESTS", d)
894 runtime_mapping_rename("RPROVIDES", d)
895 runtime_mapping_rename("RREPLACES", d)
896 runtime_mapping_rename("RCONFLICTS", d)
899 EXPORT_FUNCTIONS mapping_rename_hook