Gentoo Archives: gentoo-catalyst

From: Daniel Cordero <gentoo.catalyst@××××.ws>
To: gentoo-catalyst@l.g.o
Cc: "Andreas K. Hüttel" <dilfridge@g.o>
Subject: Re: [gentoo-catalyst] [PATCH] Add option to generate BSD-style tagged hashes (can be verified by modern coreutils)
Date: Thu, 18 Mar 2021 11:40:18
Message-Id: YFM1uNSfoWB38jhB@dysnomia.localdomain
In Reply to: [gentoo-catalyst] [PATCH] Add option to generate BSD-style tagged hashes (can be verified by modern coreutils) by "Andreas K. Hüttel"
1 On Wed, Feb 24, 2021 at 10:30:26PM +0100, Andreas K. Hüttel wrote:
2 > ---
3 > catalyst/base/genbase.py | 6 +++++-
4 > catalyst/defaults.py | 2 ++
5 > 2 files changed, 7 insertions(+), 1 deletion(-)
6 >
7 > diff --git a/catalyst/base/genbase.py b/catalyst/base/genbase.py
8 > index c7dd87bc..52418877 100644
9 > --- a/catalyst/base/genbase.py
10 > +++ b/catalyst/base/genbase.py
11 > @@ -24,7 +24,11 @@ class GenBase():
12 > h.update(data)
13 >
14 > filename = os.path.split(filepath)[1]
15 > - return f'# {name.upper()} HASH\n{h.hexdigest()} {filename}\n'
16 > +
17 > + if self.settings['digest_format'] == 'bsd':
18
19 GenBase.generate_hash is a @staticmethod, and no variable called 'self'
20 is passed to it:
21
22 class GenBase():
23 ...
24 @staticmethod
25 def generate_hash(filepath, name):
26 ...
27
28
29 Traceback (most recent call last):
30 File "/run/media/system/substrate/bindist/catalyst/bin/catalyst", line 27, in <module>
31 main(sys.argv[1:])
32 File "/run/media/system/substrate/bindist/catalyst/catalyst/main.py", line 256, in main
33 return _main(parser, opts)
34 File "/run/media/system/substrate/bindist/catalyst/catalyst/main.py", line 366, in _main
35 success = build_target(addlargs)
36 File "/run/media/system/substrate/bindist/catalyst/catalyst/main.py", line 79, in build_target
37 target = getattr(module, target)(conf_values, addlargs)
38 File "/run/media/system/substrate/bindist/catalyst/catalyst/targets/stage1.py", line 24, in __init__
39 StageBase.__init__(self, spec, addlargs)
40 File "/run/media/system/substrate/bindist/catalyst/catalyst/base/stagebase.py", line 183, in __init__
41 self.set_source_path()
42 File "/run/media/system/substrate/bindist/catalyst/catalyst/base/stagebase.py", line 463, in set_source_path
43 self.generate_hash(self.settings["source_path"], "sha1")
44 File "/run/media/system/substrate/bindist/catalyst/catalyst/base/genbase.py", line 28, in generate_hash
45 if self.settings['digest_format'] == 'bsd':
46 NameError: name 'self' is not defined
47
48 > + return f'# {name.upper()} HASH\n{name.upper()} ({filename}) = {h.hexdigest()}\n'
49 > + else:
50 > + return f'# {name.upper()} HASH\n{h.hexdigest()} {filename}\n'
51 >
52 > def gen_contents_file(self, path):
53 > c = self.settings['contents_map']
54 > diff --git a/catalyst/defaults.py b/catalyst/defaults.py
55 > index ccb0a584..2cede562 100644
56 > --- a/catalyst/defaults.py
57 > +++ b/catalyst/defaults.py
58 > @@ -11,6 +11,7 @@ from DeComp.definitions import DECOMPRESSOR_PROGRAM_OPTIONS, LIST_XATTRS_OPTIONS
59 > valid_config_file_values = frozenset([
60 > "compression_mode",
61 > "digests",
62 > + "digest_format",
63 > "distcc_hosts",
64 > "distdir",
65 > "envscript",
66 > @@ -35,6 +36,7 @@ confdefaults = {
67 > "compressor_options": XATTRS_OPTIONS['linux'],
68 > "decomp_opt": DECOMPRESSOR_PROGRAM_OPTIONS['linux'],
69 > "decompressor_search_order": DECOMPRESSOR_SEARCH_ORDER,
70 > + "digest_format": 'linux',
71 > "distdir": portage.settings['DISTDIR'],
72 > "icecream": "/var/cache/icecream",
73 > 'list_xattrs_opt': LIST_XATTRS_OPTIONS['linux'],
74 > --
75 > 2.30.1
76 >
77 >

Replies