# Remaining package name validity fixes
return s.lower().replace('_', '-').replace('@', '+').replace(',', '+').replace('/', '-')
-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):
+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, allow_links=False):
"""
Used in .bb files to split up dynamically generated subpackages of a
given package, usually plugins or modules.
continue
f = os.path.join(dvar + root, o)
mode = os.lstat(f).st_mode
- if not (stat.S_ISREG(mode) or (allow_dirs and stat.S_ISDIR(mode))):
+ if not (stat.S_ISREG(mode) or (allow_links and stat.S_ISLNK(mode)) or (allow_dirs and stat.S_ISDIR(mode))):
continue
on = legitimize_package_name(m.group(1))
pkg = output_pattern % on
PACKAGE_DEPENDS += "file-native"
+def package_stash_hook(func, name, d):
+ import bb, os.path
+ body = bb.data.getVar(func, d, True)
+ pn = bb.data.getVar('PN', d, True)
+ staging = bb.data.getVar('PKGDATA_DIR', d, True)
+ dirname = os.path.join(staging, 'hooks', name)
+ bb.mkdirhier(dirname)
+ fn = os.path.join(dirname, pn)
+ f = open(fn, 'w')
+ f.write("python () {\n");
+ f.write(body);
+ f.write("}\n");
+ f.close()
+
python () {
import bb
if bb.data.getVar('PACKAGES', d, True) != '':
# If the file is in a .debug directory it was already stripped,
# don't do it again...
if os.path.dirname(file).endswith(".debug"):
- bb.note("Already ran strip")
+ bb.debug(2, "Already ran strip on %s" % file)
return 0
strip = bb.data.getVar("STRIP", d, 1)
bb.data.setVar('DESCRIPTION_' + pkg, '%s translation for %s' % (l, pn), d)
bb.data.setVar('PACKAGES', ' '.join(packages), d)
-
- # Disabled by RP 18/06/07
- # Wildcards aren't supported in debian
- # They break with ipkg since glibc-locale* will mean that
- # glibc-localedata-translit* won't install as a dependency
- # for some other package which breaks meta-toolchain
- # Probably breaks since virtual-locale- isn't provided anywhere
- #rdep = (bb.data.getVar('RDEPENDS_%s' % mainpkg, d, 1) or bb.data.getVar('RDEPENDS', d, 1) or "").split()
- #rdep.append('%s-locale*' % pn)
- #bb.data.setVar('RDEPENDS_%s' % mainpkg, ' '.join(rdep), d)
}
python populate_packages () {
os.system('rm -rf %s' % pkgdest)
seen = []
+ main_is_empty = 1
+ main_pkg = bb.data.getVar('PN', d, 1)
for pkg in package_list:
localdata = bb.data.createCopy(d)
globbed = glob.glob(file)
if globbed:
if [ file ] != globbed:
- files += globbed
- continue
+ if not file in globbed:
+ files += globbed
+ continue
+ else:
+ globbed.remove(file)
+ files += globbed
if (not os.path.islink(file)) and (not os.path.exists(file)):
continue
+ if file[-4:] == '.pyc':
+ continue
if file in seen:
continue
seen.append(file)
ret = bb.copyfile(file, fpath)
if ret is False or ret == 0:
raise bb.build.FuncFailed("File population failed")
+ if pkg == main_pkg and main_is_empty:
+ main_is_empty = 0
del localdata
os.chdir(workdir)
dangling_links[pkg].append(os.path.normpath(target))
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, 0) or bb.data.getVar('RDEPENDS', d, 0) or "")
+
+ remstr = "${PN} (= ${EXTENDPV})"
+ if main_is_empty and remstr in rdepends:
+ rdepends.remove(remstr)
for l in dangling_links[pkg]:
found = False
bb.debug(1, "%s contains dangling link %s" % (pkg, l))
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, 1)
+ if val:
+ f.write('%s: %s\n' % (var, encode(val)))
+ return
packages = bb.data.getVar('PACKAGES', d, True)
pkgdatadir = bb.data.getVar('PKGDATA_DIR', d, True)
subdata_file = pkgdatadir + "/runtime/%s" % pkg
sf = open(subdata_file, 'w')
write_if_exists(sf, pkg, 'PN')
+ write_if_exists(sf, pkg, 'PV')
write_if_exists(sf, pkg, 'PR')
write_if_exists(sf, pkg, 'DESCRIPTION')
write_if_exists(sf, pkg, 'RDEPENDS')
ldconfig_postinst_fragment() {
if [ x"$D" = "x" ]; then
- [ -x /sbin/ldconfig ] && /sbin/ldconfig
+ if [ -e /etc/ld.so.conf ] ; then
+ [ -x /sbin/ldconfig ] && /sbin/ldconfig
+ fi
fi
}
exclude_shlibs = bb.data.getVar('EXCLUDE_FROM_SHLIBS', d, 0)
if exclude_shlibs:
- bb.note("not generating shlibs")
+ bb.debug(1, "not generating shlibs")
return
lib_re = re.compile("^lib.*\.so")
if pstageactive == "1":
lf = bb.utils.lockfile(bb.data.expand("${STAGING_DIR}/staging.lock", d))
+ if bb.data.getVar('PACKAGE_SNAP_LIB_SYMLINKS', d, True) == "1":
+ snap_symlinks = True
+ else:
+ snap_symlinks = False
+
+ if (bb.data.getVar('USE_LDCONFIG', d, True) or "1") == "1":
+ use_ldconfig = True
+ else:
+ use_ldconfig = False
+
needed = {}
private_libs = bb.data.getVar('PRIVATE_LIBS', d, 1)
for pkg in packages.split():
needed[pkg] = []
sonames = list()
top = os.path.join(pkgdest, pkg)
+ renames = []
for root, dirs, files in os.walk(top):
for file in files:
soname = None
path = os.path.join(root, file)
- if os.access(path, os.X_OK) or lib_re.match(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)
fd = os.popen(cmd)
if m:
needed[pkg].append(m.group(1))
m = re.match("\s+SONAME\s+([^\s]*)", l)
- if m and not m.group(1) in sonames:
- # if library is private (only used by package) then do not build shlib for it
- if not private_libs or -1 == private_libs.find(m.group(1)):
- sonames.append(m.group(1))
- if m and libdir_re.match(root):
- needs_ldconfig = True
+ if m:
+ this_soname = m.group(1)
+ if not this_soname in sonames:
+ # if library is private (only used by package) then do not build shlib for it
+ if not private_libs or -1 == private_libs.find(this_soname):
+ sonames.append(this_soname)
+ if libdir_re.match(root):
+ needs_ldconfig = True
+ if snap_symlinks and (file != soname):
+ renames.append((path, os.path.join(root, this_soname)))
+ for (old, new) in renames:
+ os.rename(old, new)
shlibs_file = os.path.join(shlibs_dir, pkg + ".list")
if os.path.exists(shlibs_file):
os.remove(shlibs_file)
fd.write(ver + '\n')
fd.close()
package_stagefile(shver_file, d)
- if needs_ldconfig:
+ 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)
if not postinst:
dep_pkg = dep_pkg[0]
shlib_provider[l] = (dep_pkg, lib_ver)
+ dep_packages = []
for pkg in packages.split():
bb.debug(2, "calculating shlib requirements for %s" % pkg)
dep = dep_pkg
if not dep in deps:
deps.append(dep)
+ if not dep_pkg in dep_packages:
+ dep_packages.append(dep_pkg)
+
else:
bb.note("Couldn't find shared library provider for %s" % n)
package_depchains \
emit_pkgdata"
+def package_run_hooks(f, d):
+ import bb, os
+ staging = bb.data.getVar('PKGDATA_DIR', d, True)
+ dn = os.path.join(staging, 'hooks', f)
+ if os.access(dn, os.R_OK):
+ for f in os.listdir(dn):
+ fn = os.path.join(dn, f)
+ fp = open(fn, 'r')
+ line = 0
+ for l in fp.readlines():
+ l = l.rstrip()
+ 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 []
+ body = [x['content'] for x in anonqueue]
+ flag = { 'python' : 1, 'func' : 1 }
+ bb.data.setVar("__anonfunc", "\n".join(body), d)
+ bb.data.setVarFlags("__anonfunc", flag, d)
+ try:
+ t = bb.data.getVar('T', d)
+ bb.data.setVar('T', '${TMPDIR}/', d)
+ bb.build.exec_func("__anonfunc", d)
+ bb.data.delVar('T', d)
+ if t:
+ bb.data.setVar('T', t, d)
+ except Exception, e:
+ bb.msg.debug(1, bb.msg.domain.Parsing, "Exception when executing anonymous function: %s" % e)
+ raise
+ bb.data.delVar("__anonqueue", d)
+ bb.data.delVar("__anonfunc", d)
+
python package_do_package () {
packages = (bb.data.getVar('PACKAGES', d, 1) or "").split()
if len(packages) < 1:
for f in (bb.data.getVar('PACKAGEFUNCS', d, 1) or '').split():
bb.build.exec_func(f, d)
+ package_run_hooks(f, d)
}
do_package[dirs] = "${D}"
addtask package before do_build after do_install