From ccc413fd93f5e7572afd50bbfac8532f07fed9b1 Mon Sep 17 00:00:00 2001 From: Joshua Watt Date: Wed, 6 Mar 2019 10:32:30 -0600 Subject: Add source package to ${PACKAGES} Permanently adds the -src source package to ${PACKAGES} instead of relying on creating it dynamically at packaging time. The source package is now defined in bitbake.conf, just like -dev and -dbg packages. For compatibility, the -src package is still added dynamically if it was missing, since some recipes have a tendency to completely override PACKAGES and do so without manually adding back the -src package. This allows RDEPENDS on the -src packages, which wasn't previously possible. [YOCTO #13203] (From OE-Core rev: b25e1edf0204fc2f64aa8d66e09b8e2d67b90e17) Signed-off-by: Joshua Watt Signed-off-by: Richard Purdie --- meta/classes/package.bbclass | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) (limited to 'meta/classes') diff --git a/meta/classes/package.bbclass b/meta/classes/package.bbclass index 749c7d9ea1..4c0a859536 100644 --- a/meta/classes/package.bbclass +++ b/meta/classes/package.bbclass @@ -1128,7 +1128,7 @@ python populate_packages () { workdir = d.getVar('WORKDIR') outdir = d.getVar('DEPLOY_DIR') dvar = d.getVar('PKGD') - packages = d.getVar('PACKAGES') + packages = d.getVar('PACKAGES').split() pn = d.getVar('PN') bb.utils.mkdirhier(outdir) @@ -1138,32 +1138,34 @@ python populate_packages () { split_source_package = (d.getVar('PACKAGE_DEBUG_SPLIT_STYLE') == 'debug-with-srcpkg') - # If debug-with-srcpkg mode is enabled then the src package is added - # into the package list and the source directory as its main content + # If debug-with-srcpkg mode is enabled then add the source package if it + # doesn't exist and add the source file contents to the source package. if split_source_package: src_package_name = ('%s-src' % d.getVar('PN')) - packages += (' ' + src_package_name) + if not src_package_name in packages: + packages.append(src_package_name) d.setVar('FILES_%s' % src_package_name, '/usr/src/debug') # Sanity check PACKAGES for duplicates # Sanity should be moved to sanity.bbclass once we have the infrastructure package_dict = {} - for i, pkg in enumerate(packages.split()): + for i, pkg in enumerate(packages): if pkg in package_dict: msg = "%s is listed in PACKAGES multiple times, this leads to packaging errors." % pkg package_qa_handle_error("packages-list", msg, d) - # If debug-with-srcpkg mode is enabled then the src package will have - # priority over dbg package when assigning the files. - # This allows src package to include source files and remove them from dbg. - elif split_source_package and pkg.endswith("-src"): + # Ensure the source package gets the chance to pick up the source files + # before the debug package by ordering it first in PACKAGES. Whether it + # actually picks up any source files is controlled by + # PACKAGE_DEBUG_SPLIT_STYLE. + elif pkg.endswith("-src"): package_dict[pkg] = (10, i) elif autodebug and pkg.endswith("-dbg"): package_dict[pkg] = (30, i) else: package_dict[pkg] = (50, i) - package_list = sorted(package_dict.keys(), key=package_dict.get) - d.setVar('PACKAGES', ' '.join(package_list)) + packages = sorted(package_dict.keys(), key=package_dict.get) + d.setVar('PACKAGES', ' '.join(packages)) pkgdest = d.getVar('PKGDEST') seen = [] @@ -1181,7 +1183,7 @@ python populate_packages () { if "/.debug/" in path or path.endswith("/.debug"): debug.append(path) - for pkg in package_list: + for pkg in packages: root = os.path.join(pkgdest, pkg) bb.utils.mkdirhier(root) @@ -1252,7 +1254,7 @@ python populate_packages () { # Handle LICENSE_EXCLUSION package_list = [] - for pkg in packages.split(): + for pkg in packages: if d.getVar('LICENSE_EXCLUSION-' + pkg): msg = "%s has an incompatible license. Excluding from packaging." % pkg package_qa_handle_error("incompatible-license", msg, d) -- cgit v1.2.3-54-g00ecf