Gentoo Archives: gentoo-catalyst

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