commit:     804d9f20534d0bc504f873a893596f79c8837f46
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sat Oct  1 15:28:24 2022 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sat Oct  1 16:19:37 2022 +0000
URL:        https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=804d9f20

catalyst: generate .sha256 file if any digest is enabled

Backport from master branch

checksum format is simple one, identical to one
sha256sum from coreutils produces, lines starting with # are ignored.

example:[1]

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 <AT> gentoo.org>
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 catalyst/base/genbase.py  | 2 ++
 doc/catalyst-config.5.txt | 3 ++-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/catalyst/base/genbase.py b/catalyst/base/genbase.py
index 0909a475..94b02f26 100644
--- a/catalyst/base/genbase.py
+++ b/catalyst/base/genbase.py
@@ -52,3 +52,5 @@ class GenBase(object):
                                                                for j in array:
                                                                        digest 
= hash_map.generate_hash(f, hash_=j)
                                                                        
myf.write(digest)
+                               with io.open(path + '.sha256', 'w', 
encoding='utf-8') as sha256file:
+                                       
sha256file.write(hash_map.generate_hash(path, hash_='sha256'))

diff --git a/doc/catalyst-config.5.txt b/doc/catalyst-config.5.txt
index 76ac4a29..ef52941e 100644
--- a/doc/catalyst-config.5.txt
+++ b/doc/catalyst-config.5.txt
@@ -55,7 +55,8 @@ Basic configuration
 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`).  See the *SUPPORTED HASHES*
-section for a list of supported hashes.
+section for a list of supported hashes. Enabling ANY digest will
+generate a `.sha256` file in addition to the `.DIGESTS` file.
 
 *contents*::
 Create a `.CONTENTS` file listing the contents of the file.  If this

Reply via email to