summaryrefslogtreecommitdiffstats
path: root/yocto-poky/meta/classes/package.bbclass
diff options
context:
space:
mode:
Diffstat (limited to 'yocto-poky/meta/classes/package.bbclass')
-rw-r--r--yocto-poky/meta/classes/package.bbclass85
1 files changed, 65 insertions, 20 deletions
diff --git a/yocto-poky/meta/classes/package.bbclass b/yocto-poky/meta/classes/package.bbclass
index a86b68016..76b9f8649 100644
--- a/yocto-poky/meta/classes/package.bbclass
+++ b/yocto-poky/meta/classes/package.bbclass
@@ -121,6 +121,9 @@ def do_split_packages(d, root, file_regex, output_pattern, description, postinst
"""
dvar = d.getVar('PKGD', True)
+ root = d.expand(root)
+ output_pattern = d.expand(output_pattern)
+ extra_depends = d.expand(extra_depends)
# If the root directory doesn't exist, don't error out later but silently do
# no splitting.
@@ -298,6 +301,15 @@ def get_conffiles(pkg, d):
os.chdir(cwd)
return conf_list
+def checkbuildpath(file, d):
+ tmpdir = d.getVar('TMPDIR', True)
+ with open(file) as f:
+ file_content = f.read()
+ if tmpdir in file_content:
+ return True
+
+ return False
+
def splitdebuginfo(file, debugfile, debugsrcdir, sourcefile, d):
# Function to split a single file into two components, one is the stripped
# target system binary, the other contains any debugging information. The
@@ -310,8 +322,6 @@ def splitdebuginfo(file, debugfile, debugsrcdir, sourcefile, d):
dvar = d.getVar('PKGD', True)
objcopy = d.getVar("OBJCOPY", True)
debugedit = d.expand("${STAGING_LIBDIR_NATIVE}/rpm/bin/debugedit")
- workdir = d.getVar("WORKDIR", True)
- workparentdir = d.getVar("DEBUGSRC_OVERRIDE_PATH", True) or os.path.dirname(os.path.dirname(workdir))
# We ignore kernel modules, we don't generate debug info files.
if file.find("/lib/modules/") != -1 and file.endswith(".ko"):
@@ -325,7 +335,7 @@ def splitdebuginfo(file, debugfile, debugsrcdir, sourcefile, d):
# We need to extract the debug src information here...
if debugsrcdir:
- cmd = "'%s' -b '%s' -d '%s' -i -l '%s' '%s'" % (debugedit, workparentdir, debugsrcdir, sourcefile, file)
+ cmd = "'%s' -i -l '%s' '%s'" % (debugedit, sourcefile, file)
(retval, output) = oe.utils.getstatusoutput(cmd)
if retval:
bb.fatal("debugedit failed with exit code %s (cmd was %s)%s" % (retval, cmd, ":\n%s" % output if output else ""))
@@ -364,6 +374,13 @@ def copydebugsources(debugsrcdir, d):
workparentdir = os.path.dirname(os.path.dirname(workdir))
workbasedir = os.path.basename(os.path.dirname(workdir)) + "/" + os.path.basename(workdir)
+ # If build path exists in sourcefile, it means toolchain did not use
+ # -fdebug-prefix-map to compile
+ if checkbuildpath(sourcefile, d):
+ localsrc_prefix = workparentdir + "/"
+ else:
+ localsrc_prefix = "/usr/src/debug/"
+
nosuchdir = []
basepath = dvar
for p in debugsrcdir.split("/"):
@@ -377,9 +394,11 @@ def copydebugsources(debugsrcdir, d):
# We need to ignore files that are not actually ours
# we do this by only paying attention to items from this package
processdebugsrc += "fgrep -zw '%s' | "
+ # Remove prefix in the source paths
+ processdebugsrc += "sed 's#%s##g' | "
processdebugsrc += "(cd '%s' ; cpio -pd0mlL --no-preserve-owner '%s%s' 2>/dev/null)"
- cmd = processdebugsrc % (sourcefile, workbasedir, workparentdir, dvar, debugsrcdir)
+ cmd = processdebugsrc % (sourcefile, workbasedir, localsrc_prefix, workparentdir, dvar, debugsrcdir)
(retval, output) = oe.utils.getstatusoutput(cmd)
# Can "fail" if internal headers/transient sources are attempted
#if retval:
@@ -427,7 +446,7 @@ def get_package_additional_metadata (pkg_type, d):
if d.getVar(key, False) is None:
continue
d.setVarFlag(key, "type", "list")
- if d.getVarFlag(key, "separator") is None:
+ if d.getVarFlag(key, "separator", True) is None:
d.setVarFlag(key, "separator", "\\n")
metadata_fields = [field.strip() for field in oe.data.typed_value(key, d)]
return "\n".join(metadata_fields).strip()
@@ -708,6 +727,7 @@ python fixup_perms () {
dvar = d.getVar('PKGD', True)
fs_perms_table = {}
+ fs_link_table = {}
# By default all of the standard directories specified in
# bitbake.conf will get 0755 root:root.
@@ -754,24 +774,32 @@ python fixup_perms () {
continue
entry = fs_perms_entry(d.expand(line))
if entry and entry.path:
- fs_perms_table[entry.path] = entry
+ if entry.link:
+ fs_link_table[entry.path] = entry
+ if entry.path in fs_perms_table:
+ fs_perms_table.pop(entry.path)
+ else:
+ fs_perms_table[entry.path] = entry
+ if entry.path in fs_link_table:
+ fs_link_table.pop(entry.path)
f.close()
# Debug -- list out in-memory table
#for dir in fs_perms_table:
# bb.note("Fixup Perms: %s: %s" % (dir, str(fs_perms_table[dir])))
+ #for link in fs_link_table:
+ # bb.note("Fixup Perms: %s: %s" % (link, str(fs_link_table[link])))
# We process links first, so we can go back and fixup directory ownership
# for any newly created directories
- for dir in fs_perms_table:
- if not fs_perms_table[dir].link:
- continue
-
+ # Process in sorted order so /run gets created before /run/lock, etc.
+ for entry in sorted(fs_link_table.values(), key=lambda x: x.link):
+ link = entry.link
+ dir = entry.path
origin = dvar + dir
if not (cpath.exists(origin) and cpath.isdir(origin) and not cpath.islink(origin)):
continue
- link = fs_perms_table[dir].link
if link[0] == "/":
target = dvar + link
ptarget = link
@@ -791,9 +819,6 @@ python fixup_perms () {
os.symlink(link, origin)
for dir in fs_perms_table:
- if fs_perms_table[dir].link:
- continue
-
origin = dvar + dir
if not (cpath.exists(origin) and cpath.isdir(origin)):
continue
@@ -905,7 +930,7 @@ python split_and_strip_files () {
continue
# Check its an excutable
if (s[stat.ST_MODE] & stat.S_IXUSR) or (s[stat.ST_MODE] & stat.S_IXGRP) or (s[stat.ST_MODE] & stat.S_IXOTH) \
- or ((file.startswith(libdir) or file.startswith(baselibdir)) and ".so" in f):
+ or ((file.startswith(libdir) or file.startswith(baselibdir)) and (".so" in f or ".node" in f)):
# If it's a symlink, and points to an ELF file, we capture the readlink target
if cpath.islink(file):
target = os.readlink(file)
@@ -1039,6 +1064,8 @@ python populate_packages () {
bb.utils.mkdirhier(outdir)
os.chdir(dvar)
+
+ autodebug = not (d.getVar("NOAUTOPACKAGEDEBUG", True) or False)
# Sanity check PACKAGES for duplicates
# Sanity should be moved to sanity.bbclass once we have the infrastucture
@@ -1048,6 +1075,8 @@ python populate_packages () {
if pkg in package_list:
msg = "%s is listed in PACKAGES multiple times, this leads to packaging errors." % pkg
package_qa_handle_error("packages-list", msg, d)
+ elif autodebug and pkg.endswith("-dbg"):
+ package_list.insert(0, pkg)
else:
package_list.append(pkg)
d.setVar('PACKAGES', ' '.join(package_list))
@@ -1058,6 +1087,16 @@ python populate_packages () {
# os.mkdir masks the permissions with umask so we have to unset it first
oldumask = os.umask(0)
+ debug = []
+ for root, dirs, files in cpath.walk(dvar):
+ dir = root[len(dvar):]
+ if not dir:
+ dir = os.sep
+ for f in (files + dirs):
+ path = "." + os.path.join(dir, f)
+ if "/.debug/" in path or path.endswith("/.debug"):
+ debug.append(path)
+
for pkg in package_list:
root = os.path.join(pkgdest, pkg)
bb.utils.mkdirhier(root)
@@ -1071,6 +1110,9 @@ python populate_packages () {
origfiles = filesvar.split()
files = files_from_filevars(origfiles)
+ if autodebug and pkg.endswith("-dbg"):
+ files.extend(debug)
+
for file in files:
if (not cpath.islink(file)) and (not cpath.exists(file)):
continue
@@ -1513,7 +1555,7 @@ python package_do_shlibs() {
rpath = []
p = sub.Popen([d.expand("${HOST_PREFIX}otool"), '-l', file],stdout=sub.PIPE,stderr=sub.PIPE)
err, out = p.communicate()
- # If returned succesfully, process stderr for results
+ # If returned successfully, process stderr for results
if p.returncode == 0:
for l in err.split("\n"):
l = l.strip()
@@ -1522,7 +1564,7 @@ python package_do_shlibs() {
p = sub.Popen([d.expand("${HOST_PREFIX}otool"), '-L', file],stdout=sub.PIPE,stderr=sub.PIPE)
err, out = p.communicate()
- # If returned succesfully, process stderr for results
+ # If returned successfully, process stderr for results
if p.returncode == 0:
for l in err.split("\n"):
l = l.strip()
@@ -1892,12 +1934,11 @@ python package_depchains() {
for pkg in pkglibdeps:
for k in pkglibdeps[pkg]:
add_dep(pkglibdeplist, k)
- # FIXME this should not look at PN once all task recipes inherit from task.bbclass
- dbgdefaultdeps = ((d.getVar('DEPCHAIN_DBGDEFAULTDEPS', True) == '1') or (d.getVar('PN', True) or '').startswith('packagegroup-'))
+ dbgdefaultdeps = ((d.getVar('DEPCHAIN_DBGDEFAULTDEPS', True) == '1') or (bb.data.inherits_class('packagegroup', d)))
for suffix in pkgs:
for pkg in pkgs[suffix]:
- if d.getVarFlag('RRECOMMENDS_' + pkg, 'nodeprrecs'):
+ if d.getVarFlag('RRECOMMENDS_' + pkg, 'nodeprrecs', True):
continue
(base, func) = pkgs[suffix][pkg]
if suffix == "-dev":
@@ -2035,6 +2076,10 @@ python do_package () {
for f in (d.getVar('PACKAGEFUNCS', True) or '').split():
bb.build.exec_func(f, d)
+
+ qa_sane = d.getVar("QA_SANE", True)
+ if not qa_sane:
+ bb.fatal("Fatal QA errors found, failing task.")
}
do_package[dirs] = "${SHLIBSWORKDIR} ${PKGDESTWORK} ${D}"
OpenPOWER on IntegriCloud