From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 6AB3B158086 for ; Fri, 5 Nov 2021 03:21:20 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id AB454E08A8; Fri, 5 Nov 2021 03:21:19 +0000 (UTC) Received: from smtp.gentoo.org (mail.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id DDEE5E08A8 for ; Fri, 5 Nov 2021 03:21:18 +0000 (UTC) From: Georgy Yakovlev To: gentoo-catalyst@lists.gentoo.org Cc: Georgy Yakovlev Subject: [gentoo-catalyst] [PATCH] catalyst: generate .sha256 file if any digest is enabled Date: Thu, 4 Nov 2021 20:21:11 -0700 Message-Id: <20211105032111.689252-1-gyakovlev@gentoo.org> X-Mailer: git-send-email 2.33.1 Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-catalyst@lists.gentoo.org Reply-to: gentoo-catalyst@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Archives-Salt: 94f27966-72d2-421a-a75e-bc6c2f9a220e X-Archives-Hash: 5b74ec38794a13238c56251bd8bcc3b7 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 --- 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