Gentoo Archives: gentoo-portage-dev

From: Zac Medico <zmedico@g.o>
To: gentoo-portage-dev@l.g.o, "Michał Górny" <mgorny@g.o>
Subject: Re: [gentoo-portage-dev] [PATCH] Make manifest-required-hashes configurable
Date: Mon, 06 Nov 2017 16:52:57
Message-Id: 2133106b-0131-0b22-87d0-8032ebd0a497@gentoo.org
In Reply to: Re: [gentoo-portage-dev] [PATCH] Make manifest-required-hashes configurable by "Michał Górny"
1 On 11/06/2017 08:47 AM, Michał Górny wrote:
2 > W dniu pon, 06.11.2017 o godzinie 08∶44 -0800, użytkownik Zac Medico
3 > napisał:
4 >> On 11/06/2017 07:27 AM, Michał Górny wrote:
5 >>> @@ -148,15 +147,21 @@ class Manifest(object):
6 >>> self.pkgdir = _unicode_decode(pkgdir).rstrip(os.sep) + os.sep
7 >>> self.fhashdict = {}
8 >>> self.hashes = set()
9 >>> + self.required_hashes = set()
10 >>>
11 >>> if hashes is None:
12 >>> hashes = MANIFEST2_HASH_DEFAULTS
13 >>> + if required_hashes is None:
14 >>> + required_hashes = hashes
15 >>>
16 >>> self.hashes.update(hashes)
17 >>> self.hashes.difference_update(hashname for hashname in \
18 >>> list(self.hashes) if hashname not in get_valid_checksum_keys())
19 >>> self.hashes.add("size")
20 >>> - self.hashes.add(MANIFEST2_REQUIRED_HASH)
21 >>> +
22 >>> + self.required_hashes.update(required_hashes)
23 >>> + self.required_hashes.intersection_update(self.hashes)
24 >>> +
25 >>
26 >> Requiring that presence of digests for all manifest-hashes can be
27 >> problematic, because when we extend manifest-hashes it means that nobody
28 >> can regenerate a particular manifest without fetching *all* distfiles
29 >> referenced in the Manifest. It's much more friendly if we generate the
30 >> missing digests when the distfiles happen to be available in DISTDIR,
31 >> which is how the portage currently behaves.
32 >
33 > This doesn't change. The intersection only strips away hashes that are
34 > not in 'self.hashes'.
35
36 Then the bug must have been introduced by changes to behavior of
37 digestgen in the same patch. Try adding MD5 to manifest-hashes, and then
38 try generating a manifest with no internet connection and DISTDIR set to
39 an empty directory. You'll see that it fails with the patch, but
40 succeeds with the current master branch.
41 --
42 Thanks,
43 Zac

Replies