Control: tags -1 patch ^^^^^ untested and includes typo We had a live discussion on #ubuntu-release just now. To keep it attached to the bug, I send it here, including an untested patch with typo in the attachment.
[11:06:51] <elbrus> Laney: slangasek: juliank: regarding debian bug 893754 [11:06:52] <ubot5> Debian bug 893754 in autopkgtest "autopkgtest 5.1 "autopkgtest-default-release" breaks tests that exercise apt" [Normal,Open] http://bugs.debian.org/893754 [11:07:34] <juliank> elbrus: I just sent an email [11:09:09] <elbrus> juliank: reading [11:09:09] <elbrus> juliank: but it is python-apt specific? [11:09:14] <elbrus> as apt just works int that environment [11:09:23] <juliank> apt -o Dir should fail [11:09:40] <juliank> In general, it's all very fragile [11:10:13] <elbrus> what exactly is fragile? [11:10:29] <juliank> What happens is that if you change the root directory in apt by setting Dir, you still have the host's config files read, because you're setting Dir after they are read. [11:10:54] <juliank> Now apt tries to find the release you specified in the host apt.conf(.d), but cannot find it inside Dir's sources.list and errors out [11:10:59] <elbrus> my problem, why I went for APT::Default-Release is that it is agnostic for the delta between suite and codename [11:12:33] <elbrus> I don't want to detect if /etc/apt/sources.list is mentioning a suite or codename, and convert if required (as that means knowing all codenames) [11:13:12] <elbrus> therefor, the old method of using "release -a=" doesn't work anymore [11:13:25] <juliank> elbrus: It's the same as using "release bionic" [11:13:36] <juliank> without a= or n= [11:13:51] <elbrus> juliank: so I don't need the a= or n=? [11:13:57] <juliank> Right [11:14:20] <juliank> If you just write "release foo", it checks codename, suite, version. That's precisely what APT::Default-Release generates [11:14:38] -*- juliank just learned that [11:14:38] <elbrus> so wouldn't python-apt still error out? [11:14:42] <juliank> No [11:14:51] <elbrus> what's the diff? [11:14:57] <juliank> The check for APT::Default-Release validity happens before it creates the pin [11:15:03] <juliank> # [11:15:13] <juliank> pins are not checked [11:15:17] <elbrus> great [11:15:50] <Laney> hey elbrus and juliank [11:15:51] <elbrus> juliank: can you update the documentation of apt_preferences when you touch it again? [11:15:55] <Laney> thanks for being responsive ♥ [11:16:12] <elbrus> np (<cut>) [11:17:48] <elbrus> hmm, I see an example without the a/n [11:18:16] <juliank> yeah, the manpage does not really document it well, but uses it [11:19:20] -*- juliank writes a bug [11:19:26] -*- elbrus wished he knew this a year ago [11:19:40] <elbrus> much headaches whould have been avoided [11:20:29] <juliank> elbrus: I only learned about that today as well :) [11:20:45] <elbrus> well, if you didn't know... ;) [11:20:47] <juliank> elbrus: though it's been that way since $forever [11:20:51] <elbrus> ack [11:21:00] <juliank> b2e465d6d3 (Arch Librarian 2004-09-20 16:56:32 +0000 59) CreatePin(pkgVersionMatch::Release,"",DefRel,990); [11:21:11] <juliank> I mean, that was before bzr [11:22:00] <juliank> Author: jgg, Date: 2001-02-20 07:03:16 GMT, "Join with aliencode" [11:22:12] <Laney> apt's code always makes my head hurt a bit [11:22:27] -*- elbrus never looked at it [11:22:28] <juliank> Laney: just dont read it [11:22:50] <Laney> juliank: write only coding [11:22:54] <Laney> :P [11:23:29] <elbrus> anyways, this probably means I'll have to remove an option from autopkgtest (and ci.debian.net / debci needs adaptation as well if so) [11:23:32] <elbrus> pain. [11:23:37] <Laney> it's just a different style to what I'm used to, doesn't lend itself to being read in my brain [11:23:43] <Laney> why does it? [11:23:55] <Laney> don't you replace the default-release with the pin and done? [11:24:05] <elbrus> it's an option now [11:24:11] <elbrus> to set the default-release [11:24:23] <juliank> well, and instead of writing that, write a pin file for the option? [11:24:30] <Laney> right [11:25:16] <elbrus> and ci.d.n uses it [11:25:25] <elbrus> see e.g. the top of https://ci.debian.net/data/autopkgtest/testing/amd64/r/ruby-rqrcode-rails3/30123/log.gz [11:25:43] <elbrus> hmm, no it doesn't [11:25:52] <elbrus> nevermind [11:26:24] <elbrus> juliank: I guess I could do that [11:26:58] <elbrus> but question, if pinning doesn't need validation, why does APT::Default-Release? [11:27:39] <juliank> Because more people used that then people used pins? [11:27:42] <juliank> I don't know [11:28:38] <juliank> there is not always a reason for why things are the way they are [11:28:54] <elbrus> typically: history [11:29:20] <juliank> http://bugs.debian.org/407511 [11:29:21] <ubot5> Debian bug 407511 in apt "apt: Wrong value for APT::Default-Release may cause unwanted " [Wishlist,Fixed] [11:29:40] <juliank> that was the discussion [11:32:46] <elbrus> I see [11:33:17] <elbrus> by the way, I'll copy this discussion to the bug (unless somebody objects) [11:33:35] <juliank> fine with me [11:38:15] <Laney> elbrus: something like https://paste.debian.net/1015983/ - untested, because I can't run the chroot tests for some reason [11:38:21] <Laney> feel free to start with that if you want to change it [11:38:29] <Laney> np on copying to the bug from me too [11:38:55] <Laney> + with open(os.path.join(apt_dir, 'preferences.d', 'autopkgtest-fluffy-proposed')) as f: <- wrong filename
From 89a70739171e4c35c41f038e3330e035fb065591 Mon Sep 17 00:00:00 2001 From: Iain Lane <iain.l...@canonical.com> Date: Thu, 22 Mar 2018 10:34:56 +0000 Subject: [PATCH] Use apt pinning instead of APT::Default-Release apt verifies that the value of APT::Default-Release exists in sources.list, and this breaks assumptions in certain tests which expect to be able to construct arbitrary sources.lists and work with them. pin files aren't subject to this validation, but are otherwise equivalent - let's use one of those. --- lib/adt_testbed.py | 5 ++--- tests/autopkgtest | 12 ++++++------ 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/lib/adt_testbed.py b/lib/adt_testbed.py index 0848f72..4e0d16c 100644 --- a/lib/adt_testbed.py +++ b/lib/adt_testbed.py @@ -613,7 +613,7 @@ Description: satisfy autopkgtest test dependencies 'Retrying with 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/apt.conf.d/autopkgtest-default-release']) + self.check_exec(['/bin/sh', '-ec', 'rm -f /etc/apt/apt.preferences.d/autopkgtest-default-release']) continue if shell_on_failure: @@ -1272,8 +1272,7 @@ fi def _set_default_release(self): '''Set APT::Default-Release to enable pinning to do it's job.''' - script = 'mkdir -p /etc/apt/apt.conf.d; ' - script += 'printf "APT::Default-Release \\"%(default)s\\";\\n" > /etc/apt/apt.conf.d/autopkgtest-default-release; ' % \ + script = 'printf "\nPackage: *\\nPin: release %(default)s\\nPin-Priority: 990\\n" > /etc/apt/preferences.d/autopkgtest-default-release' % \ {'default': self._get_default_release()} self.check_exec(['sh', '-ec', script]) diff --git a/tests/autopkgtest b/tests/autopkgtest index 8201665..afee411 100755 --- a/tests/autopkgtest +++ b/tests/autopkgtest @@ -1960,7 +1960,7 @@ deb [trusted=yes arch=6510] http://foo.ubuntu.com/ fluffy-proposed main 6510 # should set up apt pinning self.assertEqual(os.listdir(os.path.join(apt_dir, 'preferences.d')), - ['autopkgtest-fluffy-proposed']) + ['autopkgtest-fluffy-proposed', 'autopkgtest-default-release']) with open(os.path.join(apt_dir, 'preferences.d', 'autopkgtest-fluffy-proposed')) as f: self.assertEqual(f.read(), '''Package: foo bar Pin: release a=fluffy-proposed @@ -1969,13 +1969,13 @@ Pin-Priority: 995 Package: * Pin: release a=fluffy-updates Pin-Priority: 990 +''') + with open(os.path.join(apt_dir, 'preferences.d', 'autopkgtest-fluffy-proposed')) as f: + self.assertEqual(f.read(), '''Package: * +Pin: release fluffy +Pin-Priority: 990 ''') - # should set up APT::Default-Release - self.assertEqual(os.listdir(os.path.join(apt_dir, 'apt.conf.d')), - ['autopkgtest-default-release']) - with open(os.path.join(apt_dir, 'apt.conf.d', 'autopkgtest-default-release')) as f: - self.assertEqual(f.read(), 'APT::Default-Release "fluffy";\n') def test_apt_default_release(self): '''--apt-default-release''' -- 2.15.1
signature.asc
Description: OpenPGP digital signature