Debian multilib packaging fixes
v3 cover Debian multilib packaging fixes
This version adds a fourth patch from Aníbal to skip any "unmet dependencies" errors reported by APT from the initial install, which were prematurely terminating the rootfs build.
Aníbal Limón (1):
DpkgRootfs: Fix logcheck_error false-positive when use multilib
Matt Madison (3):
package_deb.bbclass, cross-canadian.bbclass: DPKG_ARCH mapping
function
package_manager.py: fixes for multilib deb packaging builds package_deb.bbclass: add 'Multi-Arch: foreign' tag to allarch packages
meta/classes/cross-canadian.bbclass | 2 +- meta/classes/package_deb.bbclass | 37 +++++++++++++++++++++++++++---------- meta/lib/oe/package_manager.py | 17 +++++++++++------ meta/lib/oe/rootfs.py | 13 +++++++++++++ 4 files changed, 52 insertions(+), 17 deletions(-)
Signature · 1 line
2.5.0
PATCH v3 1/4 package_deb.bbclass, cross-canadian.bbclass: DPKG_ARCH mapping function
Have DPKG_ARCH set by directly invoking a mapping function, rather than using an anonymous Python function modify the variable under the hood, so we can have proper handling of overrides.
Also bring in some additional mappings to Debian architecture names that weren't being handled.
--- meta/classes/cross-canadian.bbclass | 2 +- meta/classes/package_deb.bbclass | 35 +++++++++++++++++++++++++---------- 2 files changed, 26 insertions(+), 11 deletions(-)
meta/classes/cross-canadian.bbclass +1 -1
@@ -103,7 +103,7 @@ HOST_LD_ARCH = "${SDK_LD_ARCH}" HOST_AS_ARCH = "${SDK_AS_ARCH}" #assign DPKG_ARCH -DPKG_ARCH = "${SDK_ARCH}" +DPKG_ARCH = "${@debian_arch_map(d.getVar('SDK_ARCH', True), '')}" CPPFLAGS = "${BUILDSDK_CPPFLAGS}" CFLAGS = "${BUILDSDK_CFLAGS}"
meta/classes/package_deb.bbclass +25 -10
@@ -6,7 +6,7 @@ inherit package IMAGE_PKGTYPE ?= "deb" -DPKG_ARCH ?= "${TARGET_ARCH}" +DPKG_ARCH ?= "${@debian_arch_map(d.getVar('TARGET_ARCH', True), d.getVar('TUNE_FEATURES', True))}" PKGWRITEDIRDEB = "${WORKDIR}/deploy-debs"
@@ -14,6 +14,28 @@ APTCONF_TARGET = "${WORKDIR}" APT_ARGS = "${@['', '--no-install-recommends'][d.getVar("NO_RECOMMENDATIONS", True) == "1"]}" +def debian_arch_map(arch, tune): + tune_features = tune.split() + if arch in ["i586", "i686"]: + return "i386" + if arch == "x86_64": + if "mx32" in tune_features: + return "x32" + return "amd64" + if arch.startswith("mips"): + endian = ["el", ""]["bigendian" in tune_features] + if "n64" in tune_features: + return "mips64" + endian + if "n32" in tune_features: + return "mipsn32" + endian + return "mips" + endian + if arch == "powerpc": + return arch + ["", "spe"]["spe" in tune_features] + if arch == "aarch64": + return "arm64" + if arch == "arm": + return arch + ["el", "hf"]["callconvention-hard" in tune_features] + return arch # # install a bunch of packages using apt # the following shell variables needs to be set before calling this func:
@@ -288,6 +310,8 @@ python do_package_deb () { cleanupcontrol(root) bb.utils.unlockfile(lf) } +# Indirect references to these vars +do_package_write_deb[vardeps] += "PKGV PKGR PKGV DESCRIPTION SECTION PRIORITY MAINTAINER DPKG_ARCH PN HOMEPAGE" # Otherwise allarch packages may change depending on override configuration do_package_deb[vardepsexclude] = "OVERRIDES"
@@ -311,15 +335,6 @@ python () { deps = ' dpkg-native:do_populate_sysroot virtual/fakeroot-native:do_populate_sysroot' d.appendVarFlag('do_package_write_deb', 'depends', deps) d.setVarFlag('do_package_write_deb', 'fakeroot', "1") - - # Map TARGET_ARCH to Debian's ideas about architectures - darch = d.getVar('DPKG_ARCH', True) - if darch in ["x86", "i486", "i586", "i686", "pentium"]: - d.setVar('DPKG_ARCH', 'i386') - elif darch == "x86_64": - d.setVar('DPKG_ARCH', 'amd64') - elif darch == "arm": - d.setVar('DPKG_ARCH', 'armel') } python do_package_write_deb () {
Signature · 1 line
2.5.0
PATCH v3 2/4 package_manager.py: fixes for multilib deb packaging builds
In reply to Matt Madison* tmp/deploy/deb subdirectories do not get hyphens replaced with underscores, so don't do that translation when building the sources list.
* Fix MULTILIB_VARIANTS handling to be more general and work for all architectures
* Also include a fix for a warning generated by apt due to missing apt/preferences.d directory.
--- meta/lib/oe/package_manager.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-)
meta/lib/oe/package_manager.py +11 -6
@@ -247,7 +247,7 @@ class DpkgIndexer(Indexer): if a not in pkg_archs: arch_list.append(a) - all_mlb_pkg_arch_list = (self.d.getVar('ALL_MULTILIB_PACKAGE_ARCHS', True) or "").replace('-', '_').split() + all_mlb_pkg_arch_list = (self.d.getVar('ALL_MULTILIB_PACKAGE_ARCHS', True) or "").split() arch_list.extend(arch for arch in all_mlb_pkg_arch_list if arch not in arch_list) apt_ftparchive = bb.utils.which(os.getenv('PATH'), "apt-ftparchive")
@@ -1775,7 +1775,7 @@ class DpkgPM(PackageManager): self.apt_args = d.getVar("APT_ARGS", True) self.all_arch_list = archs.split() - all_mlb_pkg_arch_list = (self.d.getVar('ALL_MULTILIB_PACKAGE_ARCHS', True) or "").replace('-', '_').split() + all_mlb_pkg_arch_list = (self.d.getVar('ALL_MULTILIB_PACKAGE_ARCHS', True) or "").split() self.all_arch_list.extend(arch for arch in all_mlb_pkg_arch_list if arch not in self.all_arch_list) self._create_configs(archs, base_archs)
@@ -1966,6 +1966,7 @@ class DpkgPM(PackageManager): bb.utils.mkdirhier(self.apt_conf_dir) bb.utils.mkdirhier(self.apt_conf_dir + "/lists/partial/") bb.utils.mkdirhier(self.apt_conf_dir + "/apt.conf.d/") + bb.utils.mkdirhier(self.apt_conf_dir + "/preferences.d/") arch_list = [] for arch in self.all_arch_list:
@@ -2000,10 +2001,14 @@ class DpkgPM(PackageManager): base_arch_list = base_archs.split() multilib_variants = self.d.getVar("MULTILIB_VARIANTS", True); for variant in multilib_variants.split(): - if variant == "lib32": - base_arch_list.append("i386") - elif variant == "lib64": - base_arch_list.append("amd64") + localdata = bb.data.createCopy(self.d) + variant_tune = localdata.getVar("DEFAULTTUNE_virtclass-multilib-" + variant, False) + orig_arch = localdata.getVar("DPKG_ARCH", True) + localdata.setVar("DEFAULTTUNE", variant_tune) + bb.data.update_data(localdata) + variant_arch = localdata.getVar("DPKG_ARCH", True) + if variant_arch not in base_arch_list: + base_arch_list.append(variant_arch) with open(self.apt_conf_file, "w+") as apt_conf: with open(self.d.expand("${STAGING_ETCDIR_NATIVE}/apt/apt.conf.sample")) as apt_conf_sample:
Signature · 1 line
2.5.0
PATCH v3 3/4 package_deb.bbclass: add 'Multi-Arch: foreign' tag to allarch packages
In reply to Matt MadisonThis tells APT that it can use such packages to resolve dependencies from packages of any architecture in a multilib build.
--- meta/classes/package_deb.bbclass | 2 ++ 1 file changed, 2 insertions(+)
meta/classes/package_deb.bbclass +2 -0
@@ -161,6 +161,8 @@ python do_package_deb () { return l2 ctrlfile.write("Package: %s\n" % pkgname) + if d.getVar('PACKAGE_ARCH', True) == "all": + ctrlfile.write("Multi-Arch: foreign\n") # check for required fields try: for (c, fs) in fields:
Signature · 1 line
2.5.0
PATCH v3 4/4 DpkgRootfs: Fix logcheck_error false-positive when use multilib
In reply to Matt MadisonFrom: Aníbal Limón <[email protected]>
Rootfs with dpkg was failing due to false-positive in logcheck_error because current logic of DpkgPM handles missing dependencies failure using apt-get -f install [1][2].
This support was broken due to addition of logcheck and don't take into account dpkgpm cases, in order to fix add an attr for specify expected errors regex'es by package manager.
[1] http://git.yoctoproject.org/cgit/cgit.cgi/poky/tree/meta/lib/oe/rootfs.py#n659
[2] http://git.yoctoproject.org/cgit/cgit.cgi/poky/tree/meta/lib/oe/package_manager.py#n2038
--- meta/lib/oe/rootfs.py | 13 +++++++++++++ 1 file changed, 13 insertions(+)
meta/lib/oe/rootfs.py +13 -0
@@ -63,6 +63,15 @@ class Rootfs(object): if 'log_check' in line: continue + if hasattr(self, 'log_check_expected_errors_regexes'): + m = None + for ee in self.log_check_expected_errors_regexes: + m = re.search(ee, line) + if m: + break + if m: + continue + m = r.search(line) if m: found_error = 1
@@ -623,6 +632,10 @@ class DpkgRootfs(DpkgOpkgRootfs): def __init__(self, d, manifest_dir): super(DpkgRootfs, self).__init__(d) self.log_check_regex = '^E:' + self.log_check_expected_errors_regexes = \ + [ + "^E: Unmet dependencies." + ] bb.utils.remove(self.image_rootfs, True) bb.utils.remove(self.d.getVar('MULTILIB_TEMP_ROOTFS', True), True)
Signature · 1 line
2.5.0
It would be great if these could be pulled into jethro as well, since that's where I first noticed that multilib Debian builds were broken.
-Matt
Quoted 22 lines · Matt Madison
This version adds a fourth patch from Aníbal to skip any "unmet dependencies" errors reported by APT from the initial install, which were prematurely terminating the rootfs build.
Aníbal Limón (1):
DpkgRootfs: Fixlogcheck_errorfalse-positive when use multilibMatt Madison (3):
package_deb.bbclass, cross-canadian.bbclass:DPKG_ARCHmapping
function
package_manager.py: fixes for multilib deb packaging builds package_deb.bbclass: add 'Multi-Arch: foreign' tag to allarch packagesmeta/classes/cross-canadian.bbclass | 2 +- meta/classes/package_deb.bbclass | 37 +++++++++++++++++++++++++++---------- meta/lib/oe/package_manager.py | 17 +++++++++++------ meta/lib/oe/rootfs.py | 13 +++++++++++++ 4 files changed, 52 insertions(+), 17 deletions(-)--
2.5.0