diff options
author | Olav Vitters <olav@vitters.nl> | 2020-05-06 17:16:22 +0200 |
---|---|---|
committer | Olav Vitters <olav@vitters.nl> | 2020-05-06 17:16:22 +0200 |
commit | 1cd76b321a2b35830dbb68dc8a63174f5e8ef9f7 (patch) | |
tree | be9662ffe60cf387d6ad9f28c0a0354736daf55c | |
parent | c71a0b35380f07191d157d895fcd1d0fb89f7d13 (diff) | |
download | mgagnome-1cd76b321a2b35830dbb68dc8a63174f5e8ef9f7.tar mgagnome-1cd76b321a2b35830dbb68dc8a63174f5e8ef9f7.tar.gz mgagnome-1cd76b321a2b35830dbb68dc8a63174f5e8ef9f7.tar.bz2 mgagnome-1cd76b321a2b35830dbb68dc8a63174f5e8ef9f7.tar.xz mgagnome-1cd76b321a2b35830dbb68dc8a63174f5e8ef9f7.zip |
SpecFile: again explain convert_buildrequire; also add a spec_path property
-rwxr-xr-x | mgagnome | 40 |
1 files changed, 23 insertions, 17 deletions
@@ -444,7 +444,7 @@ class SpecFile(): """Return the sources""" return self._sources_and_patches(flag=1) - def convert_buildrequires(self): + def convert_buildrequires(self, explain_changes=False): """Converts BuildRequires into their preferred form Requires SpecFile to be initialized with its package argument""" @@ -600,6 +600,20 @@ class SpecFile(): if change_to is not None: keys['changes'][req] = change_to + # Optionally explain the intended and failed buildrequire changes + if explain_changes: + if debug_enabled: + for keys in list(convert_brs.items()): + if 'changes' in keys and keys['changes']: + pprint.pprint(keys['changes']) + + if no_alt: + print("WARNING: no alternatives found for: %s" % ", ".join(sorted(no_alt))) + + if no_change and debug_enabled: + pprint.pprint(no_change) + + keys_with_changes = [keys for keys in convert_brs.values() if 'changes' in keys and keys['changes']] # XXX - seems to cause false messages # if not keys_with_changes: @@ -1610,8 +1624,13 @@ class Package: """Return the SpecFile for a given package""" path = self.path - return SpecFile(os.path.join(path, "SPECS", "%s.spec" % self.name), package=self, module=self.name) + return SpecFile(self.spec_path, package=self, module=self.name) + @cached_property + def spec_path(self): + path = self.path + + return os.path.join(path, "SPECS", "%s.spec" % self.name) @retry(subprocess.CalledProcessError) def checkout(self, cwd=None, spec_only=False): @@ -1975,23 +1994,10 @@ def _cmd_clean_spec_multi(args): # Convert perl- and -devel buildrequires into perl() and pkgconfig() requires if options.convert_br: - if spec.convert_buildrequires(): + if spec.convert_buildrequires(explain_changes=not options.doit): made_changes = True -# if not options.doit: -# if options.debug: -# for keys in list(convert_brs.items()): -# if 'changes' in keys and keys['changes']: -# pprint.pprint(keys['changes']) -# -# if no_alt: -# print("WARNING: no alternatives found for: %s" % ", ".join(sorted(no_alt))) -# -# if no_change and options.debug: -# pprint.pprint(no_change) -# else: -# convert_brs = {} - + # Clean the spec file if spec.clean_spec(): made_changes = True |