SHA256
1
0
forked from pool/rpmlint

Accepting request 308088 from devel:openSUSE:Factory:rpmlint

rpmlint 1.6

OBS-URL: https://build.opensuse.org/request/show/308088
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/rpmlint?expand=0&rev=236
This commit is contained in:
Dominique Leuenberger 2015-05-23 11:19:25 +00:00 committed by Git OBS Bridge
commit 38b97113bf
91 changed files with 1535 additions and 2521 deletions

View File

@ -1,909 +0,0 @@
From 54235cd38e08c8a93de74e7884eea746ae002b2e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ville=20Skytt=C3=A4?= <ville.skytta@iki.fi>
Date: Thu, 12 Sep 2013 21:27:55 +0300
Subject: [PATCH 1/3] Python 3 compatibility tweaks.
(cherry picked from commit cc6369dbafb27568802b8f0a60518a69d6738e3b)
---
AbstractCheck.py | 4 +++-
Filter.py | 2 +-
Pkg.py | 37 ++++++++++++++++++++-----------------
PostCheck.py | 3 +--
rpmdiff | 8 ++++----
rpmlint | 40 +++++++++++++++++++++++-----------------
6 files changed, 52 insertions(+), 42 deletions(-)
Index: rpmlint-1.5/AbstractCheck.py
===================================================================
--- rpmlint-1.5.orig/AbstractCheck.py
+++ rpmlint-1.5/AbstractCheck.py
@@ -9,7 +9,11 @@
import re
import socket
-import urllib2
+import sys
+try:
+ import urllib2
+except:
+ import urllib.request as urllib2
from Filter import addDetails, printInfo, printWarning
import Config
@@ -61,7 +65,8 @@ class AbstractCheck:
opener.addheaders = [('User-Agent',
'rpmlint/%s' % Config.__version__)]
res = opener.open(_HeadRequest(url))
- except Exception, e:
+ except Exception:
+ e = sys.exc_info()[1]
errstr = str(e) or repr(e) or type(e)
printWarning(pkg, 'invalid-url', '%s:' % tag, url, errstr)
info = None
Index: rpmlint-1.5/Filter.py
===================================================================
--- rpmlint-1.5.orig/Filter.py
+++ rpmlint-1.5/Filter.py
@@ -123,7 +123,7 @@ def printAllReasons():
_details = {}
def addDetails(*details):
- for idx in range(len(details)/2):
+ for idx in range(int(len(details)/2)):
if not details[idx*2] in _details:
_details[details[idx*2]] = details[idx*2+1]
Index: rpmlint-1.5/Pkg.py
===================================================================
--- rpmlint-1.5.orig/Pkg.py
+++ rpmlint-1.5/Pkg.py
@@ -8,14 +8,15 @@
# the rpm file or by accessing the files contained inside.
#############################################################################
-import commands
import os
import re
import subprocess
import sys
import tempfile
-import types
-import urlparse
+try:
+ from urlparse import urljoin
+except:
+ from urllib.parse import urljoin
try:
import magic
@@ -73,18 +74,18 @@ def substitute_shell_vars(val, script):
else:
return val
-def getstatusoutput(cmd, stdoutonly = False):
+def getstatusoutput(cmd, stdoutonly = False, shell = 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,
+ proc = subprocess.Popen(cmd, shell=shell, stdin=subprocess.PIPE,
stdout=subprocess.PIPE, close_fds=True)
else:
- proc = subprocess.Popen(cmd, stdin=subprocess.PIPE,
+ proc = subprocess.Popen(cmd, shell=shell, stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT, close_fds=True)
proc.stdin.close()
- text = proc.stdout.read()
+ text = proc.stdout.read().decode()
sts = proc.wait()
if sts is None:
sts = 0
@@ -192,7 +193,9 @@ def get_default_valid_rpmgroups(filename
return groups
# from yum 3.2.27, rpmUtils.miscutils, with rpmlint modifications
-def compareEVR((e1, v1, r1), (e2, v2, r2)):
+def compareEVR(evr1, evr2):
+ (e1, v1, r1) = evr1
+ (e2, v2, r2) = evr2
# return 1: a is newer than b
# 0: a and b are the same version
# -1: b is newer than a
@@ -441,13 +444,13 @@ class Pkg:
os.close(fd)
self.is_source = not self.header[rpm.RPMTAG_SOURCERPM]
- self.name = self.header[rpm.RPMTAG_NAME]
+ self.name = self.header[rpm.RPMTAG_NAME].decode()
if self.isNoSource():
self.arch = 'nosrc'
elif self.isSource():
self.arch = 'src'
else:
- self.arch = self.header[rpm.RPMTAG_ARCH]
+ self.arch = self.header.format("%{ARCH}")
# Return true if the package is a source package
def isSource(self):
@@ -488,7 +491,7 @@ class Pkg:
command_str = \
'rpm2cpio "%s" | (cd "%s"; cpio -id); chmod -R +rX "%s"' % \
(self.filename, self.dirname, self.dirname)
- cmd = commands.getstatusoutput(command_str)
+ cmd = getstatusoutput(command_str, shell=True)
self.extracted = True
return cmd
@@ -507,14 +510,16 @@ class Pkg:
in_file = None
try:
try:
- in_file = open(self.dirName() + '/' + filename)
+ in_file = open(os.path.join(
+ self.dirName() or '/', filename.lstrip('/')))
for line in in_file:
lineno += 1
if regex.search(line):
ret.append(str(lineno))
break
- except Exception, e:
- Filter.printWarning(self, 'read-error', filename, e)
+ except Exception:
+ Filter.printWarning(self, 'read-error', filename,
+ sys.exc_info()[1])
finally:
if in_file:
in_file.close()
@@ -525,7 +530,7 @@ class Pkg:
# LANGUAGE trumps other env vars per GNU gettext docs, see also #166
orig = os.environ.get('LANGUAGE')
os.environ['LANGUAGE'] = lang
- ret = self[tag]
+ ret = self[tag].decode()
if orig is not None:
os.environ['LANGUAGE'] = orig
return ret
@@ -590,17 +595,17 @@ class Pkg:
modes = self.header[rpm.RPMTAG_FILEMODES]
users = self.header[rpm.RPMTAG_FILEUSERNAME]
groups = self.header[rpm.RPMTAG_FILEGROUPNAME]
- links = self.header[rpm.RPMTAG_FILELINKTOS]
+ links = [x.decode() for x in self.header[rpm.RPMTAG_FILELINKTOS]]
sizes = self.header[rpm.RPMTAG_FILESIZES]
md5s = self.header[rpm.RPMTAG_FILEMD5S]
mtimes = self.header[rpm.RPMTAG_FILEMTIMES]
rdevs = self.header[rpm.RPMTAG_FILERDEVS]
langs = self.header[rpm.RPMTAG_FILELANGS]
inodes = self.header[rpm.RPMTAG_FILEINODES]
- requires = self.header[rpm.RPMTAG_FILEREQUIRE]
- provides = self.header[rpm.RPMTAG_FILEPROVIDE]
- files = self.header[rpm.RPMTAG_FILENAMES]
- magics = self.header[rpm.RPMTAG_FILECLASS]
+ requires = [x.decode() for x in self.header[rpm.RPMTAG_FILEREQUIRE]]
+ provides = [x.decode() for x in self.header[rpm.RPMTAG_FILEPROVIDE]]
+ files = [x.decode() for x in self.header[rpm.RPMTAG_FILENAMES]]
+ magics = [x.decode() for x in self.header[rpm.RPMTAG_FILECLASS]]
try: # rpm >= 4.7.0
filecaps = self.header[rpm.RPMTAG_FILECAPS]
except:
@@ -608,16 +613,14 @@ class Pkg:
# rpm-python < 4.6 does not return a list for this (or FILEDEVICES,
# FWIW) for packages containing exactly one file
- if not isinstance(inodes, types.ListType):
+ if not isinstance(inodes, list):
inodes = [inodes]
if files:
for idx in range(0, len(files)):
pkgfile = PkgFile(files[idx])
- # Do not use os.path.join here, pkgfile.name can start with a
- # / which would result in self.dirName being ignored
- pkgfile.path = os.path.normpath(
- self.dirName() + '/' + pkgfile.name)
+ pkgfile.path = os.path.normpath(os.path.join(
+ self.dirName() or '/', pkgfile.name.lstrip('/')))
pkgfile.flags = flags[idx]
pkgfile.mode = modes[idx]
pkgfile.user = users[idx]
@@ -652,7 +655,7 @@ class Pkg:
PkgFile if it is found in this package, None if not."""
result = pkgfile
while result and result.linkto:
- linkpath = urlparse.urljoin(result.name, result.linkto)
+ linkpath = urljoin(result.name, result.linkto)
linkpath = safe_normpath(linkpath)
result = self.files().get(linkpath)
return result
@@ -713,12 +716,12 @@ class Pkg:
if versions:
for loop in range(len(versions)):
- evr = stringToVersion(versions[loop])
+ name = names[loop].decode()
+ evr = stringToVersion(versions[loop].decode())
if prereq is not None and flags[loop] & PREREQ_FLAG:
- prereq.append((names[loop], flags[loop] & (~PREREQ_FLAG),
- evr))
+ prereq.append((name, flags[loop] & (~PREREQ_FLAG), evr))
else:
- list.append((names[loop], flags[loop], evr))
+ list.append((name, flags[loop], evr))
def _gatherDepInfo(self):
if self._requires is None:
Index: rpmlint-1.5/PostCheck.py
===================================================================
--- rpmlint-1.5.orig/PostCheck.py
+++ rpmlint-1.5/PostCheck.py
@@ -10,7 +10,6 @@
import os
import re
-import types
import rpm
@@ -107,7 +106,7 @@ class PostCheck(AbstractCheck.AbstractCh
for tag in script_tags:
script = pkg[tag[0]]
- if not isinstance(script, types.ListType):
+ if not isinstance(script, list):
prog = pkg.scriptprog(tag[1])
if prog:
prog = prog.split()[0]
Index: rpmlint-1.5/rpmdiff
===================================================================
--- rpmlint-1.5.orig/rpmdiff
+++ rpmlint-1.5/rpmdiff
@@ -82,8 +82,8 @@ class Rpmdiff:
try:
old = self.__load_pkg(old).header
new = self.__load_pkg(new).header
- except KeyError, e:
- Pkg.warn(str(e))
+ except KeyError:
+ Pkg.warn(str(sys.exc_info()[1]))
sys.exit(2)
# Compare single tags
@@ -107,8 +107,8 @@ class Rpmdiff:
old_files_dict = self.__fileIteratorToDict(old.fiFromHeader())
new_files_dict = self.__fileIteratorToDict(new.fiFromHeader())
- files = list(set(itertools.chain(old_files_dict.iterkeys(),
- new_files_dict.iterkeys())))
+ files = list(set(itertools.chain(iter(old_files_dict),
+ iter(new_files_dict))))
files.sort()
for f in files:
@@ -205,16 +205,20 @@ class Rpmdiff:
if not isinstance(newflags, list): newflags = [ newflags ]
o = zip(old[name], oldflags, old[name[:-1]+'VERSION'])
+ if not isinstance(o, list):
+ o = list(o)
n = zip(new[name], newflags, new[name[:-1]+'VERSION'])
+ if not isinstance(n, list):
+ n = list(n)
# filter self provides, TODO: self %name(%_isa) as well
if name == 'PROVIDES':
oldE = old['epoch'] is not None and str(old['epoch'])+":" or ""
- oldNV = (old['name'], rpm.RPMSENSE_EQUAL,
- "%s%s-%s" % (oldE, old['version'], old['release']))
+ oldV = "%s%s" % (oldE, old.format("%{VERSION}-%{RELEASE}"))
+ oldNV = (old['name'], rpm.RPMSENSE_EQUAL, oldV.encode())
newE = new['epoch'] is not None and str(new['epoch'])+":" or ""
- newNV = (new['name'], rpm.RPMSENSE_EQUAL,
- "%s%s-%s" % (newE, new['version'], new['release']))
+ newV = "%s%s" % (newE, new.format("%{VERSION}-%{RELEASE}"))
+ newNV = (new['name'], rpm.RPMSENSE_EQUAL, newV.encode())
o = [entry for entry in o if entry != oldNV]
n = [entry for entry in n if entry != newNV]
@@ -224,16 +228,16 @@ class Rpmdiff:
if namestr == 'REQUIRES':
namestr = self.req2str(oldentry[1])
self.__add(self.DEPFORMAT,
- (self.REMOVED, namestr, oldentry[0],
- self.sense2str(oldentry[1]), oldentry[2]))
+ (self.REMOVED, namestr, oldentry[0].decode(),
+ self.sense2str(oldentry[1]), oldentry[2].decode()))
for newentry in n:
if not newentry in o:
namestr = name
if namestr == 'REQUIRES':
namestr = self.req2str(newentry[1])
self.__add(self.DEPFORMAT,
- (self.ADDED, namestr, newentry[0],
- self.sense2str(newentry[1]), newentry[2]))
+ (self.ADDED, namestr, newentry[0].decode(),
+ self.sense2str(newentry[1]), newentry[2].decode()))
def __fileIteratorToDict(self, fi):
result = {}
@@ -258,8 +262,8 @@ def main():
try:
opts, args = getopt.getopt(sys.argv[1:],
"hti:", ["help", "ignore-times", "ignore="])
- except getopt.GetoptError, e:
- Pkg.warn("Error: %s" % e)
+ except getopt.GetoptError:
+ Pkg.warn("Error: %s" % sys.exc_info()[1])
_usage()
for option, argument in opts:
Index: rpmlint-1.5/rpmlint
===================================================================
--- rpmlint-1.5.orig/rpmlint
+++ rpmlint-1.5/rpmlint
@@ -157,10 +157,11 @@ def main():
Pkg.warn(
'(none): E: interrupted, exiting while reading %s' % arg)
sys.exit(2)
- except Exception, e:
+ except Exception:
if isfile:
arg = os.path.abspath(arg)
- Pkg.warn('(none): E: error while reading %s: %s' % (arg, e))
+ Pkg.warn('(none): E: error while reading %s: %s' %
+ (arg, sys.exc_info()[1]))
pkgs = []
continue
@@ -192,13 +193,15 @@ def main():
Pkg.warn('(none): E: interrupted, exiting while ' +
'reading %s' % fname)
sys.exit(2)
- except Exception, e:
+ except Exception:
Pkg.warn(
- '(none): E: while reading %s: %s' % (fname, e))
+ '(none): E: while reading %s: %s' %
+ (fname, sys.exc_info()[1]))
continue
- except Exception, e:
+ except Exception:
Pkg.warn(
- '(none): E: error while reading dir %s: %s' % (dname, e))
+ '(none): E: error while reading dir %s: %s' %
+ (dname, sys.exc_info()[1]))
continue
if printAllReasons():
@@ -207,9 +210,9 @@ def main():
sys.exit(66)
finally:
- print "%d packages and %d specfiles checked; %d errors, %d warnings." \
+ print("%d packages and %d specfiles checked; %d errors, %d warnings." \
% (packages_checked, specfiles_checked,
- printed_messages["E"], printed_messages["W"])
+ printed_messages["E"], printed_messages["W"]))
if printed_messages["E"] > 0:
sys.exit(64)
@@ -255,8 +258,8 @@ try:
'option=',
'rawout=',
])
-except getopt.GetoptError, e:
- Pkg.warn("%s: %s" % (sys.argv[0], e))
+except getopt.GetoptError:
+ Pkg.warn("%s: %s" % (sys.argv[0], sys.exc_info()[1]))
usage(sys.argv[0])
sys.exit(1)
@@ -290,11 +293,12 @@ else:
for f in configs:
try:
- execfile(f)
+ exec(compile(open(f).read(), f, 'exec'))
except IOError:
pass
- except Exception, E:
- Pkg.warn('(none): W: error loading %s, skipping: %s' % (f, E))
+ except Exception:
+ Pkg.warn('(none): W: error loading %s, skipping: %s' %
+ (f, sys.exc_info()[1]))
# pychecker fix
del f
@@ -340,11 +344,13 @@ for o in opt:
# load user config file
try:
- execfile(os.path.expanduser(conf_file))
+ expconf = os.path.expanduser(conf_file)
+ exec(compile(open(expconf).read(), expconf, 'exec'))
except IOError:
pass
-except Exception,E:
- Pkg.warn('(none): W: error loading %s, skipping: %s' % (conf_file, E))
+except Exception:
+ Pkg.warn('(none): W: error loading %s, skipping: %s' %
+ (conf_file, sys.exc_info()[1]))
# apply config overrides
for key, value in config_overrides.items():
@@ -361,7 +367,7 @@ if info_error:
for c in Config.allChecks():
loadCheck(c)
for e in sorted(info_error):
- print "%s:" % e
+ print("%s:" % e)
printDescriptions(e)
sys.exit(0)
Index: rpmlint-1.5/BinariesCheck.py
===================================================================
--- rpmlint-1.5.orig/BinariesCheck.py
+++ rpmlint-1.5/BinariesCheck.py
@@ -10,6 +10,7 @@
import re
import stat
import os
+import sys
import rpm
@@ -195,10 +196,11 @@ class BinaryInfo:
fobj = None
try:
- fobj = open(path)
+ fobj = open(path, 'rb')
fobj.seek(-12, 2) # 2 == os.SEEK_END, for python 2.4 compat (#172)
- self.tail = fobj.read()
- except Exception, e:
+ self.tail = fobj.read().decode()
+ except Exception:
+ e = sys.exc_info()[1]
printWarning(pkg, 'binaryinfo-tail-failed %s: %s' % (file, e))
if fobj:
fobj.close()
@@ -291,9 +293,11 @@ class BinariesCheck(AbstractCheck.Abstra
has_usr_lib_file = False
multi_pkg = False
- res = srcname_regex.search(pkg[rpm.RPMTAG_SOURCERPM] or '')
- if res:
- multi_pkg = (pkg.name != res.group(1))
+ srpm = pkg[rpm.RPMTAG_SOURCERPM]
+ if srpm:
+ res = srcname_regex.search(srpm.decode())
+ if res:
+ multi_pkg = (pkg.name != res.group(1))
for fname, pkgfile in files.items():
Index: rpmlint-1.5/DocFilesCheck.py
===================================================================
--- rpmlint-1.5.orig/DocFilesCheck.py
+++ rpmlint-1.5/DocFilesCheck.py
@@ -43,7 +43,9 @@ class DocFilesCheck(AbstractCheck.Abstra
core_reqs[dep.N()] = []
# register things which are provided by the package
- for i in pkg.header[rpm.RPMTAG_PROVIDES] + files.keys():
+ for i in pkg.header[rpm.RPMTAG_PROVIDES]:
+ core_reqs[i.decode()] = []
+ for i in files:
core_reqs[i] = []
for i in files:
Index: rpmlint-1.5/FilesCheck.py
===================================================================
--- rpmlint-1.5.orig/FilesCheck.py
+++ rpmlint-1.5/FilesCheck.py
@@ -9,16 +9,16 @@
#############################################################################
from datetime import datetime
-import commands
import os
import re
import stat
import string
+import sys
import rpm
from Filter import addDetails, printError, printWarning
-from Pkg import catcmd, is_utf8, is_utf8_str
+from Pkg import catcmd, getstatusoutput, is_utf8, is_utf8_str
import AbstractCheck
import Config
@@ -674,7 +674,7 @@ scalable_icon_regex = re.compile(r'^/usr
# loosely inspired from Python Cookbook
# http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/173220
-text_characters = "".join(map(chr, range(32, 127)) + list("\n\r\t\b"))
+text_characters = "".join(map(chr, range(32, 127))) + "\n\r\t\b"
_null_trans = string.maketrans("", "")
def peek(filename, pkg, length=1024):
@@ -686,7 +686,8 @@ def peek(filename, pkg, length=1024):
fobj = open(filename, 'rb')
chunk = fobj.read(length)
fobj.close()
- except IOError, e: # eg. https://bugzilla.redhat.com/209876
+ except IOError: # eg. https://bugzilla.redhat.com/209876
+ e = sys.exc_info()[1]
printWarning(pkg, 'read-error', e)
if fobj:
fobj.close()
@@ -910,7 +911,8 @@ class FilesCheck(AbstractCheck.AbstractC
printError(pkg, 'compressed-symlink-with-wrong-ext',
f, link)
- perm = mode & 07777
+ perm = mode & int("7777", 8)
+ mode_is_exec = mode & int("111", 8)
if log_regex.search(f):
log_file = f
@@ -935,17 +937,17 @@ class FilesCheck(AbstractCheck.AbstractC
pkg[rpm.RPMTAG_GROUP]))):
printError(pkg, 'setgid-binary', f, group,
oct(perm))
- if mode & 0777 != 0755:
+ if mode & int("777", 8) != int("755", 8):
printError(pkg, 'non-standard-executable-perm', f,
oct(perm))
# Prefetch scriptlets, strip quotes from them (#169)
- postin = pkg[rpm.RPMTAG_POSTIN] or \
- pkg.scriptprog(rpm.RPMTAG_POSTINPROG)
+ postin = (pkg[rpm.RPMTAG_POSTIN] or \
+ pkg.scriptprog(rpm.RPMTAG_POSTINPROG)).decode()
if postin:
postin = quotes_regex.sub('', postin)
- postun = pkg[rpm.RPMTAG_POSTUN] or \
- pkg.scriptprog(rpm.RPMTAG_POSTUNPROG)
+ postun = (pkg[rpm.RPMTAG_POSTUN] or \
+ pkg.scriptprog(rpm.RPMTAG_POSTUNPROG)).decode()
if postun:
postun = quotes_regex.sub('', postun)
@@ -1049,7 +1051,7 @@ class FilesCheck(AbstractCheck.AbstractC
res = bin_regex.search(f)
if res:
- if mode & 0111 == 0:
+ if not mode_is_exec:
printWarning(pkg, 'non-executable-in-bin', f, oct(perm))
else:
exe = res.group(1)
@@ -1060,7 +1062,8 @@ class FilesCheck(AbstractCheck.AbstractC
(includefile_regex.search(f) or \
develfile_regex.search(f) or is_buildconfig):
printWarning(pkg, 'devel-file-in-non-devel-package', f)
- if mode & 0444 != 0444 and perm & 07000 == 0:
+ if mode & int("444", 8) != int("444", 8) and \
+ perm & int("7000", 8) == 0:
ok_nonreadable = False
for regex in non_readable_regexs:
if regex.search(f):
@@ -1072,7 +1075,7 @@ class FilesCheck(AbstractCheck.AbstractC
f not in ghost_files:
printError(pkg, 'zero-length', f)
- if mode & 0002 != 0:
+ if mode & stat.S_IWOTH:
printError(pkg, 'world-writable', f, oct(perm))
if not perl_dep_error:
@@ -1144,10 +1147,10 @@ class FilesCheck(AbstractCheck.AbstractC
printWarning(pkg, 'python-bytecode-without-source', f)
# normal executable check
- if mode & stat.S_IXUSR and perm != 0755:
+ if mode & stat.S_IXUSR and perm != int("755", 8):
printError(pkg, 'non-standard-executable-perm',
f, oct(perm))
- if mode & 0111 != 0:
+ if mode_is_exec:
if f in config_files:
printError(pkg, 'executable-marked-as-config-file', f)
if not nonexec_file:
@@ -1179,11 +1182,12 @@ class FilesCheck(AbstractCheck.AbstractC
man_basenames.add(res.group(1))
if use_utf8 and chunk:
# TODO: better shell escaping or seq based invocation
- cmd = commands.getstatusoutput(
+ cmd = getstatusoutput(
'env LC_ALL=C %s "%s" | gtbl | '
'env LC_ALL=en_US.UTF-8 groff -mtty-char -Tutf8 '
'-P-c -mandoc -w%s >/dev/null' %
- (catcmd(f), pkgfile.path, man_warn_category))
+ (catcmd(f), pkgfile.path, man_warn_category),
+ shell=True)
for line in cmd[1].split("\n"):
res = man_warn_regex.search(line)
if not res or man_nowarn_regex.search(line):
@@ -1213,12 +1217,11 @@ class FilesCheck(AbstractCheck.AbstractC
printError(pkg,
'sourced-script-with-shebang', f,
interpreter)
- if mode & 0111 != 0:
+ if mode_is_exec:
printError(pkg, 'executable-sourced-script',
f, oct(perm))
# ...but executed ones should
- elif interpreter or mode & 0111 != 0 or \
- script_regex.search(f):
+ elif interpreter or mode_is_exec or script_regex.search(f):
if interpreter:
if mode & 0111 != 0 and not interpreter_regex.search(interpreter):
printError(pkg, 'wrong-script-interpreter',
@@ -1228,7 +1231,7 @@ class FilesCheck(AbstractCheck.AbstractC
f.endswith('.la')):
printError(pkg, 'script-without-shebang', f)
- if mode & 0111 == 0 and not is_doc:
+ if not mode_is_exec and not is_doc:
printError(pkg, 'non-executable-script', f,
oct(perm), interpreter)
if '\r' in chunk:
@@ -1256,9 +1259,9 @@ class FilesCheck(AbstractCheck.AbstractC
# normal dir check
elif stat.S_ISDIR(mode):
- if mode & 01002 == 2: # world writable without sticky bit
+ if mode & int("1002", 8) == 2: # world writable w/o sticky bit
printError(pkg, 'world-writable', f, oct(perm))
- if perm != 0755:
+ if perm != int("755", 8):
printError(pkg, 'non-standard-dir-perm', f, oct(perm))
if pkg.name not in filesys_packages and f in STANDARD_DIRS:
printError(pkg, 'standard-dir-owned-by-package', f)
@@ -1368,7 +1371,7 @@ class FilesCheck(AbstractCheck.AbstractC
if stat.S_ISLNK(mode):
printError(pkg, 'symlink-crontab-file', f)
- if mode & 0111:
+ if mode_is_exec:
printError(pkg, 'executable-crontab-file', f)
if stat.S_IWGRP & mode or stat.S_IWOTH & mode:
Index: rpmlint-1.5/I18NCheck.py
===================================================================
--- rpmlint-1.5.orig/I18NCheck.py
+++ rpmlint-1.5/I18NCheck.py
@@ -79,7 +79,7 @@ class I18NCheck(AbstractCheck.AbstractCh
if pkg.isSource():
return
- files = pkg.files().keys()
+ files = list(pkg.files().keys())
files.sort()
locales = [] # list of locales for this packages
webapp = False
Index: rpmlint-1.5/InitScriptCheck.py
===================================================================
--- rpmlint-1.5.orig/InitScriptCheck.py
+++ rpmlint-1.5/InitScriptCheck.py
@@ -10,6 +10,7 @@
import os
import re
+import sys
import rpm
@@ -54,7 +55,7 @@ class InitScriptCheck(AbstractCheck.Abst
basename = os.path.basename(fname)
initscript_list.append(basename)
- if pkgfile.mode & 0500 != 0500:
+ if pkgfile.mode & int("500", 8) != int("500", 8):
printError(pkg, 'init-script-non-executable', fname)
if "." in basename:
@@ -87,7 +88,8 @@ class InitScriptCheck(AbstractCheck.Abst
content = None
try:
content = Pkg.readlines(pkgfile.path)
- except Exception, e:
+ except Exception:
+ e = sys.exc_info()[1]
printWarning(pkg, 'read-error', e)
continue
content_str = "".join(content)
Index: rpmlint-1.5/LSBCheck.py
===================================================================
--- rpmlint-1.5.orig/LSBCheck.py
+++ rpmlint-1.5/LSBCheck.py
@@ -31,12 +31,16 @@ class LSBCheck(AbstractCheck.AbstractChe
printError(pkg, 'non-lsb-compliant-package-name', name)
version = pkg[rpm.RPMTAG_VERSION]
- if version and not version_regex.search(version):
- printError(pkg, 'non-lsb-compliant-version', version)
+ if version:
+ version = version.decode()
+ if not version_regex.search(version):
+ printError(pkg, 'non-lsb-compliant-version', version)
release = pkg[rpm.RPMTAG_RELEASE]
- if release and not version_regex.search(release):
- printError(pkg, 'non-lsb-compliant-release', release)
+ if release:
+ release = release.decode()
+ if not version_regex.search(release):
+ printError(pkg, 'non-lsb-compliant-release', release)
# Create an object to enable the auto registration of the test
check = LSBCheck()
Index: rpmlint-1.5/MenuCheck.py
===================================================================
--- rpmlint-1.5.orig/MenuCheck.py
+++ rpmlint-1.5/MenuCheck.py
@@ -178,9 +178,9 @@ class MenuCheck(AbstractCheck.AbstractCh
else:
if basename != pkg.name:
printWarning(pkg, 'non-coherent-menu-filename', fname)
- if mode & 0444 != 0444:
+ if mode & int("444", 8) != int("444", 8):
printError(pkg, 'non-readable-menu-file', fname)
- if mode & 0111 != 0:
+ if mode & int("111", 8):
printError(pkg, 'executable-menu-file', fname)
menus.append(fname)
else:
Index: rpmlint-1.5/MenuXDGCheck.py
===================================================================
--- rpmlint-1.5.orig/MenuXDGCheck.py
+++ rpmlint-1.5/MenuXDGCheck.py
@@ -9,7 +9,10 @@
from Filter import addDetails, printError, printWarning
from Pkg import getstatusoutput, is_utf8
import AbstractCheck
-from ConfigParser import RawConfigParser
+try:
+ from ConfigParser import RawConfigParser
+except:
+ from configparser import RawConfigParser
import os
STANDARD_BIN_DIRS = ['/bin/','/sbin/','/usr/bin/','/usr/sbin/']
Index: rpmlint-1.5/SourceCheck.py
===================================================================
--- rpmlint-1.5.orig/SourceCheck.py
+++ rpmlint-1.5/SourceCheck.py
@@ -14,7 +14,7 @@ import AbstractCheck
import Config
-DEFAULT_VALID_SRC_PERMS = (0644, 0755)
+DEFAULT_VALID_SRC_PERMS = (int("644", 8), int("755", 8))
source_regex = re.compile('\\.(tar|patch|tgz|diff)$')
compress_ext = Config.getOption("CompressExtension", "bz2")
@@ -43,7 +43,7 @@ class SourceCheck(AbstractCheck.Abstract
not fname.endswith(compress_ext):
printWarning(pkg, 'source-or-patch-not-compressed',
compress_ext, fname)
- perm = pkgfile.mode & 07777
+ perm = pkgfile.mode & int("7777", 8)
if perm not in valid_src_perms:
printWarning(pkg, 'strange-permission', fname, oct(perm))
Index: rpmlint-1.5/TagsCheck.py
===================================================================
--- rpmlint-1.5.orig/TagsCheck.py
+++ rpmlint-1.5/TagsCheck.py
@@ -534,7 +534,7 @@ class TagsCheck(AbstractCheck.AbstractCh
def _unexpanded_macros(self, pkg, tagname, value, is_url=False):
if not value:
return
- for match in AbstractCheck.macro_regex.findall(str(value)):
+ for match in AbstractCheck.macro_regex.findall(value):
# Do not warn about %XX URL escapes
if is_url and re.match('^%[0-9A-F][0-9A-F]$', match, re.I):
continue
@@ -543,28 +543,33 @@ class TagsCheck(AbstractCheck.AbstractCh
def check(self, pkg):
packager = pkg[rpm.RPMTAG_PACKAGER]
- self._unexpanded_macros(pkg, 'Packager', packager)
- if not packager:
+ if packager:
+ packager = packager.decode()
+ self._unexpanded_macros(pkg, 'Packager', packager)
+ if Config.getOption('Packager') and \
+ not packager_regex.search(packager):
+ printWarning(pkg, 'invalid-packager', packager)
+ else:
printError(pkg, 'no-packager-tag')
- elif Config.getOption('Packager') and \
- not packager_regex.search(packager):
- printWarning(pkg, 'invalid-packager', packager)
version = pkg[rpm.RPMTAG_VERSION]
- self._unexpanded_macros(pkg, 'Version', version)
- if not version:
- printError(pkg, 'no-version-tag')
- else:
+ if version:
+ version = version.decode()
+ self._unexpanded_macros(pkg, 'Version', version)
res = invalid_version_regex.search(version)
if res:
printError(pkg, 'invalid-version', version)
+ else:
+ printError(pkg, 'no-version-tag')
release = pkg[rpm.RPMTAG_RELEASE]
- self._unexpanded_macros(pkg, 'Release', release)
- if not release:
+ if release:
+ release = release.decode()
+ self._unexpanded_macros(pkg, 'Release', release)
+ if release_ext and not extension_regex.search(release):
+ printWarning(pkg, 'not-standard-release-extension', release)
+ else:
printError(pkg, 'no-release-tag')
- elif release_ext and not extension_regex.search(release):
- printWarning(pkg, 'not-standard-release-extension', release)
epoch = pkg[rpm.RPMTAG_EPOCH]
if epoch is None:
@@ -592,7 +597,7 @@ class TagsCheck(AbstractCheck.AbstractCh
is_devel = FilesCheck.devel_regex.search(name)
is_source = pkg.isSource()
for d in deps:
- value = apply(Pkg.formatRequire, d)
+ value = Pkg.formatRequire(*d)
if use_epoch and d[1] and d[2][0] is None and \
not d[0].startswith('rpmlib('):
printWarning(pkg, 'no-epoch-in-dependency', value)
@@ -687,25 +692,31 @@ class TagsCheck(AbstractCheck.AbstractCh
ignored_words.update((x[0] for x in pkg.conflicts()))
ignored_words.update((x[0] for x in pkg.obsoletes()))
+ langs = pkg[rpm.RPMTAG_HEADERI18NTABLE]
+ if langs:
+ langs = [x.decode() for x in langs]
+
summary = pkg[rpm.RPMTAG_SUMMARY]
- if not summary:
- printError(pkg, 'no-summary-tag')
- else:
- if not pkg[rpm.RPMTAG_HEADERI18NTABLE]:
+ if summary:
+ summary = summary.decode()
+ if not langs:
self._unexpanded_macros(pkg, 'Summary', summary)
else:
- for lang in pkg[rpm.RPMTAG_HEADERI18NTABLE]:
+ for lang in langs:
self.check_summary(pkg, lang, ignored_words)
+ else:
+ printError(pkg, 'no-summary-tag')
description = pkg[rpm.RPMTAG_DESCRIPTION]
- if not description:
- printError(pkg, 'no-description-tag')
- else:
- if not pkg[rpm.RPMTAG_HEADERI18NTABLE]:
+ if description:
+ description = description.decode()
+ if not langs:
self._unexpanded_macros(pkg, '%description', description)
else:
- for lang in pkg[rpm.RPMTAG_HEADERI18NTABLE]:
+ for lang in langs:
self.check_description(pkg, lang, ignored_words)
+ else:
+ printError(pkg, 'no-description-tag')
group = pkg[rpm.RPMTAG_GROUP]
self._unexpanded_macros(pkg, 'Group', group)

View File

@ -1,23 +0,0 @@
From 0929683e2544813d65ef85ae49b52ccdc6662746 Mon Sep 17 00:00:00 2001
From: Sascha Peilicke <saschpe@mailbox.org>
Date: Tue, 1 Apr 2014 12:47:30 +0200
Subject: [PATCH] Set Python-3.4 magic number to 3310
This is the final magic number of the 3.4 release.
---
FilesCheck.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Index: rpmlint-1.5/FilesCheck.py
===================================================================
--- rpmlint-1.5.orig/FilesCheck.py
+++ rpmlint-1.5/FilesCheck.py
@@ -741,7 +741,7 @@ _python_magic_values = {
'3.1': 3150,
'3.2': 3180,
'3.3': 3230,
- '3.4': 3260,
+ '3.4': 3310,
}
def get_expected_pyc_magic(path):

View File

@ -1,4 +1,4 @@
<servicedata>
<service name="tar_scm">
<param name="url">http://github.com/openSUSE/rpmlint-tests.git</param>
<param name="changesrevision">00c9b555c6114912c3314cbc353bace70a509c9c</param></service></servicedata>
<param name="changesrevision">a374c88b73eb58e49989ecab59e2d602aa11be94</param></service></servicedata>

View File

@ -0,0 +1,93 @@
From: Ludwig Nussel <ludwig.nussel@suse.de>
Date: Fri, 5 Sep 2014 12:53:40 +0200
Subject: [PATCH] add check for tmpfiles created at runtime
this check parses files in /usr/lib/tmpfiles.d and verifies that entries
that create files or directories are actually listed in %files.
---
TmpFilesCheck.py | 76 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 76 insertions(+)
create mode 100644 TmpFilesCheck.py
diff --git a/TmpFilesCheck.py b/TmpFilesCheck.py
new file mode 100644
index 0000000..8c4db8d
--- /dev/null
+++ b/TmpFilesCheck.py
@@ -0,0 +1,76 @@
+# -*- coding: utf-8 -*-
+#############################################################################
+# File : TmpFilesCheck.py
+# Package : rpmlint
+# Author : Ludwig Nussel
+# Created on : Wed Sep 03 10:36 2014
+# Purpose : Check systemd created tmpfiles are included in filelist
+#############################################################################
+
+import os
+import re
+
+from Filter import addDetails, printError, printWarning
+import AbstractCheck
+import Pkg
+import stat
+
+class TmpFilesCheck(AbstractCheck.AbstractCheck):
+ '''Check systemd created tmpfiles are included in filelist'''
+
+ def __init__(self):
+ AbstractCheck.AbstractCheck.__init__(self, "TmpFilesCheck")
+ self._spec_file = None
+
+ def check(self, pkg):
+ if pkg.isSource():
+ return
+
+ # see tmpfiles.d(5)
+ interesting_types = ('f', 'F', 'w', 'd', 'D', 'p', 'L', 'c', 'b')
+
+ for fn, pkgfile in pkg.files().items():
+ if not fn.startswith('/usr/lib/tmpfiles.d/'):
+ continue
+ if not stat.S_ISREG(pkgfile.mode):
+ printWarning(pkg, "tmpfile-not-regular-file", fn)
+ continue
+ for line in open(pkgfile.path):
+ # skip comments
+ line = line.split('#')[0].split('\n')[0]
+ line = line.lstrip()
+ if not len(line):
+ continue
+ line = re.split(r'\s+', line)
+ # format is
+ #Type Path Mode UID GID Age Argument
+ # we only need type and path
+ if len(line) < 3:
+ continue
+ t = line[0]
+ p = line[1]
+ if t.endswith('!'):
+ t = t[:-1]
+ if not t in interesting_types:
+ continue
+
+ if not p in pkg.files():
+ printWarning(pkg, "tmpfile-not-in-filelist", p)
+ continue
+ if not pkg.files()[p].is_ghost:
+ printWarning(pkg, "tmpfile-not-ghost", p)
+
+check = TmpFilesCheck()
+
+addDetails(
+'tmpfile-not-regular-file',
+'''files in tmpfiles.d need to be regular files''', # otherwise we won't open it :-)
+'tmpfile-not-in-filelist',
+'''please add the specified file to your %files section as %ghost so
+users can easily query who created the file, it gets uninstalled on
+package removal and finally other rpmlint checks see it''',
+'tmpfile-not-ghost',
+'''the specified file is not marked as %ghost although created at
+runtime via tmpfiles mechanism.'''
+)
+# vim: sw=4 et

View File

@ -1,40 +0,0 @@
--- Filter.py
+++ Filter.py
@@ -80,23 +80,24 @@
def _diag_compare(x, y):
- where_a = x.split()[1]
- level_a = x.split()[2]
+ where_a = x.split()[2]
+ level_a = x.split()[1]
- where_b = y.split()[1]
- level_b = y.split()[2]
+ where_b = y.split()[2]
+ level_b = y.split()[1]
- if level_b > level_a:
+ if (level_b > level_a):
return 1
- elif level_b == level_a:
- if where_b > where_b:
- return 1
- elif where_b == where_a:
- return 0
- else:
- return -1
- else:
+
+ if (level_b < level_a):
+ return -1
+
+ if (where_b < where_a):
+ return 1
+
+ if (where_b > where_a):
return -1
+ return 0
def printAllReasons():

View File

@ -1,8 +1,18 @@
Index: Pkg.py
From: Some One <nobody@opensuse.org>
Date: Thu, 9 Apr 2015 14:55:39 +0200
Subject: [PATCH] add-weak-dependencies.diff
===================================================================
--- Pkg.py.orig 2014-02-21 15:11:27.194647274 +0000
+++ Pkg.py 2014-02-21 15:13:26.205647064 +0000
@@ -427,6 +427,10 @@ class Pkg:
---
Pkg.py | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++--
TagsCheck.py | 19 +++++++++++++++++++
2 files changed, 70 insertions(+), 2 deletions(-)
diff --git a/Pkg.py b/Pkg.py
index e97d7ef..cfaa5a9 100644
--- a/Pkg.py
+++ b/Pkg.py
@@ -466,6 +466,10 @@ class Pkg:
self._missingok_files = None
self._files = None
self._requires = None
@ -13,7 +23,7 @@ Index: Pkg.py
self._req_names = -1
if header:
@@ -673,6 +677,22 @@ class Pkg:
@@ -716,6 +720,22 @@ class Pkg:
self._gatherDepInfo()
return self._requires
@ -36,17 +46,17 @@ Index: Pkg.py
def prereq(self):
"""Get package PreReqs as list of
(name, flags, (epoch, version, release)) tuples."""
@@ -709,7 +729,7 @@ class Pkg:
@@ -752,7 +772,7 @@ class Pkg:
# internal function to gather dependency info used by the above ones
def _gather_aux(self, header, list, nametag, flagstag, versiontag,
- prereq = None):
- prereq=None):
+ prereq = None, strong_only = False, weak_only = False):
names = header[nametag]
flags = header[flagstag]
versions = header[versiontag]
@@ -720,7 +740,11 @@ class Pkg:
evr = stringToVersion(versions[loop].decode())
@@ -763,7 +783,11 @@ class Pkg:
evr = stringToVersion(b2s(versions[loop]))
if prereq is not None and flags[loop] & PREREQ_FLAG:
prereq.append((name, flags[loop] & (~PREREQ_FLAG), evr))
- else:
@ -58,7 +68,7 @@ Index: Pkg.py
list.append((name, flags[loop], evr))
def _gatherDepInfo(self):
@@ -730,6 +754,10 @@ class Pkg:
@@ -773,6 +797,10 @@ class Pkg:
self._provides = []
self._conflicts = []
self._obsoletes = []
@ -69,7 +79,7 @@ Index: Pkg.py
self._gather_aux(self.header, self._requires,
rpm.RPMTAG_REQUIRENAME,
@@ -748,6 +776,26 @@ class Pkg:
@@ -791,6 +819,26 @@ class Pkg:
rpm.RPMTAG_OBSOLETENAME,
rpm.RPMTAG_OBSOLETEFLAGS,
rpm.RPMTAG_OBSOLETEVERSION)
@ -96,11 +106,43 @@ Index: Pkg.py
def scriptprog(self, which):
"""Get the specified script interpreter as a string.
@@ -761,6 +809,7 @@ class Pkg:
prog = " ".join(prog)
return prog
@@ -805,6 +853,7 @@ class Pkg:
return b2s(prog)
+
def getInstalledPkgs(name):
"""Get list of installed package objects by name."""
diff --git a/TagsCheck.py b/TagsCheck.py
index bc79283..6528d5b 100644
--- a/TagsCheck.py
+++ b/TagsCheck.py
@@ -853,8 +853,27 @@ class TagsCheck(AbstractCheck.AbstractCheck):
value = Pkg.formatRequire(*c)
self._unexpanded_macros(pkg, 'Conflicts %s' % (value,), value)
+ for i in pkg.supplements():
+ value = Pkg.formatRequire(*i)
+ self._unexpanded_macros(pkg, 'Supplements %s' % (value,), value)
+
+ for i in pkg.suggests():
+ value = Pkg.formatRequire(*i)
+ self._unexpanded_macros(pkg, 'Suggests %s' % (value,), value)
+
+ for i in pkg.enhances():
+ value = Pkg.formatRequire(*i)
+ self._unexpanded_macros(pkg, 'Enhances %s' % (value,), value)
+
+ for i in pkg.recommends():
+ value = Pkg.formatRequire(*i)
+ self._unexpanded_macros(pkg, 'Recommends %s' % (value,), value)
+
obss = pkg.obsoletes()
if obss:
+ for obs in obss:
+ value = Pkg.formatRequire(*obs)
+ self._unexpanded_macros(pkg, 'Obsoletes %s' % (value,), value)
provs = pkg.provides()
for prov in provs:
for obs in obss:

View File

@ -1,8 +1,17 @@
Index: FilesCheck.py
From: Some One <nobody@opensuse.org>
Date: Thu, 9 Apr 2015 14:55:39 +0200
Subject: [PATCH] avoid-mismatched-libregex.diff
===================================================================
--- FilesCheck.py.orig
+++ FilesCheck.py
@@ -607,7 +607,7 @@ buildconfig_rpath_regex = re.compile('(?
---
FilesCheck.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/FilesCheck.py b/FilesCheck.py
index efda328..14cfca3 100644
--- a/FilesCheck.py
+++ b/FilesCheck.py
@@ -615,7 +615,7 @@ buildconfig_rpath_regex = re.compile('(?:-rpath|Wl,-R)\\b')
sofile_regex = re.compile('/lib(64)?/(.+/)?lib[^/]+\.so$')
devel_regex = re.compile('(.*)-(debug(info)?|devel|headers|source|static)$')
debuginfo_package_regex = re.compile('-debug(info)?$')

View File

@ -1,8 +1,17 @@
Index: FilesCheck.py
From: Some One <nobody@opensuse.org>
Date: Thu, 9 Apr 2015 14:55:38 +0200
Subject: [PATCH] better-wrong-script.diff
===================================================================
--- FilesCheck.py.orig
+++ FilesCheck.py
@@ -1670,7 +1670,10 @@ executed.''',
---
FilesCheck.py | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/FilesCheck.py b/FilesCheck.py
index 7504167..72bdf54 100644
--- a/FilesCheck.py
+++ b/FilesCheck.py
@@ -1657,7 +1657,10 @@ executed.''',
executed.''',
'wrong-script-interpreter',

View File

@ -1,8 +1,17 @@
Index: SpecCheck.py
From: Some One <nobody@opensuse.org>
Date: Thu, 9 Apr 2015 14:55:38 +0200
Subject: [PATCH] buildroot-doc.diff
===================================================================
--- SpecCheck.py.orig
+++ SpecCheck.py
@@ -647,7 +647,7 @@ versions you can ignore this warning.'''
---
SpecCheck.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/SpecCheck.py b/SpecCheck.py
index 9ea5c6e..dde66fc 100644
--- a/SpecCheck.py
+++ b/SpecCheck.py
@@ -672,7 +672,7 @@ versions you can ignore this warning.''',
'hardcoded-path-in-buildroot-tag',
'''A path is hardcoded in your Buildroot tag. It should be replaced

View File

@ -1,8 +1,17 @@
Index: SpecCheck.py
From: Some One <nobody@opensuse.org>
Date: Thu, 9 Apr 2015 14:55:39 +0200
Subject: [PATCH] buildroot-in-scripts.diff
===================================================================
--- SpecCheck.py.orig
+++ SpecCheck.py
@@ -234,7 +234,9 @@ class SpecCheck(AbstractCheck.AbstractCh
---
SpecCheck.py | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/SpecCheck.py b/SpecCheck.py
index dde66fc..63897f2 100644
--- a/SpecCheck.py
+++ b/SpecCheck.py
@@ -238,7 +238,9 @@ class SpecCheck(AbstractCheck.AbstractCheck):
continue

View File

@ -1,74 +0,0 @@
Index: SpecCheck.py
===================================================================
--- SpecCheck.py.orig
+++ SpecCheck.py
@@ -34,7 +34,7 @@ prefix_regex = re.compile('^Prefix\s*:\s
packager_regex = re.compile('^Packager\s*:\s*([^\s]+)', re.IGNORECASE)
noarch_regex = re.compile('^BuildArch(?:itectures)?\s*:\s*\\bnoarch\\b', re.IGNORECASE)
make_check_regex = re.compile('(^|\s|%{?__)make}?\s+(check|test)')
-rm_regex = re.compile('(^|\s)((.*/)?rm|%{?__rm}?) ')
+rm_rf_regex = re.compile('(^|\s)((.*/)?rm|%{?__rm}?) -[fF]?[rR][^/]*$')
rpm_buildroot_regex = re.compile('(\\\*)\${?RPM_BUILD_ROOT}?|(%+){?buildroot}?')
configure_start_regex = re.compile('\./configure')
configure_libdir_spec_regex = re.compile('ln |\./configure[^#]*--libdir=([^\s]+)[^#]*')
@@ -145,6 +145,14 @@ def contains_buildroot(line):
return 0
+def contains_create_buildroot(line):
+ '''Check if the line is of the form mkdir %{buildroot}.'''
+ line = line.strip()
+ if contains_buildroot(line) and line.startswith("mkdir") and \
+ not line.count("-p"):
+ return True
+ return False
+
class SpecCheck(AbstractCheck.AbstractCheck):
def __init__(self):
@@ -192,6 +200,7 @@ class SpecCheck(AbstractCheck.AbstractCh
ifarch_depth = -1
current_section = 'package'
buildroot_clean = {'clean': 0, 'install' : 0}
+ buildroot_created={'clean':False , 'install':True}
depscript_override = 0
depgen_disabled = 0
indent_spaces = 0
@@ -261,8 +270,13 @@ class SpecCheck(AbstractCheck.AbstractCh
printWarning(pkg, 'make-check-outside-check-section', line[:-1])
if current_section in buildroot_clean:
- if contains_buildroot(line) and rm_regex.search(line):
+ if buildroot_created[current_section] and \
+ contains_buildroot(line) and rm_rf_regex.search(line):
buildroot_clean[current_section] = 1
+ buildroot_created[current_section] = False
+
+ if contains_create_buildroot(line):
+ buildroot_created[current_section] = True
if ifarch_regex.search(line):
if_depth = if_depth + 1
@@ -441,6 +455,9 @@ class SpecCheck(AbstractCheck.AbstractCh
if not buildroot_clean[sect]:
printError(pkg, 'no-cleaning-of-buildroot', '%' + sect)
+ if buildroot_clean['install'] and not buildroot_created['install']:
+ printError(pkg, '%install-no-mkdir-buildroot')
+
if not buildroot:
printError(pkg, 'no-buildroot-tag')
@@ -598,6 +615,12 @@ unpacking the sources.''',
'''You should clean $RPM_BUILD_ROOT in the %clean section and just after the
beginning of %install section. Use "rm -Rf $RPM_BUILD_ROOT".''',
+'%install-no-mkdir-buildroot',
+"""Your install section removes the buildroot but does not create them
+afterwards in a secure way, which allows attackers to trivially play tricks
+with symlinks on you. use mkdir %buildroot (no -p option!) or don't clean
+the buildroot in %install, because that's anyway already done for you by rpm.""",
+
'rpm-buildroot-usage',
'''$RPM_BUILD_ROOT should not be touched during %build or %prep stage, as it
will break short circuiting.''',

View File

@ -0,0 +1,32 @@
From: Ludwig Nussel <ludwig.nussel@suse.de>
Date: Fri, 10 Apr 2015 14:54:18 +0200
Subject: [PATCH] check for self provides
---
TagsCheck.py | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/TagsCheck.py b/TagsCheck.py
index 4141bbc..fa6154c 100644
--- a/TagsCheck.py
+++ b/TagsCheck.py
@@ -846,6 +846,8 @@ class TagsCheck(AbstractCheck.AbstractCheck):
for p in pkg.provides():
value = Pkg.formatRequire(*p)
self._unexpanded_macros(pkg, 'Provides %s' % (value,), value)
+ if p[0] == pkg.name and not p[1]:
+ printError(pkg, 'unversioned-explicit-self-provides', p[0])
for c in pkg.conflicts():
value = Pkg.formatRequire(*c)
@@ -1180,6 +1182,10 @@ objects should thus not be depended on and they should not result in provides
in the containing package. Get rid of the provides if appropriate, for example
by filtering it out during build. Note that in some cases this may require
disabling rpmbuild's internal dependency generator.''',
+
+'unversioned-explicit-self-provides',
+'''This package provides it's own name explicitely, which might break
+upgrade path. self-provides are autogenerated. Remove the provide.''',
)
# TagsCheck.py ends here

View File

@ -1,10 +1,19 @@
Index: FilesCheck.py
From: Some One <nobody@opensuse.org>
Date: Thu, 9 Apr 2015 14:55:40 +0200
Subject: [PATCH] compressed-backup-regex.diff
===================================================================
--- FilesCheck.py.orig
+++ FilesCheck.py
@@ -591,7 +591,7 @@ DEFAULT_STANDARD_GROUPS = ('root', 'bin'
---
FilesCheck.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/FilesCheck.py b/FilesCheck.py
index fc44b50..acb379f 100644
--- a/FilesCheck.py
+++ b/FilesCheck.py
@@ -599,7 +599,7 @@ DEFAULT_DISALLOWED_DIRS = (
)
tmp_regex = re.compile('^(/var|/usr)?/tmp/')
sub_bin_regex = re.compile('^(/usr)?/s?bin/\S+/')
-backup_regex = re.compile('(~|\#[^/]+\#|\.orig|\.rej)$')
+backup_regex = re.compile('(~|\#[^/]+\#|\.orig|\.orig\.gz|\.rej)$')

17
config
View File

@ -42,6 +42,7 @@ addCheck("CheckPAMModules")
addCheck("CheckRCLinks")
addCheck("CheckAppdata")
addCheck("CheckSystemdInstall")
addCheck("TmpFilesCheck")
# stuff autobuild takes care about
addFilter(".*invalid-version.*")
@ -87,6 +88,7 @@ setOption('StandardGroups', (
'boinc',
'casaauth',
'cdrom',
'ceph',
'chef',
'citadel',
'colord',
@ -250,6 +252,7 @@ setOption('StandardUsers', (
'casaatsd',
'casaatvd',
'casaauth',
'ceph',
'chef',
'citadel',
'cntlm',
@ -397,6 +400,9 @@ add the user to the "config" file and send a submitrequest.
To register the group, please branch the devel:openSUSE:Factory:rpmlint rpmlint package,
add the group to the "config" file and send a submitrequest.
'''
'no-changelogname-tag',
'''There is no changelog. Please insert a '%changelog' section heading in your
spec file and prepare your changes file using e.g. the 'osc vc' command.''',
)
setOption('DanglingSymlinkExceptions',
@ -654,13 +660,16 @@ setOption("DBUSServices.WhiteList", (
# libKF5Auth4 (bnc#864716)
"org.kde.kf5auth.conf",
# firewalld (bnc#907625)
"org.fedoraproject.FirewallD1",
"FirewallD.conf",
# storaged (bnc#915769)
"com.redhat.storaged",
"com.redhat.lvm2",
"com.redhat.storaged.conf",
"com.redhat.storaged.service",
# systemd networkd (bnc#918799)
"org.freedesktop.network1.conf",
"org.freedesktop.network1.service"
"org.freedesktop.network1.service",
# realmd (bnc#916766)
"org.freedesktop.realmd.service",
"org.freedesktop.realmd.conf"
))
setOption("PAMModules.WhiteList", (

View File

@ -1,10 +1,18 @@
From: Some One <nobody@opensuse.org>
Date: Thu, 9 Apr 2015 14:55:39 +0200
Subject: [PATCH] confusing-invalid-spec-name
# Confusing message. The problem is not that the file does not end
# with ".spec", but that there is a mismatch of specname and pkg name.
Index: rpmlint-1.5/SpecCheck.py
===================================================================
--- rpmlint-1.5.orig/SpecCheck.py
+++ rpmlint-1.5/SpecCheck.py
@@ -621,8 +621,8 @@ addDetails(
---
SpecCheck.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/SpecCheck.py b/SpecCheck.py
index 12b6f2b..d0d381a 100644
--- a/SpecCheck.py
+++ b/SpecCheck.py
@@ -646,8 +646,8 @@ addDetails(
SPEC file to build a valid RPM package.''',
'invalid-spec-name',

View File

@ -1,8 +1,17 @@
Index: TagsCheck.py
From: Some One <nobody@opensuse.org>
Date: Thu, 9 Apr 2015 14:55:39 +0200
Subject: [PATCH] description-check.diff
===================================================================
--- TagsCheck.py.orig
+++ TagsCheck.py
@@ -715,6 +715,9 @@ class TagsCheck(AbstractCheck.AbstractCh
---
TagsCheck.py | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/TagsCheck.py b/TagsCheck.py
index b1c4c7a..bc79283 100644
--- a/TagsCheck.py
+++ b/TagsCheck.py
@@ -716,6 +716,9 @@ class TagsCheck(AbstractCheck.AbstractCheck):
else:
for lang in langs:
self.check_description(pkg, lang, ignored_words)
@ -12,7 +21,7 @@ Index: TagsCheck.py
else:
printError(pkg, 'no-description-tag')
@@ -995,6 +998,10 @@ Name tag.''',
@@ -997,6 +1000,10 @@ Name tag.''',
'''The major number of the library isn't included in the package's name.
''',

View File

@ -1,8 +1,17 @@
Index: FilesCheck.py
From: Some One <nobody@opensuse.org>
Date: Thu, 9 Apr 2015 14:55:39 +0200
Subject: [PATCH] devel-provide-is-devel-package.diff
===================================================================
--- FilesCheck.py.orig
+++ FilesCheck.py
@@ -807,6 +807,10 @@ class FilesCheck(AbstractCheck.AbstractC
---
FilesCheck.py | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/FilesCheck.py b/FilesCheck.py
index 72bdf54..ae9c364 100644
--- a/FilesCheck.py
+++ b/FilesCheck.py
@@ -829,6 +829,10 @@ class FilesCheck(AbstractCheck.AbstractCheck):
# Check if the package is a development package
devel_pkg = devel_regex.search(pkg.name)

View File

@ -1,8 +1,17 @@
Index: FilesCheck.py
From: Some One <nobody@opensuse.org>
Date: Thu, 9 Apr 2015 14:55:38 +0200
Subject: [PATCH] docdata-examples.diff
===================================================================
--- FilesCheck.py.orig
+++ FilesCheck.py
@@ -601,6 +601,7 @@ bin_regex = re.compile('^/(?:usr/(?:s?bi
---
FilesCheck.py | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/FilesCheck.py b/FilesCheck.py
index c485125..7504167 100644
--- a/FilesCheck.py
+++ b/FilesCheck.py
@@ -609,6 +609,7 @@ bin_regex = re.compile('^/(?:usr/(?:s?bin|games)|s?bin)/(.*)')
includefile_regex = re.compile('\.(c|h)(pp|xx)?$', re.IGNORECASE)
develfile_regex = re.compile('\.(a|cmxa?|mli?)$')
buildconfigfile_regex = re.compile('(\.pc|/bin/.+-config)$')
@ -10,7 +19,7 @@ Index: FilesCheck.py
# room for improvement with catching more -R, but also for false positives...
buildconfig_rpath_regex = re.compile('(?:-rpath|Wl,-R)\\b')
sofile_regex = re.compile('/lib(64)?/(.+/)?lib[^/]+\.so$')
@@ -1158,7 +1159,7 @@ class FilesCheck(AbstractCheck.AbstractC
@@ -1181,7 +1182,7 @@ class FilesCheck(AbstractCheck.AbstractCheck):
includefile_regex.search(f) or \
develfile_regex.search(f) or \
logrotate_regex.search(f)
@ -19,7 +28,7 @@ Index: FilesCheck.py
printWarning(pkg, 'spurious-executable-perm', f)
elif f.startswith('/etc/') and f not in config_files and \
f not in ghost_files:
@@ -1541,7 +1542,10 @@ included in your package.''',
@@ -1534,7 +1535,10 @@ included in your package.''',
'spurious-executable-perm',
'''The file is installed with executable permissions, but was identified as one
that probably should not be executable. Verify if the executable bits are

View File

@ -1,8 +1,17 @@
Index: FilesCheck.py
From: Some One <nobody@opensuse.org>
Date: Thu, 9 Apr 2015 14:55:40 +0200
Subject: [PATCH] extend-suse-conffiles-check.diff
===================================================================
--- FilesCheck.py.orig
+++ FilesCheck.py
@@ -1179,7 +1179,7 @@ class FilesCheck(AbstractCheck.AbstractC
---
FilesCheck.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/FilesCheck.py b/FilesCheck.py
index 0bb4b3d..fc44b50 100644
--- a/FilesCheck.py
+++ b/FilesCheck.py
@@ -1199,7 +1199,7 @@ class FilesCheck(AbstractCheck.AbstractCheck):
if nonexec_file and not docdir_examples_regex.search(f):
printWarning(pkg, 'spurious-executable-perm', f)
elif f.startswith('/etc/') and f not in config_files and \

View File

@ -1,10 +1,19 @@
Index: Filter.py
From: Some One <nobody@opensuse.org>
Date: Thu, 9 Apr 2015 14:55:39 +0200
Subject: [PATCH] filename-non-utf8-exception.diff
===================================================================
--- Filter.py.orig
+++ Filter.py
---
Filter.py | 10 ++--------
1 file changed, 2 insertions(+), 8 deletions(-)
diff --git a/Filter.py b/Filter.py
index 40fbf79..37ba038 100644
--- a/Filter.py
+++ b/Filter.py
@@ -23,14 +23,8 @@ _diagnostic = list()
_badness_score = 0
printed_messages = { "I": 0, "W": 0, "E": 0 }
printed_messages = {"I": 0, "W": 0, "E": 0}
-if sys.stdout.isatty():
- def __print(s):
@ -17,5 +26,5 @@ Index: Filter.py
+def __print(s):
+ print(s)
def printInfo(pkg, reason, *details):
_print("I", pkg, reason, details)

View File

@ -0,0 +1,39 @@
From: Ludwig Nussel <ludwig.nussel@suse.de>
Date: Thu, 9 Apr 2015 12:01:29 +0200
Subject: [PATCH] fix ghost file handling
always take into consideration the missingok files when checking for
missing ghost files.
---
PostCheck.py | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/PostCheck.py b/PostCheck.py
index a87964a..aeb18d3 100644
--- a/PostCheck.py
+++ b/PostCheck.py
@@ -123,15 +123,15 @@ class PostCheck(AbstractCheck.AbstractCheck):
if ghost_files:
postin = pkg[rpm.RPMTAG_POSTIN]
prein = pkg[rpm.RPMTAG_PREIN]
- if not postin and not prein:
- printWarning(pkg, 'ghost-files-without-postin')
- else:
- for f in ghost_files:
- 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)
+ for f in ghost_files:
+ if f in pkg.missingOkFiles():
+ continue
+ if not postin and not prein:
+ printWarning(pkg, 'ghost-files-without-postin')
+ if (not postin or f not in postin) and \
+ (not prein or f not in prein):
+ printWarning(pkg,
+ 'postin-without-ghost-file-creation', f)
def check_aux(self, pkg, files, prog, script, tag, prereq):
if script:

View File

@ -1,26 +0,0 @@
--- Pkg.py
+++ Pkg.py
@@ -403,10 +403,19 @@
current_version=d[1]
if current_version.find(':') > 0:
current_version=''.join(current_version.split(':')[1:])
- if d[2] & rpm.RPMSENSE_EQUAL != rpm.RPMSENSE_EQUAL or current_version != version:
- return 0
- else:
- return 1
+
+ if d[2] & rpm.RPMSENSE_EQUAL:
+ if current_version == version:
+ return 1
+
+ if d[2] & rpm.RPMSENSE_GREATER:
+ if current_version.count('.') > version.count('.'):
+ current_version = '.'.join(current_version.split('.')[0:version.count('.')])
+
+ if current_version == version:
+ return 1
+
+ return 0
return 0
def conflicts(self):

View File

@ -1,14 +0,0 @@
Index: FilesCheck.py
===================================================================
--- FilesCheck.py.orig
+++ FilesCheck.py
@@ -980,7 +980,8 @@ class FilesCheck(AbstractCheck.AbstractC
(includefile_regex.search(f) or \
develfile_regex.search(f) or is_buildconfig):
printWarning(pkg, 'devel-file-in-non-devel-package', f)
- if mode & 0444 != 0444 and perm & 07000 == 0 and f[0:len('/var/log')] != '/var/log':
+ if mode & 0444 != 0444 and perm & 07000 == 0 and \
+ not f.startswith('/var/log/') and not f.startswith('/etc/'):
printError(pkg, 'non-readable', f, oct(perm))
if size == 0 and not normal_zero_length_regex.search(f) and f not in ghost_files:
printError(pkg, 'zero-length', f)

View File

@ -1,8 +1,17 @@
Index: TagsCheck.py
From: Some One <nobody@opensuse.org>
Date: Thu, 9 Apr 2015 14:55:40 +0200
Subject: [PATCH] invalid-filerequires.diff
===================================================================
--- TagsCheck.py.orig
+++ TagsCheck.py
@@ -421,6 +421,7 @@ invalid_version_regex = re.compile('([0-
---
TagsCheck.py | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/TagsCheck.py b/TagsCheck.py
index 3c68d28..4141bbc 100644
--- a/TagsCheck.py
+++ b/TagsCheck.py
@@ -422,6 +422,7 @@ invalid_version_regex = re.compile('([0-9](?:rc|alpha|beta|pre).*)', re.IGNORECA
# () are here for grouping purpose in the regexp
forbidden_words_regex = re.compile('(' + Config.getOption('ForbiddenWords') + ')', re.IGNORECASE)
valid_buildhost_regex = re.compile(Config.getOption('ValidBuildHost'))
@ -10,7 +19,7 @@ Index: TagsCheck.py
use_epoch = Config.getOption('UseEpoch', False)
use_utf8 = Config.getOption('UseUTF8', Config.USEUTF8_DEFAULT)
max_line_len = Config.getOption('MaxLineLength', 79)
@@ -599,6 +600,9 @@ class TagsCheck(AbstractCheck.AbstractCh
@@ -602,6 +603,9 @@ class TagsCheck(AbstractCheck.AbstractCheck):
if d[0].startswith('/usr/local/'):
printError(pkg, 'invalid-dependency', d[0])
@ -20,7 +29,7 @@ Index: TagsCheck.py
if is_source:
if lib_devel_number_regex.search(d[0]):
printError(pkg, 'invalid-build-requires', d[0])
@@ -1106,6 +1110,12 @@ explicit Requires: tags.''',
@@ -1127,6 +1131,12 @@ unneeded explicit Requires: tags.''',
'''This package provides 2 times the same capacity. It should only provide it
once.''',

View File

@ -1,8 +1,17 @@
Index: BinariesCheck.py
From: Some One <nobody@opensuse.org>
Date: Thu, 9 Apr 2015 14:55:39 +0200
Subject: [PATCH] libtool-wrapper-check.diff
===================================================================
--- BinariesCheck.py.orig
+++ BinariesCheck.py
@@ -313,8 +313,19 @@ class BinariesCheck(AbstractCheck.Abstra
---
BinariesCheck.py | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/BinariesCheck.py b/BinariesCheck.py
index c1c566d..b92c01e 100644
--- a/BinariesCheck.py
+++ b/BinariesCheck.py
@@ -316,8 +316,19 @@ class BinariesCheck(AbstractCheck.AbstractCheck):
is_ar = 'current ar archive' in pkgfile.magic
is_ocaml_native = 'Objective caml native' in pkgfile.magic
is_lua_bytecode = 'Lua bytecode' in pkgfile.magic
@ -22,7 +31,7 @@ Index: BinariesCheck.py
if not is_binary:
if reference_regex.search(fname):
lines = pkg.grep(invalid_dir_ref_regex, fname)
@@ -572,6 +583,15 @@ recompiled separately from the static li
@@ -579,6 +590,15 @@ recompiled separately from the static libraries with the -fPIC option.
Another common mistake that causes this problem is linking with
``gcc -Wl,-shared'' instead of ``gcc -shared''.''',

View File

@ -1,19 +0,0 @@
--- rpmlint.py
+++ rpmlint.py
@@ -16,6 +16,7 @@ import Pkg
import Config
import os
import stat
+import locale
import rpm
from Filter import *
import SpecCheck
@@ -42,6 +43,8 @@ def loadCheck(name):
# main program
#############################################################################
def main():
+
+ locale.setlocale(locale.LC_ALL, '')
# Load all the tests
for c in Config.allChecks():
loadCheck(c)

View File

@ -1,34 +0,0 @@
Index: I18NCheck.py
===================================================================
--- I18NCheck.py.orig
+++ I18NCheck.py
@@ -38,22 +38,22 @@ INCORRECT_LOCALES = {
#
# 'en_RN' and 'en@IPA' are not real language bu funny variations on english
CORRECT_SUBDIRS = (
-'af', 'am', 'ang', 'ar', 'as', 'az', 'az_IR', 'be', 'bg', 'bn', 'bn_IN', 'br',
-'bs', 'ca', 'cs', 'cy', 'da', 'de', 'de_AT', 'dz', 'el',
+'af', 'am', 'ang', 'ar', 'as', 'az', 'az_IR', 'be', 'be@latin', 'bg', 'bn', 'bn_IN', 'br',
+'bs', 'ca', 'ca@valencia', 'cs', 'cy', 'da', 'de', 'de_AT', 'dz', 'el',
'en_AU', 'en_CA', 'en_GB', 'en_IE', 'en_US', 'en_RN', 'en@IPA',
'eo', 'es', 'es_AR', 'es_ES', 'es_DO', 'es_GT', 'es_HN', 'es_SV', 'es_PE',
'es_PA', 'es_MX', 'et', 'eu',
'fa', 'fi', 'fo', 'fr', 'fur', 'ga', 'gd', 'gl', 'gn', 'gu', 'gv',
'he', 'hi', 'hr', 'hu', 'hy',
-'ia', 'id', 'is', 'it', 'iu', 'ja', 'ka', 'kl', 'km', 'kn', 'ko', 'ku', 'kw',
+'ia', 'id', 'io', 'is', 'it', 'iu', 'ja', 'ka', 'kl', 'km', 'kn', 'ko', 'ku', 'kw',
# 'ltg' is not a standard ISO code; latgalian hasn't yet an ISO code
-'ky', 'lg', 'li', 'lo', 'lt', 'ltg', 'lv',
+'ky', 'lg', 'li', 'lo', 'lt', 'ltg', 'lv', 'mai', 'md',
'mg', 'mi', 'mk', 'ml', 'mn', 'mr', 'ms', 'mt', 'my',
'nb', 'nds', 'nds_DE', 'ne', 'nl', 'nn', 'no', 'nr', 'nso',
-'oc', 'or', 'pa_IN', 'ph', 'pl', 'pp', 'pt', 'pt_BR', 'qu', 'ro', 'ru', 'rw',
-'sc', 'se', 'si', 'sk', 'sl', 'sq', 'sr', 'sr@Latn', 'sr@ije', 'ss', 'st',
+'oc', 'or', 'pa_IN', 'ph', 'pl', 'pp', 'ps', 'pt', 'pt_BR', 'qu', 'ro', 'ru', 'rw',
+'sc', 'se', 'si', 'sk', 'sl', 'sq', 'sr', 'sr@latin', 'sr@ije', 'ss', 'st',
'sv', 'ta', 'te', 'tg', 'th', 'tk', 'tl', 'tn', 'tr', 'ts', 'tt',
-'ug', 'uk', 'ur', 'uz', 'uz@Latn',
+'ug', 'uk', 'ur', 'uz', 'uz@cyrillic',
've', 'vi', 'wa', 'wen', 'xh', 'yi', 'yo', 'zh_CN', 'zh_HK', 'zh_TW', 'zu',
# KDE uses 'ven' for 've'
'ven',

View File

@ -1,30 +0,0 @@
--- InitScriptCheck.py
+++ InitScriptCheck.py
@@ -101,7 +101,7 @@ class InitScriptCheck(AbstractCheck.AbstractCheck):
in_lsb_tag = 0
for i in lsb_tags.keys():
if len(lsb_tags[i]) != 1:
- printError(pkg, 'redundant-lsb-keyword', i)
+ printError(pkg, 'redundant-lsb-keyword', "'%s' in %s" % (i, f))
# TODO: where is it specified that these (or some)
# keywords are mandatory?
@@ -118,7 +118,7 @@ class InitScriptCheck(AbstractCheck.AbstractCheck):
cres = lsb_cont_regex.search(line)
if not (in_lsb_description and cres):
in_lsb_description = 0
- printError(pkg, 'malformed-line-in-lsb-comment-block', line)
+ printError(pkg, 'malformed-line-in-lsb-comment-block', "'%s' in %s" % (line,f))
else:
lsb_tags["Description"][-1] += " " + cres.group(1)
else:
@@ -127,7 +127,7 @@ class InitScriptCheck(AbstractCheck.AbstractCheck):
tag not in ('Provides', 'Required-Start', 'Required-Stop',
'Should-Stop', 'Should-Start', 'Default-Stop',
'Default-Start', 'Description', 'Short-Description'):
- printError(pkg, 'unknown-lsb-keyword', line)
+ printError(pkg, 'unknown-lsb-keyword', "'%s' in %s" % (line, f))
else:
in_lsb_description = (tag == 'Description')
if not tag in lsb_tags.keys():

View File

@ -0,0 +1,123 @@
From: Ludwig Nussel <ludwig.nussel@suse.de>
Date: Wed, 20 May 2015 09:57:28 +0200
Subject: [PATCH] move ghost file check to TmpFilesCheck
files handled by the tmpfiles mechanism can be skipped by the normal
ghost check
---
PostCheck.py | 18 ------------------
TmpFilesCheck.py | 35 +++++++++++++++++++++++++++++++++++
2 files changed, 35 insertions(+), 18 deletions(-)
diff --git a/PostCheck.py b/PostCheck.py
index aeb18d3..53f2d0c 100644
--- a/PostCheck.py
+++ b/PostCheck.py
@@ -119,20 +119,6 @@ class PostCheck(AbstractCheck.AbstractCheck):
self.check_aux(
pkg, files, prog[idx], script[idx], tag[2], prereq)
- ghost_files = pkg.ghostFiles()
- if ghost_files:
- postin = pkg[rpm.RPMTAG_POSTIN]
- prein = pkg[rpm.RPMTAG_PREIN]
- for f in ghost_files:
- if f in pkg.missingOkFiles():
- continue
- if not postin and not prein:
- printWarning(pkg, 'ghost-files-without-postin')
- if (not postin or f not in postin) and \
- (not prein or f not in prein):
- printWarning(pkg,
- 'postin-without-ghost-file-creation', f)
-
def check_aux(self, pkg, files, prog, script, tag, prereq):
if script:
if prog:
@@ -201,10 +187,6 @@ class PostCheck(AbstractCheck.AbstractCheck):
check = PostCheck()
# Add information about checks
-addDetails(
-'postin-without-ghost-file-creation',
-'''A file tagged as ghost is not created during %prein nor during %postin.''',
-)
for scriptlet in map(lambda x: '%' + x, RPM_SCRIPTLETS):
addDetails(
'one-line-command-in-%s' % scriptlet,
diff --git a/TmpFilesCheck.py b/TmpFilesCheck.py
index 8c4db8d..06be7bb 100644
--- a/TmpFilesCheck.py
+++ b/TmpFilesCheck.py
@@ -14,6 +14,7 @@ from Filter import addDetails, printError, printWarning
import AbstractCheck
import Pkg
import stat
+import rpm
class TmpFilesCheck(AbstractCheck.AbstractCheck):
'''Check systemd created tmpfiles are included in filelist'''
@@ -26,6 +27,11 @@ class TmpFilesCheck(AbstractCheck.AbstractCheck):
if pkg.isSource():
return
+ # file names handled by systemd-tmpfiles
+ tmp_files = set()
+ postin = pkg[rpm.RPMTAG_POSTIN]
+ prein = pkg[rpm.RPMTAG_PREIN]
+
# see tmpfiles.d(5)
interesting_types = ('f', 'F', 'w', 'd', 'D', 'p', 'L', 'c', 'b')
@@ -35,6 +41,13 @@ class TmpFilesCheck(AbstractCheck.AbstractCheck):
if not stat.S_ISREG(pkgfile.mode):
printWarning(pkg, "tmpfile-not-regular-file", fn)
continue
+
+ pattern = re.compile(r'systemd-tmpfiles --create .*%s'%re.escape(fn))
+ if (not postin or not pattern.match(postin)) and \
+ (not prein or not pattern.match(prein)):
+ printWarning(pkg,
+ 'postin-without-tmpfile-creation', fn)
+
for line in open(pkgfile.path):
# skip comments
line = line.split('#')[0].split('\n')[0]
@@ -54,15 +67,37 @@ class TmpFilesCheck(AbstractCheck.AbstractCheck):
if not t in interesting_types:
continue
+ tmp_files.add(p)
+
if not p in pkg.files():
printWarning(pkg, "tmpfile-not-in-filelist", p)
continue
if not pkg.files()[p].is_ghost:
printWarning(pkg, "tmpfile-not-ghost", p)
+ # now check remaining ghost files that are not already
+ # handled by systemd-tmpfiles
+ ghost_files = set(pkg.ghostFiles()) - tmp_files
+ if ghost_files:
+ for f in ghost_files:
+ if f in pkg.missingOkFiles():
+ continue
+ if not postin and not prein:
+ printWarning(pkg, 'ghost-files-without-postin')
+ if (not postin or f not in postin) and \
+ (not prein or f not in prein):
+ printWarning(pkg,
+ 'postin-without-ghost-file-creation', f)
+
+
+
check = TmpFilesCheck()
addDetails(
+'postin-without-ghost-file-creation',
+'''A file tagged as ghost is not created during %prein nor during %postin.''',
+'postin-without-tmpfile-creation',
+'''Please use the %tmpfiles_create macro in %post for each of your tmpfiles.d files''',
'tmpfile-not-regular-file',
'''files in tmpfiles.d need to be regular files''', # otherwise we won't open it :-)
'tmpfile-not-in-filelist',

View File

@ -1,8 +1,18 @@
Index: Filter.py
From: Some One <nobody@opensuse.org>
Date: Thu, 9 Apr 2015 14:55:39 +0200
Subject: [PATCH] no-badness-return.diff
===================================================================
--- Filter.py.orig
+++ Filter.py
@@ -113,7 +113,7 @@ def printAllReasons():
---
Filter.py | 2 +-
rpmlint | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/Filter.py b/Filter.py
index eaa8384..40fbf79 100644
--- a/Filter.py
+++ b/Filter.py
@@ -120,7 +120,7 @@ def printAllReasons():
if len(last_reason):
printDescriptions(last_reason)
last_reason = reason
@ -11,11 +21,11 @@ Index: Filter.py
if Config.info and len(last_reason):
printDescriptions(last_reason)
_diagnostic = list()
Index: rpmlint
===================================================================
--- rpmlint.orig
+++ rpmlint
@@ -214,7 +214,7 @@ def main():
diff --git a/rpmlint b/rpmlint
index aa37c3a..8853e79 100755
--- a/rpmlint
+++ b/rpmlint
@@ -202,7 +202,7 @@ def main():
% (packages_checked, specfiles_checked,
printed_messages["E"], printed_messages["W"]))

View File

@ -1,8 +1,17 @@
Index: FilesCheck.py
From: Some One <nobody@opensuse.org>
Date: Thu, 9 Apr 2015 14:55:38 +0200
Subject: [PATCH] no-doc-for-lib.diff
===================================================================
--- FilesCheck.py.orig
+++ FilesCheck.py
@@ -823,7 +823,7 @@ class FilesCheck(AbstractCheck.AbstractC
---
FilesCheck.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/FilesCheck.py b/FilesCheck.py
index 9532011..5929146 100644
--- a/FilesCheck.py
+++ b/FilesCheck.py
@@ -846,7 +846,7 @@ class FilesCheck(AbstractCheck.AbstractCheck):
debuginfo_srcs = False
debuginfo_debugs = False

View File

@ -1,8 +1,17 @@
Index: BinariesCheck.py
From: Some One <nobody@opensuse.org>
Date: Thu, 9 Apr 2015 14:55:39 +0200
Subject: [PATCH] noarch-lib64.diff
===================================================================
--- BinariesCheck.py.orig
+++ BinariesCheck.py
@@ -291,6 +291,7 @@ class BinariesCheck(AbstractCheck.Abstra
---
BinariesCheck.py | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/BinariesCheck.py b/BinariesCheck.py
index b92c01e..aff0f9f 100644
--- a/BinariesCheck.py
+++ b/BinariesCheck.py
@@ -294,6 +294,7 @@ class BinariesCheck(AbstractCheck.AbstractCheck):
binary = False
binary_in_usr_lib = False
has_usr_lib_file = False
@ -10,7 +19,7 @@ Index: BinariesCheck.py
multi_pkg = False
srpm = pkg[rpm.RPMTAG_SOURCERPM]
@@ -309,6 +310,10 @@ class BinariesCheck(AbstractCheck.Abstra
@@ -312,6 +313,10 @@ class BinariesCheck(AbstractCheck.AbstractCheck):
# only-non-binary-in-usr-lib false positives
binary_in_usr_lib = True
@ -21,7 +30,7 @@ Index: BinariesCheck.py
is_elf = 'ELF' in pkgfile.magic
is_ar = 'current ar archive' in pkgfile.magic
is_ocaml_native = 'Objective caml native' in pkgfile.magic
@@ -534,9 +539,12 @@ class BinariesCheck(AbstractCheck.Abstra
@@ -541,9 +546,12 @@ class BinariesCheck(AbstractCheck.AbstractCheck):
if version and version != -1 and version not in pkg.name:
printError(pkg, 'incoherent-version-in-name', version)
@ -35,7 +44,7 @@ Index: BinariesCheck.py
if has_usr_lib_file and not binary_in_usr_lib:
printWarning(pkg, 'only-non-binary-in-usr-lib')
@@ -560,6 +568,11 @@ FHS and the FSSTND forbid this.''',
@@ -567,6 +575,11 @@ FHS and the FSSTND forbid this.''',
# 'non-sparc32-binary',
# '',

View File

@ -1,8 +1,17 @@
Index: InitScriptCheck.py
From: Some One <nobody@opensuse.org>
Date: Thu, 9 Apr 2015 14:55:39 +0200
Subject: [PATCH] only-reg-files-are-scripts.diff
===================================================================
--- InitScriptCheck.py.orig
+++ InitScriptCheck.py
@@ -18,7 +18,7 @@ from Filter import addDetails, printErro
---
InitScriptCheck.py | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/InitScriptCheck.py b/InitScriptCheck.py
index 5d851d4..fb53d93 100644
--- a/InitScriptCheck.py
+++ b/InitScriptCheck.py
@@ -18,7 +18,7 @@ from Filter import addDetails, printError, printWarning
import AbstractCheck
import Config
import Pkg
@ -11,7 +20,7 @@ Index: InitScriptCheck.py
chkconfig_content_regex = re.compile('^\s*#\s*chkconfig:\s*([-0-9]+)\s+[-0-9]+\s+[-0-9]+')
subsys_regex = re.compile('/var/lock/subsys/([^/"\'\n\s;&|]+)', re.MULTILINE)
@@ -64,6 +64,9 @@ class InitScriptCheck(AbstractCheck.Abst
@@ -50,6 +50,9 @@ class InitScriptCheck(AbstractCheck.AbstractCheck):
not fname.startswith('/etc/rc.d/init.d/'):
continue

View File

@ -1,27 +0,0 @@
--- BinariesCheck.py
+++ BinariesCheck.py
@@ -119,6 +119,8 @@
sparc_regex=re.compile('SPARC32PLUS|SPARC V9|UltraSPARC')
system_lib_paths=Config.getOption('SystemLibPaths', DEFAULT_SYSTEM_LIB_PATHS)
usr_lib_regex=re.compile('^/usr/lib(64)?/')
+lib_perl_regex=re.compile('^/usr/lib/perl5/(?:vendor_perl/)?([0-9]+\.[0-9]+)\.([0-9]+)/')
+perl_version_trick=Config.getOption('PerlVersionTrick', 1)
bin_regex=re.compile('^(/usr(/X11R6)?)?/s?bin/')
soversion_regex=re.compile('.*?([0-9][.0-9]*)\\.so|.*\\.so\\.([0-9][.0-9]*).*')
reference_regex=re.compile('\.la$|^/usr/lib(64)?/pkgconfig/')
@@ -234,7 +236,14 @@
if p in system_lib_paths or \
not usr_lib_regex.search(p):
printError(pkg, 'binary-or-shlib-defines-rpath', i[0], bin_info.rpath)
- break
+ res=lib_perl_regex.search(p)
+ if res:
+ if perl_version_trick:
+ vers = res.group(1) + '.' + res.group(2)
+ else:
+ vers = res.group(1) + res.group(2)
+ if not (pkg.check_versioned_dep('perl', vers)):
+ printError(pkg, "no-dependency-on", "perl", vers)
# statically linked ?
is_exec=executable_regex.search(i[1])

View File

@ -1,14 +1,21 @@
From: Some One <nobody@opensuse.org>
Date: Thu, 9 Apr 2015 14:55:40 +0200
Subject: [PATCH] remove-expand-macros.diff
commit 29e43a3e1676aa452f730a741d00ef4ac7baec96
Author: Ludwig Nussel <ludwig.nussel@suse.de>
Date: Tue May 17 12:56:38 2011 +0200
remove-expand-macros.diff
---
TagsCheck.py | 27 ---------------------------
1 file changed, 27 deletions(-)
Index: TagsCheck.py
===================================================================
--- TagsCheck.py.orig
+++ TagsCheck.py
@@ -431,15 +431,6 @@ so_dep_regex = re.compile(r'\.so(\.[0-9a
diff --git a/TagsCheck.py b/TagsCheck.py
index fc392e5..40ce77a 100644
--- a/TagsCheck.py
+++ b/TagsCheck.py
@@ -432,15 +432,6 @@ so_dep_regex = re.compile(r'\.so(\.[0-9a-zA-z]+)*(\([^)]*\))*$')
# we assume that no rpm packages existed before rpm itself existed...
oldest_changelog_timestamp = calendar.timegm(time.strptime("1995-01-01", "%Y-%m-%d"))
@ -22,11 +29,11 @@ Index: TagsCheck.py
- private_so_paths.add(re.sub(r'/lib(?=/|$)', '/lib64', epath))
-
_enchant_checkers = {}
def spell_check(pkg, str, fmt, lang, ignored):
@@ -864,30 +855,12 @@ class TagsCheck(AbstractCheck.AbstractCh
(apply(Pkg.formatRequire, obs),
apply(Pkg.formatRequire, prov)))
@@ -886,30 +877,12 @@ class TagsCheck(AbstractCheck.AbstractCheck):
(Pkg.formatRequire(*obs),
Pkg.formatRequire(*prov)))
- expfmt = rpm.expandMacro("%{_build_name_fmt}")
- if pkg.isSource():
@ -41,8 +48,8 @@ Index: TagsCheck.py
for tag in ('Distribution', 'DistTag', 'ExcludeArch', 'ExcludeOS',
'Vendor'):
if hasattr(rpm, 'RPMTAG_%s' % tag.upper()):
self._unexpanded_macros(
pkg, tag, pkg[getattr(rpm, 'RPMTAG_%s' % tag.upper())])
self._unexpanded_macros(pkg, tag,
Pkg.b2s(pkg[getattr(rpm, 'RPMTAG_%s' % tag.upper())]))
- for path in private_so_paths:
- for fname, pkgfile in pkg.files().items():
@ -50,8 +57,8 @@ Index: TagsCheck.py
- for prov in pkgfile.provides:
- if so_dep_regex.search(prov[0]):
- printWarning(pkg, "private-shared-object-provides",
- fname, apply(Pkg.formatRequire, prov))
- fname, Pkg.formatRequire(*prov))
-
def check_description(self, pkg, lang, ignored_words):
description = pkg.langtag(rpm.RPMTAG_DESCRIPTION, lang)
self._unexpanded_macros(pkg, '%%description -l %s' % lang, description)

View File

@ -0,0 +1,55 @@
From: Ludwig Nussel <ludwig.nussel@suse.de>
Date: Tue, 19 May 2015 13:24:34 +0200
Subject: [PATCH] remove files-attr-not-set check
%defattr(-,root,root) is default since rpm 4.4, released > 10
years go so it's about time to remove that check
---
SpecCheck.py | 13 -------------
1 file changed, 13 deletions(-)
diff --git a/SpecCheck.py b/SpecCheck.py
index ace044c..4842bef 100644
--- a/SpecCheck.py
+++ b/SpecCheck.py
@@ -63,7 +63,6 @@ biarch_package_regex = re.compile(DEFAULT_BIARCH_PACKAGES)
hardcoded_lib_path_exceptions_regex = re.compile(Config.getOption('HardcodedLibPathExceptions', DEFAULT_HARDCODED_LIB_PATH_EXCEPTIONS))
use_utf8 = Config.getOption('UseUTF8', Config.USEUTF8_DEFAULT)
libdir_regex = re.compile('%{?_lib(?:dir)?\}?\\b')
-comment_or_empty_regex = re.compile('^\s*(#|$)')
defattr_regex = re.compile('^\s*%defattr\\b')
attr_regex = re.compile('^\s*%attr\\b')
suse_version_regex = re.compile('%suse_version\s*[<>=]+\s*(\d+)')
@@ -179,7 +178,6 @@ class SpecCheck(AbstractCheck.AbstractCheck):
patch_fuzz_override = False
indent_spaces = 0
indent_tabs = 0
- files_has_defattr = False
section = {}
# None == main package
current_package = None
@@ -230,9 +228,6 @@ class SpecCheck(AbstractCheck.AbstractCheck):
if section_marker:
- if current_section == 'files':
- files_has_defattr = False
-
if not is_lib_pkg and lib_package_regex.search(line):
is_lib_pkg = True
@@ -470,14 +465,6 @@ class SpecCheck(AbstractCheck.AbstractCheck):
if current_section == 'files':
- if not comment_or_empty_regex.search(line) and not \
- (ifarch_regex.search(line) or if_regex.search(line) or
- endif_regex.search(line)):
- if defattr_regex.search(line):
- files_has_defattr = True
- elif not (files_has_defattr or attr_regex.search(line)):
- printWarning(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

View File

@ -1,8 +1,17 @@
Index: TagsCheck.py
From: Some One <nobody@opensuse.org>
Date: Thu, 9 Apr 2015 14:55:39 +0200
Subject: [PATCH] rpmgroup-checks.diff
===================================================================
--- TagsCheck.py.orig
+++ TagsCheck.py
@@ -722,6 +722,8 @@ class TagsCheck(AbstractCheck.AbstractCh
---
TagsCheck.py | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/TagsCheck.py b/TagsCheck.py
index 9e00892..b1c4c7a 100644
--- a/TagsCheck.py
+++ b/TagsCheck.py
@@ -723,6 +723,8 @@ class TagsCheck(AbstractCheck.AbstractCheck):
self._unexpanded_macros(pkg, 'Group', group)
if not group:
printError(pkg, 'no-group-tag')
@ -11,7 +20,7 @@ Index: TagsCheck.py
elif VALID_GROUPS and group not in VALID_GROUPS:
printWarning(pkg, 'non-standard-group', group)
@@ -1034,6 +1036,10 @@ won't fool the specfile parser, and rebu
@@ -1036,6 +1038,10 @@ won't fool the specfile parser, and rebuild the package.''',
'''There is no Group tag in your package. You have to specify a valid group
in your spec file using the Group tag.''',

View File

@ -1,22 +0,0 @@
From e6c176c7d03f377e55d405ebe5d0368f688426c7 Mon Sep 17 00:00:00 2001
From: Orion Poplawski <orion@nwra.com>
Date: Thu, 11 Jul 2013 12:29:34 -0600
Subject: [PATCH] Fix setgroups error name
---
BinariesCheck.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Index: rpmlint-1.5/BinariesCheck.py
===================================================================
--- rpmlint-1.5.orig/BinariesCheck.py
+++ rpmlint-1.5/BinariesCheck.py
@@ -518,7 +518,7 @@ class BinariesCheck(AbstractCheck.Abstra
printError(pkg, 'missing-PT_GNU_STACK-section', fname)
if bin_info.setgid and bin_info.setuid and not bin_info.setgroups:
- printError(pkg, 'missing-call-to-setgroups', fname)
+ printError(pkg, 'missing-call-to-setgroups-before-setuid', fname)
if bin_info.chroot:
if not bin_info.chdir or not bin_info.chroot_near_chdir:

View File

@ -1,165 +0,0 @@
From c45057466e8e40bbb36fa90faa10a2b678c25ba2 Mon Sep 17 00:00:00 2001
From: Ludwig Nussel <ludwig.nussel@suse.de>
Date: Wed, 30 Apr 2014 16:35:20 +0200
Subject: [PATCH rpmlint] disallow /var/run and /var/lock
Distros moved to having /var/run and /var/lock as symlinks to /run resp
/run/lock. Therefore packages must no longer put files there at all.
Also, refactor the code for dir-or-file-in-* and make it configurable.
---
FilesCheck.py | 77 +++++++++++++++++++++++------------------------------------
config | 4 ++++
2 files changed, 34 insertions(+), 47 deletions(-)
Index: rpmlint-1.5/FilesCheck.py
===================================================================
--- rpmlint-1.5.orig/FilesCheck.py
+++ rpmlint-1.5/FilesCheck.py
@@ -559,12 +559,9 @@ STANDARD_DIRS = (
'/var/lib/nobody',
'/var/lib/pam_devperm',
'/var/lib/wwwrun',
- '/var/lock',
- '/var/lock/subsys',
'/var/log',
'/var/mail',
'/var/opt',
- '/var/run',
'/var/spool',
'/var/spool/clientmqueue',
'/var/spool/locks',
@@ -589,7 +586,19 @@ DEFAULT_STANDARD_GROUPS = ('root', 'bin'
'shutdown', 'halt', 'mail', 'news', 'uucp',
'man', 'nobody',)
-tmp_regex = re.compile('^(/var|/usr)?/tmp/')
+DEFAULT_DISALLOWED_DIRS = (
+ '/home',
+ '/mnt',
+ '/opt',
+ '/tmp',
+ '/usr/local',
+ '/usr/tmp',
+ '/var/local',
+ '/var/lock',
+ '/var/run',
+ '/var/tmp',
+)
+
sub_bin_regex = re.compile('^(/usr)?/s?bin/\S+/')
backup_regex = re.compile('(~|\#[^/]+\#|\.orig|\.orig\.gz|\.rej)$')
compr_regex = re.compile('\.(gz|z|Z|zip|bz2|lzma|xz)$')
@@ -653,6 +662,8 @@ use_relative_symlinks = Config.getOption
standard_groups = Config.getOption('StandardGroups', DEFAULT_STANDARD_GROUPS)
standard_users = Config.getOption('StandardUsers', DEFAULT_STANDARD_USERS)
+disallowed_dirs = Config.getOption('DisallowedDirs', DEFAULT_DISALLOWED_DIRS)
+
non_readable_regexs = (re.compile('^/var/log/'),
re.compile('^/etc/(g?shadow-?|securetty)$'))
@@ -871,19 +882,13 @@ class FilesCheck(AbstractCheck.AbstractC
is_kernel_package:
printError(pkg, "kernel-modules-not-in-kernel-packages", f)
- for i in ['mnt','opt','usr-local','var-local','home']:
- if f.startswith('/%s/' % i.replace('-','/')):
- printError(pkg, 'dir-or-file-in-%s' % i, f)
-
- if tmp_regex.search(f):
- printError(pkg, 'dir-or-file-in-tmp', f)
+ for i in disallowed_dirs:
+ if f.startswith(i):
+ printError(pkg, 'dir-or-file-in-%s' % '-'.join(i.split('/')[1:]), f)
- elif f.startswith('/var/run/'):
+ if f.startswith('/run/'):
if f not in ghost_files:
- printWarning(pkg, 'non-ghost-in-var-run', f)
- elif f.startswith('/var/lock/'):
- if f not in ghost_files:
- printWarning(pkg, 'non-ghost-in-var-lock', f)
+ printWarning(pkg, 'non-ghost-in-run', f)
elif sub_bin_regex.search(f):
printError(pkg, 'subdir-in-bin', f)
elif '/site_perl/' in f:
@@ -1466,35 +1471,10 @@ install-info.''',
'''You have a perl temporary file in your package. Usually, this
file is beginning with a dot (.) and contain "perl" in its name.''',
-'dir-or-file-in-tmp',
-'''A file in the package is located in /tmp. It's not permitted
-for packages to install files in this directory.''',
-
-'dir-or-file-in-mnt',
-'''A file in the package is located in /mnt. It's not permitted
-for packages to install files in this directory.''',
-
-'dir-or-file-in-opt',
-'''A file in the package is located in /opt. It's not permitted
-for packages to install files in this directory.''',
-
-'dir-or-file-in-usr-local',
-'''A file in the package is located in /usr/local. It's not permitted
-for packages to install files in this directory.''',
-
-'dir-or-file-in-var-local',
-'''A file in the package is located in /var/local. It's not permitted
-for packages to install files in this directory.''',
-
-'non-ghost-in-var-run',
-'''A file or directory in the package is located in /var/run. Files installed
-in this directory should be marked as %ghost and created at runtime to work
-properly in tmpfs /var/run setups.''',
-
-'non-ghost-in-var-lock',
-'''A file or directory in the package is located in /var/lock. Files installed
+'non-ghost-in-run',
+'''A file or directory in the package is located in /run. Files installed
in this directory should be marked as %ghost and created at runtime to work
-properly in tmpfs /var/lock setups.''',
+properly in tmpfs /run setups.''',
'subdir-in-bin',
'''The package contains a subdirectory in /usr/bin. It's not permitted to
@@ -1505,10 +1485,6 @@ create a subdir there. Create it in /usr
by an editor or resulting from applying unclean (fuzzy, or ones with line
offsets) patches.''',
-'dir-or-file-in-home',
-'''A file in the package is located in /home. It's not permitted
-for packages to install files in this directory.''',
-
'version-control-internal-file',
'''You have included file(s) internally used by a version control system
in the package. Move these files out of the package and rebuild it.''',
@@ -1832,6 +1808,13 @@ as part of the example documentation mea
use it and setup a insecure configuration.'''
)
+for i in disallowed_dirs:
+ addDetails('dir-or-file-in-%s' % '-'.join(i.split('/')[1:]),
+ '''A file in the package is located in %s. It's not permitted
+for packages to install files in this directory.''' % i)
+
+
+
# FilesCheck.py ends here
# Local variables:
Index: rpmlint-1.5/config
===================================================================
--- rpmlint-1.5.orig/config
+++ rpmlint-1.5/config
@@ -126,6 +126,10 @@ from Config import *
# Type: tuple of strings, see DEFAULT_STANDARD_USERS in FilesCheck
#setOption("StandardUsers", ())
+# List of directory prefixes that are not allowed in packages
+# Type: tuple of strings, see DEFAULT_DISALLOWED_DIRS in FilesCheck
+#setOption("DisallowedDirs", ('/home', '/mnt'))
+
# List of directories considered to be system default library search paths.
# Type: tuple of strings, default: see DEFAULT_SYSTEM_LIB_PATHS in BinariesCheck
#setOption("SystemLibPaths", ('/lib', '/lib64', '/usr/lib', '/usr/lib64'))

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:8268cede9397b263e51933a514db0f9a8426867274d495d1e87ef4c81b2c1e18
size 126048

3
rpmlint-1.6.tar.xz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:a0dae71a3fed413ee5c47bd04f393cd6598c68c0dcf1504fa020d62814ff674b
size 13563040

View File

@ -1,207 +0,0 @@
Index: rpmlint-1.5/Pkg.py
===================================================================
--- rpmlint-1.5.orig/Pkg.py
+++ rpmlint-1.5/Pkg.py
@@ -85,7 +85,7 @@ def getstatusoutput(cmd, stdoutonly = Fa
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT, close_fds=True)
proc.stdin.close()
- text = proc.stdout.read().decode()
+ text = proc.stdout.read()
sts = proc.wait()
if sts is None:
sts = 0
diff -ruN rpmlint-1.5/BinariesCheck.py rpmlint-1.5.new/BinariesCheck.py
--- rpmlint-1.5/BinariesCheck.py 2014-02-27 12:06:25.018163441 +0100
+++ rpmlint-1.5.new/BinariesCheck.py 2014-02-27 12:04:14.210110261 +0100
@@ -198,7 +198,7 @@
try:
fobj = open(path, 'rb')
fobj.seek(-12, 2) # 2 == os.SEEK_END, for python 2.4 compat (#172)
- self.tail = fobj.read().decode()
+ self.tail = fobj.read()
except Exception:
e = sys.exc_info()[1]
printWarning(pkg, 'binaryinfo-tail-failed %s: %s' % (file, e))
@@ -296,7 +296,7 @@
multi_pkg = False
srpm = pkg[rpm.RPMTAG_SOURCERPM]
if srpm:
- res = srcname_regex.search(srpm.decode())
+ res = srcname_regex.search(srpm)
if res:
multi_pkg = (pkg.name != res.group(1))
diff -ruN rpmlint-1.5/DocFilesCheck.py rpmlint-1.5.new/DocFilesCheck.py
--- rpmlint-1.5/DocFilesCheck.py 2014-02-27 12:06:24.826161897 +0100
+++ rpmlint-1.5.new/DocFilesCheck.py 2014-02-27 12:04:29.681234928 +0100
@@ -44,7 +44,7 @@
# register things which are provided by the package
for i in pkg.header[rpm.RPMTAG_PROVIDES]:
- core_reqs[i.decode()] = []
+ core_reqs[i] = []
for i in files:
core_reqs[i] = []
diff -ruN rpmlint-1.5/FilesCheck.py rpmlint-1.5.new/FilesCheck.py
--- rpmlint-1.5/FilesCheck.py 2014-02-27 12:06:25.012163393 +0100
+++ rpmlint-1.5.new/FilesCheck.py 2014-02-27 12:04:41.277328352 +0100
@@ -957,11 +957,11 @@
# Prefetch scriptlets, strip quotes from them (#169)
postin = (pkg[rpm.RPMTAG_POSTIN] or \
- pkg.scriptprog(rpm.RPMTAG_POSTINPROG)).decode()
+ pkg.scriptprog(rpm.RPMTAG_POSTINPROG))
if postin:
postin = quotes_regex.sub('', postin)
postun = (pkg[rpm.RPMTAG_POSTUN] or \
- pkg.scriptprog(rpm.RPMTAG_POSTUNPROG)).decode()
+ pkg.scriptprog(rpm.RPMTAG_POSTUNPROG))
if postun:
postun = quotes_regex.sub('', postun)
diff -ruN rpmlint-1.5/LSBCheck.py rpmlint-1.5.new/LSBCheck.py
--- rpmlint-1.5/LSBCheck.py 2014-02-27 12:06:24.827161905 +0100
+++ rpmlint-1.5.new/LSBCheck.py 2014-02-27 12:04:52.612419655 +0100
@@ -32,13 +32,11 @@
version = pkg[rpm.RPMTAG_VERSION]
if version:
- version = version.decode()
if not version_regex.search(version):
printError(pkg, 'non-lsb-compliant-version', version)
release = pkg[rpm.RPMTAG_RELEASE]
if release:
- release = release.decode()
if not version_regex.search(release):
printError(pkg, 'non-lsb-compliant-release', release)
diff -ruN rpmlint-1.5/Pkg.py rpmlint-1.5.new/Pkg.py
--- rpmlint-1.5/Pkg.py 2014-02-27 12:06:25.041163626 +0100
+++ rpmlint-1.5.new/Pkg.py 2014-02-27 12:03:33.599782891 +0100
@@ -448,7 +448,7 @@
os.close(fd)
self.is_source = not self.header[rpm.RPMTAG_SOURCERPM]
- self.name = self.header[rpm.RPMTAG_NAME].decode()
+ self.name = self.header[rpm.RPMTAG_NAME]
if self.isNoSource():
self.arch = 'nosrc'
elif self.isSource():
@@ -534,7 +534,7 @@
# LANGUAGE trumps other env vars per GNU gettext docs, see also #166
orig = os.environ.get('LANGUAGE')
os.environ['LANGUAGE'] = lang
- ret = self[tag].decode()
+ ret = self[tag]
if orig is not None:
os.environ['LANGUAGE'] = orig
return ret
@@ -599,17 +599,17 @@
modes = self.header[rpm.RPMTAG_FILEMODES]
users = self.header[rpm.RPMTAG_FILEUSERNAME]
groups = self.header[rpm.RPMTAG_FILEGROUPNAME]
- links = [x.decode() for x in self.header[rpm.RPMTAG_FILELINKTOS]]
+ links = self.header[rpm.RPMTAG_FILELINKTOS]
sizes = self.header[rpm.RPMTAG_FILESIZES]
md5s = self.header[rpm.RPMTAG_FILEMD5S]
mtimes = self.header[rpm.RPMTAG_FILEMTIMES]
rdevs = self.header[rpm.RPMTAG_FILERDEVS]
langs = self.header[rpm.RPMTAG_FILELANGS]
inodes = self.header[rpm.RPMTAG_FILEINODES]
- requires = [x.decode() for x in self.header[rpm.RPMTAG_FILEREQUIRE]]
- provides = [x.decode() for x in self.header[rpm.RPMTAG_FILEPROVIDE]]
- files = [x.decode() for x in self.header[rpm.RPMTAG_FILENAMES]]
- magics = [x.decode() for x in self.header[rpm.RPMTAG_FILECLASS]]
+ requires = self.header[rpm.RPMTAG_FILEREQUIRE]
+ provides = self.header[rpm.RPMTAG_FILEPROVIDE]
+ files = self.header[rpm.RPMTAG_FILENAMES]
+ magics = self.header[rpm.RPMTAG_FILECLASS]
try: # rpm >= 4.7.0
filecaps = self.header[rpm.RPMTAG_FILECAPS]
except:
@@ -736,8 +736,8 @@
if versions:
for loop in range(len(versions)):
- name = names[loop].decode()
- evr = stringToVersion(versions[loop].decode())
+ name = names[loop]
+ evr = stringToVersion(versions[loop])
if prereq is not None and flags[loop] & PREREQ_FLAG:
prereq.append((name, flags[loop] & (~PREREQ_FLAG), evr))
elif strong_only and flags[loop] & rpm.RPMSENSE_STRONG:
diff -ruN rpmlint-1.5/rpmdiff rpmlint-1.5.new/rpmdiff
--- rpmlint-1.5/rpmdiff 2014-02-27 12:06:24.826161897 +0100
+++ rpmlint-1.5.new/rpmdiff 2014-02-27 12:03:50.387918248 +0100
@@ -228,16 +228,16 @@
if namestr == 'REQUIRES':
namestr = self.req2str(oldentry[1])
self.__add(self.DEPFORMAT,
- (self.REMOVED, namestr, oldentry[0].decode(),
- self.sense2str(oldentry[1]), oldentry[2].decode()))
+ (self.REMOVED, namestr, oldentry[0],
+ self.sense2str(oldentry[1]), oldentry[2]))
for newentry in n:
if not newentry in o:
namestr = name
if namestr == 'REQUIRES':
namestr = self.req2str(newentry[1])
self.__add(self.DEPFORMAT,
- (self.ADDED, namestr, newentry[0].decode(),
- self.sense2str(newentry[1]), newentry[2].decode()))
+ (self.ADDED, namestr, newentry[0],
+ self.sense2str(newentry[1]), newentry[2]))
def __fileIteratorToDict(self, fi):
result = {}
diff -ruN rpmlint-1.5/TagsCheck.py rpmlint-1.5.new/TagsCheck.py
--- rpmlint-1.5/TagsCheck.py 2014-02-27 12:06:25.036163586 +0100
+++ rpmlint-1.5.new/TagsCheck.py 2014-02-27 12:05:51.742895726 +0100
@@ -536,7 +536,6 @@
packager = pkg[rpm.RPMTAG_PACKAGER]
if packager:
- packager = packager.decode()
self._unexpanded_macros(pkg, 'Packager', packager)
if Config.getOption('Packager') and \
not packager_regex.search(packager):
@@ -546,7 +545,6 @@
version = pkg[rpm.RPMTAG_VERSION]
if version:
- version = version.decode()
self._unexpanded_macros(pkg, 'Version', version)
res = invalid_version_regex.search(version)
if res:
@@ -556,7 +554,6 @@
release = pkg[rpm.RPMTAG_RELEASE]
if release:
- release = release.decode()
self._unexpanded_macros(pkg, 'Release', release)
if release_ext and not extension_regex.search(release):
printWarning(pkg, 'not-standard-release-extension', release)
@@ -688,12 +685,9 @@
ignored_words.update((x[0] for x in pkg.obsoletes()))
langs = pkg[rpm.RPMTAG_HEADERI18NTABLE]
- if langs:
- langs = [x.decode() for x in langs]
summary = pkg[rpm.RPMTAG_SUMMARY]
if summary:
- summary = summary.decode()
if not langs:
self._unexpanded_macros(pkg, 'Summary', summary)
else:
@@ -704,7 +698,6 @@
description = pkg[rpm.RPMTAG_DESCRIPTION]
if description:
- description = description.decode()
if not langs:
self._unexpanded_macros(pkg, '%description', description)
else:

View File

@ -1,39 +0,0 @@
From 092a54ca23367c845f796f753fa8ff43746b844a Mon Sep 17 00:00:00 2001
From: Alberto Planas <aplanas@suse.com>
Date: Thu, 27 Feb 2014 16:35:13 +0100
Subject: [PATCH] Fix _unexpanded_macros for array values
---
TagsCheck.py | 17 ++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)
Index: rpmlint-1.5/TagsCheck.py
===================================================================
--- rpmlint-1.5.orig/TagsCheck.py
+++ rpmlint-1.5/TagsCheck.py
@@ -524,13 +524,20 @@ class TagsCheck(AbstractCheck.AbstractCh
AbstractCheck.AbstractCheck.__init__(self, 'TagsCheck')
def _unexpanded_macros(self, pkg, tagname, value, is_url=False):
+ def _check_value(value):
+ for match in AbstractCheck.macro_regex.findall(value):
+ # Do not warn about %XX URL escapes
+ if is_url and re.match('^%[0-9A-F][0-9A-F]$', match, re.I):
+ continue
+ printWarning(pkg, 'unexpanded-macro', tagname, match)
+
if not value:
return
- for match in AbstractCheck.macro_regex.findall(value):
- # Do not warn about %XX URL escapes
- if is_url and re.match('^%[0-9A-F][0-9A-F]$', match, re.I):
- continue
- printWarning(pkg, 'unexpanded-macro', tagname, match)
+ if isinstance(value, list):
+ for single_value in value:
+ _check_value(single_value)
+ else:
+ _check_value(value)
def check(self, pkg):

View File

@ -1,32 +0,0 @@
Index: rpmlint-tests-13.2+git20150310.00c9b55/tests/pie.spec
===================================================================
--- rpmlint-tests-13.2+git20150310.00c9b55.orig/tests/pie.spec
+++ rpmlint-tests-13.2+git20150310.00c9b55/tests/pie.spec
@@ -20,7 +20,10 @@ officia deserunt mollit anim id est labo
%build
%install
-install -D -m 755 /bin/ls %buildroot/usr/bin/telnet
+mkdir -p %buildroot/usr/bin/
+echo "int main() {}" >xx.c
+gcc -O2 -fno-PIE xx.c -o %buildroot/usr/bin/telnet
+strip %buildroot/usr/bin/telnet
install -D -m 755 /bin/mount %buildroot/bin/mount
Index: rpmlint-tests-13.2+git20150310.00c9b55/tests/permissions1.spec
===================================================================
--- rpmlint-tests-13.2+git20150310.00c9b55.orig/tests/permissions1.spec
+++ rpmlint-tests-13.2+git20150310.00c9b55/tests/permissions1.spec
@@ -23,7 +23,10 @@ officia deserunt mollit anim id est labo
install -d -m 755 %buildroot/etc/permissions.d
install -d -m 755 %buildroot/bin
echo "/bin/foo root:root 4755" > %buildroot/etc/permissions.d/test
-cp /bin/ls %buildroot/bin
+
+echo "int main() {}" > xx.c
+gcc -fno-PIE -O2 xx.c -o %buildroot/bin/ls
+strip %buildroot/bin/ls
cp /bin/su %buildroot/bin
%clean

View File

@ -1,9 +1,18 @@
Index: Pkg.py
From: Some One <nobody@opensuse.org>
Date: Thu, 9 Apr 2015 14:55:40 +0200
Subject: [PATCH] rpmlint-pkg-quoting.diff
===================================================================
--- Pkg.py.orig
+++ Pkg.py
@@ -493,7 +493,7 @@ class Pkg:
dir = self.dirname)
---
Pkg.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Pkg.py b/Pkg.py
index cfaa5a9..f7dc31d 100644
--- a/Pkg.py
+++ b/Pkg.py
@@ -536,7 +536,7 @@ class Pkg:
dir=self.dirname)
# TODO: better shell escaping or sequence based command invocation
command_str = \
- 'rpm2cpio "%s" | (cd "%s"; cpio -id); chmod -R +rX "%s"' % \

View File

@ -1,8 +1,18 @@
Index: FilesCheck.py
From: Some One <nobody@opensuse.org>
Date: Thu, 9 Apr 2015 14:55:37 +0200
Subject: [PATCH] rpmlint-suse.diff
===================================================================
--- FilesCheck.py.orig
+++ FilesCheck.py
@@ -176,7 +176,7 @@ compr_regex = re.compile('\.(gz|z|Z|zip|
---
FilesCheck.py | 2 +-
I18NCheck.py | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/FilesCheck.py b/FilesCheck.py
index 1ad548b..1a70779 100644
--- a/FilesCheck.py
+++ b/FilesCheck.py
@@ -184,7 +184,7 @@ compr_regex = re.compile('\.(gz|z|Z|zip|bz2|lzma|xz)$')
absolute_regex = re.compile('^/([^/]+)')
absolute2_regex = re.compile('^/?([^/]+)')
points_regex = re.compile('^\.\./(.*)')
@ -11,10 +21,10 @@ Index: FilesCheck.py
bin_regex = re.compile('^/(?:usr/(?:s?bin|games)|s?bin)/(.*)')
includefile_regex = re.compile('\.(c|h)(pp|xx)?$', re.IGNORECASE)
develfile_regex = re.compile('\.(a|cmxa?|mli?)$')
Index: I18NCheck.py
===================================================================
--- I18NCheck.py.orig
+++ I18NCheck.py
diff --git a/I18NCheck.py b/I18NCheck.py
index 54b42cd..3bcf9d0 100644
--- a/I18NCheck.py
+++ b/I18NCheck.py
@@ -30,7 +30,7 @@ INCORRECT_LOCALES = {
'en_UK': 'en_GB'}

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:07ba9c03793bec292164fda25db42a53f7eb811263c8b2b791a119966f963721
size 9976

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:81c5b5f0e7ec9015b33685d29b25aee433ae0f858087a08490abb69438e50c9c
size 10648

View File

@ -1,3 +1,23 @@
-------------------------------------------------------------------
Wed May 20 08:02:15 UTC 2015 - lnussel@suse.de
- Update to version 13.2+git20150520.a374c88:
+ add tmpfiles.d checks
-------------------------------------------------------------------
Tue May 19 12:21:46 UTC 2015 - lnussel@suse.de
- Update to version 13.2+git20150519.278efdf:
+ add ghost file checks
+ print names of failed tests
-------------------------------------------------------------------
Tue Apr 21 08:59:43 UTC 2015 - lnussel@suse.de
- Update to version 13.2+git20150410.6161e60:
+ build our own non-PIE binaries, as the distribution slowly gets converted to all PIE binaries
(removed rpmlint-pie-fixes.patch)
-------------------------------------------------------------------
Thu Apr 9 14:00:19 UTC 2015 - meissner@suse.com

View File

@ -22,7 +22,7 @@
BuildRequires: rpmlint-mini
Name: rpmlint-tests
Version: 13.2+git20150310.00c9b55
Version: 13.2+git20150520.a374c88
Release: 0
Summary: rpmlint regression tests
License: SUSE-Public-Domain
@ -30,7 +30,6 @@ Group: Development/Tools/Building
BuildRoot: %{_tmppath}/%{name}-%{version}-build
Url: http://www.opensuse.org/
Source: rpmlint-tests-%version.tar.xz
Patch0: rpmlint-pie-fixes.patch
%description
This package doesn't actually contain any files and is not meant to
@ -39,7 +38,6 @@ regression tests against rpmlint(-mini).
%prep
%setup -q
%patch0 -p1
%build
mkdir rpms

View File

@ -1,3 +1,82 @@
-------------------------------------------------------------------
Wed May 20 07:58:52 UTC 2015 - lnussel@suse.de
- skip files handled by tmpfile mechnism in regular ghost file check
(move-ghost-file-check-to-TmpFilesCh.diff)
-------------------------------------------------------------------
Tue May 19 11:35:07 UTC 2015 - lnussel@suse.de
- fix update_git.sh
- make sure tmpfiles are listed in %files
(add-check-for-tmpfiles-created-at-r.diff)
- don't complain about missingok ghost files
(fix-ghost-file-handling.diff)
- remove obsolete check for %defattr in spec files
(remove-files-attr-not-set-check.diff)
-------------------------------------------------------------------
Fri Apr 24 07:56:05 UTC 2015 - tserong@suse.com
- added standard user and group ceph (bnc#928492)
-------------------------------------------------------------------
Wed Apr 22 12:17:30 UTC 2015 - krahmer@suse.com
- fixing some .conf/.service suffixes
-------------------------------------------------------------------
Wed Apr 22 11:51:33 UTC 2015 - krahmer@suse.com
- adding realmd DBUS service (bnc#916766)
-------------------------------------------------------------------
Mon Apr 20 14:10:14 UTC 2015 - lnussel@suse.de
- update save-content-to-an-array.diff with upstream version
-------------------------------------------------------------------
Fri Apr 10 11:16:01 UTC 2015 - lnussel@suse.de
- new versioin 1.6
- add script update_git.sh based on qemu's to simplify importing
a patch series from git after rebasing.
* Patches dropped:
0001-Python-3-compatibility-tweaks.patch (upstream)
0001-Set-Python-3.4-magic-number-to-3310.patch (upstream)
add-scoring-support.diff (different upstream solution)
check-buildroot-during-install.diff (need to fix no-cleaning-of-buildroot check upstream)
fix-versioned-prereq.diff (was disabled, not sure what it's useful for)
ignore-non-readable-in-etc.diff (filtered anyways)
locale-support.diff (drop)
locale-update.diff (different upstream solution now)
more-verbose-lsb-check.diff (drop)
perl-versioned-rpath-deps.diff (upstream)
rpmlint-1.5-disallow-var-run-and-var-lock.diff (upstream)
rpmlint-1.5-Fix-setgroups-error-name.diff (upstream)
rpmlint-decode-fix.diff (different upstream solution)
rpmlint-fix-unexpanded-macros-for-array-values.patch (different upstream solution)
stricter-tags-check.diff (merged in weak deps and check-for-self-provides.diff)
suppress-for-perl-python.diff (use filter instead)
suse-binary-info-compile-opts.diff (drop)
suse-changelog.patch (change config instead)
suse-mono-deps-checks.diff (useful?)
suse-required-lsb-tags.diff (different upstream solution)
verify-buildrequires.diff (very build system specific, drop)
xdg-check-exception.diff (upstream)
* renamed patches:
script-interpreter-only-for-exec-scripts.diff
-> script-interpreter-only-for-exec-sc.diff
confusing-invalid-spec-name.patch
-> confusing-invalid-spec-name.diff
suse-manpages-for-rc-scripts.patch
-> suse-manpages-for-rc-scripts.diff
sysv5-init-checks.diff
-> suse-sysv-init-checks.diff
* added patches:
check-for-self-provides.diff
save-content-to-an-array.diff
-------------------------------------------------------------------
Thu Apr 9 08:13:46 UTC 2015 - meissner@suse.com

View File

@ -25,7 +25,7 @@ BuildRequires: xz
Summary: Rpm correctness checker
License: GPL-2.0+
Group: System/Packages
Version: 1.5
Version: 1.6
Release: 0
Source0: https://downloads.sourceforge.net/project/rpmlint/rpmlint-%{version}.tar.xz
Source1: rpmlint-checks-master.tar.gz
@ -33,6 +33,7 @@ Source2: config
Source3: config.in
Source11: pie.config
Source12: licenses.config
Source98: update_git.sh
Source99: README.packaging.txt
Source100: syntax-validator.py
Url: https://sourceforge.net/projects/rpmlint/
@ -49,88 +50,69 @@ Requires: python-magic
Requires: rpm-python
# Requirement for ErlangCheck.py (pull-request #2).
Requires: python-pybeam
BuildArch: noarch
#
# Read README.packaging.txt before making any changes to this
# package
#
Patch0: rpmlint-suse.diff
Patch1: suse-checks.diff
Patch2: suse-version.diff
Patch3: suse-url-check.diff
Patch5: suse-python3-naming-policy.diff
Patch6: suse-filesystem.diff
Patch7: suse-pkg-config-check.diff
Patch8: suse-binarieschecks.diff
Patch9: no-doc-for-lib.diff
Patch10: add-scoring-support.diff
Patch11: suse-filter-exception.diff
Patch12: usr-arch.diff
Patch13: script-interpreter-only-for-exec-scripts.diff
Patch14: sourced-dirs.diff
Patch15: suse-filter-more-verbose.diff
Patch17: docdata-examples.diff
Patch18: 0001-Python-3-compatibility-tweaks.patch
Patch19: yast-provides.diff
Patch20: xdg-paths-update.diff
Patch22: better-wrong-script.diff
Patch23: buildroot-doc.diff
Patch24: sysv5-init-checks.diff
Patch26: ignore-non-readable-in-etc.diff
Patch29: rpmgroup-checks.diff
Patch30: devel-provide-is-devel-package.diff
Patch31: only-reg-files-are-scripts.diff
Patch33: check-buildroot-during-install.diff
Patch34: verify-buildrequires.diff
Patch35: fix-versioned-prereq.diff
Patch37: buildroot-in-scripts.diff
Patch39: libtool-wrapper-check.diff
Patch41: perl-versioned-rpath-deps.diff
Patch42: suse-check-optional-dependencies.diff
Patch46: locale-support.diff
# not is also in CheckFilelist.py
Patch47: noarch-lib64.diff
Patch49: stricter-tags-check.diff
Patch50: suse-no-run-ldconfig.diff
Patch51: description-check.diff
# this is the wrong place here
Patch52: suppress-for-perl-python.diff
Patch54: locale-update.diff
Patch57: suse-mono-deps-checks.diff
Patch58: add-weak-dependencies.diff
Patch60: selfconflicts-provide.diff
Patch62: no-badness-return.diff
Patch65: suse-shlib-devel-dependency.diff
Patch67: suse-required-lsb-tags.diff
Patch68: more-verbose-lsb-check.diff
Patch71: suse-binary-info-compile-opts.diff
Patch72: version-control-internal-file.diff
Patch73: avoid-mismatched-libregex.diff
Patch74: filename-non-utf8-exception.diff
Patch75: stricter-interpreter-check.diff
Patch76: confusing-invalid-spec-name.patch
Patch77: rpmlint-pkg-quoting.diff
Patch78: suse-g-ir-chech.diff
Patch80: remove-expand-macros.diff
Patch81: suse-whitelist-opensuse.diff
Patch84: extend-suse-conffiles-check.diff
Patch85: suse-changelog.patch
Patch87: compressed-backup-regex.diff
# accepted upstream
Patch88: suse-speccheck-utf8.diff
Patch89: suse-python-abi-check.diff
# PATCH-FIX-OPENSUSE: saschpe@suse.de - Don't complain about missing man-pages for rc-scripts
Patch91: suse-manpages-for-rc-scripts.patch
# PATCH-FIX-UPSTREAM: lnussel@suse.de - Fix setgroups error name
Patch92: rpmlint-1.5-Fix-setgroups-error-name.diff
Patch93: xdg-check-exception.diff
Patch94: suse-ignore-specfile-errors.diff
Patch95: invalid-filerequires.diff
Patch96: rpmlint-decode-fix.diff
Patch97: rpmlint-fix-unexpanded-macros-for-array-values.patch
# PATCH-FIX-UPSTREAM: lnussel@suse.de - disallow /var/run and /var/lock
Patch98: rpmlint-1.5-disallow-var-run-and-var-lock.diff
Patch99: 0001-Set-Python-3.4-magic-number-to-3310.patch
# PATCHLIST BEGIN
Patch00: rpmlint-suse.diff
Patch01: suse-checks.diff
Patch02: suse-version.diff
Patch03: suse-url-check.diff
Patch04: suse-python3-naming-policy.diff
Patch05: suse-filesystem.diff
Patch06: suse-pkg-config-check.diff
Patch07: suse-binarieschecks.diff
Patch08: no-doc-for-lib.diff
Patch09: suse-filter-exception.diff
Patch10: usr-arch.diff
Patch11: script-interpreter-only-for-exec-sc.diff
Patch12: sourced-dirs.diff
Patch13: suse-filter-more-verbose.diff
Patch14: docdata-examples.diff
Patch15: yast-provides.diff
Patch16: xdg-paths-update.diff
Patch17: better-wrong-script.diff
Patch18: buildroot-doc.diff
Patch19: rpmgroup-checks.diff
Patch20: devel-provide-is-devel-package.diff
Patch21: only-reg-files-are-scripts.diff
Patch22: buildroot-in-scripts.diff
Patch23: libtool-wrapper-check.diff
Patch24: suse-check-optional-dependencies.diff
Patch25: noarch-lib64.diff
Patch26: suse-no-run-ldconfig.diff
Patch27: description-check.diff
Patch28: add-weak-dependencies.diff
Patch29: selfconflicts-provide.diff
Patch30: no-badness-return.diff
Patch31: suse-shlib-devel-dependency.diff
Patch32: version-control-internal-file.diff
Patch33: avoid-mismatched-libregex.diff
Patch34: filename-non-utf8-exception.diff
Patch35: stricter-interpreter-check.diff
Patch36: confusing-invalid-spec-name.diff
Patch37: rpmlint-pkg-quoting.diff
Patch38: suse-g-ir-chech.diff
Patch39: remove-expand-macros.diff
Patch40: suse-whitelist-opensuse.diff
Patch41: extend-suse-conffiles-check.diff
Patch42: compressed-backup-regex.diff
Patch43: suse-speccheck-utf8.diff
Patch44: suse-python-abi-check.diff
Patch45: suse-manpages-for-rc-scripts.diff
Patch46: suse-ignore-specfile-errors.diff
Patch47: invalid-filerequires.diff
Patch48: suse-sysv-init-checks.diff
Patch49: check-for-self-provides.diff
Patch50: save-content-to-an-array.diff
Patch51: add-check-for-tmpfiles-created-at-r.diff
Patch52: fix-ghost-file-handling.diff
Patch53: remove-files-attr-not-set-check.diff
Patch54: move-ghost-file-check-to-TmpFilesCh.diff
# PATCHLIST END
# BuildArch must at the and. is a bug: https://bugzilla.suse.com/show_bug.cgi?id=926766
BuildArch: noarch
%py_requires
@ -139,80 +121,7 @@ Rpmlint is a tool to check common errors on rpm packages. Binary and
source packages can be checked.
%prep
%setup -q -n rpmlint-%{version} -a1
%patch0
%patch1
%patch2
%patch3
%patch5
%patch6
%patch7
%patch8
%patch9
#%patch10
%patch11
%patch12
%patch13
%patch14
%patch15
%patch17
%patch18 -p1
%patch19
%patch20
%patch22
%patch23
%patch24
#%patch26
%patch29
%patch30
%patch31
# needs rediff
#%patch33
#%patch34
#%patch35
%patch37
%patch39
#%patch41
%patch42
#%patch46
%patch47
#%patch49
%patch50
%patch51
#%patch52
### rediff!
#%patch54
#%patch57
%patch58
%patch60
%patch62
%patch65
#%patch67
#%patch68
#%patch71
%patch72
%patch73
%patch74
%patch75
%patch76 -p1
%patch77
%patch78
%patch80
%patch81
%patch84
%patch85
%patch87
%patch88
%patch89
%patch91 -p1
%patch92 -p1
%patch93 -p1
%patch94
%patch95
%patch96 -p1
%patch97 -p1
%patch98 -p1
%patch99 -p1
%autosetup -n rpmlint-%{version} -a1 -p1
cp -p %{SOURCE2} .
# Only move top-level python files
chmod 0755 rpmlint-checks-master/*.py
@ -251,5 +160,6 @@ rm -rf $RPM_BUILD_ROOT
%config %{_sysconfdir}/rpmlint/licenses.config
%dir /etc/rpmlint
/usr/share/man/man1/rpmlint.1.gz
/usr/share/man/man1/rpmdiff.1.gz
%changelog

View File

@ -0,0 +1,28 @@
From: Ludwig Nussel <ludwig.nussel@suse.de>
Date: Fri, 10 Apr 2015 16:22:26 +0200
Subject: [PATCH] save content to an array
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
due to the following join the generator would be at the end so iterating
through lines wouldn't work
Modified-by: Ville Skyttä <ville.skytta@iki.fi> (pep8 fixes)
---
InitScriptCheck.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/InitScriptCheck.py b/InitScriptCheck.py
index 1a58562..aab1d2d 100644
--- a/InitScriptCheck.py
+++ b/InitScriptCheck.py
@@ -103,7 +103,7 @@ class InitScriptCheck(AbstractCheck.AbstractCheck):
# check common error in file content
content = None
try:
- content = Pkg.readlines(pkgfile.path)
+ content = [x for x in Pkg.readlines(pkgfile.path)]
except Exception:
e = sys.exc_info()[1]
printWarning(pkg, 'read-error', e)

View File

@ -0,0 +1,22 @@
From: Some One <nobody@opensuse.org>
Date: Thu, 9 Apr 2015 14:55:38 +0200
Subject: [PATCH] script-interpreter-only-for-exec-scripts.diff
===================================================================
---
FilesCheck.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/FilesCheck.py b/FilesCheck.py
index 5929146..80148c4 100644
--- a/FilesCheck.py
+++ b/FilesCheck.py
@@ -1242,7 +1242,7 @@ class FilesCheck(AbstractCheck.AbstractCheck):
# ...but executed ones should
elif interpreter or mode_is_exec or script_regex.search(f):
if interpreter:
- if not interpreter_regex.search(interpreter):
+ if mode & 0111 != 0 and not interpreter_regex.search(interpreter):
printError(pkg, 'wrong-script-interpreter',
f, interpreter)
elif not nonexec_file and not \

View File

@ -1,13 +0,0 @@
Index: FilesCheck.py
===================================================================
--- FilesCheck.py.orig
+++ FilesCheck.py
@@ -1219,7 +1219,7 @@ class FilesCheck(AbstractCheck.AbstractC
elif interpreter or mode & 0111 != 0 or \
script_regex.search(f):
if interpreter:
- if not interpreter_regex.search(interpreter):
+ if mode & 0111 != 0 and not interpreter_regex.search(interpreter):
printError(pkg, 'wrong-script-interpreter',
f, interpreter)
elif not nonexec_file and not \

View File

@ -1,8 +1,17 @@
Index: TagsCheck.py
From: Some One <nobody@opensuse.org>
Date: Thu, 9 Apr 2015 14:55:39 +0200
Subject: [PATCH] selfconflicts-provide.diff
===================================================================
--- TagsCheck.py.orig
+++ TagsCheck.py
@@ -827,6 +827,7 @@ class TagsCheck(AbstractCheck.AbstractCh
---
TagsCheck.py | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/TagsCheck.py b/TagsCheck.py
index 6528d5b..18cbb6e 100644
--- a/TagsCheck.py
+++ b/TagsCheck.py
@@ -829,6 +829,7 @@ class TagsCheck(AbstractCheck.AbstractCheck):
obs_names = [x[0] for x in pkg.obsoletes()]
prov_names = [x[0].split(':/')[0] for x in pkg.provides()]
@ -10,7 +19,7 @@ Index: TagsCheck.py
for o in (x for x in obs_names if x not in prov_names):
printWarning(pkg, 'obsolete-not-provided', o)
@@ -838,6 +839,8 @@ class TagsCheck(AbstractCheck.AbstractCh
@@ -840,6 +841,8 @@ class TagsCheck(AbstractCheck.AbstractCheck):
# https://bugzilla.redhat.com/460872
useless_provides = []
for p in prov_names:
@ -19,7 +28,7 @@ Index: TagsCheck.py
if prov_names.count(p) != 1 and p not in useless_provides:
useless_provides.append(p)
for p in useless_provides:
@@ -978,6 +981,10 @@ the Release tag.''',
@@ -999,6 +1002,10 @@ the Release tag.''',
'''There is no Name tag in your package. You have to specify a name using the
Name tag.''',

View File

@ -1,9 +1,18 @@
Index: FilesCheck.py
From: Some One <nobody@opensuse.org>
Date: Thu, 9 Apr 2015 14:55:38 +0200
Subject: [PATCH] sourced-dirs.diff
===================================================================
--- FilesCheck.py.orig
+++ FilesCheck.py
@@ -634,7 +634,7 @@ manifest_perl_regex = re.compile('^/usr/
shebang_regex = re.compile('^#!\s*(\S+)')
---
FilesCheck.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/FilesCheck.py b/FilesCheck.py
index 80148c4..c485125 100644
--- a/FilesCheck.py
+++ b/FilesCheck.py
@@ -642,7 +642,7 @@ manifest_perl_regex = re.compile('^/usr/share/doc/perl-.*/MANIFEST(\.SKIP)?$')
shebang_regex = re.compile(b'^#!\s*(\S+)')
interpreter_regex = re.compile('^/(usr/)?(s?bin|games|libexec(/.+)?|(lib(64)?|share)/.+)/[^/]+$')
script_regex = re.compile('^/((usr/)?s?bin|etc/(rc\.d/init\.d|X11/xinit\.d|cron\.(hourly|daily|monthly|weekly)))/')
-sourced_script_regex = re.compile('^/etc/(bash_completion\.d|profile\.d)/')

View File

@ -1,8 +1,17 @@
Index: FilesCheck.py
From: Some One <nobody@opensuse.org>
Date: Thu, 9 Apr 2015 14:55:39 +0200
Subject: [PATCH] stricter-interpreter-check.diff
===================================================================
--- FilesCheck.py.orig
+++ FilesCheck.py
@@ -1245,7 +1245,8 @@ class FilesCheck(AbstractCheck.AbstractC
---
FilesCheck.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/FilesCheck.py b/FilesCheck.py
index 14cfca3..1b68dd5 100644
--- a/FilesCheck.py
+++ b/FilesCheck.py
@@ -1265,7 +1265,8 @@ class FilesCheck(AbstractCheck.AbstractCheck):
f.endswith('.la')):
printError(pkg, 'script-without-shebang', f)
@ -11,4 +20,4 @@ Index: FilesCheck.py
+ interpreter and interpreter.startswith("/"):
printError(pkg, 'non-executable-script', f,
oct(perm), interpreter)
if '\r' in chunk:
if b'\r' in chunk:

View File

@ -1,84 +0,0 @@
--- TagsCheck.py
+++ TagsCheck.py
@@ -509,7 +509,7 @@
printError(pkg, 'explicit-lib-dependency', d[0])
if d[2] == rpm.RPMSENSE_EQUAL and string.find(d[1], '-') != -1:
printWarning(pkg, 'requires-on-release', d[0], d[1])
- if string.find(d[1], '%') != -1:
+ if string.find(d[1], '%') != -1 or string.find(d[0], '%') != -1:
printError(pkg, 'percent-in-dependency', d[0], d[1])
if not name:
@@ -680,6 +680,7 @@
obs_names = map(lambda x: x[0], pkg.obsoletes())
prov_names = map(lambda x: x[0].split(':/')[0], pkg.provides())
+ req_names = map(lambda x: x[0], pkg.requires() + pkg.prereq())
if pkg.name in obs_names:
printError(pkg, 'obsolete-on-name')
@@ -687,7 +688,7 @@
if not o in prov_names:
printWarning(pkg, 'obsolete-not-provided', o)
for o in pkg.obsoletes():
- if string.find(o[1], '%') != -1:
+ if string.find(o[1], '%') != -1 or string.find(o[0], '%') != -1:
printError(pkg, 'percent-in-obsoletes', o[0], o[1])
# TODO: should take versions, <, <=, =, >=, > into account here
@@ -700,14 +701,41 @@
for p in useless_provides:
printError(pkg, 'useless-provides', p)
+ useless_reqs=set()
+ for r in req_names:
+ if not r in useless_reqs:
+ useless_reqs.add(r)
+ else:
+ if r[0] != '/':
+ printWarning(pkg, 'useless-explicit-requires', r)
+
for p in pkg.provides():
- if string.find(p[1], '%') != -1:
+ if string.find(p[1], '%') != -1 or string.find(p[0], '%') != -1:
printError(pkg, 'percent-in-provides', p[0], p[1])
+ if p[0] == pkg.name and not p[1]:
+ printError(pkg, 'unversioned-explicit-self-provides', p[0])
+
for c in pkg.conflicts():
- if string.find(c[1], '%') != -1:
+ if string.find(c[1], '%') != -1 or string.find(c[0], '%') != -1:
printError(pkg, 'percent-in-conflicts', c[0], c[1])
+ for c in pkg.supplements():
+ if string.find(c[1], '%') != -1 or string.find(c[0], '%') != -1:
+ printError(pkg, 'percent-in-supplements', c[0], c[1])
+
+ for c in pkg.suggests():
+ if string.find(c[1], '%') != -1 or string.find(c[0], '%') != -1:
+ printError(pkg, 'percent-in-suggests', c[0], c[1])
+
+ for c in pkg.enhances():
+ if string.find(c[1], '%') != -1 or string.find(c[0], '%') != -1:
+ printError(pkg, 'percent-in-enhances', c[0], c[1])
+
+ for c in pkg.recommends():
+ if string.find(c[1], '%') != -1 or string.find(c[0], '%') != -1:
+ printError(pkg, 'percent-in-recommends', c[0], c[1])
+
expected='%s-%s-%s.%s.rpm' % (name, version, release, pkg.arch)
basename=string.split(pkg.filename, '/')[-1]
if basename != expected:
@@ -897,6 +925,10 @@
'''This package provides 2 times the same capacity. It should only provide it
once.''',
+'unversioned-explicit-self-provides',
+'''This package provides it's own name explicitely, which might break
+upgrade path. self-provides are autogenerated. Remove the provide.''',
+
'obsolete-on-name',
'''A package should not obsolete itself, as it can cause weird errors in tools.''',
Nur in b/rpmlint-0.85: TagsCheck.py.rej.

View File

@ -1,20 +0,0 @@
--- FilesCheck.py
+++ FilesCheck.py
@@ -971,7 +971,7 @@ class FilesCheck(AbstractCheck.AbstractCheck):
if not perl_dep_error:
res=perl_regex.search(f)
- if res:
+ if res and not pkg.name in ('perl', 'perl-base'):
if perl_version_trick:
vers = res.group(1) + '.' + res.group(2)
else:
@@ -981,7 +981,7 @@ class FilesCheck(AbstractCheck.AbstractCheck):
printError(pkg, 'no-dependency-on', 'perl-base', vers)
perl_dep_error=1
- if not python_dep_error:
+ if not python_dep_error and not pkg.name in ('python', 'python-base'):
res=python_regex.search(f)
if res:
if not (pkg.check_versioned_dep('python-base', res.group(1)) or

View File

@ -1,12 +1,17 @@
Index: BinariesCheck.py
From: Some One <nobody@opensuse.org>
Date: Thu, 9 Apr 2015 14:55:38 +0200
Subject: [PATCH] suse-binarieschecks.diff
===================================================================
--- BinariesCheck.py.orig
+++ BinariesCheck.py
@@ -9,13 +9,15 @@
import re
import stat
+import os
---
BinariesCheck.py | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++--
1 file changed, 56 insertions(+), 2 deletions(-)
diff --git a/BinariesCheck.py b/BinariesCheck.py
index 4634eed..a74d3e3 100644
--- a/BinariesCheck.py
+++ b/BinariesCheck.py
@@ -14,7 +14,7 @@ import sys
import rpm
@ -15,11 +20,7 @@ Index: BinariesCheck.py
import AbstractCheck
import Config
import Pkg
+import os
DEFAULT_SYSTEM_LIB_PATHS = (
@@ -42,6 +44,9 @@ class BinaryInfo:
@@ -46,6 +46,9 @@ class BinaryInfo:
unused_regex = re.compile('^\s+(\S+)')
exit_call_regex = create_regexp_call('_?exit')
fork_call_regex = create_regexp_call('fork')
@ -27,9 +28,9 @@ Index: BinariesCheck.py
+ symtab_regex=re.compile('^\s+\[\s*\d+\]\s+\.symtab\s+')
+ gethostbyname_call_regex = re.compile('\s+FUNC\s+.*?\s+(gethostbyname(?:@\S+)?)(?:\s|$)')
# regexp for setgid setegid setresgid set(?:res|e)?gid
setgid_call_regex = create_regexp_call(['setresgid','setegid','setgid'])
setuid_call_regex = create_regexp_call(['setresuid','seteuid','setuid'])
@@ -62,7 +67,10 @@ class BinaryInfo:
setgid_call_regex = create_regexp_call(['setresgid', 'setegid', 'setgid'])
setuid_call_regex = create_regexp_call(['setresuid', 'seteuid', 'setuid'])
@@ -66,7 +69,10 @@ class BinaryInfo:
self.stack = False
self.exec_stack = False
self.exit_calls = []
@ -40,7 +41,7 @@ Index: BinariesCheck.py
self.tail = ''
self.setgid = False
@@ -131,6 +139,11 @@ class BinaryInfo:
@@ -135,6 +141,11 @@ class BinaryInfo:
self.exec_stack = True
continue
@ -52,7 +53,7 @@ Index: BinariesCheck.py
if is_shlib:
r = BinaryInfo.exit_call_regex.search(l)
if r:
@@ -141,6 +154,14 @@ class BinaryInfo:
@@ -145,6 +156,14 @@ class BinaryInfo:
fork_called = True
continue
@ -67,7 +68,7 @@ Index: BinariesCheck.py
if self.non_pic:
self.non_pic = 'TEXTREL' in res[1]
@@ -330,13 +351,26 @@ class BinariesCheck(AbstractCheck.Abstra
@@ -339,13 +358,26 @@ class BinariesCheck(AbstractCheck.AbstractCheck):
continue
# stripped ?
@ -95,7 +96,7 @@ Index: BinariesCheck.py
if is_shlib:
has_lib = True
@@ -386,6 +420,10 @@ class BinariesCheck(AbstractCheck.Abstra
@@ -396,6 +428,10 @@ class BinariesCheck(AbstractCheck.AbstractCheck):
for ec in bin_info.exit_calls:
printWarning(pkg, 'shared-lib-calls-exit', fname, ec)
@ -106,7 +107,7 @@ Index: BinariesCheck.py
# rpath ?
if bin_info.rpath:
for p in bin_info.rpath:
@@ -590,6 +628,14 @@ with the intended shared libraries only.
@@ -603,6 +639,14 @@ with the intended shared libraries only.''',
'ldd-failed',
'''Executing ldd on this file failed, all checks could not be run.''',
@ -121,7 +122,7 @@ Index: BinariesCheck.py
'executable-stack',
'''The binary declares the stack as executable. Executable stack is usually an
error as it is only needed if the code contains GCC trampolines or similar
@@ -602,6 +648,10 @@ don\'t define a proper .note.GNU-stack s
@@ -615,6 +659,10 @@ don\'t define a proper .note.GNU-stack section.''',
make the stack executable. Usual suspects include use of a non-GNU linker or
an old GNU linker version.''',
@ -132,7 +133,7 @@ Index: BinariesCheck.py
'shared-lib-calls-exit',
'''This library package calls exit() or _exit(), probably in a non-fork()
context. Doing so from a library is strongly discouraged - when a library
@@ -620,6 +670,12 @@ that use prelink, make sure that prelink
@@ -633,6 +681,12 @@ that use prelink, make sure that prelink does not strip it either, usually by
placing a blacklist file in /etc/prelink.conf.d. For more information, see
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=256900#49''',

View File

@ -1,25 +0,0 @@
--- BinariesCheck.py
+++ BinariesCheck.py
@@ -56,10 +56,11 @@
self.debuginfo=0
self.symtab=0
self.tail = ''
+ self.compileOpts = set()
is_debug=BinaryInfo.debug_file_regex.search(path)
- cmd = ['env', 'LC_ALL=C', 'readelf', '-W', '-S', '-l', '-d', '-s']
+ cmd = ['env', 'LC_ALL=C', 'readelf', '-W', '-S', '-l', '-d', '-s', '-p', '.comment.SUSE.OPTs']
cmd.append(path)
res = Pkg.getstatusoutput(cmd)
if not res[0]:
@@ -115,6 +116,9 @@
self.symtab=1
continue
+ if l.lower().find(" ospwg") != -1:
+ self.compileOpts.add(l.rpartition(' ')[2])
+
if self.non_pic:
self.non_pic=BinaryInfo.non_pic_regex.search(res[1])

View File

@ -1,15 +0,0 @@
Index: TagsCheck.py
===================================================================
--- TagsCheck.py.orig
+++ TagsCheck.py
@@ -1032,8 +1032,8 @@ Development/''',
"%s".''' % '", "'.join(VALID_GROUPS),
'no-changelogname-tag',
-'''There is no %changelog tag in your spec file. To insert it, just insert a
-'%changelog' in your spec file and rebuild it.''',
+'''There is no changelog. Please insert a '%changelog' section heading in your
+spec file and prepare your changes file using e.g. the 'osc vc' command.''',
'no-version-in-last-changelog',
'''The latest changelog entry doesn't contain a version. Please insert the

View File

@ -1,8 +1,17 @@
Index: FilesCheck.py
From: Some One <nobody@opensuse.org>
Date: Thu, 9 Apr 2015 14:55:39 +0200
Subject: [PATCH] suse-check-optional-dependencies.diff
===================================================================
--- FilesCheck.py.orig
+++ FilesCheck.py
@@ -908,6 +908,16 @@ class FilesCheck(AbstractCheck.AbstractC
---
FilesCheck.py | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)
diff --git a/FilesCheck.py b/FilesCheck.py
index ae9c364..7d2b92f 100644
--- a/FilesCheck.py
+++ b/FilesCheck.py
@@ -926,6 +926,16 @@ class FilesCheck(AbstractCheck.AbstractCheck):
if res.group(1) != pkg.name:
printError(pkg, 'incoherent-logrotate-file', f)
@ -19,7 +28,7 @@ Index: FilesCheck.py
if link != '':
ext = compr_regex.search(link)
if ext:
@@ -1730,6 +1740,24 @@ consequences), or other compiler flags w
@@ -1717,6 +1727,24 @@ consequences), or other compiler flags which result in rpmbuild's debuginfo
extraction not working as expected. Verify that the binaries are not
unexpectedly stripped and that the intended compiler flags are used.''',

View File

@ -1,7 +1,16 @@
Index: Config.py
From: Some One <nobody@opensuse.org>
Date: Thu, 9 Apr 2015 14:55:37 +0200
Subject: [PATCH] suse-checks.diff
===================================================================
--- Config.py.orig
+++ Config.py
---
Config.py | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/Config.py b/Config.py
index ac3c5ea..f27607c 100644
--- a/Config.py
+++ b/Config.py
@@ -16,14 +16,13 @@ try:
except ImportError:
__version__ = 'devel'

View File

@ -1,8 +1,17 @@
Index: FilesCheck.py
From: Some One <nobody@opensuse.org>
Date: Thu, 9 Apr 2015 14:55:38 +0200
Subject: [PATCH] suse-filesystem.diff
===================================================================
--- FilesCheck.py.orig
+++ FilesCheck.py
@@ -103,24 +103,415 @@ STANDARD_DIRS = (
---
FilesCheck.py | 454 +++++++++++++++++++++++++++++++++++++++++++++++++++++++---
1 file changed, 437 insertions(+), 17 deletions(-)
diff --git a/FilesCheck.py b/FilesCheck.py
index 1a70779..9532011 100644
--- a/FilesCheck.py
+++ b/FilesCheck.py
@@ -102,24 +102,415 @@ STANDARD_DIRS = (
'/usr/local/man/mann',
'/usr/local/sbin',
'/usr/local/share',
@ -429,7 +438,7 @@ Index: FilesCheck.py
'/usr/share/man',
'/usr/share/man/man1',
'/usr/share/man/man2',
@@ -132,28 +523,57 @@ STANDARD_DIRS = (
@@ -131,25 +522,54 @@ STANDARD_DIRS = (
'/usr/share/man/man8',
'/usr/share/man/man9',
'/usr/share/man/mann',
@ -473,14 +482,11 @@ Index: FilesCheck.py
+ '/var/lib/nobody',
+ '/var/lib/pam_devperm',
+ '/var/lib/wwwrun',
'/var/lock',
'/var/lock/subsys',
'/var/log',
'/var/mail',
- '/var/nis',
'/var/opt',
- '/var/preserve',
'/var/run',
'/var/spool',
+ '/var/spool/clientmqueue',
+ '/var/spool/locks',

View File

@ -1,8 +1,17 @@
Index: Config.py
From: Some One <nobody@opensuse.org>
Date: Thu, 9 Apr 2015 14:55:38 +0200
Subject: [PATCH] suse-filter-exception.diff
===================================================================
--- Config.py.orig
+++ Config.py
@@ -102,11 +102,23 @@ def getOption(name, default = ""):
---
Config.py | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++++++-------
1 file changed, 54 insertions(+), 7 deletions(-)
diff --git a/Config.py b/Config.py
index f27607c..b4e19cc 100644
--- a/Config.py
+++ b/Config.py
@@ -111,12 +111,23 @@ def getOption(name, default=""):
_filters = []
_filters_re = None
@ -11,7 +20,7 @@ Index: Config.py
+
+_filters_except = []
+_filters_except_re = None
+
def addFilter(s):
global _filters_re
+ global _filters_except
@ -26,10 +35,10 @@ Index: Config.py
- _filters.append(s)
- _filters_re = None
def removeFilter(s):
global _filters_re
@@ -121,19 +133,38 @@ def removeFilter(s):
_scoring = {}
@@ -133,8 +144,13 @@ _scoring = {}
def setBadness(s, score):
+ global _scoring
@ -39,11 +48,11 @@ Index: Config.py
+ global _filters_except
+
+ _filters_except.append(s)
+
def badness(s):
return _scoring.get(s, 0)
@@ -144,11 +160,24 @@ _non_named_group_re = re.compile('[^\\](\()[^:]')
_non_named_group_re = re.compile('[^\\](\()[^:]')
def isFiltered(s):
global _filters_re
+ global _filters_except
@ -51,7 +60,7 @@ Index: Config.py
+ global _filters_non_except
+ global _filters_non_except_re
- if _filters_re == None:
- if _filters_re is None:
- # no filter
- if len(_filters) == 0:
- return False
@ -71,8 +80,8 @@ Index: Config.py
_filters_re = '(?:' + _filters[0] + ')'
for idx in range(1, len(_filters)):
@@ -145,9 +176,27 @@ def isFiltered(s):
_filters_re = _filters_re + '|(?:' + _filters[idx] +')'
@@ -160,9 +189,27 @@ def isFiltered(s):
_filters_re = _filters_re + '|(?:' + _filters[idx] + ')'
_filters_re = re.compile(_filters_re)
+ if _filters_except_re == None and len(_filters_except):

View File

@ -1,7 +1,16 @@
Index: Config.py
From: Some One <nobody@opensuse.org>
Date: Thu, 9 Apr 2015 14:55:38 +0200
Subject: [PATCH] suse-filter-more-verbose.diff
===================================================================
--- Config.py.orig
+++ Config.py
---
Config.py | 25 +++++++++++++++++++++++--
1 file changed, 23 insertions(+), 2 deletions(-)
diff --git a/Config.py b/Config.py
index b4e19cc..c29db24 100644
--- a/Config.py
+++ b/Config.py
@@ -10,6 +10,7 @@
import locale
import os.path
@ -10,7 +19,7 @@ Index: Config.py
try:
from __version__ import __version__
@@ -162,7 +163,17 @@ def isFiltered(s):
@@ -175,7 +176,17 @@ def isFiltered(s):
if '(' in _filters_non_except[idx]:
_non_named_group_re.subn('(:?', _filters_non_except[idx])
_filters_non_except_re = _filters_non_except_re + '|(?:' + _filters_non_except[idx] +')'
@ -29,10 +38,10 @@ Index: Config.py
if _filters_re == None and len(_filters):
_filters_re = '(?:' + _filters[0] + ')'
@@ -174,7 +185,17 @@ def isFiltered(s):
@@ -187,7 +198,17 @@ def isFiltered(s):
if '(' in _filters[idx]:
_non_named_group_re.subn('(:?', _filters[idx])
_filters_re = _filters_re + '|(?:' + _filters[idx] +')'
_filters_re = _filters_re + '|(?:' + _filters[idx] + ')'
- _filters_re = re.compile(_filters_re)
+ try:
+ _filters_re = re.compile(_filters_re)

View File

@ -1,8 +1,17 @@
Index: FilesCheck.py
From: Some One <nobody@opensuse.org>
Date: Thu, 9 Apr 2015 14:55:40 +0200
Subject: [PATCH] suse-g-ir-chech.diff
===================================================================
--- FilesCheck.py.orig
+++ FilesCheck.py
@@ -599,7 +599,7 @@ points_regex = re.compile('^\.\./(.*)')
---
FilesCheck.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/FilesCheck.py b/FilesCheck.py
index 1b68dd5..0bb4b3d 100644
--- a/FilesCheck.py
+++ b/FilesCheck.py
@@ -607,7 +607,7 @@ points_regex = re.compile('^\.\./(.*)')
doc_regex = re.compile('^/usr(/share|/X11R6)?/(doc|man|info)/|^/opt/kde3/share/doc|^/usr/share/gnome/help')
bin_regex = re.compile('^/(?:usr/(?:s?bin|games)|s?bin)/(.*)')
includefile_regex = re.compile('\.(c|h)(pp|xx)?$', re.IGNORECASE)

View File

@ -1,10 +1,19 @@
Index: SpecCheck.py
From: Some One <nobody@opensuse.org>
Date: Thu, 9 Apr 2015 14:55:40 +0200
Subject: [PATCH] suse-ignore-specfile-errors.diff
===================================================================
--- SpecCheck.py.orig
+++ SpecCheck.py
@@ -537,9 +537,8 @@ class SpecCheck(AbstractCheck.AbstractCh
printWarning(pkg, "patch-not-applied", "Patch%d:" % pnum,
pfile)
---
SpecCheck.py | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/SpecCheck.py b/SpecCheck.py
index 60e946b..ace044c 100644
--- a/SpecCheck.py
+++ b/SpecCheck.py
@@ -562,9 +562,8 @@ class SpecCheck(AbstractCheck.AbstractCheck):
printWarning(pkg, "patch-not-applied",
"Patch%d:" % pnum, pfile)
- # Rest of the checks require a real spec file
- if not self._spec_file:

View File

@ -1,8 +1,17 @@
Index: rpmlint-1.5/FilesCheck.py
From: Some One <nobody@opensuse.org>
Date: Thu, 9 Apr 2015 14:55:40 +0200
Subject: [PATCH] suse-manpages-for-rc-scripts
===================================================================
--- rpmlint-1.5.orig/FilesCheck.py
+++ rpmlint-1.5/FilesCheck.py
@@ -1404,7 +1404,7 @@ class FilesCheck(AbstractCheck.AbstractC
---
FilesCheck.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/FilesCheck.py b/FilesCheck.py
index 214ac76..5342871 100644
--- a/FilesCheck.py
+++ b/FilesCheck.py
@@ -1426,7 +1426,7 @@ class FilesCheck(AbstractCheck.AbstractCheck):
for exe, paths in bindir_exes.items():
if len(paths) > 1:
printWarning(pkg, "duplicate-executable", exe, paths)

View File

@ -1,32 +0,0 @@
--- TagsCheck.py
+++ TagsCheck.py
@@ -686,6 +686,17 @@ class TagsCheck(AbstractCheck.AbstractCheck):
for p in useless_provides:
printError(pkg, 'useless-explicit-provides',p)
+ have_mono_reqs=False
+ for r in req_names + prov_names:
+ if r.startswith('mono('):
+ have_mono_reqs=True
+ break
+
+ if not have_mono_reqs:
+ for fname in pkg.files():
+ if fname.endswith('.dll'):
+ printError(pkg, 'mono-versioned-deps-missing', fname)
+
useless_reqs=set()
for r in reqs:
if not r in useless_reqs:
@@ -901,6 +912,11 @@ upgrade path. self-provides are autogenerated. Remove the provide.''',
'obsolete-on-name',
'''A package should not obsolete itself, as it can cause weird errors in tools.''',
+'mono-versioned-deps-missing',
+'''This package appears to be related to mono, but doesn't have versioned
+mono provides being generated. Add mono-devel to the buildrequires to
+build the package with the correct provides.''',
+
'invalid-filepath-dependency',
'''A package has a file or path based dependency that is not resolveable for
package solvers because it is not in the whitelist for path based dependencies

View File

@ -1,9 +1,18 @@
Index: SpecCheck.py
From: Some One <nobody@opensuse.org>
Date: Thu, 9 Apr 2015 14:55:39 +0200
Subject: [PATCH] suse-no-run-ldconfig.diff
===================================================================
--- SpecCheck.py.orig
+++ SpecCheck.py
@@ -424,6 +424,10 @@ class SpecCheck(AbstractCheck.AbstractCh
printWarning(pkg, 'comparison-operator-in-deptoken',
---
SpecCheck.py | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/SpecCheck.py b/SpecCheck.py
index 63897f2..12b6f2b 100644
--- a/SpecCheck.py
+++ b/SpecCheck.py
@@ -448,6 +448,10 @@ class SpecCheck(AbstractCheck.AbstractCheck):
'comparison-operator-in-deptoken',
conf)
+ if current_section in ('post', 'postun'):
@ -13,7 +22,7 @@ Index: SpecCheck.py
if current_section == 'changelog':
for match in AbstractCheck.macro_regex.findall(line):
res = re.match('%+', match)
@@ -748,6 +752,14 @@ may break short circuit builds.''',
@@ -773,6 +777,14 @@ may break short circuit builds.''',
'''Make check or other automated regression test should be run in %check, as
they can be disabled with a rpm macro for short circuiting purposes.''',

View File

@ -1,8 +1,17 @@
Index: TagsCheck.py
From: Some One <nobody@opensuse.org>
Date: Thu, 9 Apr 2015 14:55:38 +0200
Subject: [PATCH] suse-pkg-config-check.diff
===================================================================
--- TagsCheck.py.orig
+++ TagsCheck.py
@@ -415,6 +415,7 @@ lib_devel_number_regex = re.compile('^li
---
TagsCheck.py | 19 ++++++++++++++++++-
1 file changed, 18 insertions(+), 1 deletion(-)
diff --git a/TagsCheck.py b/TagsCheck.py
index d49239f..0a56b7d 100644
--- a/TagsCheck.py
+++ b/TagsCheck.py
@@ -416,6 +416,7 @@ lib_devel_number_regex = re.compile('^lib(.*?)([0-9.]+)(_[0-9.]+)?-devel')
invalid_url_regex = re.compile(Config.getOption('InvalidURL'), re.IGNORECASE)
lib_package_regex = re.compile('(?:^(?:compat-)?lib.*?(\.so.*)?|libs?[\d-]*)$', re.IGNORECASE)
leading_space_regex = re.compile('^\s+')
@ -10,7 +19,7 @@ Index: TagsCheck.py
license_regex = re.compile('\(([^)]+)\)|\s(?:and|or)\s')
invalid_version_regex = re.compile('([0-9](?:rc|alpha|beta|pre).*)', re.IGNORECASE)
# () are here for grouping purpose in the regexp
@@ -626,10 +627,12 @@ class TagsCheck(AbstractCheck.AbstractCh
@@ -634,10 +635,12 @@ class TagsCheck(AbstractCheck.AbstractCheck):
base = is_devel.group(1)
dep = None
has_so = False
@ -24,7 +33,7 @@ Index: TagsCheck.py
if has_so:
base_or_libs = base + '/' + base + '-libs/lib' + base
# try to match *%_isa as well (e.g. "(x86-64)", "(x86-32)")
@@ -666,6 +669,15 @@ class TagsCheck(AbstractCheck.AbstractCh
@@ -674,6 +677,15 @@ class TagsCheck(AbstractCheck.AbstractCheck):
if prov not in (x[0] for x in pkg.provides()):
printWarning(pkg, 'no-provides', prov)
@ -40,7 +49,7 @@ Index: TagsCheck.py
# List of words to ignore in spell check
ignored_words = set()
for pf in pkg.files():
@@ -1099,6 +1111,11 @@ once.''',
@@ -1112,6 +1124,11 @@ once.''',
'no-url-tag',
'''The URL tag is missing. Please add a http or ftp link to the project location.''',

View File

@ -1,8 +1,17 @@
Index: FilesCheck.py
From: Some One <nobody@opensuse.org>
Date: Thu, 9 Apr 2015 14:55:40 +0200
Subject: [PATCH] suse-python-abi-check.diff
===================================================================
--- FilesCheck.py.orig
+++ FilesCheck.py
@@ -1110,8 +1110,11 @@ class FilesCheck(AbstractCheck.AbstractC
---
FilesCheck.py | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/FilesCheck.py b/FilesCheck.py
index acb379f..214ac76 100644
--- a/FilesCheck.py
+++ b/FilesCheck.py
@@ -1129,8 +1129,11 @@ class FilesCheck(AbstractCheck.AbstractCheck):
if res and not (pkg.check_versioned_dep('python-base',
res.group(1)) or
pkg.check_versioned_dep('python',

View File

@ -1,7 +1,16 @@
Index: NamingPolicyCheck.py
From: Some One <nobody@opensuse.org>
Date: Thu, 9 Apr 2015 14:55:37 +0200
Subject: [PATCH] suse-python3-naming-policy.diff
===================================================================
--- NamingPolicyCheck.py.orig
+++ NamingPolicyCheck.py
---
NamingPolicyCheck.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/NamingPolicyCheck.py b/NamingPolicyCheck.py
index 231b936..96fb91d 100644
--- a/NamingPolicyCheck.py
+++ b/NamingPolicyCheck.py
@@ -90,7 +90,7 @@ check = NamingPolicyCheck()

View File

@ -1,11 +0,0 @@
--- InitScriptCheck.py
+++ InitScriptCheck.py
@@ -105,7 +105,7 @@ class InitScriptCheck(AbstractCheck.AbstractCheck):
# TODO: where is it specified that these (or some)
# keywords are mandatory?
- for i in ('Provides', 'Description', 'Short-Description'):
+ for i in ('Provides', 'Required-Start', 'Required-Stop', 'Default-Start'):
if i not in lsb_tags.keys():
printError(pkg, 'missing-mandatory-lsb-keyword', "%s in %s" % (i, f))
if in_lsb_tag:

View File

@ -1,8 +1,17 @@
Index: TagsCheck.py
From: Some One <nobody@opensuse.org>
Date: Thu, 9 Apr 2015 14:55:39 +0200
Subject: [PATCH] suse-shlib-devel-dependency.diff
===================================================================
--- TagsCheck.py.orig
+++ TagsCheck.py
@@ -639,10 +639,10 @@ class TagsCheck(AbstractCheck.AbstractCh
---
TagsCheck.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/TagsCheck.py b/TagsCheck.py
index 18cbb6e..fc392e5 100644
--- a/TagsCheck.py
+++ b/TagsCheck.py
@@ -642,10 +642,10 @@ class TagsCheck(AbstractCheck.AbstractCheck):
if pkg_config_regex.match(fname) and fname.endswith('.pc'):
has_pc = True
if has_so:

View File

@ -1,8 +1,17 @@
Index: SpecCheck.py
From: Some One <nobody@opensuse.org>
Date: Thu, 9 Apr 2015 14:55:40 +0200
Subject: [PATCH] suse-speccheck-utf8.diff
===================================================================
--- SpecCheck.py.orig
+++ SpecCheck.py
@@ -625,8 +625,8 @@ SPEC file to build a valid RPM package.'
---
SpecCheck.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/SpecCheck.py b/SpecCheck.py
index d0d381a..60e946b 100644
--- a/SpecCheck.py
+++ b/SpecCheck.py
@@ -650,8 +650,8 @@ SPEC file to build a valid RPM package.''',
("Name:" tag). Either rename your package or the specfile.''',
'non-utf8-spec-file',

View File

@ -0,0 +1,78 @@
From: Ludwig Nussel <ludwig.nussel@suse.de>
Date: Fri, 10 Apr 2015 14:38:22 +0200
Subject: [PATCH] suse sysv init checks
we don't use chkconfig but have different macros
---
InitScriptCheck.py | 44 ++++++++++++++++++++++++++++++--------------
1 file changed, 30 insertions(+), 14 deletions(-)
diff --git a/InitScriptCheck.py b/InitScriptCheck.py
index fb53d93..1a58562 100644
--- a/InitScriptCheck.py
+++ b/InitScriptCheck.py
@@ -36,6 +36,10 @@ LSB_KEYWORDS = ('Provides', 'Required-Start', 'Required-Stop', 'Should-Start',
RECOMMENDED_LSB_KEYWORDS = ('Provides', 'Required-Start', 'Required-Stop',
'Default-Stop', 'Short-Description')
+suse = True
+stop_on_removal_regex=re.compile('bin/systemctl stop \$service >/dev/null')
+restart_on_update_regex=re.compile('bin/systemctl try-restart \$service >/dev/null')
+insserv_cleanup_regex=re.compile('^\s*/sbin/insserv /etc/init.d$', re.MULTILINE)
class InitScriptCheck(AbstractCheck.AbstractCheck):
@@ -44,6 +48,12 @@ class InitScriptCheck(AbstractCheck.AbstractCheck):
def check_binary(self, pkg):
initscript_list = []
+
+ # check chkconfig call in %post and %preun
+ postin = Pkg.b2s(pkg[rpm.RPMTAG_POSTIN]) or pkg.scriptprog(rpm.RPMTAG_POSTINPROG)
+ preun = Pkg.b2s(pkg[rpm.RPMTAG_PREUN]) or pkg.scriptprog(rpm.RPMTAG_PREUNPROG)
+ postun = Pkg.b2s(pkg[rpm.RPMTAG_POSTUN]) or pkg.scriptprog(rpm.RPMTAG_POSTUNPROG)
+
for fname, pkgfile in pkg.files().items():
if not fname.startswith('/etc/init.d/') and \
@@ -61,20 +71,26 @@ class InitScriptCheck(AbstractCheck.AbstractCheck):
if "." in basename:
printError(pkg, 'init-script-name-with-dot', fname)
- # check chkconfig call in %post and %preun
- postin = Pkg.b2s(pkg[rpm.RPMTAG_POSTIN]) or \
- pkg.scriptprog(rpm.RPMTAG_POSTINPROG)
- if not postin:
- printError(pkg, 'init-script-without-chkconfig-postin', fname)
- elif not chkconfig_regex.search(postin):
- printError(pkg, 'postin-without-chkconfig', fname)
-
- preun = Pkg.b2s(pkg[rpm.RPMTAG_PREUN]) or \
- pkg.scriptprog(rpm.RPMTAG_PREUNPROG)
- if not preun:
- printError(pkg, 'init-script-without-chkconfig-preun', fname)
- elif not chkconfig_regex.search(preun):
- printError(pkg, 'preun-without-chkconfig', fname)
+ if not suse:
+ if not postin:
+ printError(pkg, 'init-script-without-chkconfig-postin', fname)
+ elif not chkconfig_regex.search(postin):
+ printError(pkg, 'postin-without-chkconfig', fname)
+
+ if not preun:
+ printError(pkg, 'init-script-without-chkconfig-preun', fname)
+ elif not chkconfig_regex.search(preun):
+ printError(pkg, 'preun-without-chkconfig', fname)
+
+ else:
+ if not preun or not stop_on_removal_regex.search(preun):
+ printError(pkg, 'init-script-without-%stop_on_removal-preun', fname)
+
+ if not postun or not restart_on_update_regex.search(postun):
+ printError(pkg, 'init-script-without-%restart_on_update-postun', fname)
+
+ if not postun or not insserv_cleanup_regex.search(postun):
+ printError(pkg, 'init-script-without-%insserv_cleanup-postun', fname)
status_found = False
reload_found = False

View File

@ -1,17 +1,26 @@
Index: TagsCheck.py
From: Some One <nobody@opensuse.org>
Date: Thu, 9 Apr 2015 14:55:37 +0200
Subject: [PATCH] suse-url-check.diff
===================================================================
--- TagsCheck.py.orig
+++ TagsCheck.py
@@ -781,7 +781,7 @@ class TagsCheck(AbstractCheck.AbstractCh
---
TagsCheck.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/TagsCheck.py b/TagsCheck.py
index fa38a07..d49239f 100644
--- a/TagsCheck.py
+++ b/TagsCheck.py
@@ -794,7 +794,7 @@ class TagsCheck(AbstractCheck.AbstractCheck):
if not valid_license:
self._unexpanded_macros(pkg, 'License', rpm_license)
- for tag in ('URL', 'DistURL', 'BugURL'):
+ for tag in ('URL', 'BugURL'):
if hasattr(rpm, 'RPMTAG_%s' % tag.upper()):
url = pkg[getattr(rpm, 'RPMTAG_%s' % tag.upper())]
self._unexpanded_macros(pkg, tag, url, is_url = True)
@@ -1097,7 +1097,7 @@ once.''',
url = Pkg.b2s(pkg[getattr(rpm, 'RPMTAG_%s' % tag.upper())])
self._unexpanded_macros(pkg, tag, url, is_url=True)
@@ -1110,7 +1110,7 @@ once.''',
'''This rpm requires a specific release of another package.''',
'no-url-tag',

View File

@ -1,16 +1,25 @@
Index: SpecCheck.py
From: Some One <nobody@opensuse.org>
Date: Thu, 9 Apr 2015 14:55:37 +0200
Subject: [PATCH] suse-version.diff
===================================================================
--- SpecCheck.py.orig
+++ SpecCheck.py
@@ -66,6 +66,7 @@ libdir_regex = re.compile('%{?_lib(?:dir
---
SpecCheck.py | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/SpecCheck.py b/SpecCheck.py
index 2b24b43..9ea5c6e 100644
--- a/SpecCheck.py
+++ b/SpecCheck.py
@@ -66,6 +66,7 @@ libdir_regex = re.compile('%{?_lib(?:dir)?\}?\\b')
comment_or_empty_regex = re.compile('^\s*(#|$)')
defattr_regex = re.compile('^\s*%defattr\\b')
attr_regex = re.compile('^\s*%attr\\b')
+suse_version_regex = re.compile('%suse_version\s*[<>=]+\s*(\d+)')
section_regexs = dict(
([x, re.compile('^%' + x + '(?:\s|$)')]
for x in ['build', 'changelog', 'check', 'clean', 'description', 'files',
@@ -369,6 +370,12 @@ class SpecCheck(AbstractCheck.AbstractCh
for x in ('build', 'changelog', 'check', 'clean', 'description', 'files',
@@ -387,6 +388,12 @@ class SpecCheck(AbstractCheck.AbstractCheck):
if not res.group(1).startswith('%'):
printWarning(pkg, 'hardcoded-prefix-tag', res.group(1))
@ -23,7 +32,7 @@ Index: SpecCheck.py
res = prereq_regex.search(line)
if res:
printError(pkg, 'prereq-use', res.group(2))
@@ -790,6 +797,15 @@ in the resulting binary package dependin
@@ -815,6 +822,15 @@ in the resulting binary package depending on the build environment and rpmbuild
version (typically < 4.4). Add default attributes using %defattr before it in
the %files section, or use per entry %attr's.''',

View File

@ -1,8 +1,17 @@
Index: TagsCheck.py
From: Some One <nobody@opensuse.org>
Date: Thu, 9 Apr 2015 14:55:40 +0200
Subject: [PATCH] suse-whitelist-opensuse.diff
===================================================================
--- TagsCheck.py.orig
+++ TagsCheck.py
@@ -891,7 +891,7 @@ class TagsCheck(AbstractCheck.AbstractCh
---
TagsCheck.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/TagsCheck.py b/TagsCheck.py
index 40ce77a..3c68d28 100644
--- a/TagsCheck.py
+++ b/TagsCheck.py
@@ -912,7 +912,7 @@ class TagsCheck(AbstractCheck.AbstractCheck):
spell_check(pkg, utf8summary, 'Summary(%s)', lang, ignored_words)
if '\n' in summary:
printError(pkg, 'summary-on-multiple-lines', lang)

View File

@ -1,76 +0,0 @@
Index: InitScriptCheck.py
===================================================================
--- InitScriptCheck.py.orig
+++ InitScriptCheck.py
@@ -30,6 +30,10 @@ lsb_tags_regex = re.compile('^# ([\w-]+)
lsb_cont_regex = re.compile('^#(?:\t| )(.*?)\s*$')
use_subsys = Config.getOption('UseVarLockSubsys', True)
+stop_on_removal_regex=re.compile('bin/systemctl stop \$service >/dev/null')
+restart_on_update_regex=re.compile('bin/systemctl try-restart \$service >/dev/null')
+insserv_cleanup_regex=re.compile('^\s*/sbin/insserv /etc/init.d$', re.MULTILINE)
+
LSB_KEYWORDS = ('Provides', 'Required-Start', 'Required-Stop', 'Should-Start',
'Should-Stop', 'Default-Start', 'Default-Stop',
'Short-Description', 'Description')
@@ -47,6 +51,13 @@ class InitScriptCheck(AbstractCheck.Abst
return
initscript_list = []
+
+
+ # check chkconfig call in %post and %preun
+ postin = pkg[rpm.RPMTAG_POSTIN] or pkg.scriptprog(pkg[rpm.RPMTAG_POSTINPROG])
+ preun = pkg[rpm.RPMTAG_PREUN] or pkg.scriptprog(pkg[rpm.RPMTAG_PREUNPROG])
+ postun = pkg[rpm.RPMTAG_POSTUN] or pkg.scriptprog(pkg[rpm.RPMTAG_POSTUNPROG])
+
for fname, pkgfile in pkg.files().items():
if not fname.startswith('/etc/init.d/') and \
@@ -61,20 +72,16 @@ class InitScriptCheck(AbstractCheck.Abst
if "." in basename:
printError(pkg, 'init-script-name-with-dot', fname)
- # check chkconfig call in %post and %preun
- postin = pkg[rpm.RPMTAG_POSTIN] or \
- pkg.scriptprog(rpm.RPMTAG_POSTINPROG)
- if not postin:
- printError(pkg, 'init-script-without-chkconfig-postin', fname)
- elif not chkconfig_regex.search(postin):
- printError(pkg, 'postin-without-chkconfig', fname)
-
preun = pkg[rpm.RPMTAG_PREUN] or \
pkg.scriptprog(rpm.RPMTAG_PREUNPROG)
- if not preun:
- printError(pkg, 'init-script-without-chkconfig-preun', fname)
- elif not chkconfig_regex.search(preun):
- printError(pkg, 'preun-without-chkconfig', fname)
+ if not preun or not stop_on_removal_regex.search(preun):
+ printError(pkg, 'init-script-without-%stop_on_removal-preun', fname)
+
+ if not postun or not restart_on_update_regex.search(postun):
+ printError(pkg, 'init-script-without-%restart_on_update-postun', fname)
+
+ if not postun or not insserv_cleanup_regex.search(postun):
+ printError(pkg, 'init-script-without-%insserv_cleanup-postun', fname)
status_found = False
reload_found = False
@@ -276,6 +283,17 @@ of chkconfig don't work as expected with
'init-script-non-executable',
'''The init script should have at least the execution bit set for root
in order for it to run at boot time.''',
+
+'init-script-without-%stop_on_removal-preun',
+'''The init script should have a %preun script that calls %stop_on_removal.''',
+
+'init-script-without-%insserv_cleanup-postun',
+'''The package doesn't have a %insserv_cleanup call in %postun''',
+
+'init-script-without-%restart_on_update-postun',
+''' The package has an init script but is missing the %restart_on_update
+call in %postun to automatically restart the daemon. This is optional,
+but in most cases it is wanted. Please check.'''
)
# InitScriptCheck.py ends here

154
update_git.sh Normal file
View File

@ -0,0 +1,154 @@
#!/bin/bash -e
#
# based on qemu's update_git.sh this program updates the patches
# applied on top of a tarball based on commmits in git
#
# how to use:
# quilt setup rpmlint.spec
# cp rpmlint-$RPMLINTVERSION/series .
# mkdir ~/git; cd ~/git
# git clone git://git.code.sf.net/p/rpmlint/code rpmlint-code
# git checkout -b opensuse-$RPMLINTVERSION v$RPMLINTVERSION
# git quiltimport --patches /where/rpmlint/checkout/is
# ... add/remove/rebase patches
# ... to rebase to a new version create branch and modify versions below
# when done run update_git.sh
GIT_TREE=https://github.com/lnussel/rpmlint-code.git
GIT_LOCAL_TREE=~/git/rpmlint-code
GIT_BRANCH=opensuse-1.6
GIT_UPSTREAM_TAG=v1.6
cleanup()
{
[ -z "$GIT_DIR" ] || rm -rf "$GIT_DIR"
[ -z "$CMP_DIR" ] || rm -rf "$GIT_DIR"
}
trap cleanup EXIT
GIT_DIR=`mktemp -d --tmpdir update_git.XXXXXXXXXX`
CMP_DIR=`mktemp -d --tmpdir update_git.XXXXXXXXXX`
if [ -d "$GIT_LOCAL_TREE" ]; then
echo "Processing $GIT_BRANCH branch of local git tree, using tag:" \
"$GIT_UPSTREAM_TAG"
if ! (cd $GIT_LOCAL_TREE && git show-branch $GIT_BRANCH &>/dev/null); then
echo "Error: Branch $GIT_BRANCH not found - please create a remote" \
"tracking branch of origin/$GIT_BRANCH"
exit
fi
git clone -ls $GIT_LOCAL_TREE $GIT_DIR -b $GIT_BRANCH
if ! (cd $GIT_LOCAL_TREE && git remote show upstream &>/dev/null); then
echo "Remote for upstream git tree not found. Next time add remote" \
"named upstream for $GIT_TREE and update"
(cd $GIT_DIR && git remote add upstream "$GIT_TREE")
(cd $GIT_DIR && git remote update)
fi
else
echo "Processing $GIT_BRANCH branch of remote git tree, using tag:" \
"$GIT_UPSTREAM_TAG"
echo "(For much fast processing, consider establishing a local git tree" \
"at $GIT_LOCAL_TREE)"
git clone $GIT_TREE $GIT_DIR -b $GIT_BRANCH
(cd $GIT_DIR && git remote add upstream "$GIT_TREE")
(cd $GIT_DIR && git remote update)
fi
(cd $GIT_DIR && git format-patch -N $GIT_UPSTREAM_TAG --suffix=.tmp -o $CMP_DIR >/dev/null)
CHANGED_COUNT=0
UNCHANGED_COUNT=0
DELETED_COUNT=0
ADDED_COUNT=0
shopt -s nullglob
patches=()
for i in $CMP_DIR/*.tmp; do
basename="${i##*/}"
newname=${basename%.tmp}
newname=${newname%.diff} # remove .diff suffix it exist
# limit file names to 40 chars before extension
newname=${newname:0:40}.diff
# remove git signature and commit hash to make content
# independent of git version
head -n -3 "$i" | tail -n +2 > "$CMP_DIR/$newname"
rm "$i"
localname=${newname#*-}
patches+=("$localname")
if [ -e "$localname" ]; then
if cmp -s "$CMP_DIR/$newname" "$localname"; then
rm "$CMP_DIR/$newname"
let UNCHANGED_COUNT+=1
else
mv "$CMP_DIR/$newname" "$localname"
let CHANGED_COUNT+=1
fi
else
mv "$CMP_DIR/$newname" "$localname"
let ADDED_COUNT+=1
echo " $localname" >> qemu.changes.added
osc add "$localname"
fi
done
# delete dropped patches
for patch in *.diff; do
keep=
for i in "${patches[@]}"; do
if [ "$i" = "$patch" ]; then
keep=1
break
fi
done
if [ -z "$keep" ]; then
osc rm --force $patch
let DELETED_COUNT+=1
echo " $patch" >> qemu.changes.deleted
fi
done
for package in rpmlint; do
skip=
while IFS= read -r line; do
if [ "$line" = "# PATCHLIST END" ]; then
skip=
i=0
for patch in "${patches[@]}"; do
printf "Patch%02d: %s\n" "$i" "$patch"
let i+=1
done
fi
if [ -z "$skip" ]; then
echo "$line"
fi
if [ "$line" = "# PATCHLIST BEGIN" ]; then
skip=1
fi
done < $package.spec > $package.spec.new
mv $package.spec.new $package.spec
if [ -e qemu.changes.deleted ]; then
echo "* Patches dropped:" >> $package.changes.proposed
cat qemu.changes.deleted >> $package.changes.proposed
fi
if [ -e qemu.changes.added ]; then
echo "* Patches added:" >> $package.changes.proposed
cat qemu.changes.added >> $package.changes.proposed
fi
if [ -e $package.changes.proposed ]; then
osc vc --file=$package.changes.proposed $package
rm -f $package.changes.proposed
fi
done
if [ -e qemu.changes.deleted ]; then
rm -f qemu.changes.deleted
fi
if [ -e qemu.changes.added ]; then
rm -f qemu.changes.added
fi
echo "git patch summary"
echo " unchanged: $UNCHANGED_COUNT"
echo " changed: $CHANGED_COUNT"
echo " deleted: $DELETED_COUNT"
echo " added: $ADDED_COUNT"

View File

@ -1,16 +1,25 @@
Index: BinariesCheck.py
From: Some One <nobody@opensuse.org>
Date: Thu, 9 Apr 2015 14:55:38 +0200
Subject: [PATCH] usr-arch.diff
===================================================================
--- BinariesCheck.py.orig
+++ BinariesCheck.py
@@ -263,6 +263,7 @@ usr_lib_exception_regex = re.compile(Con
---
BinariesCheck.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/BinariesCheck.py b/BinariesCheck.py
index a74d3e3..c1c566d 100644
--- a/BinariesCheck.py
+++ b/BinariesCheck.py
@@ -270,6 +270,7 @@ usr_lib_exception_regex = re.compile(Config.getOption('UsrLibBinaryException', '
srcname_regex = re.compile('(.*?)-[0-9]')
invalid_dir_ref_regex = re.compile('/(home|tmp)(\W|$)')
ocaml_mixed_regex = re.compile('^Caml1999X0\d\d$')
+usr_arch_share_regex = re.compile('/share/.*/(?:x86|i.86|x86_64|ppc|ppc64|s390|s390x|ia64|m68k|arm|aarch64)')
def dir_base(path):
res = path_regex.search(path)
@@ -336,7 +337,7 @@ class BinariesCheck(AbstractCheck.Abstra
@@ -343,7 +344,7 @@ class BinariesCheck(AbstractCheck.AbstractCheck):
# arch dependent packages only from here on
# in /usr/share ?

View File

@ -1,105 +0,0 @@
--- SpecCheck.py
+++ SpecCheck.py
@@ -45,7 +45,8 @@
biarch_package_regex = re.compile(DEFAULT_BIARCH_PACKAGES)
hardcoded_lib_path_exceptions_regex = re.compile(Config.getOption('HardcodedLibPathExceptions', DEFAULT_HARDCODED_LIB_PATH_EXCEPTIONS))
prereq_regex = re.compile('^PreReq(\(.*\))?:\s*(.+?)\s*$', re.IGNORECASE)
-buildprereq_regex = re.compile('^BuildPreReq:\s*(.+?)\s*$', re.IGNORECASE)
+buildprereq_regex = re.compile('^BuildPreReq\s*:\s*(.+)\s*$', re.IGNORECASE)
+buildrequires_regex = re.compile('^\s*BuildRequires\s*:\s*(.+)\s*$', re.IGNORECASE)
use_utf8 = Config.getOption('UseUTF8', Config.USEUTF8_DEFAULT)
macro_regex = re.compile('(%+)[{(]?(\w+)')
libdir_regex = re.compile('%{?_lib(?:dir)?\}?\\b')
@@ -126,6 +127,25 @@
res.append(tok)
return res
+def find_reverse_requires():
+ reverse_requires = dict()
+ try:
+ f = file("/.builtinfo/rpmdeps", "r")
+ except:
+ return reverse_requires
+
+ for line in f:
+ if line.startswith('R:'):
+ package = "-".join(line.split(':')[1].split('-')[:-3])
+ deps = deptokens(line.split(':')[2])
+ for dep in deps:
+ name = dep.split(' ')[0]
+ if name.startswith('/') or name.find('(') != -1 or name == dep:
+ continue
+ reverse_requires.setdefault(name, set()).add(package)
+
+ return reverse_requires
+
def contains_buildroot(line):
'''Check if the given line contains use of rpm buildroot.'''
res = rpm_buildroot_regex.search(line)
@@ -188,6 +208,8 @@
indent_tabs = 0
files_has_defattr = 0
section = {}
+ buildrequires = set()
+
for sec in ['description', 'prep', 'build', 'install', 'clean',
'files', 'changelog', 'package', 'check']:
section[sec] = {
@@ -348,6 +370,14 @@
if res:
printError(pkg, 'buildprereq-use', res.group(1))
+ res = buildrequires_regex.search(line)
+ if not if_depth and res:
+ for r in deptokens(res.group(1)):
+ name = r.split(' ')[0]
+ if name in buildrequires:
+ printWarning(pkg, 'duplicate-buildrequires', name)
+ buildrequires.add(name)
+
if scriptlet_requires_regex.search(line):
printError(pkg, 'broken-syntax-in-scriptlet-requires', string.strip(line))
@@ -420,6 +450,24 @@
'(spaces: line %d, tab: line %d)' %
(indent_spaces, indent_tabs))
+ reverse_requires = find_reverse_requires()
+ for r in buildrequires:
+ if r in reverse_requires:
+ for rev in reverse_requires[r]:
+ if rev in buildrequires:
+ printWarning(pkg, 'unnecessary-buildrequires', r, 'already included by', rev)
+
+ if not r.endswith("-devel"):
+ develr = [ r + "-devel" ]
+ # libfoo-4_2 -> libfoo-devel
+ dr2 = re.sub(r'-?[0-9_]+$', '', r) + "-devel"
+ if dr2 != develr[0]:
+ develr.append(dr2);
+ for dr in develr:
+ if r in reverse_requires and dr in reverse_requires[r] \
+ and not dr in buildrequires:
+ printWarning(pkg, "non-devel-buildrequires", r, "- did you mean", dr, "?")
+
# process gathered info
for p in patches.keys():
if p in applied_patches_ifarch:
@@ -557,6 +605,17 @@
odd entries eg. in source rpms, which is rarely wanted. Avoid use of macros
in %changelog altogether, or use two '%'s to escape them, like '%%foo'.''',
+'unnecessary-buildrequires',
+''' The specfile contains a buildrequires entry that seems to be already
+requires by one of the other buildrequires. Please consider reducing your
+buildrequires definitions in case this is a real implicit dependency.''',
+
+'non-devel-buildrequires',
+'''The specfile contains a buildrequires entry that has a -devel package.
+Please carefully check if you want to buildrequire the -devel subpackage or if
+this is an unnecessary dependency that is already required by one of the other
+buildrequires.''',
+
'depscript-without-disabling-depgen',
'''In some common rpm configurations/versions, defining __find_provides and/or
__find_requires has no effect if rpm's internal dependency generator has not

View File

@ -1,9 +1,17 @@
From: Some One <nobody@opensuse.org>
Date: Thu, 9 Apr 2015 14:55:39 +0200
Subject: [PATCH] version-control-internal-file.diff
also detect RCS files
Index: FilesCheck.py
===================================================================
--- FilesCheck.py.orig
+++ FilesCheck.py
@@ -612,7 +612,7 @@ ldconfig_regex = re.compile('^[^#]*ldcon
---
FilesCheck.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/FilesCheck.py b/FilesCheck.py
index 7d2b92f..efda328 100644
--- a/FilesCheck.py
+++ b/FilesCheck.py
@@ -620,7 +620,7 @@ ldconfig_regex = re.compile('^[^#]*ldconfig', re.MULTILINE)
depmod_regex = re.compile('^[^#]*depmod', re.MULTILINE)
install_info_regex = re.compile('^[^#]*install-info', re.MULTILINE)
perl_temp_file_regex = re.compile('.*perl.*/(\.packlist|perllocal\.pod)$')

View File

@ -1,27 +0,0 @@
Index: rpmlint-1.5/MenuXDGCheck.py
===================================================================
--- rpmlint-1.5.orig/MenuXDGCheck.py
+++ rpmlint-1.5/MenuXDGCheck.py
@@ -43,13 +43,16 @@ class MenuXDGCheck(AbstractCheck.Abstrac
printError(pkg, 'non-utf8-desktopfile', filename)
self.cfp.read(f)
- binary = self.cfp.get('Desktop Entry','Exec').split(' ',1)[0]
+ binary = None
found = False
- for i in STANDARD_BIN_DIRS:
- if os.path.exists(root + i + binary):
- # no need to check if the binary is +x, rpmlint does it
- # in another place
- found = True
+ if self.cfp.has_option('Desktop Entry','Exec'):
+ binary = self.cfp.get('Desktop Entry','Exec').split(' ',1)[0]
+
+ for i in STANDARD_BIN_DIRS:
+ if os.path.exists(root + i + binary):
+ # no need to check if the binary is +x, rpmlint does it
+ # in another place
+ found = True
if not found and binary:
printWarning(pkg, 'desktopfile-without-binary', filename, binary)

View File

@ -1,10 +1,19 @@
Index: MenuXDGCheck.py
From: Some One <nobody@opensuse.org>
Date: Thu, 9 Apr 2015 14:55:38 +0200
Subject: [PATCH] xdg-paths-update.diff
===================================================================
--- MenuXDGCheck.py.orig
+++ MenuXDGCheck.py
@@ -24,7 +24,7 @@ class MenuXDGCheck(AbstractCheck.Abstrac
---
MenuXDGCheck.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/MenuXDGCheck.py b/MenuXDGCheck.py
index 4aab385..158db23 100644
--- a/MenuXDGCheck.py
+++ b/MenuXDGCheck.py
@@ -24,7 +24,7 @@ class MenuXDGCheck(AbstractCheck.AbstractFilesCheck):
# $ echo $XDG_DATA_DIRS/applications
# /var/lib/menu-xdg:/usr/share
self.cfp = RawConfigParser()
AbstractCheck.AbstractFilesCheck.__init__(
- self, "MenuXDGCheck", "/usr/share/applications/.*\.desktop$")
+ self, "MenuXDGCheck", "(?:/usr/share|/etc/opt/.*/share|/opt/.*)/applications/.*\.desktop$")

View File

@ -1,8 +1,17 @@
Index: TagsCheck.py
From: Some One <nobody@opensuse.org>
Date: Thu, 9 Apr 2015 14:55:38 +0200
Subject: [PATCH] yast-provides.diff
===================================================================
--- TagsCheck.py.orig
+++ TagsCheck.py
@@ -821,7 +821,7 @@ class TagsCheck(AbstractCheck.AbstractCh
---
TagsCheck.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/TagsCheck.py b/TagsCheck.py
index 0a56b7d..9e00892 100644
--- a/TagsCheck.py
+++ b/TagsCheck.py
@@ -823,7 +823,7 @@ class TagsCheck(AbstractCheck.AbstractCheck):
printWarning(pkg, 'no-url-tag')
obs_names = [x[0] for x in pkg.obsoletes()]