Gentoo Archives: gentoo-commits

From: Matt Turner <mattst88@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/catalyst:wip/mattst88 commit in: catalyst/base/, doc/
Date: Sun, 30 Jan 2022 20:43:05
Message-Id: 1637808201.7457cd3b1a5f3ed4a566bbf23e36c939af06967c.mattst88@gentoo
1 commit: 7457cd3b1a5f3ed4a566bbf23e36c939af06967c
2 Author: Georgy Yakovlev <gyakovlev <AT> gentoo <DOT> org>
3 AuthorDate: Fri Nov 5 02:14:00 2021 +0000
4 Commit: Matt Turner <mattst88 <AT> gentoo <DOT> org>
5 CommitDate: Thu Nov 25 02:43:21 2021 +0000
6 URL: https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=7457cd3b
7
8 catalyst: generate .sha256 file if any digest is enabled
9
10 checksum format is simple one, identical to one
11 sha256sum from coreutils produces, lines starting with # are ignored.
12
13 example:[1]
14
15 # SHA256 HASH
16 xxxx..... stage3-....tar.xz
17
18 systemd upstream calls it suse-style .sha256 files.[0]
19 infra already supports inline signing of files.
20
21 Bug: https://bugs.gentoo.org/821568
22 [0] https://github.com/systemd/systemd/blob/aedec452b9e5dd197881f2164fb205dfe8bfdcec/src/import/pull-common.c#L236
23 [1] https://mirrors.edge.kernel.org/opensuse/distribution/leap/15.0/iso/openSUSE-Leap-15.0-DVD-x86_64.iso.sha256
24 Signed-off-by: Georgy Yakovlev <gyakovlev <AT> gentoo.org>
25
26 catalyst/base/genbase.py | 3 +++
27 doc/catalyst-config.5.txt | 7 ++++---
28 2 files changed, 7 insertions(+), 3 deletions(-)
29
30 diff --git a/catalyst/base/genbase.py b/catalyst/base/genbase.py
31 index 6d039a8f..1643b1dc 100644
32 --- a/catalyst/base/genbase.py
33 +++ b/catalyst/base/genbase.py
34 @@ -43,3 +43,6 @@ class GenBase():
35 for f in [path, path + '.CONTENTS.gz']:
36 for i in self.settings['digests']:
37 file.write(self.generate_hash(f, name=i))
38 +
39 + with io.open(path + '.sha256', 'w', encoding='utf-8') as sha256file:
40 + sha256file.write(self.generate_hash(path, name='sha256'))
41
42 diff --git a/doc/catalyst-config.5.txt b/doc/catalyst-config.5.txt
43 index 003d40b6..ca9335d6 100644
44 --- a/doc/catalyst-config.5.txt
45 +++ b/doc/catalyst-config.5.txt
46 @@ -38,9 +38,10 @@ Basic configuration
47 *digests*::
48 Create a `.DIGESTS` file containing the hash output from any of the
49 supported options below. Adding them all may take a long time.
50 -(example: `md5 sha1 sha512 whirlpool`). The set of supported hashes
51 -is dependent on the version of Python. To see the set of hashes
52 -supported by the version of Python in use, run
53 +(example: `md5 sha1 sha512 whirlpool`). Enabling ANY digest will
54 +generate `.sha256` file in addition `.DIGESTS` file. The set of
55 +supported hashes is dependent on the version of Python. To see the
56 +set of hashes supported by the version of Python in use, run
57 +
58 ---------------------------------
59 $ python3 -c 'import hashlib; print(hashlib.algorithms_available)'