Rename checknewer to checknewer.py and fix Flake8 fallout

This is a python script so as the majority of scripts in here
it should end in a .py suffix
This commit is contained in:
Dirk Mueller 2017-10-17 15:46:18 +02:00
parent 1168d474b7
commit 3eb66257e8
3 changed files with 15 additions and 16 deletions

View File

@ -32,7 +32,7 @@ Scripts
* *link:docs/maintbot.asciidoc[maintbot].* script that checks maintenance * *link:docs/maintbot.asciidoc[maintbot].* script that checks maintenance
incidents to make sure the Factory maintainer submitted the package. incidents to make sure the Factory maintainer submitted the package.
* *link:checknewer[checknewer].* script compares version numbers in repos to * *link:checknewer.py[checknewer.py].* script compares version numbers in repos to
make sure all packages e.g. in a new distro are newer make sure all packages e.g. in a new distro are newer
Installation Installation

View File

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python2
# Copyright (c) 2016 SUSE LLC # Copyright (c) 2016 SUSE LLC
# #
# Permission is hereby granted, free of charge, to any person obtaining a copy # Permission is hereby granted, free of charge, to any person obtaining a copy
@ -29,24 +29,24 @@ import solv
pool = solv.Pool() pool = solv.Pool()
args = sys.argv[1:] args = sys.argv[1:]
if len(args) < 2: if len(args) < 2:
print("usage: checknewer NEWREPO OLDREPO1 [OLDREPO2...]") print("usage: checknewer NEWREPO OLDREPO1 [OLDREPO2...]")
sys.exit(1) sys.exit(1)
firstrepo = None firstrepo = None
for arg in args: for arg in args:
argf = solv.xfopen(arg) argf = solv.xfopen(arg)
repo = pool.add_repo(arg) repo = pool.add_repo(arg)
if not firstrepo: if not firstrepo:
firstrepo = repo firstrepo = repo
if re.search(r'solv$', arg): if re.search(r'solv$', arg):
repo.add_solv(argf) repo.add_solv(argf)
elif re.search(r'primary\.xml', arg): elif re.search(r'primary\.xml', arg):
repo.add_rpmmd(argf, None) repo.add_rpmmd(argf, None)
elif re.search(r'packages', arg): elif re.search(r'packages', arg):
repo.add_susetags(argf, 0, None) repo.add_susetags(argf, 0, None)
else: else:
print("%s: unknown repo type" % (arg)) print("%s: unknown repo type" % (arg))
sys.exit(1) sys.exit(1)
# we only want self-provides # we only want self-provides
for p in pool.solvables: for p in pool.solvables:
@ -67,7 +67,7 @@ for p in firstrepo.solvables:
continue continue
if p.identical(pp): if p.identical(pp):
continue continue
if p.archid != pp.archid and p.archid != solv.ARCH_NOARCH and pp.archid != solv.ARCH_NOARCH: if p.archid != pp.archid and p.archid != solv.ARCH_NOARCH and pp.archid != solv.ARCH_NOARCH:
continue continue
src = p.name src = p.name
if not p.lookup_void(solv.SOLVABLE_SOURCENAME): if not p.lookup_void(solv.SOLVABLE_SOURCENAME):

View File

@ -1,4 +1,3 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# #
# (C) 2014 tchvatal@suse.cz, openSUSE.org # (C) 2014 tchvatal@suse.cz, openSUSE.org