| |
@@ -22,8 +22,6 @@
|
| |
import os
|
| |
import os.path
|
| |
import re
|
| |
- import rpm
|
| |
-
|
| |
from glob import glob
|
| |
from StringIO import StringIO
|
| |
from subprocess import Popen, PIPE, CalledProcessError
|
| |
@@ -31,7 +29,7 @@
|
| |
from subprocess import check_output # pylint: disable=E0611
|
| |
except ImportError:
|
| |
from FedoraReview.el_compat import check_output
|
| |
-
|
| |
+ import rpm
|
| |
|
| |
from FedoraReview import CheckBase, Mock, ReviewDirs
|
| |
from FedoraReview import ReviewError # pylint: disable=W0611
|
| |
@@ -130,8 +128,8 @@
|
| |
if check_dirs:
|
| |
self.set_passed(
|
| |
self.PENDING,
|
| |
- 'Especially check following dirs for bundled code: '
|
| |
- + ', '.join(check_dirs))
|
| |
+ 'Especially check following dirs for bundled code: ' +
|
| |
+ ', '.join(check_dirs))
|
| |
else:
|
| |
self.set_passed(self.PENDING)
|
| |
|
| |
@@ -231,8 +229,8 @@
|
| |
if not install_sec:
|
| |
self.set_passed(self.NA)
|
| |
return
|
| |
- self.log.debug('regex: ' + regex)
|
| |
- self.log.debug('install_sec: ' + install_sec)
|
| |
+ self.log.debug('regex: %s', regex)
|
| |
+ self.log.debug('install_sec: %s', install_sec)
|
| |
has_clean = install_sec and re.search(regex, install_sec)
|
| |
if self.flags['EPEL5']:
|
| |
self.text = 'EPEL5: Package does run rm -rf %{buildroot}' \
|
| |
@@ -268,7 +266,7 @@
|
| |
with open('/dev/null', 'w') as f:
|
| |
suids = check_output(cmd.split(), stderr=f).strip().split()
|
| |
except CalledProcessError:
|
| |
- self.log.info('Cannot run find command: ' + cmd)
|
| |
+ self.log.info('Cannot run find command: %s', cmd)
|
| |
suids = []
|
| |
else:
|
| |
suids = [os.path.basename(s) for s in suids]
|
| |
@@ -419,7 +417,7 @@
|
| |
found = in_list('%{?dist}', rel_tags)
|
| |
if len(rel_tags) > 1:
|
| |
self.set_passed(found, 'Multiple Release: tags found')
|
| |
- elif len(rel_tags) == 0:
|
| |
+ elif not rel_tags:
|
| |
self.set_passed(found, 'No Release: tags found')
|
| |
else:
|
| |
self.set_passed(found)
|
| |
@@ -622,7 +620,7 @@
|
| |
tarballs if first option fails '''
|
| |
s = Mock.get_builddir('BUILD') + '/*'
|
| |
globs = glob(s)
|
| |
- if globs and len(globs) > 0:
|
| |
+ if globs:
|
| |
msg = 'Checking patched sources after %prep for licenses.'
|
| |
source_dir = globs[0]
|
| |
else:
|
| |
@@ -661,7 +659,7 @@
|
| |
def run(self):
|
| |
try:
|
| |
source_dir, msg = self._get_source_dir()
|
| |
- self.log.debug("Scanning sources in " + source_dir)
|
| |
+ self.log.debug("Scanning sources in %s", source_dir)
|
| |
if os.path.exists(source_dir):
|
| |
cmd = 'licensecheck -r ' + source_dir
|
| |
try:
|
| |
@@ -670,13 +668,13 @@
|
| |
self.set_passed(self.PENDING,
|
| |
"Cannot run licensecheck: " + str(err))
|
| |
return
|
| |
- self.log.debug("Got license reply, length: %d" % len(out))
|
| |
+ self.log.debug("Got license reply, length: %d", len(out))
|
| |
files_by_license = self._parse_licenses(out)
|
| |
filename = os.path.join(ReviewDirs.root,
|
| |
'licensecheck.txt')
|
| |
self._write_license(files_by_license, filename)
|
| |
else:
|
| |
- self.log.error('Source directory %s does not exist!' %
|
| |
+ self.log.error('Source directory %s does not exist!',
|
| |
source_dir)
|
| |
if not files_by_license:
|
| |
msg += ' No licenses found.'
|
| |
@@ -690,7 +688,7 @@
|
| |
msg += ' Detailed output of licensecheck in ' + filename
|
| |
self.set_passed(self.PENDING, msg)
|
| |
except OSError as e:
|
| |
- self.log.error('OSError: %s' % str(e))
|
| |
+ self.log.error('OSError: %s', str(e))
|
| |
msg = ' Programmer error: ' + e.strerror
|
| |
self.set_passed(self.PENDING, msg)
|
| |
|
| |
@@ -759,16 +757,15 @@
|
| |
|
| |
for _license in licenses:
|
| |
if self._license_flag == 'L' and _license not in qpL_files:
|
| |
- self.log.debug("Found " + _license + " not marked as %license")
|
| |
+ self.log.debug("Found %s not marked as %%license", _license)
|
| |
self.set_passed(
|
| |
self.FAIL,
|
| |
"License file %s is not marked as %%license" % _license)
|
| |
return
|
| |
if _license not in flagged_files:
|
| |
- self.log.debug("Cannot find " + _license +
|
| |
- " in doclist")
|
| |
+ self.log.debug("Cannot find %s in doclist", _license)
|
| |
self.set_passed(self.FAIL,
|
| |
- "Cannot find %s in rpm(s)" % _license)
|
| |
+ "Cannot find %s in rpm(s)", _license)
|
| |
return
|
| |
self.set_passed(self.PASS)
|
| |
|
| |
@@ -1082,8 +1079,8 @@
|
| |
if bad_dirs:
|
| |
bad_dirs = list(set(bad_dirs))
|
| |
self.set_passed(self.PENDING,
|
| |
- "Directories without known owners: "
|
| |
- + ', '.join(bad_dirs))
|
| |
+ "Directories without known owners: " +
|
| |
+ ', '.join(bad_dirs))
|
| |
else:
|
| |
self.set_passed(self.PASS)
|
| |
|
| |
@@ -1242,17 +1239,17 @@
|
| |
local = self.srpm.extract(s.filename)
|
| |
if not local:
|
| |
self.log.warn(
|
| |
- "Cannot extract local source: " + s.filename)
|
| |
+ "Cannot extract local source: %s", s.filename)
|
| |
return(False, None)
|
| |
cmd = '/usr/bin/diff -U2 -r %s %s' % (upstream, local)
|
| |
- self.log.debug(' Diff cmd: ' + cmd)
|
| |
+ self.log.debug(' Diff cmd: %s', cmd)
|
| |
try:
|
| |
p = Popen(cmd.split(), stdout=PIPE, stderr=PIPE)
|
| |
output = p.communicate()[0]
|
| |
except OSError:
|
| |
self.log.error("Cannot run diff", exc_info=True)
|
| |
return (False, None)
|
| |
- if output and len(output) > 0:
|
| |
+ if output:
|
| |
return (False, output)
|
| |
return (True, None)
|
| |
|
| |
@@ -1262,8 +1259,8 @@
|
| |
all_sources_passed = True
|
| |
for source in sources:
|
| |
if source.local:
|
| |
- self.log.debug('Skipping md5-test for '
|
| |
- + source.filename)
|
| |
+ self.log.debug('Skipping md5-test for %s',
|
| |
+ source.filename)
|
| |
continue
|
| |
if source.local_src:
|
| |
text += "Using local file " + source.local_src + \
|
| |
@@ -1307,7 +1304,7 @@
|
| |
text += 'diff -r also reports differences\n'
|
| |
msg = 'Upstream MD5sum check error, diff is in ' + p
|
| |
except AttributeError as e:
|
| |
- self.log.debug("CheckSourceMD5(): Attribute error " + str(e),
|
| |
+ self.log.debug("CheckSourceMD5(): Attribute error %s", str(e),
|
| |
exc_info=True)
|
| |
msg = 'Internal Error!'
|
| |
passed = False
|
| |
@@ -1492,8 +1489,8 @@
|
| |
self.set_passed(
|
| |
self.FAIL,
|
| |
'A package with this name already exists. Please check'
|
| |
- ' https://admin.fedoraproject.org/pkgdb/package/'
|
| |
- + name)
|
| |
+ ' https://admin.fedoraproject.org/pkgdb/package/' +
|
| |
+ name)
|
| |
else:
|
| |
self.set_passed(self.PASS)
|
| |
except pycurl.error:
|
| |
@@ -1544,11 +1541,11 @@
|
| |
if self.flags['EPEL5'] or self.flags['EPEL6'] \
|
| |
or self.flags['EPEL7']:
|
| |
if not in_list('gtk-update-icon-cache',
|
| |
- [rpm_pkg.postun, rpm_pkg.posttrans]):
|
| |
+ [rpm_pkg.postun, rpm_pkg.posttrans]):
|
| |
failed = True
|
| |
else:
|
| |
if in_list('gtk-update-icon-cache',
|
| |
- [rpm_pkg.postun, rpm_pkg.posttrans]):
|
| |
+ [rpm_pkg.postun, rpm_pkg.posttrans]):
|
| |
failed = True
|
| |
if not using:
|
| |
self.set_passed(self.NA)
|
| |
@@ -1590,7 +1587,7 @@
|
| |
if os.path.isdir(path):
|
| |
return False
|
| |
elif not os.path.exists(path):
|
| |
- self.log.warning("Can't access desktop file: " + path)
|
| |
+ self.log.warning("Can't access desktop file: %s", path)
|
| |
return False
|
| |
with open(path) as f:
|
| |
for line in f.readlines():
|
| |
@@ -1609,11 +1606,11 @@
|
| |
if self.flags['EPEL5'] or self.flags['EPEL6'] \
|
| |
or self.flags['EPEL7']:
|
| |
if not in_list('update-desktop-database',
|
| |
- [rpm_pkg.post, rpm_pkg.postun]):
|
| |
+ [rpm_pkg.post, rpm_pkg.postun]):
|
| |
failed = True
|
| |
else:
|
| |
if in_list('update-desktop-database',
|
| |
- [rpm_pkg.post, rpm_pkg.postun]):
|
| |
+ [rpm_pkg.post, rpm_pkg.postun]):
|
| |
failed = True
|
| |
if not using:
|
| |
self.set_passed(self.NA)
|
| |
@@ -1654,11 +1651,11 @@
|
| |
if self.flags['EPEL5'] or self.flags['EPEL6'] \
|
| |
or self.flags['EPEL7']:
|
| |
if not in_list('gio-querymodules',
|
| |
- [rpmpkg.post, rpmpkg.postun]):
|
| |
+ [rpmpkg.post, rpmpkg.postun]):
|
| |
failed = True
|
| |
else:
|
| |
if in_list('gio-querymodules',
|
| |
- [rpmpkg.post, rpmpkg.postun]):
|
| |
+ [rpmpkg.post, rpmpkg.postun]):
|
| |
failed = True
|
| |
if not using:
|
| |
self.set_passed(self.NA)
|
| |
@@ -1698,11 +1695,11 @@
|
| |
if self.flags['EPEL5'] or self.flags['EPEL6'] \
|
| |
or self.flags['EPEL7']:
|
| |
if not in_list('gtk-query-immodules',
|
| |
- [rpmpkg.postun, rpmpkg.posttrans]):
|
| |
+ [rpmpkg.postun, rpmpkg.posttrans]):
|
| |
failed = True
|
| |
else:
|
| |
if in_list('gtk-query-immodules',
|
| |
- [rpmpkg.postun, rpmpkg.posttrans]):
|
| |
+ [rpmpkg.postun, rpmpkg.posttrans]):
|
| |
failed = True
|
| |
|
| |
if not using:
|
| |
@@ -1742,11 +1739,11 @@
|
| |
if self.flags['EPEL5'] or self.flags['EPEL6'] \
|
| |
or self.flags['EPEL7']:
|
| |
if not in_list('glib-compile-schemas',
|
| |
- [rpm_pkg.postun, rpm_pkg.posttrans]):
|
| |
+ [rpm_pkg.postun, rpm_pkg.posttrans]):
|
| |
failed = True
|
| |
else:
|
| |
if in_list('glib-compile-schemas',
|
| |
- [rpm_pkg.postun, rpm_pkg.posttrans]):
|
| |
+ [rpm_pkg.postun, rpm_pkg.posttrans]):
|
| |
failed = True
|
| |
|
| |
if not using:
|
| |
@@ -1845,11 +1842,11 @@
|
| |
if self.flags['EPEL5'] or self.flags['EPEL6'] \
|
| |
or self.flags['EPEL7']:
|
| |
if not in_list('gdk-pixbuf-query-loaders',
|
| |
- [rpmpkg.postun, rpmpkg.post]):
|
| |
+ [rpmpkg.postun, rpmpkg.post]):
|
| |
failed = True
|
| |
else:
|
| |
if in_list('gdk-pixbuf-query-loaders',
|
| |
- [rpmpkg.postun, rpmpkg.post]):
|
| |
+ [rpmpkg.postun, rpmpkg.post]):
|
| |
failed = True
|
| |
|
| |
if not using:
|
| |
@@ -1965,7 +1962,6 @@
|
| |
pkgs.extend(deps.resolve(requires_to_process))
|
| |
return set(pkgs)
|
| |
|
| |
-
|
| |
pkg_deps = set()
|
| |
for pkg in self.spec.packages:
|
| |
pkg_deps |= resolve(self.rpms.get(pkg).requires)
|
| |
@@ -1975,8 +1971,8 @@
|
| |
for pkg in pkg_deps:
|
| |
provides = deps.list_provides(pkg)
|
| |
if any('deprecated()' in p for p in provides):
|
| |
- self.set_passed(self.FAIL, pkg + ' is deprecated, you must '\
|
| |
- 'not depend on it.')
|
| |
+ self.set_passed(self.FAIL, pkg + ' is deprecated, you must '
|
| |
+ 'not depend on it.')
|
| |
return
|
| |
|
| |
self.set_passed(self.PASS)
|
| |
This PR aims to fix a bunch of warnings in a lot of files (e.g. logging warnings, line-too-long, trailing-whitespaces, wrong-import-order, no-else-return, bad-continuation). In a future PR I will address the remaining warnings case by case, because they probably deserve a bit more attention.