diff options
author | Rasmus Villemoes <rasmus.villemoes@prevas.dk> | 2018-07-11 13:38:56 +0200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2018-08-15 21:45:58 +0100 |
commit | f163fd8ec4333f32a32c21d867ef56b40e3eadaa (patch) | |
tree | 817180a80063dd3fb47fc70d31bc4290d2ba43e4 /meta/classes/package.bbclass | |
parent | c5435fa1c2ef03d8867e182968b544ca9f8e0cf3 (diff) | |
download | poky-f163fd8ec4333f32a32c21d867ef56b40e3eadaa.tar.gz |
package.bbclass: improve -dbg and -src package ordering
nativesdk-gpgme fails package_qa when setting PACKAGE_DEBUG_SPLIT_STYLE
= "debug-with-srcpkg".
ERROR: nativesdk-gpgme-1.10.0-r0 do_package_qa: QA Issue: non debug package contains .debug directory: nativesdk-python3-gpg path /work/x86_64-nativesdk-oesdk-linux/nativesdk-gpgme/1.10.0-r0/packages-split/nativesdk-python3-gpg/usr/local/oecore-x86_64/sysroots/x86_64-oesdk-linux/usr/lib/python3.5/site-packages/gpg/.debug/_gpgme.cpython-35m-x86_64-linux-gnu.so [debug-files]
This turns out to be because the automatic moving of the -dbg package to
the beginning of the package list is disabled in that case, so the
python3-gpg packages that the recipe prepends to PACKAGES ends up before
the -dbg package.
It's not clear why the "and not split_source_package" was added when
debug-with-srcpkg was introduced. Presumably the intention was to
prevent the -dbg package to end up before the -src package, which we of
course need to. But at the same time, we still need -dbg packages to end
up before all other packages.
Using list.insert(0, ...) also means that if there happens to more than
one -dbg package, their relative ordering gets inverted in the new list.
This tries to fix these issues by sorting the packages by (priority,
original position), where priority is 10 for -src, 30 for -dbg and 50
for everything else. That guarantees that packages of the same "type"
preserve their relative ordering, while also ensuring that -dbg always
preceed other packages. This scheme is also quite extensible, and,
should the need arise, one could even expose the priorities as a knob
the recipe author could use to ensure specific orderings of packages
instead of the somewhat fragile and coarse-grained method of "prepend or
append, and ensure you do that in a proper order".
Probably the autodebug condition needs to stay, but I think the
split_source_package condition in the preceding elif should be removed,
so that that logic applies to all packages called -src, not just the one
we might have created a few lines above.
(From OE-Core rev: 805edbc7dc9ceae00d991f9b4e185bbbe1d3ba45)
Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/package.bbclass')
-rw-r--r-- | meta/classes/package.bbclass | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/meta/classes/package.bbclass b/meta/classes/package.bbclass index a116948952..4ce9de2f57 100644 --- a/meta/classes/package.bbclass +++ b/meta/classes/package.bbclass | |||
@@ -1138,21 +1138,22 @@ python populate_packages () { | |||
1138 | 1138 | ||
1139 | # Sanity check PACKAGES for duplicates | 1139 | # Sanity check PACKAGES for duplicates |
1140 | # Sanity should be moved to sanity.bbclass once we have the infrastructure | 1140 | # Sanity should be moved to sanity.bbclass once we have the infrastructure |
1141 | package_list = [] | 1141 | package_dict = {} |
1142 | 1142 | ||
1143 | for pkg in packages.split(): | 1143 | for i, pkg in enumerate(packages.split()): |
1144 | if pkg in package_list: | 1144 | if pkg in package_dict: |
1145 | msg = "%s is listed in PACKAGES multiple times, this leads to packaging errors." % pkg | 1145 | msg = "%s is listed in PACKAGES multiple times, this leads to packaging errors." % pkg |
1146 | package_qa_handle_error("packages-list", msg, d) | 1146 | package_qa_handle_error("packages-list", msg, d) |
1147 | # If debug-with-srcpkg mode is enabled then the src package will have | 1147 | # If debug-with-srcpkg mode is enabled then the src package will have |
1148 | # priority over dbg package when assigning the files. | 1148 | # priority over dbg package when assigning the files. |
1149 | # This allows src package to include source files and remove them from dbg. | 1149 | # This allows src package to include source files and remove them from dbg. |
1150 | elif split_source_package and pkg.endswith("-src"): | 1150 | elif split_source_package and pkg.endswith("-src"): |
1151 | package_list.insert(0, pkg) | 1151 | package_dict[pkg] = (10, i) |
1152 | elif autodebug and pkg.endswith("-dbg") and not split_source_package: | 1152 | elif autodebug and pkg.endswith("-dbg"): |
1153 | package_list.insert(0, pkg) | 1153 | package_dict[pkg] = (30, i) |
1154 | else: | 1154 | else: |
1155 | package_list.append(pkg) | 1155 | package_dict[pkg] = (50, i) |
1156 | package_list = sorted(package_dict.keys(), key=package_dict.get) | ||
1156 | d.setVar('PACKAGES', ' '.join(package_list)) | 1157 | d.setVar('PACKAGES', ' '.join(package_list)) |
1157 | pkgdest = d.getVar('PKGDEST') | 1158 | pkgdest = d.getVar('PKGDEST') |
1158 | 1159 | ||