diff -Nru autopkgtest-5.11ubuntu1.1/debian/changelog autopkgtest-5.11ubuntu1.2/debian/changelog --- autopkgtest-5.11ubuntu1.1/debian/changelog 2021-06-30 08:37:39.000000000 +0000 +++ autopkgtest-5.11ubuntu1.2/debian/changelog 2023-01-11 21:41:14.000000000 +0000 @@ -1,3 +1,13 @@ +autopkgtest (5.11ubuntu1.2) UNRELEASED; urgency=medium + + * Include patch for -a ARCH capability. For complete info see: + https://code.launchpad.net/~ubuntu-release/autopkgtest/+git/development/+merge/376169 + * Include debian/patches/0010-pin-pockets-with-500.patch to pin pockets with Pin-Priority: 500 + + LP: #2002455 + + -- Heather Ellsworth Wed, 11 Jan 2023 21:41:14 +0000 + autopkgtest (5.11ubuntu1.1) focal; urgency=medium * setup-testbed: Set Always-Include-Phased-Updates for apt (LP: #1934100) diff -Nru autopkgtest-5.11ubuntu1.1/debian/patches/0001-Add-an-architecture-argument-to-autopkgtest-for-fore.patch autopkgtest-5.11ubuntu1.2/debian/patches/0001-Add-an-architecture-argument-to-autopkgtest-for-fore.patch --- autopkgtest-5.11ubuntu1.1/debian/patches/0001-Add-an-architecture-argument-to-autopkgtest-for-fore.patch 1970-01-01 00:00:00.000000000 +0000 +++ autopkgtest-5.11ubuntu1.2/debian/patches/0001-Add-an-architecture-argument-to-autopkgtest-for-fore.patch 2023-01-11 21:41:14.000000000 +0000 @@ -0,0 +1,39 @@ +commit 6d6915ddb906943638ef06389c906a92b52b2a48 +Author: Steve Langasek +Date: Wed Nov 27 12:06:45 2019 -0800 + + Add an --architecture argument to autopkgtest for foreign-arch testing + +diff --git a/lib/autopkgtest_args.py b/lib/autopkgtest_args.py +index 7fea2d8..9edb4a8 100644 +--- a/lib/autopkgtest_args.py ++++ b/lib/autopkgtest_args.py +@@ -210,6 +210,11 @@ for details.''' + help='Run tests from already installed click package ' + '(e. g. "com.example.myapp"), from specified click ' + 'source directory or manifest\'s x-source.') ++ g_test.add_argument('-a', '--architecture', metavar='ARCH', ++ help='run tests for (and when asked, build binaries ' ++ 'for) ARCH instead of the testbed host architecture. ' ++ 'Assumes ARCH is available as a foreign architecture ' ++ 'on the testbed.') + g_test.add_argument('packages', nargs='*', + help='testsrc source package and testbinary packages as above') + +diff --git a/runner/autopkgtest.1 b/runner/autopkgtest.1 +index ce4a1bf..abf181b 100644 +--- a/runner/autopkgtest.1 ++++ b/runner/autopkgtest.1 +@@ -135,6 +135,12 @@ autopkgtest --installed-click com.example.myclick -- [...] + + .SH TEST OPTIONS + ++.TP ++.BR -a " | " --architecture ARCH ++Run tests for the specified architecture, rather than for the host ++architecture as defined by dpkg \-\-print-architecture. When building ++packages from source, cross-build for the target architecture as well. ++ + .TP + .BR -B " | " --no-built-binaries + Binaries from unbuilt source packages (see above) diff -Nru autopkgtest-5.11ubuntu1.1/debian/patches/0002-Add-support-for-using-apt-get-build-dep-for-build-de.patch autopkgtest-5.11ubuntu1.2/debian/patches/0002-Add-support-for-using-apt-get-build-dep-for-build-de.patch --- autopkgtest-5.11ubuntu1.1/debian/patches/0002-Add-support-for-using-apt-get-build-dep-for-build-de.patch 1970-01-01 00:00:00.000000000 +0000 +++ autopkgtest-5.11ubuntu1.2/debian/patches/0002-Add-support-for-using-apt-get-build-dep-for-build-de.patch 2023-01-11 21:41:14.000000000 +0000 @@ -0,0 +1,123 @@ +commit d47ee656f25db42e404664f6d9195996d83d4e38 +Author: Steve Langasek +Date: Wed Nov 27 17:13:05 2019 -0800 + + Add support for using apt-get build-dep for build-dependency resolution + + Cross-arch testing requires much more complicated parsing of + build-dependencies. Rather than reimplementing this resolver in + autopkgtest, just call apt-get build-dep. + + apt-get build-dep only works in apt 1.1 and later, so for now this is + optional rather than replacing the existing implementation. + +diff --git a/lib/adt_testbed.py b/lib/adt_testbed.py +index 4fe8874..c9662f9 100644 +--- a/lib/adt_testbed.py ++++ b/lib/adt_testbed.py +@@ -1021,6 +1021,105 @@ fi + if self.execute(['sh', adtlog.verbosity >= 2 and '-exc' or '-ec', script], kind='install')[0] != 0: + self.bomb('Failed to update click AppArmor rules') + ++ def _run_apt_build_dep(self, what, prefix, recommends, ignorerc=False): ++ '''actually run apt-get build-dep''' ++ ++ # capture status-fd to stderr ++ (rc, _, serr) = self.execute(['/bin/sh', '-ec', '%s apt-get build-dep ' ++ '--assume-yes %s ' ++ '-o APT::Status-Fd=3 ' ++ '-o APT::Install-Recommends=%s ' ++ '-o Dpkg::Options::=--force-confnew ' ++ '-o Debug::pkgProblemResolver=true 3>&2 2>&1' % ++ (prefix, what, recommends)], ++ kind='install', stderr=subprocess.PIPE) ++ if not ignorerc and rc != 0: ++ adtlog.debug('apt-get build-dep %s failed; status-fd:\n%s' % (what, serr)) ++ # check if apt failed during package download, which might be a ++ # transient error, so retry ++ if 'dlstatus:' in serr and 'pmstatus:' not in serr: ++ raise adtlog.AptDownloadError ++ else: ++ raise adtlog.AptPermanentError ++ ++ def satisfy_build_deps(self, source_pkg, architecture=None, ++ recommends=False, shell_on_failure=False): ++ '''Install build-dependencies into testbed with apt-get build-dep ++ ++ This requires root privileges and a writable file system. ++ ''' ++ # check if we can use apt-get ++ can_apt_get = False ++ if 'root-on-testbed' in self.caps: ++ rc = self.execute(['test', '-w', '/var/lib/dpkg/status'])[0] ++ if rc == 0: ++ can_apt_get = True ++ adtlog.debug('can use apt-get on testbed: %s' % can_apt_get) ++ ++ if not can_apt_get: ++ self.bomb('no root on testbed, unsupported when specifying target architecture') ++ ++ what = source_pkg ++ if architecture: ++ what += ' -a ' + architecture ++ # install the build-dependencies for the specified source (which can ++ # be a source package name, or a path); our apt pinning is not ++ # very clever wrt. resolving transitional dependencies in the pocket, ++ # so we might need to retry without pinning ++ download_fail_retries = 3 ++ while True: ++ rc = 0 ++ try: ++ self._run_apt_build_dep(what, ' '.join(self.eatmydata_prefix), recommends) ++ ++ # check if apt failed during package download, which might be a ++ # transient error, so retry ++ except adtlog.AptDownloadError: ++ download_fail_retries -= 1 ++ if download_fail_retries > 0: ++ adtlog.warning('apt failed to download packages, retrying in 10s...') ++ time.sleep(10) ++ continue ++ else: ++ self.bomb('apt repeatedly failed to download packages') ++ ++ except adtlog.AptPermanentError: ++ rc = -1 ++ if shell_on_failure: ++ self.run_shell() ++ ++ if rc != 0: ++ if self.apt_pin_for_releases and self.enable_apt_fallback: ++ release = self.apt_pin_for_releases.pop() ++ adtlog.warning('Test dependencies are unsatisfiable using apt pinning. ' ++ 'Retrying using all packages from %s' % release) ++ self.check_exec(['/bin/sh', '-ec', 'rm /etc/apt/preferences.d/autopkgtest-' + release]) ++ if not self.apt_pin_for_releases: ++ self.check_exec(['/bin/sh', '-ec', 'rm -f /etc/apt/preferences.d/autopkgtest-default-release']) ++ continue ++ ++ adtlog.warning('Test dependencies are unsatisfiable - calling ' ++ 'apt install on test deps directly for further ' ++ 'data about failing dependencies in test logs') ++ self._run_apt_build_dep('--simulate ' + what, ++ ' '.join(self.eatmydata_prefix), ++ recommends, ignorerc=True) ++ ++ if shell_on_failure: ++ self.run_shell() ++ if self.enable_apt_fallback: ++ self.badpkg('Test dependencies are unsatisfiable. A common reason is ' ++ 'that your testbed is out of date with respect to the ' ++ 'archive, and you need to use a current testbed or run ' ++ 'apt-get update or use -U.') ++ else: ++ self.badpkg('Test dependencies are unsatisfiable. A common reason is ' ++ 'that the requested apt pinning prevented dependencies ' ++ 'from the non-default suite to be installed. In that ' ++ 'case you need to add those dependencies to the pinning ' ++ 'list.') ++ break ++ + def satisfy_dependencies_string(self, deps, what, recommends=False, + build_dep=False, shell_on_failure=False, synth_deps=[]): + '''Install dependencies from a string into the testbed''' diff -Nru autopkgtest-5.11ubuntu1.1/debian/patches/0003-Multiarch-build-support.patch autopkgtest-5.11ubuntu1.2/debian/patches/0003-Multiarch-build-support.patch --- autopkgtest-5.11ubuntu1.1/debian/patches/0003-Multiarch-build-support.patch 1970-01-01 00:00:00.000000000 +0000 +++ autopkgtest-5.11ubuntu1.2/debian/patches/0003-Multiarch-build-support.patch 2023-01-11 21:41:14.000000000 +0000 @@ -0,0 +1,87 @@ +commit e5e8e38a0f1f40f40fea8ed4dee00c78c4fb0c2d +Author: Steve Langasek +Date: Wed Nov 27 17:16:43 2019 -0800 + + Multiarch build support. + + Use the 'apt-get build-dep' based resolver for build dependencies whenever + we have an architecture specified; and pass -a $arch to apt-get build-dep + and to dpkg-buildpackage. + +diff --git a/runner/autopkgtest b/runner/autopkgtest +index 93c6e61..61832bb 100755 +--- a/runner/autopkgtest ++++ b/runner/autopkgtest +@@ -580,22 +580,6 @@ dpkg-source -x %(src)s_*.dsc src >/dev/null''' % {'src': arg} + if kind not in ['dsc', 'apt-source']: + testbed.install_deps([], False) + +- if kind in ('apt-source', 'git-source'): +- # we need to get the downloaded debian/control from the testbed, so +- # that we can avoid calling "apt-get build-dep" and thus +- # introducing a second mechanism for installing build deps +- pkg_control = adt_testbed.Path(testbed, +- os.path.join(tmp, 'apt-control'), +- os.path.join(result_pwd, 'debian/control'), False) +- pkg_control.copyup() +- dsc = pkg_control.host +- +- with open(dsc, encoding='UTF-8') as f: +- d = deb822.Deb822(sequence=f) +- bd = d.get('Build-Depends', '') +- bdi = d.get('Build-Depends-Indep', '') +- bda = d.get('Build-Depends-Arch', '') +- + # determine build command and build-essential packages + build_essential = ['build-essential'] + assert testbed.nproc +@@ -607,8 +591,47 @@ dpkg-source -x %(src)s_*.dsc src >/dev/null''' % {'src': arg} + if testbed.user or 'root-on-testbed' not in testbed.caps: + build_essential += ['fakeroot'] + +- testbed.satisfy_dependencies_string(bd + ', ' + bdi + ', ' + bda + ', ' + ', '.join(build_essential), arg, +- build_dep=True, shell_on_failure=opts.shell_fail) ++ if opts.architecture: ++ dpkg_buildpackage += ' -a' + opts.architecture ++ build_essential += ['crossbuild-essential-' + opts.architecture] ++ # apt-get build-dep is the best option here, but we don't call ++ # it unconditionally because it doesn't take a path to a source ++ # package as an option in very old releases; so for compatibility ++ # only use it when we need its multiarch build-dep resolution ++ # support. ++ # This is supported in apt 1.1~exp2 and newer, which covers ++ # Debian oldstable (at time of writing) and Ubuntu 16.04 and ++ # newer, so once we can rely on this version of apt everywhere, ++ # the old build-dep resolver code should be deprecated. ++ all_build_deps = '' ++ testbed.satisfy_build_deps(result_pwd, ++ architecture=opts.architecture, ++ shell_on_failure=opts.shell_fail) ++ else: ++ if kind in ('apt-source', 'git-source'): ++ # we need to get the downloaded debian/control from the ++ # testbed, so that we can avoid calling "apt-get build-dep" ++ # and thus introducing a second mechanism for installing ++ # build deps ++ pkg_control = adt_testbed.Path(testbed, ++ os.path.join(tmp, 'apt-control'), ++ os.path.join(result_pwd, 'debian/control'), False) ++ pkg_control.copyup() ++ dsc = pkg_control.host ++ ++ with open(dsc, encoding='UTF-8') as f: ++ d = deb822.Deb822(sequence=f) ++ bd = d.get('Build-Depends', '') ++ bdi = d.get('Build-Depends-Indep', '') ++ bda = d.get('Build-Depends-Arch', '') ++ ++ all_build_deps = bd + ', ' + bdi + ', ' + bda + ', ' ++ ++ testbed.satisfy_dependencies_string(all_build_deps ++ + ', '.join(build_essential), ++ arg, ++ build_dep=True, ++ shell_on_failure=opts.shell_fail) + + # keep patches applied for tests + source_rules_command([dpkg_buildpackage, 'dpkg-source --before-build .'], 'build', cwd=result_pwd) diff -Nru autopkgtest-5.11ubuntu1.1/debian/patches/0004-Cross-arch-handling-of-in-test-depends.patch autopkgtest-5.11ubuntu1.2/debian/patches/0004-Cross-arch-handling-of-in-test-depends.patch --- autopkgtest-5.11ubuntu1.1/debian/patches/0004-Cross-arch-handling-of-in-test-depends.patch 1970-01-01 00:00:00.000000000 +0000 +++ autopkgtest-5.11ubuntu1.2/debian/patches/0004-Cross-arch-handling-of-in-test-depends.patch 2023-01-11 21:41:14.000000000 +0000 @@ -0,0 +1,106 @@ +commit d9e037ec460141d5174dce4b26abd0731b16072f +Author: Steve Langasek +Date: Wed Nov 27 18:21:53 2019 -0800 + + Cross-arch handling of @ in test depends + + When we have a target architecture specified, generally assume that test + dependencies can be satisfied by packages of the testbed architecture; but + special-case packages built from the package we're testing, since it doesn't + make sense to "cross" test if we're just going to install the binaries for + the testbed architecture! + +diff --git a/lib/testdesc.py b/lib/testdesc.py +index 84d24db..5ee5a7d 100644 +--- a/lib/testdesc.py ++++ b/lib/testdesc.py +@@ -239,7 +239,7 @@ def _debian_check_unknown_fields(name, record): + raise Unsupported(name, 'unknown field %s' % unknown_keys.pop()) + + +-def _debian_packages_from_source(srcdir): ++def _debian_packages_from_source(srcdir, cross_arch=None): + packages = [] + packages_no_arch = [] + +@@ -252,10 +252,17 @@ def _debian_packages_from_source(srcdir): + st.get('Package-type', 'deb') != 'deb': + continue + arch = st['Architecture'] +- if arch in ('all', 'any'): ++ qual_pkg = st['Package'] ++ # take care to emit an arch qualifier only for arch-dependent ++ # packages, not for arch: all ones ++ if cross_arch: ++ qual_pkg += ':' + cross_arch ++ if arch == 'all': + packages.append(st['Package']) ++ elif arch == 'any': ++ packages.append(qual_pkg) + else: +- packages.append('%s [%s]' % (st['Package'], arch)) ++ packages.append('%s [%s]' % (qual_pkg, arch)) + packages_no_arch.append(st['Package']) + + return (packages, packages_no_arch) +@@ -353,7 +360,8 @@ def _synthesize_deps(dep, testbed_arch): + return None + + +-def _parse_debian_depends(testname, dep_str, srcdir, testbed_arch): ++def _parse_debian_depends(testname, dep_str, srcdir, testbed_arch, ++ cross_arch=None): + '''Parse Depends: line in a Debian package + + Split dependencies (comma separated), validate their syntax, and expand @ +@@ -364,7 +372,8 @@ def _parse_debian_depends(testname, dep_str, srcdir, testbed_arch): + ''' + deps = [] + synthdeps = [] +- (my_packages, my_packages_no_arch) = _debian_packages_from_source(srcdir) ++ (my_packages, my_packages_no_arch) = _debian_packages_from_source(srcdir, ++ cross_arch=cross_arch) + for alt_group_str in dep_str.split(','): + alt_group_str = alt_group_str.strip() + if not alt_group_str: +@@ -429,7 +438,7 @@ def _autodep8(srcdir): + + + def parse_debian_source(srcdir, testbed_caps, testbed_arch, control_path=None, +- auto_control=True): ++ auto_control=True, cross_arch=None): + '''Parse test descriptions from a Debian DEP-8 source dir + + You can specify an alternative path for the control file (default: +@@ -503,7 +512,7 @@ def parse_debian_source(srcdir, testbed_caps, testbed_arch, control_path=None, + test_names[0], + record.get('Depends', '@'), + srcdir, +- testbed_arch) ++ testbed_arch, cross_arch=cross_arch) + if 'Test-command' in record: + raise InvalidControl('*', 'Only one of "Tests" or ' + '"Test-Command" may be given') +@@ -529,7 +538,7 @@ def parse_debian_source(srcdir, testbed_caps, testbed_arch, control_path=None, + command, + record.get('Depends', '@'), + srcdir, +- testbed_arch) ++ testbed_arch, cross_arch=cross_arch) + if feature_test_name is None: + command_counter += 1 + name = 'command%i' % command_counter +diff --git a/runner/autopkgtest b/runner/autopkgtest +index 61832bb..802e9ea 100755 +--- a/runner/autopkgtest ++++ b/runner/autopkgtest +@@ -756,7 +756,8 @@ def process_actions(): + (tests, skipped) = testdesc.parse_debian_source( + tests_tree.host, testbed.caps, testbed.dpkg_arch, + control_path=control_override, +- auto_control=opts.auto_control) ++ auto_control=opts.auto_control, ++ cross_arch=opts.architecture) + except testdesc.InvalidControl as e: + adtlog.badpkg(str(e)) + diff -Nru autopkgtest-5.11ubuntu1.1/debian/patches/0005-cross-arch-aware-apt-pinning.patch autopkgtest-5.11ubuntu1.2/debian/patches/0005-cross-arch-aware-apt-pinning.patch --- autopkgtest-5.11ubuntu1.1/debian/patches/0005-cross-arch-aware-apt-pinning.patch 1970-01-01 00:00:00.000000000 +0000 +++ autopkgtest-5.11ubuntu1.2/debian/patches/0005-cross-arch-aware-apt-pinning.patch 2023-01-11 21:41:14.000000000 +0000 @@ -0,0 +1,38 @@ +commit dd9cea62afc459c64352b9885b7403f0ead0d2ac +Author: Steve Langasek +Date: Wed Nov 27 18:28:18 2019 -0800 + + cross-arch aware apt pinning + + apt pin matches for the binaries from this source should be based on the + target arch, not the testbed arch. + + (We probably need to also include binaries for the testbed arch, but that + will come later.) + +diff --git a/runner/autopkgtest b/runner/autopkgtest +index 802e9ea..6989d6b 100755 +--- a/runner/autopkgtest ++++ b/runner/autopkgtest +@@ -388,6 +388,12 @@ def build_source(kind, arg, built_binari + return tests_tree + + elif kind == 'apt-source': ++ # Make sure we are selecting the binaries based on the actual target ++ # architecture, not necessarily the testbed architecture ++ if opts.architecture: ++ arch = opts.architecture ++ else: ++ arch = testbed.dpkg_arch + # The default is to determine the version for "apt-get source + # pkg=version" that conforms to the current apt pinning. We only + # consider binaries which are shipped in all available versions, +@@ -436,7 +442,7 @@ pkgs=$(echo "$pkgs\n" | awk " + next } + (/^ / && inlist == 1) { thissrc[\\$1] = 1; next } + { if (!inlist) next; +- inlist=0;''' % {'src': arg} ++ inlist=0;''' % {'src': arg, 'arch': arch} + + create_command_part2_check_all_pkgs = ''' + remaining=0; diff -Nru autopkgtest-5.11ubuntu1.1/debian/patches/0005.patch autopkgtest-5.11ubuntu1.2/debian/patches/0005.patch --- autopkgtest-5.11ubuntu1.1/debian/patches/0005.patch 1970-01-01 00:00:00.000000000 +0000 +++ autopkgtest-5.11ubuntu1.2/debian/patches/0005.patch 2023-01-11 21:41:14.000000000 +0000 @@ -0,0 +1,26 @@ +Index: autopkgtest-5.11ubuntu1.1/runner/autopkgtest +=================================================================== +--- autopkgtest-5.11ubuntu1.1.orig/runner/autopkgtest ++++ autopkgtest-5.11ubuntu1.1/runner/autopkgtest +@@ -388,6 +388,12 @@ def build_source(kind, arg, built_binari + return tests_tree + + elif kind == 'apt-source': ++ # Make sure we are selecting the binaries based on the actual target ++ # architecture, not necessarily the testbed architecture ++ if opts.architecture: ++ arch = opts.architecture ++ else: ++ arch = testbed.dpkg_arch + # The default is to determine the version for "apt-get source + # pkg=version" that conforms to the current apt pinning. We only + # consider binaries which are shipped in all available versions, +@@ -436,7 +442,7 @@ pkgs=$(echo "$pkgs\n" | awk " + next } + (/^ / && inlist == 1) { thissrc[\\$1] = 1; next } + { if (!inlist) next; +- inlist=0;''' % {'src': arg} ++ inlist=0;''' % {'src': arg, 'arch': arch} + + create_command_part2_check_all_pkgs = ''' + remaining=0; diff -Nru autopkgtest-5.11ubuntu1.1/debian/patches/0006-cross-arch-handling-of-packages-from-the-source-pack.patch autopkgtest-5.11ubuntu1.2/debian/patches/0006-cross-arch-handling-of-packages-from-the-source-pack.patch --- autopkgtest-5.11ubuntu1.1/debian/patches/0006-cross-arch-handling-of-packages-from-the-source-pack.patch 1970-01-01 00:00:00.000000000 +0000 +++ autopkgtest-5.11ubuntu1.2/debian/patches/0006-cross-arch-handling-of-packages-from-the-source-pack.patch 2023-01-11 21:41:14.000000000 +0000 @@ -0,0 +1,55 @@ +commit c6dfa7fa55f31d9c1af43c1a7bc39b86781b463d +Author: Steve Langasek +Date: Wed Nov 27 23:02:34 2019 -0800 + + cross-arch handling of packages from the source package under test. + + Ensure packages from this source are arch-qualified in the dependency list, + so that we don't mis-test packages for the testbed arch when cross-testing. + +diff --git a/lib/testdesc.py b/lib/testdesc.py +index 5ee5a7d..eb2ffd4 100644 +--- a/lib/testdesc.py ++++ b/lib/testdesc.py +@@ -374,6 +374,10 @@ def _parse_debian_depends(testname, dep_str, srcdir, testbed_arch, + synthdeps = [] + (my_packages, my_packages_no_arch) = _debian_packages_from_source(srcdir, + cross_arch=cross_arch) ++ if cross_arch: ++ target_arch = cross_arch ++ else: ++ target_arch = testbed_arch + for alt_group_str in dep_str.split(','): + alt_group_str = alt_group_str.strip() + if not alt_group_str: +@@ -384,7 +388,7 @@ def _parse_debian_depends(testname, dep_str, srcdir, testbed_arch, + for d in my_packages: + adtlog.debug('synthesised dependency %s' % d) + deps.append(d) +- s = _synthesize_deps(d, testbed_arch) ++ s = _synthesize_deps(d, target_arch) + if s: + synthdeps.append(s) + elif alt_group_str == '@builddeps@': +@@ -398,8 +402,10 @@ def _parse_debian_depends(testname, dep_str, srcdir, testbed_arch, + if pkg not in my_packages_no_arch: + synthdep_alternatives = [] + break +- s = _synthesize_deps(dep, testbed_arch) ++ s = _synthesize_deps(dep, target_arch) + if s: ++ if cross_arch: ++ s += ':' + cross_arch + synthdep_alternatives.append(s) + if synthdep_alternatives: + adtlog.debug('marked alternatives %s as a synthesised dependency' % synthdep_alternatives) +@@ -407,6 +413,9 @@ def _parse_debian_depends(testname, dep_str, srcdir, testbed_arch, + synthdeps.append(synthdep_alternatives) + else: + synthdeps.append(synthdep_alternatives[0]) ++ if cross_arch and alt_group_str + ':' + cross_arch in my_packages: ++ adtlog.debug('%s is from our source package, adding arch qualifier for cross-testing' % s) ++ alt_group_str += ':' + cross_arch + deps.append(alt_group_str) + + return (deps, synthdeps) diff -Nru autopkgtest-5.11ubuntu1.1/debian/patches/0007-cross-arch-handling-of-all-test-deps-via-apt-get-bui.patch autopkgtest-5.11ubuntu1.2/debian/patches/0007-cross-arch-handling-of-all-test-deps-via-apt-get-bui.patch --- autopkgtest-5.11ubuntu1.1/debian/patches/0007-cross-arch-handling-of-all-test-deps-via-apt-get-bui.patch 1970-01-01 00:00:00.000000000 +0000 +++ autopkgtest-5.11ubuntu1.2/debian/patches/0007-cross-arch-handling-of-all-test-deps-via-apt-get-bui.patch 2023-01-11 21:41:14.000000000 +0000 @@ -0,0 +1,79 @@ +commit 52ae9972653dec31bfddd2623d4e59ce47c84fd4 +Author: Steve Langasek +Date: Thu Nov 28 20:57:49 2019 -0800 + + cross-arch handling of all test deps via apt-get build-dep + + The apt-get build-dep resolver is designed to handle Build-Depends fields, + which have additional multiarch semantics that are relevant here and are not + supported by apt-get install. In order to make it possible to correctly + specify test deps in a cross-friendly manner, whenever we have a cross-arch + specified, use apt-get build-dep to install test dependencies instead of + apt-get --fix-broken. + + This has the effect that a test dependency on a package which is not + declared as Multi-Arch: foreign will pull in the version of the package for + the test arch, unless that test dependency has the :native tag appended to + the package name. + + I have confirmed that the existing autopkgtest test dep resolver plus + apt-get in Ubuntu 14.04 do the right thing with :native tags, so maintainers + do not risk incompatibility with existing test environments by adopting this + convention. + +diff --git a/lib/adt_testbed.py b/lib/adt_testbed.py +index c9662f9..ff1a0ff 100644 +--- a/lib/adt_testbed.py ++++ b/lib/adt_testbed.py +@@ -395,7 +395,8 @@ class Testbed: + self._opened(pl) + self.modified = False + +- def install_deps(self, deps_new, recommends, shell_on_failure=False, synth_deps=[]): ++ def install_deps(self, deps_new, recommends, shell_on_failure=False, ++ synth_deps=[], cross_arch=None): + '''Install dependencies into testbed''' + adtlog.debug('install_deps: deps_new=%s, recommends=%s' % (deps_new, recommends)) + +@@ -403,7 +404,24 @@ class Testbed: + self.recommends_installed = recommends + if not deps_new: + return +- self.satisfy_dependencies_string(', '.join(deps_new), 'install-deps', recommends, shell_on_failure=shell_on_failure, synth_deps=synth_deps) ++ if cross_arch: ++ # mock up a .dsc with our dependencies string as our build-deps ++ dsc = TempPath(self, 'autopkgtest-satdep.dsc') ++ with open(dsc.host, 'w', encoding='UTF-8') as f_dsc: ++ f_dsc.write("Source: autopkgtest-satdep\n" ++ "Binary: autopkgtest-satdep\n" ++ "Architecture: any all\n" ++ "Build-Depends: " + ', '.join(deps_new) + "\n") ++ dsc.copydown() ++ ++ # feed the result to apt-get build-dep ++ self.satisfy_build_deps(dsc.tb, cross_arch, ++ recommends, shell_on_failure) ++ # Now handle the synthetic deps as well ++ self.install_apt('', recommends, shell_on_failure, synth_deps) ++ ++ else: ++ self.satisfy_dependencies_string(', '.join(deps_new), 'install-deps', recommends, shell_on_failure=shell_on_failure, synth_deps=synth_deps) + + def needs_reset(self): + # show what caused a reset +diff --git a/runner/autopkgtest b/runner/autopkgtest +index 6989d6b..e97862f 100755 +--- a/runner/autopkgtest ++++ b/runner/autopkgtest +@@ -159,7 +159,10 @@ def run_tests(tests, tree): + binaries.publish() + doTest = True + try: +- testbed.install_deps(t.depends, 'needs-recommends' in t.restrictions, opts.shell_fail, t.synth_depends) ++ testbed.install_deps(t.depends, ++ 'needs-recommends' in t.restrictions, ++ opts.shell_fail, t.synth_depends, ++ opts.architecture) + except adtlog.BadPackageError as e: + if 'skip-not-installable' in t.restrictions: + errorcode |= 2 diff -Nru autopkgtest-5.11ubuntu1.1/debian/patches/0008-Ensure-we-are-installing-the-testbed-native-version-.patch autopkgtest-5.11ubuntu1.2/debian/patches/0008-Ensure-we-are-installing-the-testbed-native-version-.patch --- autopkgtest-5.11ubuntu1.1/debian/patches/0008-Ensure-we-are-installing-the-testbed-native-version-.patch 1970-01-01 00:00:00.000000000 +0000 +++ autopkgtest-5.11ubuntu1.2/debian/patches/0008-Ensure-we-are-installing-the-testbed-native-version-.patch 2023-01-11 21:41:14.000000000 +0000 @@ -0,0 +1,33 @@ +commit f38ba729f629449ec5b7e668029f2432da0dceb5 +Author: Steve Langasek +Date: Thu Nov 28 21:51:55 2019 -0800 + + Ensure we are installing the testbed-native version of build-essential + + The build-essential package is not Multi-Arch: foreign, so we need to make + sure we are always picking up the package for the testbed architecture, not + for a cross-test architecture. We also install crossbuild-essential-$arch, + which requires similar :native handling. + +diff --git a/runner/autopkgtest b/runner/autopkgtest +index e97862f..b0c9b1b 100755 +--- a/runner/autopkgtest ++++ b/runner/autopkgtest +@@ -590,7 +590,7 @@ dpkg-source -x %(src)s_*.dsc src >/dev/null''' % {'src': arg} + testbed.install_deps([], False) + + # determine build command and build-essential packages +- build_essential = ['build-essential'] ++ build_essential = ['build-essential:native'] + assert testbed.nproc + dpkg_buildpackage = 'DEB_BUILD_OPTIONS="parallel=%s $DEB_BUILD_OPTIONS" dpkg-buildpackage -us -uc -b' % ( + opts.build_parallel or testbed.nproc) +@@ -602,7 +602,7 @@ dpkg-source -x %(src)s_*.dsc src >/dev/null''' % {'src': arg} + + if opts.architecture: + dpkg_buildpackage += ' -a' + opts.architecture +- build_essential += ['crossbuild-essential-' + opts.architecture] ++ build_essential += ['crossbuild-essential-%s:native' % opts.architecture] + # apt-get build-dep is the best option here, but we don't call + # it unconditionally because it doesn't take a path to a source + # package as an option in very old releases; so for compatibility diff -Nru autopkgtest-5.11ubuntu1.1/debian/patches/0009-coding-style.patch autopkgtest-5.11ubuntu1.2/debian/patches/0009-coding-style.patch --- autopkgtest-5.11ubuntu1.1/debian/patches/0009-coding-style.patch 1970-01-01 00:00:00.000000000 +0000 +++ autopkgtest-5.11ubuntu1.2/debian/patches/0009-coding-style.patch 2023-01-11 21:41:14.000000000 +0000 @@ -0,0 +1,21 @@ +commit c4fc7003a2447e07d4e44083757dfe3458b26e2e +Author: Steve Langasek +Date: Fri Nov 29 00:37:54 2019 -0800 + + coding style + +diff --git a/runner/autopkgtest b/runner/autopkgtest +index b0c9b1b..f1e2e8f 100755 +--- a/runner/autopkgtest ++++ b/runner/autopkgtest +@@ -636,8 +636,8 @@ dpkg-source -x %(src)s_*.dsc src >/dev/null''' % {'src': arg} + + all_build_deps = bd + ', ' + bdi + ', ' + bda + ', ' + +- testbed.satisfy_dependencies_string(all_build_deps +- + ', '.join(build_essential), ++ testbed.satisfy_dependencies_string(all_build_deps + ++ ', '.join(build_essential), + arg, + build_dep=True, + shell_on_failure=opts.shell_fail) diff -Nru autopkgtest-5.11ubuntu1.1/debian/patches/0010-pin-pockets-with-500.patch autopkgtest-5.11ubuntu1.2/debian/patches/0010-pin-pockets-with-500.patch --- autopkgtest-5.11ubuntu1.1/debian/patches/0010-pin-pockets-with-500.patch 1970-01-01 00:00:00.000000000 +0000 +++ autopkgtest-5.11ubuntu1.2/debian/patches/0010-pin-pockets-with-500.patch 2023-01-11 21:41:14.000000000 +0000 @@ -0,0 +1,72 @@ +commit c92df58ae5f3bc55aa58bbfb93ca60cb38b2615c +Author: Paride Legovini +Date: Tue Dec 6 19:46:15 2022 +0100 + + Pin pockets with Pin-Priority: 500 + + Ubuntu is switching to NotAutomatic: yes for the proposed pocket: + the change is already operative on >= Lunar and under consideration + for older stable releases. This means that by default packages from + -proposed won't be installed unless explicitly requested. + + The change is meant to make it easier for end users to keep -proposed + enabled (for SRU verification or individual package installation) + without manually adding a pin to avoid pulling in all of -proposed. + + However when running autopkgtests with --apt-pocket=proposed we do want + to pull in all the pocket, so let's always give it Pin-Priority: 500. + This is similar to what Launchpad does with the buildds. + + Note: This change does not really treat -proposed in a special way: + any pocket will get Pin-Priority: 500. It makes sense to keep the tool + behavior consistent, and we're not aware of cases where this could be + cause issues. + +diff --git a/lib/adt_testbed.py b/lib/adt_testbed.py +index d2991eb..9f92b2b 100644 +--- a/lib/adt_testbed.py ++++ b/lib/adt_testbed.py +@@ -347,15 +347,22 @@ class Testbed: + ''' % (pocket, pocket, pocket) + self.check_exec(['sh', '-ec', script]) + +- # create apt pinning for --apt-pocket with package list ++ # create apt pinning for --apt-pocket + for pocket in self.add_apt_pockets: + # do we have a package list? +- try: ++ pkglist = '' ++ if '=' in pocket: + (pocket, pkglist) = pocket.split('=', 1) +- except ValueError: +- continue +- self._create_apt_pinning_for_packages(self._get_default_release() + '-' + pocket, pkglist, +- [self._get_default_release() + '-updates']) ++ ++ # set priority for the specified pocket. ++ # this is useful to override NotAutomatic: yes. ++ self._create_apt_pinning_for_pocket(self._get_default_release() + '-' + pocket) ++ ++ # set priorities for individual packages if specified ++ if pkglist: ++ self._create_apt_pinning_for_packages(self._get_default_release() + '-' + pocket, pkglist, ++ [self._get_default_release() + '-updates']) ++ + if self.add_apt_releases: + get_mirror_and_components = ''' + sed -rn 's/^(deb|deb-src) +(\\[.*\\] *)?((http|https|file):[^ ]*) +([^ ]+) +(.*)$/\\2\\3 \\6/p' \\ +@@ -1332,6 +1339,14 @@ Description: satisfy autopkgtest test dependencies + # helper methods + # + ++ def _create_apt_pinning_for_pocket(self, release): ++ '''Create apt pinning for --apt-pocket=pocket[=pkglist] with ++ Pin-Priority: 500 to undo the effect of NotAutomatic: yes''' ++ ++ script = 'printf "Package: *\\nPin: release a=%(release)s\\nPin-Priority: 500\\n" > /etc/apt/preferences.d/autopkgtest-%(release)s-baseline; ' % \ ++ {'release': release} ++ self.check_exec(['sh', '-ec', script]) ++ + def _create_apt_pinning_for_packages(self, release, pkglist, default_releases=[]): + '''Create apt pinning for --apt-pocket=pocket=pkglist and + --pin-packages=release=pkglist''' diff -Nru autopkgtest-5.11ubuntu1.1/debian/patches/series autopkgtest-5.11ubuntu1.2/debian/patches/series --- autopkgtest-5.11ubuntu1.1/debian/patches/series 1970-01-01 00:00:00.000000000 +0000 +++ autopkgtest-5.11ubuntu1.2/debian/patches/series 2023-01-11 21:41:14.000000000 +0000 @@ -0,0 +1,10 @@ +0001-Add-an-architecture-argument-to-autopkgtest-for-fore.patch +0002-Add-support-for-using-apt-get-build-dep-for-build-de.patch +0003-Multiarch-build-support.patch +0004-Cross-arch-handling-of-in-test-depends.patch +0005-cross-arch-aware-apt-pinning.patch +0006-cross-arch-handling-of-packages-from-the-source-pack.patch +0007-cross-arch-handling-of-all-test-deps-via-apt-get-bui.patch +0008-Ensure-we-are-installing-the-testbed-native-version-.patch +0009-coding-style.patch +0010-pin-pockets-with-500.patch