Wrap bunch of long lines, tune comments and info messages.
git-svn-id: svn+ssh://rpmlint.zarb.org/home/projects/rpmlint/svn/trunk@1732 9bc8b190-ac0f-0410-8968-dc7d1f502856
This commit is contained in:
parent
a8f20c1d06
commit
8a514dd9aa
|
@ -213,7 +213,8 @@ class BinariesCheck(AbstractCheck.AbstractCheck):
|
|||
|
||||
if not stat.S_ISDIR(pkgfile.mode) and usr_lib_regex.search(fname):
|
||||
has_usr_lib_file = True
|
||||
if not binary_in_usr_lib and usr_lib_exception_regex.search(fname):
|
||||
if not binary_in_usr_lib and \
|
||||
usr_lib_exception_regex.search(fname):
|
||||
# Fake that we have binaries there to avoid
|
||||
# only-non-binary-in-usr-lib false positives
|
||||
binary_in_usr_lib = True
|
||||
|
@ -226,11 +227,15 @@ class BinariesCheck(AbstractCheck.AbstractCheck):
|
|||
|
||||
if is_binary:
|
||||
binary = True
|
||||
if has_usr_lib_file and not binary_in_usr_lib and usr_lib_regex.search(fname):
|
||||
if has_usr_lib_file and not binary_in_usr_lib and \
|
||||
usr_lib_regex.search(fname):
|
||||
binary_in_usr_lib = True
|
||||
|
||||
if pkg.arch == 'noarch':
|
||||
printError(pkg, 'arch-independent-package-contains-binary-or-object', fname)
|
||||
printError(
|
||||
pkg,
|
||||
'arch-independent-package-contains-binary-or-object',
|
||||
fname)
|
||||
else:
|
||||
# in /usr/share ?
|
||||
if fname.startswith('/usr/share/'):
|
||||
|
@ -271,7 +276,9 @@ class BinariesCheck(AbstractCheck.AbstractCheck):
|
|||
symlink = directory + bin_info.soname
|
||||
link = files[symlink].linkto
|
||||
if link not in (fname, base, ''):
|
||||
printError(pkg, 'invalid-ldconfig-symlink', fname, link)
|
||||
printError(
|
||||
pkg, 'invalid-ldconfig-symlink',
|
||||
fname, link)
|
||||
except KeyError:
|
||||
printError(
|
||||
pkg, 'no-ldconfig-symlink', fname)
|
||||
|
@ -292,7 +299,9 @@ class BinariesCheck(AbstractCheck.AbstractCheck):
|
|||
for p in bin_info.rpath:
|
||||
if p in system_lib_paths or \
|
||||
not usr_lib_regex.search(p):
|
||||
printError(pkg, 'binary-or-shlib-defines-rpath', fname, bin_info.rpath)
|
||||
printError(pkg,
|
||||
'binary-or-shlib-defines-rpath',
|
||||
fname, bin_info.rpath)
|
||||
break
|
||||
|
||||
# shared lib calls exit() or _exit()?
|
||||
|
@ -320,34 +329,46 @@ class BinariesCheck(AbstractCheck.AbstractCheck):
|
|||
not (bin_info.soname and \
|
||||
ldso_soname_regex.search(bin_info.soname)):
|
||||
if shared_object_regex.search(pkgfile.magic):
|
||||
printError(pkg, 'shared-lib-without-dependency-information', fname)
|
||||
printError(pkg,
|
||||
'shared-lib-without-dependency-information',
|
||||
fname)
|
||||
else:
|
||||
printError(pkg, 'statically-linked-binary', fname)
|
||||
else:
|
||||
# linked against libc ?
|
||||
if not libc_regex.search(fname) and \
|
||||
( not bin_info.soname or \
|
||||
( not libc_regex.search(bin_info.soname) and \
|
||||
not ldso_soname_regex.search(bin_info.soname))):
|
||||
(not bin_info.soname or
|
||||
(not libc_regex.search(bin_info.soname) and
|
||||
not ldso_soname_regex.search(
|
||||
bin_info.soname))):
|
||||
found_libc = False
|
||||
for lib in bin_info.needed:
|
||||
if libc_regex.search(lib):
|
||||
found_libc = True
|
||||
break
|
||||
if not found_libc:
|
||||
if shared_object_regex.search(pkgfile.magic):
|
||||
printError(pkg, 'library-not-linked-against-libc', fname)
|
||||
if shared_object_regex.search(
|
||||
pkgfile.magic):
|
||||
printError(pkg,
|
||||
'library-not-linked-against-libc',
|
||||
fname)
|
||||
else:
|
||||
printError(pkg, 'program-not-linked-against-libc', fname)
|
||||
printError(pkg,
|
||||
'program-not-linked-against-libc',
|
||||
fname)
|
||||
|
||||
# It could be useful to check these for others than
|
||||
# shared libs only, but that has potential to
|
||||
# generate lots of false positives and noise.
|
||||
if is_shlib:
|
||||
for s in bin_info.undef:
|
||||
printWarning(pkg, 'undefined-non-weak-symbol', fname, s)
|
||||
printWarning(pkg,
|
||||
'undefined-non-weak-symbol',
|
||||
fname, s)
|
||||
for s in bin_info.unused:
|
||||
printWarning(pkg, 'unused-direct-shlib-dependency', fname, s)
|
||||
printWarning(
|
||||
pkg, 'unused-direct-shlib-dependency',
|
||||
fname, s)
|
||||
|
||||
if bin_info.stack:
|
||||
if bin_info.exec_stack:
|
||||
|
@ -356,7 +377,8 @@ class BinariesCheck(AbstractCheck.AbstractCheck):
|
|||
pkg.arch.endswith("86") or
|
||||
pkg.arch.startswith("pentium") or
|
||||
pkg.arch in ("athlon", "x86_64")):
|
||||
printError(pkg, 'missing-PT_GNU_STACK-section', fname)
|
||||
printError(pkg, 'missing-PT_GNU_STACK-section',
|
||||
fname)
|
||||
|
||||
else:
|
||||
if reference_regex.search(fname):
|
||||
|
@ -371,7 +393,8 @@ class BinariesCheck(AbstractCheck.AbstractCheck):
|
|||
for f in files:
|
||||
res = numeric_dir_regex.search(f)
|
||||
fn = res and res.group(1) or f
|
||||
if f not in exec_files and not so_regex.search(f) and not versioned_dir_regex.search(fn):
|
||||
if f not in exec_files and not so_regex.search(f) and \
|
||||
not versioned_dir_regex.search(fn):
|
||||
printError(pkg, 'non-versioned-file-in-library-package', f)
|
||||
if version and version != -1 and version not in pkg.name:
|
||||
printError(pkg, 'incoherent-version-in-name', version)
|
||||
|
@ -474,7 +497,8 @@ indicate gratuitously bloated linkage; check that the binary has been linked
|
|||
with the intended shared libraries only.''',
|
||||
|
||||
'only-non-binary-in-usr-lib',
|
||||
'''There are only non binary files in /usr/lib so they should be in /usr/share.''',
|
||||
'''There are only non binary files in /usr/lib so they should be in
|
||||
/usr/share.''',
|
||||
|
||||
'binaryinfo-readelf-failed',
|
||||
'''Executing readelf on this file failed, all checks could not be run.''',
|
||||
|
|
|
@ -155,8 +155,9 @@ def isFiltered(s):
|
|||
_filters_re = '(?:' + _filters[0] + ')'
|
||||
|
||||
for idx in range(1, len(_filters)):
|
||||
# to prevent named group overflow that happen when there is too many () in a single regexp
|
||||
# AssertionError: sorry, but this version only supports 100 named groups
|
||||
# to prevent named group overflow that happen when there is too
|
||||
# many () in a single regexp: AssertionError: sorry, but this
|
||||
# version only supports 100 named groups
|
||||
if '(' in _filters[idx]:
|
||||
_non_named_group_re.subn('(:?', _filters[idx])
|
||||
_filters_re = _filters_re + '|(?:' + _filters[idx] +')'
|
||||
|
|
|
@ -38,7 +38,8 @@ class DistributionCheck(AbstractCheck.AbstractCheck):
|
|||
printWarning(pkg, "invalid-vendor", pkg[rpm.RPMTAG_VENDOR])
|
||||
|
||||
if distribution and pkg[rpm.RPMTAG_DISTRIBUTION] != distribution:
|
||||
printWarning(pkg, "invalid-distribution", pkg[rpm.RPMTAG_DISTRIBUTION])
|
||||
printWarning(pkg, "invalid-distribution",
|
||||
pkg[rpm.RPMTAG_DISTRIBUTION])
|
||||
|
||||
if compress_ext:
|
||||
for fname in pkg.files():
|
||||
|
@ -58,7 +59,7 @@ check = DistributionCheck()
|
|||
|
||||
addDetails(
|
||||
'invalid-vendor',
|
||||
'In the ' + distribution + ' distribution, the vendor should be "' + vendor + '".',
|
||||
'''In the "%s" distribution, vendor should be "%s".''' % (distribution, vendor),
|
||||
|
||||
'invalid-distribution',
|
||||
'The distribution value should be "' + distribution + '".',
|
||||
|
|
114
FilesCheck.py
114
FilesCheck.py
|
@ -388,7 +388,8 @@ class FilesCheck(AbstractCheck.AbstractCheck):
|
|||
if standard_groups and group not in standard_groups:
|
||||
printWarning(pkg, 'non-standard-gid', f, group)
|
||||
|
||||
if not module_rpms_ok and kernel_modules_regex.search(f) and not is_kernel_package:
|
||||
if not module_rpms_ok and kernel_modules_regex.search(f) and not \
|
||||
is_kernel_package:
|
||||
printError(pkg, "kernel-modules-not-in-kernel-packages", f)
|
||||
|
||||
if tmp_regex.search(f):
|
||||
|
@ -431,7 +432,8 @@ class FilesCheck(AbstractCheck.AbstractCheck):
|
|||
ext = compr_regex.search(link)
|
||||
if ext:
|
||||
if not re.compile('\.' + ext.group(1) + '$').search(f):
|
||||
printError(pkg, 'compressed-symlink-with-wrong-ext', f, link)
|
||||
printError(pkg, 'compressed-symlink-with-wrong-ext',
|
||||
f, link)
|
||||
|
||||
perm = mode & 07777
|
||||
|
||||
|
@ -449,10 +451,14 @@ class FilesCheck(AbstractCheck.AbstractCheck):
|
|||
printError(pkg, 'setuid-binary', f, setuid, oct(perm))
|
||||
if setgid:
|
||||
if not (group == 'games' and
|
||||
(games_path_regex.search(f) or games_group_regex.search(pkg[rpm.RPMTAG_GROUP]))):
|
||||
printError(pkg, 'setgid-binary', f, setgid, oct(perm))
|
||||
(games_path_regex.search(f) or
|
||||
games_group_regex.search(
|
||||
pkg[rpm.RPMTAG_GROUP]))):
|
||||
printError(pkg, 'setgid-binary', f, setgid,
|
||||
oct(perm))
|
||||
if mode & 0777 != 0755:
|
||||
printError(pkg, 'non-standard-executable-perm', f, oct(perm))
|
||||
printError(pkg, 'non-standard-executable-perm', f,
|
||||
oct(perm))
|
||||
|
||||
if log_regex.search(f):
|
||||
log_file = f
|
||||
|
@ -536,16 +542,19 @@ class FilesCheck(AbstractCheck.AbstractCheck):
|
|||
# check install-info call in %post and %postun
|
||||
if f.startswith('/usr/share/info/'):
|
||||
if not postin:
|
||||
printError(pkg, 'info-files-without-install-info-postin', f)
|
||||
printError(pkg,
|
||||
'info-files-without-install-info-postin', f)
|
||||
else:
|
||||
if not install_info_regex.search(postin):
|
||||
printError(pkg, 'postin-without-install-info', f)
|
||||
|
||||
if not postun and not preun:
|
||||
printError(pkg, 'info-files-without-install-info-postun', f)
|
||||
printError(pkg,
|
||||
'info-files-without-install-info-postun', f)
|
||||
else:
|
||||
if (not postun or not install_info_regex.search(postun)) and \
|
||||
(not preun or not install_info_regex.search(preun)):
|
||||
if (not postun or
|
||||
not install_info_regex.search(postun)) and \
|
||||
(not preun or not install_info_regex.search(preun)):
|
||||
printError(pkg, 'postin-without-install-info', f)
|
||||
|
||||
# check perl temp file
|
||||
|
@ -574,7 +583,8 @@ class FilesCheck(AbstractCheck.AbstractCheck):
|
|||
break
|
||||
if not ok_nonreadable:
|
||||
printError(pkg, 'non-readable', f, oct(perm))
|
||||
if size == 0 and not normal_zero_length_regex.search(f) and f not in ghost_files:
|
||||
if size == 0 and not normal_zero_length_regex.search(f) and \
|
||||
f not in ghost_files:
|
||||
printError(pkg, 'zero-length', f)
|
||||
|
||||
if mode & 0002 != 0:
|
||||
|
@ -589,15 +599,19 @@ class FilesCheck(AbstractCheck.AbstractCheck):
|
|||
vers = res.group(1) + res.group(2)
|
||||
if not (pkg.check_versioned_dep('perl-base', vers) or
|
||||
pkg.check_versioned_dep('perl', vers)):
|
||||
printError(pkg, 'no-dependency-on', 'perl-base', vers)
|
||||
printError(pkg, 'no-dependency-on',
|
||||
'perl-base', vers)
|
||||
perl_dep_error = True
|
||||
|
||||
if not python_dep_error:
|
||||
res = python_regex.search(f)
|
||||
if res:
|
||||
if not (pkg.check_versioned_dep('python-base', res.group(1)) or
|
||||
pkg.check_versioned_dep('python', res.group(1))):
|
||||
printError(pkg, 'no-dependency-on', 'python-base', res.group(1))
|
||||
if not (pkg.check_versioned_dep('python-base',
|
||||
res.group(1)) or
|
||||
pkg.check_versioned_dep('python',
|
||||
res.group(1))):
|
||||
printError(pkg, 'no-dependency-on', 'python-base',
|
||||
res.group(1))
|
||||
python_dep_error = True
|
||||
|
||||
res = python_bytecode_regex.search(f)
|
||||
|
@ -649,7 +663,8 @@ class FilesCheck(AbstractCheck.AbstractCheck):
|
|||
|
||||
# normal executable check
|
||||
if mode & stat.S_IXUSR and perm != 0755:
|
||||
printError(pkg, 'non-standard-executable-perm', f, oct(perm))
|
||||
printError(pkg, 'non-standard-executable-perm',
|
||||
f, oct(perm))
|
||||
if mode & 0111 != 0:
|
||||
if f in config_files:
|
||||
printError(pkg, 'executable-marked-as-config-file', f)
|
||||
|
@ -698,7 +713,8 @@ class FilesCheck(AbstractCheck.AbstractCheck):
|
|||
# absolute link
|
||||
r = absolute_regex.search(link)
|
||||
if r:
|
||||
if not is_so and link not in files and link not in req_names:
|
||||
if not is_so and link not in files and \
|
||||
link not in req_names:
|
||||
is_exception = False
|
||||
for e in dangling_exceptions:
|
||||
if e[0].search(link):
|
||||
|
@ -706,7 +722,8 @@ class FilesCheck(AbstractCheck.AbstractCheck):
|
|||
break
|
||||
if is_exception:
|
||||
if is_exception not in req_names:
|
||||
printWarning(pkg, 'no-dependency-on', is_exception)
|
||||
printWarning(pkg, 'no-dependency-on',
|
||||
is_exception)
|
||||
else:
|
||||
printWarning(pkg, 'dangling-symlink', f, link)
|
||||
linktop = r.group(1)
|
||||
|
@ -714,7 +731,8 @@ class FilesCheck(AbstractCheck.AbstractCheck):
|
|||
if r:
|
||||
filetop = r.group(1)
|
||||
if filetop == linktop or use_relative_symlinks:
|
||||
printWarning(pkg, 'symlink-should-be-relative', f, link)
|
||||
printWarning(pkg, 'symlink-should-be-relative',
|
||||
f, link)
|
||||
# relative link
|
||||
else:
|
||||
if not is_so:
|
||||
|
@ -728,9 +746,11 @@ class FilesCheck(AbstractCheck.AbstractCheck):
|
|||
break
|
||||
if is_exception:
|
||||
if is_exception not in req_names:
|
||||
printWarning(pkg, 'no-dependency-on', is_exception)
|
||||
printWarning(pkg, 'no-dependency-on',
|
||||
is_exception)
|
||||
else:
|
||||
printWarning(pkg, 'dangling-relative-symlink', f, link)
|
||||
printWarning(pkg, 'dangling-relative-symlink',
|
||||
f, link)
|
||||
pathcomponents = f.split('/')[1:]
|
||||
r = points_regex.search(link)
|
||||
lastpop = None
|
||||
|
@ -739,7 +759,8 @@ class FilesCheck(AbstractCheck.AbstractCheck):
|
|||
while r:
|
||||
mylink = r.group(1)
|
||||
if len(pathcomponents) == 0:
|
||||
printError(pkg, 'symlink-has-too-many-up-segments', f, link)
|
||||
printError(pkg, 'symlink-has-too-many-up-segments',
|
||||
f, link)
|
||||
break
|
||||
else:
|
||||
lastpop = pathcomponents[0]
|
||||
|
@ -750,7 +771,8 @@ class FilesCheck(AbstractCheck.AbstractCheck):
|
|||
r = absolute2_regex.search(mylink)
|
||||
linktop = r.group(1)
|
||||
|
||||
# does the link go up and then down into the same directory?
|
||||
# does the link go up and then down into the same
|
||||
# directory?
|
||||
#if linktop == lastpop:
|
||||
# printWarning(pkg, 'lengthy-symlink', f, link)
|
||||
|
||||
|
@ -758,11 +780,16 @@ class FilesCheck(AbstractCheck.AbstractCheck):
|
|||
# we've reached the root directory
|
||||
if linktop != lastpop and not use_relative_symlinks:
|
||||
# relative link into other toplevel directory
|
||||
printWarning(pkg, 'symlink-should-be-absolute', f, link)
|
||||
# check additional segments for mistakes like `foo/../bar/'
|
||||
printWarning(pkg, 'symlink-should-be-absolute',
|
||||
f, link)
|
||||
# check additional segments for mistakes like
|
||||
# `foo/../bar/'
|
||||
for linksegment in mylink.split('/'):
|
||||
if linksegment == '..':
|
||||
printError(pkg, 'symlink-contains-up-and-down-segments', f, link)
|
||||
printError(
|
||||
pkg,
|
||||
'symlink-contains-up-and-down-segments',
|
||||
f, link)
|
||||
|
||||
# check text file
|
||||
if stat.S_ISREG(mode):
|
||||
|
@ -781,26 +808,34 @@ class FilesCheck(AbstractCheck.AbstractCheck):
|
|||
# sourced scripts should not be executable
|
||||
if sourced_script_regex.search(f):
|
||||
if res:
|
||||
printError(pkg, 'sourced-script-with-shebang', f)
|
||||
printError(pkg,
|
||||
'sourced-script-with-shebang', f)
|
||||
if mode & 0111 != 0:
|
||||
printError(pkg, 'executable-sourced-script', f, oct(perm))
|
||||
printError(pkg, 'executable-sourced-script',
|
||||
f, oct(perm))
|
||||
# ...but executed ones should
|
||||
elif res or mode & 0111 != 0 or script_regex.search(f):
|
||||
interpreter = None
|
||||
if res:
|
||||
interpreter = res.group(1)
|
||||
if not interpreter_regex.search(interpreter):
|
||||
printError(pkg, 'wrong-script-interpreter', f, interpreter)
|
||||
elif not nonexec_file and not (lib_path_regex.search(f) and f.endswith('.la')):
|
||||
printError(pkg, 'wrong-script-interpreter',
|
||||
f, interpreter)
|
||||
elif not nonexec_file and not \
|
||||
(lib_path_regex.search(f) and
|
||||
f.endswith('.la')):
|
||||
printError(pkg, 'script-without-shebang', f)
|
||||
|
||||
if mode & 0111 == 0 and not is_doc:
|
||||
printError(pkg, 'non-executable-script', f, oct(perm), interpreter)
|
||||
printError(pkg, 'non-executable-script', f,
|
||||
oct(perm), interpreter)
|
||||
if line.endswith('\r\n') or line.endswith('\r'):
|
||||
printError(pkg, 'wrong-script-end-of-line-encoding', f)
|
||||
printError(
|
||||
pkg, 'wrong-script-end-of-line-encoding', f)
|
||||
elif is_doc and not skipdocs_regex.search(f):
|
||||
if line.endswith('\r\n') or line.endswith('\r'):
|
||||
printWarning(pkg, 'wrong-file-end-of-line-encoding', f)
|
||||
printWarning(
|
||||
pkg, 'wrong-file-end-of-line-encoding', f)
|
||||
# We check only doc text files for UTF-8-ness;
|
||||
# checking everything may be slow and can generate
|
||||
# lots of unwanted noise.
|
||||
|
@ -861,7 +896,8 @@ Standard groups are:
|
|||
a call to ldconfig.''',
|
||||
|
||||
'postin-without-ldconfig',
|
||||
'''This package contains a library and its %post scriptlet doesn't call ldconfig.''',
|
||||
'''This package contains a library and its %post scriptlet doesn't call
|
||||
ldconfig.''',
|
||||
|
||||
'library-without-ldconfig-postun',
|
||||
'''This package contains a library and provides no %postun scriptlet containing
|
||||
|
@ -882,7 +918,8 @@ a call to install-info.''',
|
|||
a call to install-info.''',
|
||||
|
||||
'postun-without-install-info',
|
||||
'''This package contains info files and its %postun doesn't call install-info.''',
|
||||
'''This package contains info files and its %postun doesn't call
|
||||
install-info.''',
|
||||
|
||||
'perl-temp-file',
|
||||
'''You have a perl temporary file in your package. Usually, this
|
||||
|
@ -941,7 +978,8 @@ a configuration file. All non-executable files in /etc should be configuration
|
|||
files. Mark the file as %config in the spec file.''',
|
||||
|
||||
'compressed-symlink-with-wrong-ext',
|
||||
'''The symlink points to a compressed file but doesn't use the same extension.''',
|
||||
'''The symlink points to a compressed file but doesn't use the same
|
||||
extension.''',
|
||||
|
||||
'setuid-binary',
|
||||
'''The file is setuid, this may be dangerous, especially if this
|
||||
|
@ -1087,7 +1125,8 @@ customize an executable, make it for example read a config file in
|
|||
/etc/sysconfig.''',
|
||||
|
||||
'sourced-script-with-shebang',
|
||||
'''This text file contains a shebang, but is meant to be sourced, not executed.''',
|
||||
'''This text file contains a shebang, but is meant to be sourced, not
|
||||
executed.''',
|
||||
|
||||
'executable-sourced-script',
|
||||
'''This text file has executable bit set, but is meant to be sourced, not
|
||||
|
@ -1122,7 +1161,8 @@ correctly in some circumstances.''',
|
|||
in the specfile's %prep section for example using iconv(1).''',
|
||||
|
||||
'filename-not-utf8',
|
||||
'''The character encoding of the name of this file is not UTF-8. Rename it.''',
|
||||
'''The character encoding of the name of this file is not UTF-8.
|
||||
Rename it.''',
|
||||
|
||||
'file-in-meta-package',
|
||||
'''This package seems to be a meta-package (an empty package used to require
|
||||
|
|
|
@ -111,7 +111,8 @@ class I18NCheck(AbstractCheck.AbstractCheck):
|
|||
# others in /usr/share or /usr/lib, the only reliable way
|
||||
# sofar to detect them is to look for an apache configuration file
|
||||
for f in files:
|
||||
if f.startswith('/etc/apache2/') or f.startswith('/etc/httpd/conf.d/'):
|
||||
if f.startswith('/etc/apache2/') or \
|
||||
f.startswith('/etc/httpd/conf.d/'):
|
||||
webapp = True
|
||||
|
||||
for f in files:
|
||||
|
@ -204,7 +205,8 @@ addDetails(
|
|||
""",
|
||||
|
||||
'subfile-not-in-%lang',
|
||||
""" If /foo/bar is not tagged %lang(XX) whereas /foo is, the package won't be installable if XX is not in %_install_langs""",
|
||||
""" If /foo/bar is not tagged %lang(XX) whereas /foo is, the package won't be
|
||||
installable if XX is not in %_install_langs.""",
|
||||
|
||||
)
|
||||
|
||||
|
|
|
@ -60,14 +60,16 @@ class InitScriptCheck(AbstractCheck.AbstractCheck):
|
|||
# check chkconfig call in %post and %preun
|
||||
postin = pkg[rpm.RPMTAG_POSTIN] or pkg[rpm.RPMTAG_POSTINPROG]
|
||||
if not postin:
|
||||
printError(pkg, 'init-script-without-chkconfig-postin', fname)
|
||||
printError(pkg,
|
||||
'init-script-without-chkconfig-postin', fname)
|
||||
else:
|
||||
if not chkconfig_regex.search(postin):
|
||||
printError(pkg, 'postin-without-chkconfig', fname)
|
||||
|
||||
preun = pkg[rpm.RPMTAG_PREUN] or pkg[rpm.RPMTAG_PREUNPROG]
|
||||
if not preun:
|
||||
printError(pkg, 'init-script-without-chkconfig-preun', fname)
|
||||
printError(pkg,
|
||||
'init-script-without-chkconfig-preun', fname)
|
||||
else:
|
||||
if not chkconfig_regex.search(preun):
|
||||
printError(pkg, 'preun-without-chkconfig', fname)
|
||||
|
@ -115,9 +117,12 @@ class InitScriptCheck(AbstractCheck.AbstractCheck):
|
|||
cres = lsb_cont_regex.search(line)
|
||||
if not (in_lsb_description and cres):
|
||||
in_lsb_description = False
|
||||
printError(pkg, 'malformed-line-in-lsb-comment-block', line)
|
||||
printError(pkg,
|
||||
'malformed-line-in-lsb-comment-block',
|
||||
line)
|
||||
else:
|
||||
lsb_tags["Description"][-1] += " " + cres.group(1)
|
||||
lsb_tags["Description"][-1] += \
|
||||
" " + cres.group(1)
|
||||
else:
|
||||
tag = res.group(1)
|
||||
if not tag.startswith('X-') and \
|
||||
|
@ -146,7 +151,8 @@ class InitScriptCheck(AbstractCheck.AbstractCheck):
|
|||
printWarning(pkg, 'no-default-runlevel', fname)
|
||||
else:
|
||||
if res.group(1) != '-':
|
||||
printWarning(pkg, 'service-default-enabled', fname)
|
||||
printWarning(pkg,
|
||||
'service-default-enabled', fname)
|
||||
|
||||
res = subsys_regex.search(line)
|
||||
if res:
|
||||
|
@ -155,7 +161,8 @@ class InitScriptCheck(AbstractCheck.AbstractCheck):
|
|||
if name != basename:
|
||||
error = True
|
||||
if name[0] == '$':
|
||||
value = Pkg.substitute_shell_vars(name, content_str)
|
||||
value = Pkg.substitute_shell_vars(
|
||||
name, content_str)
|
||||
if value == basename:
|
||||
error = False
|
||||
else:
|
||||
|
@ -165,9 +172,11 @@ class InitScriptCheck(AbstractCheck.AbstractCheck):
|
|||
error = name != basename
|
||||
if error and len(name):
|
||||
if name[0] == '$':
|
||||
printWarning(pkg, 'incoherent-subsys', fname, name)
|
||||
printWarning(pkg, 'incoherent-subsys',
|
||||
fname, name)
|
||||
else:
|
||||
printError(pkg, 'incoherent-subsys', fname, name)
|
||||
printError(pkg, 'incoherent-subsys',
|
||||
fname, name)
|
||||
|
||||
if "Default-Start" in lsb_tags:
|
||||
if "".join(lsb_tags["Default-Start"]):
|
||||
|
@ -197,14 +206,16 @@ addDetails(
|
|||
a call to chkconfig.''',
|
||||
|
||||
'postin-without-chkconfig',
|
||||
'''The package contains an init script but doesn't call chkconfig in its %post.''',
|
||||
'''The package contains an init script but doesn't call chkconfig in its
|
||||
%post script.''',
|
||||
|
||||
'init-script-without-chkconfig-preun',
|
||||
'''The package contains an init script but doesn't contain a %preun with
|
||||
a call to chkconfig.''',
|
||||
|
||||
'preun-without-chkconfig',
|
||||
'''The package contains an init script but doesn't call chkconfig in its %preun.''',
|
||||
'''The package contains an init script but doesn't call chkconfig in its
|
||||
%preun script.''',
|
||||
|
||||
'missing-lsb-keyword',
|
||||
'''The package contains an init script that does not contain one of the LSB
|
||||
|
|
41
MenuCheck.py
41
MenuCheck.py
|
@ -225,7 +225,9 @@ class MenuCheck(AbstractCheck.AbstractCheck):
|
|||
if res:
|
||||
package = res.group(1)
|
||||
if package != pkg.name:
|
||||
printWarning(pkg, 'incoherent-package-value-in-menu', package, f)
|
||||
printWarning(pkg,
|
||||
'incoherent-package-value-in-menu',
|
||||
package, f)
|
||||
else:
|
||||
printInfo(pkg, 'unable-to-parse-menu-entry', line)
|
||||
|
||||
|
@ -239,8 +241,9 @@ class MenuCheck(AbstractCheck.AbstractCheck):
|
|||
found = False
|
||||
if launcher[1]:
|
||||
if ('/bin/' + command_line[0] in files or
|
||||
'/usr/bin/' + command_line[0] in files or
|
||||
'/usr/X11R6/bin/' + command_line[0] in files):
|
||||
'/usr/bin/' + command_line[0] in files
|
||||
or '/usr/X11R6/bin/' + command_line[0]
|
||||
in files):
|
||||
found = True
|
||||
else:
|
||||
for l in launcher[1]:
|
||||
|
@ -248,17 +251,21 @@ class MenuCheck(AbstractCheck.AbstractCheck):
|
|||
found = True
|
||||
break
|
||||
if not found:
|
||||
printError(pkg, 'use-of-launcher-in-menu-but-no-requires-on', launcher[1][0])
|
||||
printError(pkg,
|
||||
'use-of-launcher-in-menu-but-no-requires-on',
|
||||
launcher[1][0])
|
||||
command = command_line[1]
|
||||
break
|
||||
if command[0] == '/':
|
||||
if command not in files:
|
||||
printWarning(pkg, 'menu-command-not-in-package', command)
|
||||
printWarning(pkg, 'menu-command-not-in-package',
|
||||
command)
|
||||
else:
|
||||
if not ('/bin/' + command in files or
|
||||
'/usr/bin/' + command in files or
|
||||
'/usr/X11R6/bin/' + command in files):
|
||||
printWarning(pkg, 'menu-command-not-in-package', command)
|
||||
printWarning(pkg, 'menu-command-not-in-package',
|
||||
command)
|
||||
else:
|
||||
printWarning(pkg, 'missing-menu-command')
|
||||
command = False
|
||||
|
@ -268,10 +275,12 @@ class MenuCheck(AbstractCheck.AbstractCheck):
|
|||
grp = res.groups()
|
||||
title = grp[1] or grp[2]
|
||||
if title[0] != title[0].upper():
|
||||
printWarning(pkg, 'menu-longtitle-not-capitalized', title)
|
||||
printWarning(pkg, 'menu-longtitle-not-capitalized',
|
||||
title)
|
||||
res = version_regex.search(title)
|
||||
if res:
|
||||
printWarning(pkg, 'version-in-menu-longtitle', title)
|
||||
printWarning(pkg, 'version-in-menu-longtitle',
|
||||
title)
|
||||
else:
|
||||
printError(pkg, 'no-longtitle-in-menu', f)
|
||||
title = None
|
||||
|
@ -281,7 +290,8 @@ class MenuCheck(AbstractCheck.AbstractCheck):
|
|||
grp = res.groups()
|
||||
title = grp[1] or grp[2]
|
||||
if title[0] != title[0].upper():
|
||||
printWarning(pkg, 'menu-title-not-capitalized', title)
|
||||
printWarning(pkg, 'menu-title-not-capitalized',
|
||||
title)
|
||||
res = version_regex.search(title)
|
||||
if res:
|
||||
printWarning(pkg, 'version-in-menu-title', title)
|
||||
|
@ -303,9 +313,11 @@ class MenuCheck(AbstractCheck.AbstractCheck):
|
|||
# don't warn entries for sections
|
||||
if command:
|
||||
if section not in valid_sections:
|
||||
printError(pkg, 'invalid-menu-section', section, f)
|
||||
printError(pkg, 'invalid-menu-section',
|
||||
section, f)
|
||||
else:
|
||||
printInfo(pkg, 'unable-to-parse-menu-section', line)
|
||||
printInfo(pkg, 'unable-to-parse-menu-section',
|
||||
line)
|
||||
elif needs not in standard_needs:
|
||||
printInfo(pkg, 'strange-needs', needs, f)
|
||||
else:
|
||||
|
@ -317,11 +329,14 @@ class MenuCheck(AbstractCheck.AbstractCheck):
|
|||
if not icon_ext_regex.search(icon):
|
||||
printWarning(pkg, 'invalid-menu-icon-type', icon)
|
||||
if icon[0] == '/' and needs == 'x11':
|
||||
printWarning(pkg, 'hardcoded-path-in-menu-icon', icon)
|
||||
printWarning(pkg, 'hardcoded-path-in-menu-icon',
|
||||
icon)
|
||||
else:
|
||||
for path in icon_paths:
|
||||
if (path[0] + icon) not in files:
|
||||
printError(pkg, path[1] + '-icon-not-in-package', icon, f)
|
||||
printError(pkg,
|
||||
path[1] + '-icon-not-in-package',
|
||||
icon, f)
|
||||
else:
|
||||
printWarning(pkg, 'no-icon-in-menu', title)
|
||||
|
||||
|
|
|
@ -17,7 +17,8 @@ class MenuXDGCheck(AbstractCheck.AbstractFilesCheck):
|
|||
# desktop file need to be in $XDG_DATA_DIRS
|
||||
# $ echo $XDG_DATA_DIRS/applications
|
||||
# /var/lib/menu-xdg:/usr/share
|
||||
AbstractCheck.AbstractFilesCheck.__init__(self, "MenuXDGCheck", "/usr/share/applications/.*\.desktop$")
|
||||
AbstractCheck.AbstractFilesCheck.__init__(
|
||||
self, "MenuXDGCheck", "/usr/share/applications/.*\.desktop$")
|
||||
|
||||
def check_file(self, pkg, filename):
|
||||
f = pkg.dirName() + filename
|
||||
|
|
|
@ -64,7 +64,8 @@ class NamingPolicyCheck(AbstractCheck.AbstractCheck):
|
|||
# check for files then
|
||||
for c in self.checks_:
|
||||
for f in files:
|
||||
if c['file_re'].search(f) and not c['name_re'].search(pkg.name):
|
||||
if c['file_re'].search(f) and \
|
||||
not c['name_re'].search(pkg.name):
|
||||
raise NamingPolicyNotAppliedException
|
||||
except NamingPolicyNotAppliedException:
|
||||
printWarning(pkg, c['pkg_name'] + '-naming-policy-not-applied', f)
|
||||
|
@ -72,7 +73,7 @@ class NamingPolicyCheck(AbstractCheck.AbstractCheck):
|
|||
check = NamingPolicyCheck()
|
||||
|
||||
#
|
||||
# these are the check currently impleted.
|
||||
# these are the check currently implemented.
|
||||
#
|
||||
# first argument is the name of the check, printed by the warning.
|
||||
# ex : xmms.
|
||||
|
@ -80,10 +81,12 @@ check = NamingPolicyCheck()
|
|||
# secund argument is the regular expression of the naming policy.
|
||||
# ex: xmms plugin should be named xmms-name_of_plugin.
|
||||
#
|
||||
# third is the path of the file that should contains a package to be related to the naming scheme.
|
||||
# third is the path of the file that should contains a package to be related to
|
||||
# the naming scheme.
|
||||
# ex: xmms plugin are put under /usr/lib/xmms/
|
||||
#
|
||||
# the module is far from being perfect since you need to check this file for the naming file.
|
||||
# the module is far from being perfect since you need to check this file for
|
||||
# the naming file.
|
||||
# if somone as a elegant solution, I will be happy to implement and test it.
|
||||
|
||||
|
||||
|
|
|
@ -19,7 +19,8 @@ pam_stack_re = re.compile('^\s*[^#].*pam_stack\.so\s*service')
|
|||
|
||||
class PamCheck(AbstractCheck.AbstractFilesCheck):
|
||||
def __init__(self):
|
||||
AbstractCheck.AbstractFilesCheck.__init__(self, "PamCheck", "/etc/pam\.d/.*")
|
||||
AbstractCheck.AbstractFilesCheck.__init__(self, "PamCheck",
|
||||
"/etc/pam\.d/.*")
|
||||
|
||||
def check_file(self, pkg, filename):
|
||||
lines = pkg.grep(pam_stack_re, filename)
|
||||
|
|
30
Pkg.py
30
Pkg.py
|
@ -69,7 +69,8 @@ def substitute_shell_vars(val, script):
|
|||
value = shell_var_value(res.group(2), script)
|
||||
if not value:
|
||||
value = ''
|
||||
return res.group(1) + value + substitute_shell_vars(res.group(3), script)
|
||||
return res.group(1) + value + \
|
||||
substitute_shell_vars(res.group(3), script)
|
||||
else:
|
||||
return val
|
||||
|
||||
|
@ -77,9 +78,12 @@ def getstatusoutput(cmd, stdoutonly = False):
|
|||
'''A version of commands.getstatusoutput() which can take cmd as a
|
||||
sequence, thus making it potentially more secure.'''
|
||||
if stdoutonly:
|
||||
proc = subprocess.Popen(cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE, close_fds=True)
|
||||
proc = subprocess.Popen(cmd, stdin=subprocess.PIPE,
|
||||
stdout=subprocess.PIPE, close_fds=True)
|
||||
else:
|
||||
proc = subprocess.Popen(cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, close_fds=True)
|
||||
proc = subprocess.Popen(cmd, stdin=subprocess.PIPE,
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.STDOUT, close_fds=True)
|
||||
proc.stdin.close()
|
||||
text = proc.stdout.read()
|
||||
sts = proc.wait()
|
||||
|
@ -98,7 +102,8 @@ def is_utf8(fname):
|
|||
if bz2_regex.search(fname): cat = 'bzip2 -dcf'
|
||||
elif xz_regex.search(fname): cat = 'xz -dc'
|
||||
# TODO: better shell escaping or sequence based command invocation
|
||||
cmd = commands.getstatusoutput('%s "%s" | iconv -f utf-8 -t utf-8 -o /dev/null' % (cat, fname))
|
||||
cmd = commands.getstatusoutput(
|
||||
'%s "%s" | iconv -f utf-8 -t utf-8 -o /dev/null' % (cat, fname))
|
||||
return not cmd[0]
|
||||
|
||||
def is_utf8_str(s):
|
||||
|
@ -217,7 +222,8 @@ def rangeCompare(reqtuple, provtuple):
|
|||
r = None
|
||||
if reqe is None:
|
||||
e = None
|
||||
if reqv is None: # just for the record if ver is None then we're going to segfault
|
||||
# just for the record if ver is None then we're going to segfault
|
||||
if reqv is None:
|
||||
v = None
|
||||
|
||||
# if we just require foo-version, then foo-version-* will match
|
||||
|
@ -384,7 +390,9 @@ class Pkg:
|
|||
prefix = 'rpmlint.%s.' % os.path.basename(self.filename),
|
||||
dir = self.dirname)
|
||||
# TODO: better shell escaping or sequence based command invocation
|
||||
command_str = 'rpm2cpio "%s" | (cd "%s"; cpio -id); chmod -R +rX "%s"' % (self.filename, self.dirname, self.dirname)
|
||||
command_str = \
|
||||
'rpm2cpio "%s" | (cd "%s"; cpio -id); chmod -R +rX "%s"' % \
|
||||
(self.filename, self.dirname, self.dirname)
|
||||
cmd = commands.getstatusoutput(command_str)
|
||||
self.extracted = True
|
||||
return cmd
|
||||
|
@ -577,7 +585,8 @@ class Pkg:
|
|||
return self._provides
|
||||
|
||||
# internal function to gather dependency info used by the above ones
|
||||
def _gather_aux(self, header, list, nametag, versiontag, flagstag, prereq = None):
|
||||
def _gather_aux(self, header, list, nametag, versiontag, flagstag,
|
||||
prereq = None):
|
||||
names = header[nametag]
|
||||
versions = header[versiontag]
|
||||
flags = header[flagstag]
|
||||
|
@ -585,7 +594,8 @@ class Pkg:
|
|||
if versions:
|
||||
for loop in range(len(versions)):
|
||||
if prereq is not None and flags[loop] & PREREQ_FLAG:
|
||||
prereq.append((names[loop], versions[loop], flags[loop] & (~PREREQ_FLAG)))
|
||||
prereq.append((names[loop], versions[loop],
|
||||
flags[loop] & (~PREREQ_FLAG)))
|
||||
else:
|
||||
list.append((names[loop], versions[loop], flags[loop]))
|
||||
|
||||
|
@ -649,7 +659,9 @@ class InstalledPkg(Pkg):
|
|||
|
||||
self.extracted = True
|
||||
# create a fake filename to satisfy some checks on the filename
|
||||
self.filename = '%s-%s-%s.%s.rpm' % (self.name, self[rpm.RPMTAG_VERSION], self[rpm.RPMTAG_RELEASE], self[rpm.RPMTAG_ARCH])
|
||||
self.filename = '%s-%s-%s.%s.rpm' % \
|
||||
(self.name, self[rpm.RPMTAG_VERSION], self[rpm.RPMTAG_RELEASE],
|
||||
self[rpm.RPMTAG_ARCH])
|
||||
|
||||
def cleanup(self):
|
||||
pass
|
||||
|
|
18
PostCheck.py
18
PostCheck.py
|
@ -119,7 +119,8 @@ class PostCheck(AbstractCheck.AbstractCheck):
|
|||
self.check_aux(pkg, files, prog, script, tag, prereq)
|
||||
else:
|
||||
for idx in range(0, len(prog)):
|
||||
self.check_aux(pkg, files, prog[idx], script[idx], tag, prereq)
|
||||
self.check_aux(
|
||||
pkg, files, prog[idx], script[idx], tag, prereq)
|
||||
|
||||
ghost_files = pkg.ghostFiles()
|
||||
if ghost_files:
|
||||
|
@ -132,7 +133,8 @@ class PostCheck(AbstractCheck.AbstractCheck):
|
|||
if (not postin or f not in postin) and \
|
||||
(not prein or f not in prein) and \
|
||||
f not in pkg.missingOkFiles():
|
||||
printWarning(pkg, 'postin-without-ghost-file-creation', f)
|
||||
printWarning(pkg,
|
||||
'postin-without-ghost-file-creation', f)
|
||||
|
||||
def check_aux(self, pkg, files, prog, script, tag, prereq):
|
||||
if script:
|
||||
|
@ -148,10 +150,12 @@ class PostCheck(AbstractCheck.AbstractCheck):
|
|||
printWarning(pkg, 'spurious-bracket-in-' + tag[2])
|
||||
res = dangerous_command_regex.search(script)
|
||||
if res:
|
||||
printWarning(pkg, 'dangerous-command-in-' + tag[2], res.group(2))
|
||||
printWarning(pkg, 'dangerous-command-in-' + tag[2],
|
||||
res.group(2))
|
||||
res = selinux_regex.search(script)
|
||||
if res:
|
||||
printError(pkg, 'forbidden-selinux-command-in-' + tag[2], res.group(2))
|
||||
printError(pkg, 'forbidden-selinux-command-in-' + tag[2],
|
||||
res.group(2))
|
||||
|
||||
if 'update-menus' in script:
|
||||
menu_error = True
|
||||
|
@ -160,7 +164,8 @@ class PostCheck(AbstractCheck.AbstractCheck):
|
|||
menu_error = False
|
||||
break
|
||||
if menu_error:
|
||||
printError(pkg, 'update-menus-without-menu-file-in-' + tag[2])
|
||||
printError(pkg, 'update-menus-without-menu-file-in-' +
|
||||
tag[2])
|
||||
if tmp_regex.search(script):
|
||||
printError(pkg, 'use-tmp-in-' + tag[2])
|
||||
for c in prereq_assoc:
|
||||
|
@ -180,7 +185,8 @@ class PostCheck(AbstractCheck.AbstractCheck):
|
|||
printError(pkg, 'use-of-home-in-' + tag[2])
|
||||
res = bogus_var_regex.search(script)
|
||||
if res:
|
||||
printWarning(pkg, 'bogus-variable-use-in-' + tag[2], res.group(1))
|
||||
printWarning(pkg, 'bogus-variable-use-in-' + tag[2],
|
||||
res.group(1))
|
||||
|
||||
if prog == '/usr/bin/perl':
|
||||
if incorrect_perl_script(prog, script):
|
||||
|
|
|
@ -39,7 +39,8 @@ check = RpmFileCheck()
|
|||
|
||||
addDetails(
|
||||
'filename-too-long-for-joliet',
|
||||
'This filename is too long to fit on a joliet filesystem (limit is 64 unicode chars).',
|
||||
'''This filename is too long to fit on a joliet filesystem (limit is 64 unicode
|
||||
chars).''',
|
||||
)
|
||||
|
||||
# Local variables:
|
||||
|
|
|
@ -32,7 +32,8 @@ class SignatureCheck(AbstractCheck.AbstractCheck):
|
|||
if kres:
|
||||
printError(pkg, "unknown-key", kres.group(1))
|
||||
else:
|
||||
Pkg.warn("Error checking signature of %s: %s" % (pkg.filename, res[1]))
|
||||
Pkg.warn("Error checking signature of %s: %s" %
|
||||
(pkg.filename, res[1]))
|
||||
else:
|
||||
if not SignatureCheck.pgp_regex.search(res[1]):
|
||||
printError(pkg, "no-signature")
|
||||
|
|
39
SpecCheck.py
39
SpecCheck.py
|
@ -266,12 +266,15 @@ class SpecCheck(AbstractCheck.AbstractCheck):
|
|||
|
||||
if current_section in ('prep', 'build'):
|
||||
if contains_buildroot(line):
|
||||
printWarning(pkg, 'rpm-buildroot-usage', '%' + current_section, line[:-1].strip())
|
||||
printWarning(pkg, 'rpm-buildroot-usage',
|
||||
'%' + current_section, line[:-1].strip())
|
||||
|
||||
if make_check_regex.search(line) and current_section not in ('check', 'changelog', 'package', 'description'):
|
||||
if make_check_regex.search(line) and current_section not in \
|
||||
('check', 'changelog', 'package', 'description'):
|
||||
printWarning(pkg, 'make-check-outside-check-section', line[:-1])
|
||||
|
||||
if current_section in buildroot_clean and not buildroot_clean[current_section]:
|
||||
if current_section in buildroot_clean and \
|
||||
not buildroot_clean[current_section]:
|
||||
if contains_buildroot(line) and rm_regex.search(line):
|
||||
buildroot_clean[current_section] = True
|
||||
|
||||
|
@ -327,16 +330,22 @@ class SpecCheck(AbstractCheck.AbstractCheck):
|
|||
elif res.group(1):
|
||||
res = re.match(hardcoded_library_paths, res.group(1))
|
||||
if res:
|
||||
printError(pkg, "hardcoded-library-path", res.group(1), "in configure options")
|
||||
printError(pkg, "hardcoded-library-path",
|
||||
res.group(1), "in configure options")
|
||||
configure_linenum = None
|
||||
|
||||
if current_section != 'changelog' and './configure' in line:
|
||||
configure_linenum = pkg.current_linenum # store line where it started
|
||||
# store line where it started
|
||||
configure_linenum = pkg.current_linenum
|
||||
configure_cmdline = line.strip()
|
||||
|
||||
res = hardcoded_library_path_regex.search(line)
|
||||
if current_section != 'changelog' and res and not (biarch_package_regex.match(pkg.name) or hardcoded_lib_path_exceptions_regex.search(res.group(1).lstrip())):
|
||||
printError(pkg, "hardcoded-library-path", "in", res.group(1).lstrip())
|
||||
if current_section != 'changelog' and res and not \
|
||||
(biarch_package_regex.match(pkg.name) or
|
||||
hardcoded_lib_path_exceptions_regex.search(
|
||||
res.group(1).lstrip())):
|
||||
printError(pkg, "hardcoded-library-path", "in",
|
||||
res.group(1).lstrip())
|
||||
|
||||
if '%mklibname' in line:
|
||||
mklibname = True
|
||||
|
@ -361,7 +370,8 @@ class SpecCheck(AbstractCheck.AbstractCheck):
|
|||
if res:
|
||||
buildroot = True
|
||||
if res.group(1).startswith('/'):
|
||||
printWarning(pkg, 'hardcoded-path-in-buildroot-tag', res.group(1))
|
||||
printWarning(pkg, 'hardcoded-path-in-buildroot-tag',
|
||||
res.group(1))
|
||||
|
||||
res = packager_regex.search(line)
|
||||
if res:
|
||||
|
@ -385,7 +395,8 @@ class SpecCheck(AbstractCheck.AbstractCheck):
|
|||
printError(pkg, 'buildprereq-use', res.group(1))
|
||||
|
||||
if scriptlet_requires_regex.search(line):
|
||||
printError(pkg, 'broken-syntax-in-scriptlet-requires', line.strip())
|
||||
printError(pkg, 'broken-syntax-in-scriptlet-requires',
|
||||
line.strip())
|
||||
|
||||
res = requires_regex.search(line)
|
||||
if res:
|
||||
|
@ -428,9 +439,11 @@ class SpecCheck(AbstractCheck.AbstractCheck):
|
|||
printWarning(pkg, 'macro-in-%changelog', match)
|
||||
else:
|
||||
if not depscript_override:
|
||||
depscript_override = depscript_override_regex.search(line) is not None
|
||||
depscript_override = \
|
||||
depscript_override_regex.search(line) is not None
|
||||
if not depgen_disabled:
|
||||
depgen_disabled = depgen_disable_regex.search(line) is not None
|
||||
depgen_disabled = \
|
||||
depgen_disable_regex.search(line) is not None
|
||||
|
||||
if current_section == 'files':
|
||||
|
||||
|
@ -443,7 +456,9 @@ class SpecCheck(AbstractCheck.AbstractCheck):
|
|||
printError(pkg, 'files-attr-not-set')
|
||||
|
||||
# TODO: check scriptlets for these too?
|
||||
if package_noarch.get(current_package) or (current_package not in package_noarch and package_noarch.get(None)):
|
||||
if package_noarch.get(current_package) or \
|
||||
(current_package not in package_noarch and
|
||||
package_noarch.get(None)):
|
||||
res = libdir_regex.search(line)
|
||||
if res:
|
||||
pkgname = current_package
|
||||
|
|
44
TagsCheck.py
44
TagsCheck.py
|
@ -513,7 +513,8 @@ class TagsCheck(AbstractCheck.AbstractCheck):
|
|||
self._unexpanded_macros(pkg, 'Packager', packager)
|
||||
if not packager:
|
||||
printError(pkg, 'no-packager-tag')
|
||||
elif Config.getOption('Packager') and not packager_regex.search(packager):
|
||||
elif Config.getOption('Packager') and \
|
||||
not packager_regex.search(packager):
|
||||
printWarning(pkg, 'invalid-packager', packager)
|
||||
|
||||
version = pkg[rpm.RPMTAG_VERSION]
|
||||
|
@ -543,10 +544,12 @@ class TagsCheck(AbstractCheck.AbstractCheck):
|
|||
if use_epoch:
|
||||
for o in pkg.obsoletes():
|
||||
if o[1] and not epoch_regex.search(o[1]):
|
||||
printWarning(pkg, 'no-epoch-in-obsoletes', o[0] + ' ' + o[1])
|
||||
printWarning(pkg,
|
||||
'no-epoch-in-obsoletes', o[0] + ' ' + o[1])
|
||||
for c in pkg.conflicts():
|
||||
if c[1] and not epoch_regex.search(c[1]):
|
||||
printWarning(pkg, 'no-epoch-in-conflicts', c[0] + ' ' + c[1])
|
||||
printWarning(pkg,
|
||||
'no-epoch-in-conflicts', c[0] + ' ' + c[1])
|
||||
for p in pkg.provides():
|
||||
if p[1] and not epoch_regex.search(p[1]):
|
||||
printWarning(pkg, 'no-epoch-in-provides', p[0] + ' ' + p[1])
|
||||
|
@ -557,7 +560,8 @@ class TagsCheck(AbstractCheck.AbstractCheck):
|
|||
is_devel = FilesCheck.devel_regex.search(name)
|
||||
is_source = pkg.isSource()
|
||||
for d in deps:
|
||||
if use_epoch and d[1] and d[0][0:7] != 'rpmlib(' and not epoch_regex.search(d[1]):
|
||||
if use_epoch and d[1] and d[0][0:7] != 'rpmlib(' and \
|
||||
not epoch_regex.search(d[1]):
|
||||
printWarning(pkg, 'no-epoch-in-dependency', d[0] + ' ' + d[1])
|
||||
for r in INVALID_REQUIRES:
|
||||
if r.search(d[0]):
|
||||
|
@ -611,9 +615,12 @@ class TagsCheck(AbstractCheck.AbstractCheck):
|
|||
expected = version
|
||||
if dep[1][:len(expected)] != expected:
|
||||
if dep[1] != '':
|
||||
printWarning(pkg, 'incoherent-version-dependency-on', base_or_libs, dep[1], expected)
|
||||
printWarning(pkg,
|
||||
'incoherent-version-dependency-on',
|
||||
base_or_libs, dep[1], expected)
|
||||
else:
|
||||
printWarning(pkg, 'no-version-dependency-on', base_or_libs, expected)
|
||||
printWarning(pkg, 'no-version-dependency-on',
|
||||
base_or_libs, expected)
|
||||
res = devel_number_regex.search(name)
|
||||
if not res:
|
||||
printWarning(pkg, 'no-major-in-name', name)
|
||||
|
@ -687,10 +694,12 @@ class TagsCheck(AbstractCheck.AbstractCheck):
|
|||
# Allow EVR in changelog without release extension,
|
||||
# the extension is often a macro or otherwise dynamic.
|
||||
if release_ext:
|
||||
expected.append(extension_regex.sub('', expected[0]))
|
||||
expected.append(
|
||||
extension_regex.sub('', expected[0]))
|
||||
if ret.group(1) not in expected:
|
||||
if len(expected) == 1: expected = expected[0]
|
||||
printWarning(pkg, 'incoherent-version-in-changelog', ret.group(1), expected)
|
||||
printWarning(pkg, 'incoherent-version-in-changelog',
|
||||
ret.group(1), expected)
|
||||
|
||||
if clt: changelog = changelog + clt
|
||||
if use_utf8 and not Pkg.is_utf8_str(' '.join(changelog)):
|
||||
|
@ -784,7 +793,8 @@ class TagsCheck(AbstractCheck.AbstractCheck):
|
|||
j += 1
|
||||
i += 1
|
||||
|
||||
expected = pkg.header.sprintf(rpm.expandMacro("%{_build_name_fmt}")).split("/")[-1]
|
||||
expected = pkg.header.sprintf(
|
||||
rpm.expandMacro("%{_build_name_fmt}")).split("/")[-1]
|
||||
basename = os.path.basename(pkg.filename)
|
||||
if basename != expected:
|
||||
printWarning(pkg, 'non-coherent-filename', basename, expected)
|
||||
|
@ -866,12 +876,12 @@ with something you have control over.''',
|
|||
'''The value of this tag appears to be misspelled. Please double-check.''',
|
||||
|
||||
'no-packager-tag',
|
||||
'''There is no Packager tag in your package. You have to specify a packager using
|
||||
the Packager tag. Ex: Packager: John Doo <john.doo@example.com>.''',
|
||||
'''There is no Packager tag in your package. You have to specify a packager
|
||||
using the Packager tag. Ex: Packager: John Doe <john.doe@example.com>.''',
|
||||
|
||||
'invalid-packager',
|
||||
'''The packager email must finish with a email compatible with the Packager option
|
||||
of rpmlint. Please change it and rebuild your package.''',
|
||||
'''The packager email must end with an email compatible with the Packager
|
||||
option of rpmlint. Please change it and rebuild your package.''',
|
||||
|
||||
'no-version-tag',
|
||||
'''There is no Version tag in your package. You have to specify a version using
|
||||
|
@ -909,8 +919,8 @@ Name tag.''',
|
|||
''',
|
||||
|
||||
'no-provides',
|
||||
'''Your library package doesn't provide the -devel name without the major version
|
||||
included.''',
|
||||
'''Your library package doesn't provide the -devel name without the major
|
||||
version included.''',
|
||||
|
||||
'no-summary-tag',
|
||||
'''There is no Summary tag in your package. You have to describe your package
|
||||
|
@ -1008,8 +1018,8 @@ Epoch tag.''',
|
|||
package itself.''',
|
||||
|
||||
'invalid-build-requires',
|
||||
'''Your source package contains a dependency not compliant with the lib64 naming.
|
||||
This BuildRequires dependency will not be resolved on lib64 platforms
|
||||
'''Your source package contains a dependency not compliant with the lib64
|
||||
naming. This BuildRequires dependency will not be resolved on lib64 platforms
|
||||
(eg. amd64).''',
|
||||
|
||||
'explicit-lib-dependency',
|
||||
|
|
|
@ -55,7 +55,8 @@ class ZipCheck(AbstractCheck.AbstractCheck):
|
|||
try:
|
||||
mf = z.read('META-INF/MANIFEST.MF')
|
||||
if classpath_regex.search(mf):
|
||||
printWarning(pkg, 'class-path-in-manifest', fname)
|
||||
printWarning(pkg,
|
||||
'class-path-in-manifest', fname)
|
||||
except KeyError:
|
||||
# META-INF/* are optional:
|
||||
# http://java.sun.com/j2se/1.4/docs/guide/jar/jar.html
|
||||
|
|
Loading…
Reference in New Issue