summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xmgagnome335
1 files changed, 167 insertions, 168 deletions
diff --git a/mgagnome b/mgagnome
index 875edea..d4c19bf 100755
--- a/mgagnome
+++ b/mgagnome
@@ -4,6 +4,8 @@
# https://git.gnome.org/browse/sysadmin-bin/tree/ftpadmin
# Written by Olav Vitters
+from functools import wraps
+
# basic modules:
import os
import os.path
@@ -19,12 +21,10 @@ import errno
import tempfile
import shutil
-# version comparison:
-import rpm
-
# getting links from HTML document:
from html.parser import HTMLParser
-import urllib.request, urllib.error, urllib.parse
+import urllib.request
+import urllib.error
import urllib.parse
# for checking hashes
@@ -37,42 +37,41 @@ from email.mime.text import MIMEText
# to be able to sleep for a while
import time
-# version freeze
-import datetime
-
# packages --sort
import itertools
# automatically dropping merged patches
import shlex
-# check-latest
-import requests
-
import concurrent.futures
# for merging comments in order
import collections
-SLEEP_INITIAL=180
-SLEEP_REPEAT=30
-SLEEP_TIMES=30
+# check-latest
+import requests
+
+# version comparison:
+import rpm
+
+SLEEP_INITIAL = 180
+SLEEP_REPEAT = 30
+SLEEP_TIMES = 30
re_majmin = re.compile(r'^([0-9]+\.[0-9]+).*')
re_version = re.compile(r'([-.]|\d+|[^-.\d]+)')
-from functools import wraps
-def retry(ExceptionToCheck, tries=4, delay=3, backoff=2, logger=None):
+def retry(exceptions, tries=4, delay=3, backoff=2, logger=None):
"""Retry calling the decorated function using an exponential backoff.
http://www.saltycrane.com/blog/2009/11/trying-out-retry-decorator-python/
original from: http://wiki.python.org/moin/PythonDecoratorLibrary#Retry
- :param ExceptionToCheck: the exception to check. may be a tuple of
+ :param exceptions: the exception to check. may be a tuple of
exceptions to check
- :type ExceptionToCheck: Exception or tuple
+ :type exceptions: Exception or tuple
:param tries: number of times to try (not retry) before giving up
:type tries: int
:param delay: initial delay between retries in seconds
@@ -91,8 +90,8 @@ def retry(ExceptionToCheck, tries=4, delay=3, backoff=2, logger=None):
while mtries > 1:
try:
return f(*args, **kwargs)
- except ExceptionToCheck as e:
- msg = "%s, Retrying in %d seconds..." % (str(e), mdelay)
+ except exceptions as exc:
+ msg = "%s, Retrying in %d seconds..." % (str(exc), mdelay)
if logger:
logger.warning(msg)
else:
@@ -125,8 +124,8 @@ def get_latest_version(versions, max_version=None):
max_version"""
latest = None
for version in versions:
- if ( latest is None or version_cmp(version, latest) > 0 ) \
- and ( max_version is None or version_cmp(version, max_version) < 0 ):
+ if (latest is None or version_cmp(version, latest) > 0) \
+ and (max_version is None or version_cmp(version, max_version) < 0):
latest = version
return latest
@@ -172,75 +171,75 @@ def get_safe_max_version(version, module=None):
return "%s.%d" % (majmin[0], min_nr + 2)
def judge_version_increase(version_old, version_new, module=None):
- """Judge quality of version increase:
+ """Judge quality of version increase:
- Returns a tuple containing judgement and message
+ Returns a tuple containing judgement and message
- Judgement:
- Less than 0: Error
- 0 to 4: Better not
- 5+: Ok"""
- versions = (version_old, version_new)
+ Judgement:
+ Less than 0: Error
+ 0 to 4: Better not
+ 5+: Ok"""
+ versions = (version_old, version_new)
- # First do a basic version comparison to ensure version_new is actually newer
- compare = version_cmp(version_new, version_old)
+ # First do a basic version comparison to ensure version_new is actually newer
+ compare = version_cmp(version_new, version_old)
- if compare == 0:
- # 1.0.0 -> 1.0.1
- return (-2, "Already at version %s!" % (version_old))
+ if compare == 0:
+ # 1.0.0 -> 1.0.1
+ return (-2, "Already at version %s!" % (version_old))
- if compare != 1:
- # 1.0.1 -> 1.0.0
- return (-3, "Version %s is older than current version %s!" % (version_new, version_old))
+ if compare != 1:
+ # 1.0.1 -> 1.0.0
+ return (-3, "Version %s is older than current version %s!" % (version_new, version_old))
- # Version is newer, but we don't want to see if it follows the GNOME versioning scheme
- majmins = [get_majmin(ver, module) for ver in versions if re_majmin.match(ver) is not None]
+ # Version is newer, but we don't want to see if it follows the GNOME versioning scheme
+ majmins = [get_majmin(ver, module) for ver in versions if re_majmin.match(ver) is not None]
- if len(majmins) == 1:
- return (-1, "Version number scheme changes: %s" % (", ".join(versions)))
+ if len(majmins) == 1:
+ return (-1, "Version number scheme changes: %s" % (", ".join(versions)))
- if len(majmins) == 0:
- return (0, "Unsupported version numbers: %s" % (", ".join(versions)))
+ if len(majmins) == 0:
+ return (0, "Unsupported version numbers: %s" % (", ".join(versions)))
- # Follows GNOME versioning scheme
- # Meaning: x.y.z
- # x = major
- # y = minor : even if stable
- # z = micro
+ # Follows GNOME versioning scheme
+ # Meaning: x.y.z
+ # x = major
+ # y = minor : even if stable
+ # z = micro
- # Major+minor the same? Then go ahead and upgrade!
- if majmins[0] == majmins[1]:
- # Majmin of both versions are the same, looks good!
- # 1.1.x -> 1.1.x or 1.0.x -> 1.0.x
- return (10, None)
+ # Major+minor the same? Then go ahead and upgrade!
+ if majmins[0] == majmins[1]:
+ # Majmin of both versions are the same, looks good!
+ # 1.1.x -> 1.1.x or 1.0.x -> 1.0.x
+ return (10, None)
- # Check/ensure major version number is the same
- if majmins[0][0] != majmins[1][0]:
- # 1.0.x -> 2.0.x
- return (1, "Major version number increase")
+ # Check/ensure major version number is the same
+ if majmins[0][0] != majmins[1][0]:
+ # 1.0.x -> 2.0.x
+ return (1, "Major version number increase")
- # Minor indicates stable/unstable
- devstate = (int(majmins[0][1]) % 2 == 0, int(majmins[1][1]) % 2 == 0)
+ # Minor indicates stable/unstable
+ devstate = (int(majmins[0][1]) % 2 == 0, int(majmins[1][1]) % 2 == 0)
- # Upgrading to unstable is weird
- if not devstate[1]:
- if devstate[0]:
- # 1.2.x -> 1.3.x
- return (1, "Stable to unstable increase")
+ # Upgrading to unstable is weird
+ if not devstate[1]:
+ if devstate[0]:
+ # 1.2.x -> 1.3.x
+ return (1, "Stable to unstable increase")
- # 1.3.x -> 1.5.x
- return (3, "Unstable to unstable version increase")
+ # 1.3.x -> 1.5.x
+ return (3, "Unstable to unstable version increase")
- # Unstable => stable is always ok
- if not devstate[0]:
- # 1.1.x -> 1.2.x
- return (5, "Unstable to stable")
+ # Unstable => stable is always ok
+ if not devstate[0]:
+ # 1.1.x -> 1.2.x
+ return (5, "Unstable to stable")
- # Can only be increase of minors from one stable to the next
- # 1.0.x -> 1.2.x
- return (4, "Stable version increase")
+ # Can only be increase of minors from one stable to the next
+ # 1.0.x -> 1.2.x
+ return (4, "Stable version increase")
-def line_input (file):
+def line_input(file):
for line in file:
if line[-1] == '\n':
yield line[:-1]
@@ -286,7 +285,7 @@ class urllister(HTMLParser):
def handle_starttag(self, tag, attrs):
if tag == 'a':
- href = [v for k, v in attrs if k=='href']
+ href = [v for k, v in attrs if k == 'href']
if href:
self.urls.extend(href)
@@ -326,7 +325,7 @@ class SpecFile(object):
re_update_br = re.compile(r'^(?P<pre>BuildRequires[ \t]*:\s*)(?P<br>[^\s%{},]+?)(?P<post>\s*(?:(?:[<>]=?|=)\s+(?:[^\s%{},]+|\%\{[^\s{%}]+\}|\%[^\s%{},]+))?\s*\n)', re.MULTILINE + re.IGNORECASE)
# re_update_br_unsplit = re.compile(r'^(?P<pre>BuildRequires:\s*)(?P<unsplit>[^\n,]+,[^\n]*)(?P<post>\s*\n)', re.MULTILINE + re.IGNORECASE)
- re_update_br_fix_operator = re.compile('^(?P<pre>BuildRequires[ \t]*:\s*[^\n]*)(?P<operator>=<|=>)(?P<post>[^\n]+)\n', re.MULTILINE + re.IGNORECASE)
+ re_update_br_fix_operator = re.compile(r'^(?P<pre>BuildRequires[ \t]*:\s*[^\n]*)(?P<operator>=<|=>)(?P<post>[^\n]+)\n', re.MULTILINE + re.IGNORECASE)
re_update_br_unsplit = re.compile(r'^(?P<pre>BuildRequires[ \t]*:\s*)(?P<unsplit>(?:%s,?(?:[ \t\f\v]+|$)){2,})(?P<unsplitpost>\n)' % (re_br_part.pattern,), re.MULTILINE + re.IGNORECASE)
def __init__(self, path, module=None):
@@ -359,7 +358,7 @@ class SpecFile(object):
def _sources_and_patches(self, flag=None):
os.chdir(self.cwd)
- rpm.delMacro("_topdir" )
+ rpm.delMacro("_topdir")
rpm.addMacro("_topdir", os.path.join(self.cwd, '..'))
ts = rpm.ts()
spec = ts.parseSpec(self.path)
@@ -399,7 +398,7 @@ class SpecFile(object):
('make use of autopatch', r'%autopatch -p1', re.compile(r'^%apply_patches$', re.MULTILINE)),
('change configure2_5x macro to configure', r'%configure', re.compile(r'^%configure2_5x\b', re.MULTILINE)),
('change make macro to make_build', r'%make_build', re.compile(r'^%make\b', re.MULTILINE), True),
- ('change find_lang --with-help into --with-gnome', '\g<keeppre> --with-gnome\g<keeppost>', re.compile(r'^(?P<keeppre>\s*\%find_lang[^\\\n]+) --with-help(?P<keeppost>[^\\\n]*\n)', re.MULTILINE + re.IGNORECASE)),
+ ('change find_lang --with-help into --with-gnome', r'\g<keeppre> --with-gnome\g<keeppost>', re.compile(r'^(?P<keeppre>\s*\%find_lang[^\\\n]+) --with-help(?P<keeppost>[^\\\n]*\n)', re.MULTILINE + re.IGNORECASE)),
('change find_lang remove duplicate with_gnome', None, re.compile(r'^(?P<keeppre>\%find_lang[^\\\n]+ --with-gnome) --with-gnome(?P<keeppost>[^\\\n]*\n)', re.MULTILINE + re.IGNORECASE)),
# Use new Python macros
('use new Python macros', r'%py3_build', re.compile(r'^%{__python3} setup.py build$', re.MULTILINE)),
@@ -471,9 +470,9 @@ class SpecFile(object):
if mo and mo.group('definition') and len(re_variable.findall(data)) == 1:
mo2 = re_spec.search(data)
if mo2:
- data, nr = re_spec.subn('\g<keeppre>' + mo.group('definition').replace('\\', '\\\\') + '\g<keeppost>', data)
+ data, nr = re_spec.subn(r'\g<keeppre>' + mo.group('definition').replace('\\', '\\\\') + r'\g<keeppost>', data)
if nr:
- made_changes=True
+ made_changes = True
data, nr = re_variable.subn('', data)
converted_defines.append(search_for)
@@ -532,7 +531,7 @@ class SpecFile(object):
# XXX -- werird, self.patches should've returned 0 already
return made_changes, data
- if not (patch_nrs_header == patch_nrs_any == patch_nrs_valid):
+ if not patch_nrs_header == patch_nrs_any == patch_nrs_valid:
print("NOTICE: Unable to automatically convert %s patches into %%autopatch (header/patch/valid: %s, %s, %s)" % (self.module, len(patch_nrs_header), len(patch_nrs_any), len(patch_nrs_valid)), file=sys.stderr)
return made_changes, data
@@ -546,7 +545,7 @@ class SpecFile(object):
change_to = "%%autopatch -p%s\n" % list(patch_flags)[0]
prep, n1 = re_patch_valid.subn(change_to.replace('\\', '\\\\'), mo2.group(0), count=1)
prep, n2 = re_patch_valid.subn('', prep)
- if len(patch_nrs_valid) != n1 + n2:
+ if len(patch_nrs_valid) != n1 + n2:
print("WARNING: Couldn't replace patches?!? Likely error in program logic", file=sys.stderr)
return made_changes, data
@@ -573,7 +572,7 @@ class SpecFile(object):
@property
def buildrequires(self):
- rpm.delMacro("_topdir" )
+ rpm.delMacro("_topdir")
rpm.addMacro("_topdir", os.path.join(self.cwd, '..'))
ts = rpm.ts()
try:
@@ -596,9 +595,9 @@ class SpecFile(object):
if flag & 15 != flag: continue
ver_cmp = ""
- if (flag & rpm.RPMSENSE_LESS): ver_cmp += '<'
- if (flag & rpm.RPMSENSE_GREATER): ver_cmp += '>'
- if (flag & rpm.RPMSENSE_EQUAL): ver_cmp += '='
+ if flag & rpm.RPMSENSE_LESS: ver_cmp += '<'
+ if flag & rpm.RPMSENSE_GREATER: ver_cmp += '>'
+ if flag & rpm.RPMSENSE_EQUAL: ver_cmp += '='
br[req] = (ver_cmp, ver)
return br
@@ -620,7 +619,7 @@ class SpecFile(object):
with open(self.path, "r", encoding="utf-8") as f:
data = f.read()
- len_before=len(data)
+ len_before = len(data)
data, nr = self.re_update_patch.subn(lambda mo: '' if mo.group('nr') in nrs or (mo.group('nr').isdigit() and int(mo.group('nr')) in nrs) else mo.group(0), data)
@@ -747,7 +746,7 @@ class SpecFile(object):
with open(self.path, "r", encoding="utf-8") as f:
data = f.read()
- data_before=data
+ data_before = data
# Change any "," in buildrequires into multiple lines
data, nr = self.re_update_br_unsplit.subn(lambda mo: ''.join((''.join((mo.group('pre'), mo2.group(0), mo.group('unsplitpost'))) for mo2 in self.re_br_part.finditer(mo.group('unsplit')) if mo.group(0).strip() != '')), data)
@@ -783,7 +782,7 @@ class SpecFile(object):
return made_changes
- MAX_JUDGEMENT=5
+ MAX_JUDGEMENT = 5
def ensure_no_local_changes(self, force=False):
# XXX - os.path.join is hackish
@@ -989,7 +988,7 @@ class Patch(object):
info = r.groupdict()
# Avoid matching URLS
- if info['data'].startswith('//') and info['header'].lower () == info['header']:
+ if info['data'].startswith('//') and info['header'].lower() == info['header']:
continue
headers[info['header']] = info['data']
@@ -1011,7 +1010,7 @@ class Patch(object):
dep3['valid'] = \
(('Description' in headers and headers['Description'].strip() != '')
- or ('Subject' in headers and headers['Subject'].strip() != '')) \
+ or ('Subject' in headers and headers['Subject'].strip() != '')) \
and (('Origin' in headers and headers['Origin'].strip() != '') \
or ('Author' in headers and headers['Author'].strip() != '') \
or ('From' in headers and headers['From'].strip() != ''))
@@ -1051,7 +1050,7 @@ class Patch(object):
class Upstream(object):
- URL="https://download.gnome.org/sources/"
+ URL = "https://download.gnome.org/sources/"
limit = None
_cache_versions = {}
@@ -1093,11 +1092,11 @@ class Upstream(object):
class Downstream(object):
re_file = re.compile(r'^(?P<module>.*)[_-](?:(?P<oldversion>([0-9]+[\.])*[0-9]+)-)?(?P<version>([0-9]+[\.\-])*[0-9]+)\.(?P<format>(?:tar\.|diff\.)?[a-z][a-z0-9]*)$')
- MEDIA="Core Release Source"
+ MEDIA = "Core Release Source"
# PKGROOT will be overwritten (command line option)
- PKGROOT='~/pkgs'
- DISTRO=None
- SECTION=None
+ PKGROOT = '~/pkgs'
+ DISTRO = None
+ SECTION = None
def __init__(self):
contents = subprocess.check_output(['urpmf', '--qf', '%name|%version|%files', '.', "--media", self.MEDIA], close_fds=True).decode("utf-8").strip("\n").splitlines()
@@ -1150,7 +1149,7 @@ class Downstream(object):
Relies on urpmf. Results are cached. It will only provide alternatives if
the alternative is only provided by one package. Meaning, if a pkgconfig(foo)
- is provided by 2 packages, the pkgconfig(foo) will NOT be given as an
+ is provided by 2 packages, the pkgconfig(foo) will NOT be given as an
alternative.
Sort of works like:
@@ -1160,7 +1159,7 @@ class Downstream(object):
provide_has_multiple_pkgs = set()
_provide_to_pkg = {}
_pkg_to_provide = {}
- for myline in subprocess.check_output(['urpmf', "--qf", "%name\t%provides\t%arch", '.']).decode("utf-8").splitlines():
+ for myline in subprocess.check_output(['urpmf', "--qf", "%name\t%provides\t%arch", '.']).decode("utf-8").splitlines():
pkgname, pkgprovide, pkgarch = myline.split("\t")
if pkgarch in ('src', 'i586'): continue
if '-debug' in pkgprovide: continue
@@ -1288,7 +1287,7 @@ class Downstream(object):
raise ValueError("Multiple packages found and cannot determine package for version %s" % version)
def write_file(path, data):
- with tempfile.NamedTemporaryFile(mode='w+t',dir=os.path.dirname(path), delete=False, encoding="utf-8") as fdst:
+ with tempfile.NamedTemporaryFile(mode='w+t', dir=os.path.dirname(path), delete=False, encoding="utf-8") as fdst:
fdst.write(data)
fdst.flush()
os.rename(fdst.name, path)
@@ -1358,7 +1357,7 @@ def join_streams(show_version=False, only_diff_version=False, auto_update=True):
def cmd_group_owner(options, parser):
groups = set(options.group)
- output = [pkg.split("\t") for pkg in subprocess.check_output(["urpmf", "-F|", "--qf", "%group\t%name\t%sourcerpm\t%version\t%release", "."]).decode("utf-8").splitlines()]
+ output = [pkg.split("\t") for pkg in subprocess.check_output(["urpmf", "-F|", "--qf", "%group\t%name\t%sourcerpm\t%version\t%release", "."]).decode("utf-8").splitlines()]
if not output: return
# Filter by groups
@@ -1385,9 +1384,9 @@ def cmd_group_owner(options, parser):
def get_output(source, maints, packages):
for source in list(packages.keys()):
- maint = maints.get(source, "?")
+ maint = maints.get(source, "?")
- yield "\t".join((maint, source, ",".join(sorted(packages[source]))))
+ yield "\t".join((maint, source, ",".join(sorted(packages[source]))))
first = True
for group in list(packages.keys()):
@@ -1427,9 +1426,9 @@ def cmd_cleanup(options, parser):
stats = [stat for stat in c2.status(os.path.join(root, path, 'SOURCES'), depth=pysvn.depth.immediates) if stat.text_status == pysvn.wc_status_kind.unversioned and os.path.basename(stat.path) not in binaries]
if len(stats):
- print (path)
- print (", ".join(os.path.basename(stat.path) for stat in stats))
- print (stats)
+ print(path)
+ print(", ".join(os.path.basename(stat.path) for stat in stats))
+ print(stats)
for stat in stats:
if os.path.isfile(stat.path):
os.remove(stat.path)
@@ -1439,7 +1438,7 @@ def cmd_cleanup(options, parser):
def cmd_ls(options, parser):
streams = join_streams(show_version=options.show_version, only_diff_version=options.diff)
if options.sort:
- SORT=dict(list(zip(options.sort.read().splitlines(), itertools.count())))
+ SORT = dict(list(zip(options.sort.read().splitlines(), itertools.count())))
streams = sorted(streams, key=lambda a: (SORT.get(a[1], 9999), a[0]))
else:
@@ -1467,7 +1466,7 @@ def cmd_check_latest(options, parser):
streams = join_streams(show_version=True)
for package, module, package_version, spec_version, downstream_files in streams:
- upgrade=set()
+ upgrade = set()
sys.stdout.write(package)
sys.stdout.write("\t%s\t%s" % (spec_version, package_version))
@@ -1517,7 +1516,7 @@ def cmd_patches(options, parser):
if p.dep3['headers']:
forwarded = p.dep3['headers'].get('Forwarded', "no")
if p.dep3['valid']:
- valid="VALID"
+ valid = "VALID"
print("\t".join((module, package, str(p), forwarded, valid)))
def cmd_dep3(options, parser):
@@ -1555,7 +1554,7 @@ def cmd_clean_spec_multi(args):
print("ERROR: cannot clean spec file for %s" % package, file=sys.stderr)
return False
- made_changes=False
+ made_changes = False
changes = {}
@@ -1570,20 +1569,20 @@ def cmd_clean_spec_multi(args):
'desc': 'convert -devel buildrequires into pkgconfig',
'check_br': lambda req: req.endswith('-devel'),
'check_provide': lambda prov: prov.startswith('pkgconfig('),
- 'basereqs': lambda req: [ req[:-len('-devel')] ],
- 'basereq_no_version': lambda basereqs: [ basereq.rstrip('1234567890.') for basereq in basereqs if basereq[-1] in '1234567890' ],
- 'versions_from_basereq': lambda basereqs: set([basereq[len(basereq.rstrip('01234567890.')):] for basereq in basereqs if basereq[-1] in '1234567890'] ),
- 'versions_basereq_extra': lambda versions: set( [ "%s.0" % version for version in versions if '.' not in version] ),
+ 'basereqs': lambda req: [req[:-len('-devel')]],
+ 'basereq_no_version': lambda basereqs: [basereq.rstrip('1234567890.') for basereq in basereqs if basereq[-1] in '1234567890'],
+ 'versions_from_basereq': lambda basereqs: set([basereq[len(basereq.rstrip('01234567890.')):] for basereq in basereqs if basereq[-1] in '1234567890']),
+ 'versions_basereq_extra': lambda versions: set(["%s.0" % version for version in versions if '.' not in version]),
'extra': lambda basereq, versions: \
- [ 'pkgconfig(%s)' % basereq for basereq in basereqs] +
- [ 'pkgconfig(%s)' % basereq[len('lib'):] if basereq.startswith('lib') else 'pkgconfig(lib%s)' % basereq for basereq in basereqs ] +
- [ 'pkgconfig(%s-%s)' % (basereq, version) for basereq in basereqs for version in versions],
+ ['pkgconfig(%s)' % basereq for basereq in basereqs] +
+ ['pkgconfig(%s)' % basereq[len('lib'):] if basereq.startswith('lib') else 'pkgconfig(lib%s)' % basereq for basereq in basereqs] +
+ ['pkgconfig(%s-%s)' % (basereq, version) for basereq in basereqs for version in versions],
},
'perl': {
'desc': 'convert perl- buildrequires into perl()',
'check_br': lambda req: req.startswith('perl-'),
'check_provide': lambda prov: prov.startswith('perl('),
- 'basereqs': lambda req: [ req[len('perl-'):] ],
+ 'basereqs': lambda req: [req[len('perl-'):]],
'extra': lambda basereqs, versions: ['perl(%s)' % basereq.replace('-', '::') for basereq in basereqs],
},
# PySolFC.spec:BuildRequires: python3-setuptools
@@ -1599,14 +1598,14 @@ def cmd_clean_spec_multi(args):
'desc': 'convert python buildrequires into python3dist()',
'check_br': lambda req: req.startswith('python3-'),
'check_provide': lambda prov: prov.startswith('python3dist('),
- 'basereqs': lambda req: [ req[len('python3-'):] ],
+ 'basereqs': lambda req: [req[len('python3-'):]],
'extra': lambda basereqs, versions: ['python3dist(%s)' % basereq for basereq in basereqs],
},
'python-egg': {
'desc': 'convert pythonegg(3) into python3dist()',
'check_br': lambda req: req.startswith('pythonegg(3)(') and req.endswith(')'),
'check_provide': lambda prov: prov.startswith('python3dist('),
- 'basereqs': lambda req: [ req[len('pythonegg(3)('):-1] ],
+ 'basereqs': lambda req: [req[len('pythonegg(3)('):-1]],
'extra': lambda basereqs, versions: ['python3dist(%s)' % basereq for basereq in basereqs],
},
}
@@ -1639,7 +1638,7 @@ def cmd_clean_spec_multi(args):
basereqs.extend(keys['basereq_no_version'](basereqs))
# Make it unique again, but keep the order
#
- # This is done so that e.g. python3-devel changes to pkgconfig(python3),
+ # This is done so that e.g. python3-devel changes to pkgconfig(python3),
# even if pkgconfig(python) might be available
basereqs = list(distinct(basereqs))
if 'versions_basereq_extra' in keys:
@@ -1675,7 +1674,7 @@ def cmd_clean_spec_multi(args):
provides_alt_no_versions.append(prov)
if len(provides_alt_no_versions) == 1:
- change_to = provides_alt_no_versions[0]
+ change_to = provides_alt_no_versions[0]
if len(provides_alt):
@@ -1697,14 +1696,14 @@ def cmd_clean_spec_multi(args):
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'})
+ keys_with_changes.append({'changes': [], 'desc': 'unsplit BRs'})
for keys in keys_with_changes:
if s.update_br(keys['changes'], change_description=keys['desc']):
- made_changes=True
+ made_changes = True
if s.clean_spec():
- made_changes=True
+ made_changes = True
# If we made it this far, checkin the changes
if made_changes:
@@ -1751,7 +1750,7 @@ def cmd_check_spec(options, parser):
cmd_check_spec_multi((options, package))
else:
import os
- workers=os.cpu_count() or 4
+ workers = os.cpu_count() or 4
with concurrent.futures.ThreadPoolExecutor(max_workers=workers) as executor:
executor.map(cmd_check_spec_multi, ((options, package) for package in packages))
@@ -1769,7 +1768,7 @@ def cmd_clean_spec(options, parser):
cmd_clean_spec_multi((options, package))
else:
import os
- workers=os.cpu_count() or 4
+ workers = os.cpu_count() or 4
# Hack: warm alternative provides cache
if options.convert_br:
Downstream.alternative_provides('XXXX')
@@ -2017,17 +2016,17 @@ def cmd_parse_ftp_release_list(options, parser):
def main():
description = """Mageia GNOME commands."""
- epilog="""Report bugs to Olav Vitters"""
- parser = argparse.ArgumentParser(description=description,epilog=epilog)
+ epilog = """Report bugs to Olav Vitters"""
+ parser = argparse.ArgumentParser(description=description, epilog=epilog)
parser.add_argument("-l", "--limit", type=argparse.FileType('r', 0),
dest="limit_upstream", metavar="FILE",
help="File containing upstream names")
parser.add_argument("-p", "--root", action="store", dest="PKGROOT",
- help="Package root directory")
+ help="Package root directory")
parser.add_argument("-d", "--distro", action="store", dest="distro",
- help="Distribution release")
+ help="Distribution release")
parser.add_argument("--debug", action="store_true", dest="debug",
- help="Use for debugging")
+ help="Use for debugging")
parser.set_defaults(
debug=False, PKGROOT="~/pkgs"
)
@@ -2036,7 +2035,7 @@ def main():
subparsers = parser.add_subparsers(title='subcommands')
subparser = subparsers.add_parser('check-latest', help='check for latest version of packages')
subparser.add_argument("-s", "--submit", action="store_true", dest="submit",
- help="Increase version for stable upgrades and submit")
+ help="Increase version for stable upgrades and submit")
subparser.set_defaults(
func=cmd_check_latest, submit=False
)
@@ -2052,7 +2051,7 @@ def main():
subparser.add_argument("-d", "-s", action="store_true", dest="doit", help="submit the changes")
subparser.add_argument("-f", "--force", action="store_true")
subparser.add_argument("-a", "--all", action="store_true", dest="all",
- help="checkout all Downstream packages")
+ help="checkout all Downstream packages")
subparser.add_argument("--convert", action="store_true", dest="convert_br",
help="convert -buildrequirements to perl/pkgconfig if possible")
subparser.set_defaults(
@@ -2067,16 +2066,16 @@ def main():
subparser = subparsers.add_parser('check-spec', help='check if spec file is ok')
subparser.add_argument("package", help="Package name", nargs='*')
subparser.add_argument("-a", "--all", action="store_true", dest="all",
- help="checkout all Downstream packages")
+ help="checkout all Downstream packages")
subparser.set_defaults(
func=cmd_check_spec
)
subparser = subparsers.add_parser('co', help='checkout all GNOME packages')
subparser.add_argument("-a", "--all", action="store_true", dest="all",
- help="checkout all Downstream packages")
- subparser.add_argument("-s", action="store_true", dest="spec_only",
- help="only checkout SPECS/ directory")
+ help="checkout all Downstream packages")
+ subparser.add_argument("-s", action="store_true", dest="spec_only",
+ help="only checkout SPECS/ directory")
subparser.add_argument("package", help="Package name", nargs='*')
subparser.set_defaults(
func=cmd_co, all=False
@@ -2090,14 +2089,14 @@ def main():
subparser = subparsers.add_parser('gnome-release-email', help='submit packages based on GNOME ftp-release-list email')
subparser.add_argument("-m", "--mail", help="Email address to send the progress to")
- subparser.add_argument( "--fork", action="store_true",
- help="Fork as quickly as possible")
+ subparser.add_argument("--fork", action="store_true",
+ help="Fork as quickly as possible")
subparser.add_argument("-w", "--wait", action="store_true",
- help="Wait before trying to retrieve the new version")
+ help="Wait before trying to retrieve the new version")
subparser.add_argument("-s", "--submit", action="store_true", dest="submit",
- help="Commit changes and submit")
+ help="Commit changes and submit")
subparser.add_argument("-f", "--force", action="store_true",
- help="Force submission")
+ help="Force submission")
subparser.set_defaults(
func=cmd_parse_ftp_release_list, force=False, wait=False, fork=False
)
@@ -2105,20 +2104,20 @@ def main():
subparser = subparsers.add_parser('group-owner', help='list packages by group')
subparser.add_argument('group', metavar="GROUP", nargs='+')
subparser.set_defaults(
- func=cmd_group_owner
+ func=cmd_group_owner
)
subparser = subparsers.add_parser('rebuild', help='increase release')
subparser.add_argument("package", help="Package name", nargs="*")
subparser.add_argument("-m", "--reason", dest="reason", required=True, help="Reason for the rebuild")
subparser.add_argument("-f", "--force", action="store_true", dest="force",
- help="Override warnings, just do it")
+ help="Override warnings, just do it")
subparser.add_argument("-u", "--upstream", action="store_true", dest="upstream",
- help="Package name reflects the upstream name")
+ help="Package name reflects the upstream name")
subparser.add_argument("-s", "--submit", action="store_true", dest="submit",
- help="Commit changes and submit")
- subparser.add_argument( "--no-submit", action="store_false", dest="submit",
- help="Do not commit changes and submit")
+ help="Commit changes and submit")
+ subparser.add_argument("--no-submit", action="store_false", dest="submit",
+ help="Do not commit changes and submit")
subparser.set_defaults(
func=cmd_new_release, submit=argparse.SUPPRESS, upstream=False,
force=False
@@ -2128,34 +2127,34 @@ def main():
subparser.add_argument("package", help="Package name")
subparser.add_argument("version", help="Version number")
subparser.add_argument("-f", "--force", action="store_true", dest="force",
- help="Override warnings, just do it")
+ help="Override warnings, just do it")
subparser.add_argument("-u", "--upstream", action="store_true", dest="upstream",
- help="Package name reflects the upstream name")
+ help="Package name reflects the upstream name")
subparser.add_argument("-s", "--submit", action="store_true", dest="submit",
- help="Commit changes and submit")
- subparser.add_argument( "--no-submit", action="store_false", dest="submit",
- help="Do not commit changes and submit")
+ help="Commit changes and submit")
+ subparser.add_argument("--no-submit", action="store_false", dest="submit",
+ help="Do not commit changes and submit")
subparser.add_argument("-a", "--algorithm", choices=hashlib.algorithms_available, dest="algo",
- help="Hash algorithm")
+ help="Hash algorithm")
subparser.add_argument("--hash", dest="hexdigest",
- help="Hexdigest of the hash")
+ help="Hexdigest of the hash")
subparser.set_defaults(
- func=cmd_package_new_version, submit=argparse.SUPPRESS, upstream=False, hexdigest=None, algo="sha256",
- force=False
+ func=cmd_package_new_version, submit=argparse.SUPPRESS, upstream=False,
+ hexdigest=None, algo="sha256", force=False
)
subparser = subparsers.add_parser('packages', help='list all GNOME packages')
subparser.add_argument("-m", "--m", action="store_true", dest="upstream",
- help="Show upstream module")
- subparser.add_argument( "--version", action="store_true", dest="show_version",
- help="Show version numbers")
- subparser.add_argument( "--diff", action="store_true", dest="diff",
- help="Only show packages with different version")
- subparser.add_argument( "--sort", type=argparse.FileType('r', 0),
- dest="sort", metavar="FILE",
- help="Sort packages according to order in given FILE")
- subparser.add_argument( "--spec", action="store_true", dest="spec",
- help="Give spec file location")
+ help="Show upstream module")
+ subparser.add_argument("--version", action="store_true", dest="show_version",
+ help="Show version numbers")
+ subparser.add_argument("--diff", action="store_true", dest="diff",
+ help="Only show packages with different version")
+ subparser.add_argument("--sort", type=argparse.FileType('r', 0),
+ dest="sort", metavar="FILE",
+ help="Sort packages according to order in given FILE")
+ subparser.add_argument("--spec", action="store_true", dest="spec",
+ help="Give spec file location")
subparser.set_defaults(
func=cmd_ls, upstream=False, show_version=False, diff=False
)
@@ -2167,7 +2166,7 @@ def main():
subparser = subparsers.add_parser('patches', help='list all GNOME patches')
subparser.add_argument("-p", "--path", action="store_true", dest="path",
- help="Show full path to patch")
+ help="Show full path to patch")
subparser.set_defaults(
func=cmd_patches, path=False
)
@@ -2188,7 +2187,7 @@ def main():
global pprint
import pprint
- Downstream.PKGROOT=options.PKGROOT
+ Downstream.PKGROOT = options.PKGROOT
if options.distro:
Downstream.PKGROOT = os.path.join(options.PKGROOT, options.distro)
Downstream.MEDIA = "Core Release {0} Source,Core {0} Updates Source,Core {0} Updates Testing Source".format(options.distro)