From: Georgy Yakovlev <gyakovlev@gentoo.org>
To: gentoo-catalyst@lists.gentoo.org
Cc: Georgy Yakovlev <gyakovlev@gentoo.org>
Subject: [gentoo-catalyst] [PATCH] catalyst: generate .sha256 file if any digest is enabled
Date: Thu, 4 Nov 2021 20:21:11 -0700 [thread overview]
Message-ID: <20211105032111.689252-1-gyakovlev@gentoo.org> (raw)
checksum format is simple one, identical to one
sha256sum from coreutils produces, lines starting with # are ignored.
example:[1]
# SHA256 HASH
xxxx..... stage3-....tar.xz
systemd upstream calls it suse-style .sha256 files.[0]
infra already supports inline signing of files.
Bug: https://bugs.gentoo.org/821568
[0] https://github.com/systemd/systemd/blob/aedec452b9e5dd197881f2164fb205dfe8bfdcec/src/import/pull-common.c#L236
[1] https://mirrors.edge.kernel.org/opensuse/distribution/leap/15.0/iso/openSUSE-Leap-15.0-DVD-x86_64.iso.sha256
Signed-off-by: Georgy Yakovlev <gyakovlev@gentoo.org>
---
catalyst/base/genbase.py | 3 +++
doc/catalyst-config.5.txt | 7 ++++---
2 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/catalyst/base/genbase.py b/catalyst/base/genbase.py
index 6d039a8f..1643b1dc 100644
--- a/catalyst/base/genbase.py
+++ b/catalyst/base/genbase.py
@@ -43,3 +43,6 @@ class GenBase():
for f in [path, path + '.CONTENTS.gz']:
for i in self.settings['digests']:
file.write(self.generate_hash(f, name=i))
+
+ with io.open(path + '.sha256', 'w', encoding='utf-8') as sha256file:
+ sha256file.write(self.generate_hash(path, name='sha256'))
diff --git a/doc/catalyst-config.5.txt b/doc/catalyst-config.5.txt
index 003d40b6..ca9335d6 100644
--- a/doc/catalyst-config.5.txt
+++ b/doc/catalyst-config.5.txt
@@ -38,9 +38,10 @@ Basic configuration
*digests*::
Create a `.DIGESTS` file containing the hash output from any of the
supported options below. Adding them all may take a long time.
-(example: `md5 sha1 sha512 whirlpool`). The set of supported hashes
-is dependent on the version of Python. To see the set of hashes
-supported by the version of Python in use, run
+(example: `md5 sha1 sha512 whirlpool`). Enabling ANY digest will
+generate `.sha256` file in addition `.DIGESTS` file. The set of
+supported hashes is dependent on the version of Python. To see the
+set of hashes supported by the version of Python in use, run
+
---------------------------------
$ python3 -c 'import hashlib; print(hashlib.algorithms_available)'
--
2.33.1
next reply other threads:[~2021-11-05 3:21 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-05 3:21 Georgy Yakovlev [this message]
2021-11-19 2:58 ` [gentoo-catalyst] [PATCH] catalyst: generate .sha256 file if any digest is enabled Matt Turner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20211105032111.689252-1-gyakovlev@gentoo.org \
--to=gyakovlev@gentoo.org \
--cc=gentoo-catalyst@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox