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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 1A97D1382C5 for ; Thu, 18 Mar 2021 11:40:18 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 54240E087F; Thu, 18 Mar 2021 11:40:17 +0000 (UTC) Received: from rs234.mailgun.us (rs234.mailgun.us [209.61.151.234]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id AB164E087F for ; Thu, 18 Mar 2021 11:40:13 +0000 (UTC) DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=xxoo.ws; q=dns/txt; s=mx; t=1616067616; h=In-Reply-To: Content-Transfer-Encoding: Content-Type: MIME-Version: References: Message-ID: Subject: Cc: To: From: Date: Sender; bh=h4u9bA5BPksqJiI2M9OGqUX1GXKaWjZeqtOa2ZSRzns=; b=P3rB9PG4qHGNJdsHYrJ+RUn7y719ot5XnizKrMGZ4Ydt1vc1qFObHPpDq+Yo90cGGvgotXkv URebueNqgyYMk2eLUZF4N8FIilnNuc9vTE6WoeBjazXexSbnfHgkDFI5f2K2rHZvYUtcA4dL s1kEJ+vzJNFFDQ7v2hvUF0CvHxA= X-Mailgun-Sending-Ip: 209.61.151.234 X-Mailgun-Sid: WyIxYmU3MyIsICJnZW50b28tY2F0YWx5c3RAbGlzdHMuZ2VudG9vLm9yZyIsICJlYTQwNTYiXQ== Received: from mail.0xdc.io (ip-54-37-0.eu [54.37.0.172]) by smtp-out-n06.prod.us-west-2.postgun.com with SMTP id 60533c19e2200c0a0d7da4bb (version=TLS1.3, cipher=TLS_AES_128_GCM_SHA256); Thu, 18 Mar 2021 11:40:09 GMT Sender: gentoo.catalyst@xxoo.ws Received: from dysnomia (f.d.8.3.b.e.b.6.d.b.1.1.4.d.2.5.0.a.4.7.9.0.c.0.0.b.8.0.1.0.0.2.ip6.arpa [IPv6:2001:8b0:c09:74a0:52d4:11bd:6beb:38df]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail.0xdc.io (Postfix) with ESMTPSA id 713FE1023CE; Thu, 18 Mar 2021 11:40:25 +0000 (UTC) Date: Thu, 18 Mar 2021 11:40:03 +0000 From: Daniel Cordero To: gentoo-catalyst@lists.gentoo.org Cc: Andreas =?iso-8859-1?B?Sy4gSPx0dGVs?= Subject: Re: [gentoo-catalyst] [PATCH] Add option to generate BSD-style tagged hashes (can be verified by modern coreutils) Message-ID: References: <20210224213026.1031-1-dilfridge@gentoo.org> 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-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20210224213026.1031-1-dilfridge@gentoo.org> X-Archives-Salt: 7d4c4459-d82a-4a3c-b70e-cd9984c2c6b9 X-Archives-Hash: f5ad27d803018086166785381ed4c486 On Wed, Feb 24, 2021 at 10:30:26PM +0100, Andreas K. Hüttel wrote: > --- > catalyst/base/genbase.py | 6 +++++- > catalyst/defaults.py | 2 ++ > 2 files changed, 7 insertions(+), 1 deletion(-) > > diff --git a/catalyst/base/genbase.py b/catalyst/base/genbase.py > index c7dd87bc..52418877 100644 > --- a/catalyst/base/genbase.py > +++ b/catalyst/base/genbase.py > @@ -24,7 +24,11 @@ class GenBase(): > h.update(data) > > filename = os.path.split(filepath)[1] > - return f'# {name.upper()} HASH\n{h.hexdigest()} {filename}\n' > + > + if self.settings['digest_format'] == 'bsd': GenBase.generate_hash is a @staticmethod, and no variable called 'self' is passed to it: class GenBase(): ... @staticmethod def generate_hash(filepath, name): ... Traceback (most recent call last): File "/run/media/system/substrate/bindist/catalyst/bin/catalyst", line 27, in main(sys.argv[1:]) File "/run/media/system/substrate/bindist/catalyst/catalyst/main.py", line 256, in main return _main(parser, opts) File "/run/media/system/substrate/bindist/catalyst/catalyst/main.py", line 366, in _main success = build_target(addlargs) File "/run/media/system/substrate/bindist/catalyst/catalyst/main.py", line 79, in build_target target = getattr(module, target)(conf_values, addlargs) File "/run/media/system/substrate/bindist/catalyst/catalyst/targets/stage1.py", line 24, in __init__ StageBase.__init__(self, spec, addlargs) File "/run/media/system/substrate/bindist/catalyst/catalyst/base/stagebase.py", line 183, in __init__ self.set_source_path() File "/run/media/system/substrate/bindist/catalyst/catalyst/base/stagebase.py", line 463, in set_source_path self.generate_hash(self.settings["source_path"], "sha1") File "/run/media/system/substrate/bindist/catalyst/catalyst/base/genbase.py", line 28, in generate_hash if self.settings['digest_format'] == 'bsd': NameError: name 'self' is not defined > + return f'# {name.upper()} HASH\n{name.upper()} ({filename}) = {h.hexdigest()}\n' > + else: > + return f'# {name.upper()} HASH\n{h.hexdigest()} {filename}\n' > > def gen_contents_file(self, path): > c = self.settings['contents_map'] > diff --git a/catalyst/defaults.py b/catalyst/defaults.py > index ccb0a584..2cede562 100644 > --- a/catalyst/defaults.py > +++ b/catalyst/defaults.py > @@ -11,6 +11,7 @@ from DeComp.definitions import DECOMPRESSOR_PROGRAM_OPTIONS, LIST_XATTRS_OPTIONS > valid_config_file_values = frozenset([ > "compression_mode", > "digests", > + "digest_format", > "distcc_hosts", > "distdir", > "envscript", > @@ -35,6 +36,7 @@ confdefaults = { > "compressor_options": XATTRS_OPTIONS['linux'], > "decomp_opt": DECOMPRESSOR_PROGRAM_OPTIONS['linux'], > "decompressor_search_order": DECOMPRESSOR_SEARCH_ORDER, > + "digest_format": 'linux', > "distdir": portage.settings['DISTDIR'], > "icecream": "/var/cache/icecream", > 'list_xattrs_opt': LIST_XATTRS_OPTIONS['linux'], > -- > 2.30.1 > >