summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOlav Vitters <olav@vitters.nl>2020-04-24 11:22:10 +0200
committerOlav Vitters <olav@vitters.nl>2020-04-24 11:22:10 +0200
commit508d7c0da72e2bd3f7d18a81a2940a83e06dfdbc (patch)
treeb7567c2663cb00c772ec663e84b551afa1ea4b72
parenta8ec952ecd9111d9edf2f602d5fd4f4f0dce0af4 (diff)
downloadmgagnome-508d7c0da72e2bd3f7d18a81a2940a83e06dfdbc.tar
mgagnome-508d7c0da72e2bd3f7d18a81a2940a83e06dfdbc.tar.gz
mgagnome-508d7c0da72e2bd3f7d18a81a2940a83e06dfdbc.tar.bz2
mgagnome-508d7c0da72e2bd3f7d18a81a2940a83e06dfdbc.tar.xz
mgagnome-508d7c0da72e2bd3f7d18a81a2940a83e06dfdbc.zip
clean-spec: be more strict, only fallback to changing 1 BR if there aren't any ignored alternative provides
-rwxr-xr-xmgagnome68
1 files changed, 39 insertions, 29 deletions
diff --git a/mgagnome b/mgagnome
index 7ba8752..d0285d5 100755
--- a/mgagnome
+++ b/mgagnome
@@ -1084,17 +1084,21 @@ class Downstream():
for pkgname in _provide_to_pkg[key]:
for pkgprovide in _pkg_to_provide[pkgname]:
- if pkgprovide in provide_has_single and '(' in pkgprovide:
- if key in cls._provide_to_alternate:
- cls._provide_to_alternate[key].add(pkgprovide)
- else:
- cls._provide_to_alternate[key] = set((pkgprovide,))
+ if not '(' in pkgprovide:
+ continue
+
+ if not key in cls._provide_to_alternate:
+ cls._provide_to_alternate[key] = (set(), set())
+ if pkgprovide in provide_has_single:
+ cls._provide_to_alternate[key][0].add(pkgprovide)
+ else:
+ cls._provide_to_alternate[key][1].add(pkgprovide)
if search_for in cls._provide_to_alternate:
return cls._provide_to_alternate[search_for]
- return set()
+ return (set(), set())
@classmethod
def package_path(cls, package):
@@ -1523,20 +1527,21 @@ def cmd_clean_spec_multi(args):
keys['changes'] = {}
br_old = [r for r in list(br.keys()) if keys['check_br'](r)]
- if options.debug:
- pprint.pprint(br)
+ if options.debug and br_old:
+ pprint.pprint(br_old)
for req in br_old:
- provides = Downstream.alternative_provides(req)
- # XXX - document what the following line is for
- # maybe integrate in alternative_provides function?
- provides_alt = [clean_pkgconfig_prov(prov) for prov in provides if keys['check_provide'](prov)]
+ every_provides, every_ignored_provide = Downstream.alternative_provides(req)
+ # XXX - document what clean_pkgconfig_prov is for
+ # maybe integrate clean_pkgconfig_prov in alternative_provides function?
+ provides = [clean_pkgconfig_prov(prov) for prov in every_provides if keys['check_provide'](prov)]
+ provides_ignored = [clean_pkgconfig_prov(prov) for prov in every_ignored_provide if keys['check_provide'](prov)]
change_to = None
- if len(provides_alt) == 1:
+ if len(provides) == 1 and not provides_ignored:
if options.debug:
- print("NOTICE: Only one available option, using %s" % provides_alt[0])
+ print("NOTICE: Only one available option, using %s" % provides[0])
- change_to = provides_alt[0]
- elif provides_alt and 'extra' in keys:
+ change_to = provides[0]
+ elif provides and 'extra' in keys:
# Determine base require (e.g. gtk+3.0-devel --> gtk+3.0)
basereqs = keys['basereqs'](req)
@@ -1562,7 +1567,7 @@ def cmd_clean_spec_multi(args):
#
# This is only done as a last resort to avoid matching
# e.g. gtk+3.0-devel --> pkgconfig(gtk+2.0)
- for prov in provides_alt:
+ for prov in provides:
for match in re_prov_get_version.finditer(prov):
if options.debug:
print("NOTICE: Heuristically adding version %s from provide %s" % (match.group('version'), prov))
@@ -1570,27 +1575,31 @@ def cmd_clean_spec_multi(args):
check_for = keys['extra'](basereqs, versions)
- if options.debug:
+ if options.debug and versions:
pprint.pprint(versions)
for check in check_for:
- if check in provides_alt:
+ if check in provides:
+ if options.debug:
+ print("NOTICE: Matched: %s => %s" % (check, provides))
change_to = check
break
- if change_to is None and provides_alt:
- provides_alt_no_versions = []
- for prov in provides_alt:
+ if change_to is None and provides:
+ provides_no_versions = []
+ for prov in provides:
if re_prov_get_version.fullmatch(prov) is None:
- provides_alt_no_versions.append(prov)
+ provides_no_versions.append(prov)
- if len(provides_alt_no_versions) == 1:
- change_to = provides_alt_no_versions[0]
+ if len(provides_no_versions) == 1 and not provides_ignored:
+ change_to = provides_no_versions[0]
+ if options.debug:
+ print("NOTICE: Only one available versionless option, using %s" % change_to)
- if provides_alt:
+ if provides:
if change_to is None:
- no_change[req] = (provides_alt, check_for)
+ no_change[req] = (provides, check_for)
else:
no_alt.add(req)
@@ -1612,8 +1621,9 @@ def cmd_clean_spec_multi(args):
convert_brs = {}
keys_with_changes = [keys for keys in convert_brs.values() if 'changes' in keys and keys['changes']]
- if not keys_with_changes:
- keys_with_changes.append({'changes': [], 'desc': 'unsplit BRs'})
+# XXX - seems to cause false messages
+# if not keys_with_changes:
+# keys_with_changes.append({'changes': [], 'desc': 'unsplit BRs'})
for keys in keys_with_changes:
if s.update_br(keys['changes'], change_description=keys['desc']):