SHA256
1
0
forked from pool/rpmlint

Accepting request 359550 from devel:openSUSE:Factory:rpmlint

1

OBS-URL: https://build.opensuse.org/request/show/359550
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/rpmlint?expand=0&rev=246
This commit is contained in:
Dominique Leuenberger 2016-02-16 08:27:45 +00:00 committed by Git OBS Bridge
commit fb7e5cca31
5 changed files with 218 additions and 5 deletions

126
binaryinfo-speedup.diff Normal file
View File

@ -0,0 +1,126 @@
From 4d995b87763076cc2aca25b7836e106708bd926f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20Br=C3=BCns?= <stefan.bruens@rwth-aachen.de>
Date: Fri, 23 Oct 2015 23:43:16 +0200
Subject: [PATCH] Skip checks for problematic function calls if common prefix
does not match
The regexes have a common prefix. If the prefix does not match, none of
the regexes will match, continue with the next line.
---
BinariesCheck.py | 53 ++++++++++++++++++++++++++++++++---------------------
1 file changed, 32 insertions(+), 21 deletions(-)
Index: rpmlint-rpmlint-1.8/BinariesCheck.py
===================================================================
--- rpmlint-rpmlint-1.8.orig/BinariesCheck.py
+++ rpmlint-rpmlint-1.8/BinariesCheck.py
@@ -28,14 +28,14 @@ DEFAULT_SYSTEM_LIB_PATHS = (
def create_regexp_call(call):
if type(call) == type([]):
call = '(?:' + '|'.join(call) + ')'
- r = "\s+FUNC\s+.*?\s+(%s(?:@GLIBC\S+)?)(?:\s|$)" % call
+ r = ".*?\s+(%s(?:@GLIBC\S+)?)(?:\s|$)" % call
return re.compile(r)
def create_nonlibc_regexp_call(call):
if type(call) == type([]):
call = '(?:' + '|'.join(call) + ')'
- r = "\s+FUNC\s+.*?\s+UND\s+(%s)\s?.*$" % call
+ r = ".*?\s+UND\s+(%s)\s?.*$" % call
return re.compile(r)
@@ -51,6 +51,7 @@ class BinaryInfo:
stack_exec_regex = re.compile('^..E$')
undef_regex = re.compile('^undefined symbol:\s+(\S+)')
unused_regex = re.compile('^\s+(\S+)')
+ call_regex = re.compile('\s0\s+FUNC\s+(.*)')
exit_call_regex = create_regexp_call('_?exit')
fork_call_regex = create_regexp_call('fork')
debuginfo_regex=re.compile('^\s+\[\s*\d+\]\s+\.debug_.*\s+')
@@ -109,25 +110,8 @@ class BinaryInfo:
cmd.append(path)
res = Pkg.getstatusoutput(cmd)
if not res[0]:
- for l in res[1].splitlines():
- if BinaryInfo.mktemp_call_regex.search(l):
- self.mktemp = True
-
- if BinaryInfo.setgid_call_regex.search(l):
- self.setgid = True
-
- if BinaryInfo.setuid_call_regex.search(l):
- self.setuid = True
-
- if BinaryInfo.setgroups_call_regex.search(l):
- self.setgroups = True
-
- if BinaryInfo.chdir_call_regex.search(l):
- self.chdir = True
-
- if BinaryInfo.chroot_call_regex.search(l):
- self.chroot = True
-
+ lines = res[1].splitlines()
+ for l in lines:
r = BinaryInfo.needed_regex.search(l)
if r:
self.needed.append(r.group(1))
@@ -160,6 +144,41 @@ class BinaryInfo:
self.exec_stack = True
continue
+ if BinaryInfo.debuginfo_regex.search(l):
+ self.debuginfo=1
+ continue
+
+ if BinaryInfo.symtab_regex.search(l):
+ self.symtab=1
+ continue
+
+ if l.startswith("Symbol table"):
+ break
+
+ for l in lines:
+ r = BinaryInfo.call_regex.search(l)
+ if not r:
+ continue
+ l = r.group(1)
+
+ if BinaryInfo.mktemp_call_regex.search(l):
+ self.mktemp = True
+
+ if BinaryInfo.setgid_call_regex.search(l):
+ self.setgid = True
+
+ if BinaryInfo.setuid_call_regex.search(l):
+ self.setuid = True
+
+ if BinaryInfo.setgroups_call_regex.search(l):
+ self.setgroups = True
+
+ if BinaryInfo.chdir_call_regex.search(l):
+ self.chdir = True
+
+ if BinaryInfo.chroot_call_regex.search(l):
+ self.chroot = True
+
if BinaryInfo.forbidden_functions:
for r_name, func in BinaryInfo.forbidden_functions.items():
ret = func['f_regex'].search(l)
@@ -181,14 +200,6 @@ class BinaryInfo:
fork_called = True
continue
- if BinaryInfo.debuginfo_regex.search(l):
- self.debuginfo=1
- continue
-
- if BinaryInfo.symtab_regex.search(l):
- self.symtab=1
- continue
-
# check if we don't have a string that will automatically
# waive the presence of a forbidden call
if self.forbidden_calls:

12
config
View File

@ -114,6 +114,7 @@ setOption('StandardGroups', (
'ftp',
'games',
'geronimo',
'guixbuild',
'haclient',
'haldaemon',
'hsqldb',
@ -632,6 +633,9 @@ setOption("DBUSServices.WhiteList", (
# systemd machined service (bnc#828207)
"org.freedesktop.machine1.service",
"org.freedesktop.machine1.conf",
# systemd importd service (bnc#964935)
"org.freedesktop.import1.service",
"org.freedesktop.import1.conf",
# GeoClue2 DBUS Service (bnc#838360)
"org.freedesktop.GeoClue2.service",
"org.freedesktop.GeoClue2.conf",
@ -689,7 +693,10 @@ setOption("DBUSServices.WhiteList", (
"org.freedesktop.thermald.service",
# drbdmanage (bsc#956811)
"org.drbd.drbdmanaged.conf",
"org.drbd.drbdmanaged.service"
"org.drbd.drbdmanaged.service",
# iio-sensor-proxy (bsc#939191)
"net.hadess.SensorProxy.conf",
"net.hadess.SensorProxy.service"
))
setOption("PAMModules.WhiteList", (
@ -1026,5 +1033,8 @@ addFilter(" non-coherent-filename ")
addFilter(" invalid-build-requires ")
addFilter(" no-provides ")
# bash completion files are not scripts, do not require them marked as %config
addFilter("W: non-conffile-in-etc /etc/bash_completion.d/")
# config ends here

47
postin-speedup.diff Normal file
View File

@ -0,0 +1,47 @@
From 1436dd7bc41115af658cf8f36a3149ab90a61fcf Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20Br=C3=BCns?= <stefan.bruens@rwth-aachen.de>
Date: Sun, 1 Nov 2015 19:32:57 +0100
Subject: [PATCH] Expand postin/postun once per pkg instead once per file
---
FilesCheck.py | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
Index: rpmlint-rpmlint-1.8/FilesCheck.py
===================================================================
--- rpmlint-rpmlint-1.8.orig/FilesCheck.py
+++ rpmlint-rpmlint-1.8/FilesCheck.py
@@ -863,6 +863,16 @@ class FilesCheck(AbstractCheck.AbstractC
elif debuginfo_package:
printError(pkg, 'empty-debuginfo-package')
+ # Prefetch scriptlets, strip quotes from them (#169)
+ postin = pkg[rpm.RPMTAG_POSTIN] or \
+ pkg.scriptprog(rpm.RPMTAG_POSTINPROG)
+ if postin:
+ postin = quotes_regex.sub('', postin)
+ postun = pkg[rpm.RPMTAG_POSTUN] or \
+ pkg.scriptprog(rpm.RPMTAG_POSTUNPROG)
+ if postun:
+ postun = quotes_regex.sub('', postun)
+
# Unique (rdev, inode) combinations
hardlinks = {}
@@ -976,16 +986,6 @@ class FilesCheck(AbstractCheck.AbstractC
printError(pkg, 'non-standard-executable-perm', f,
"%o" % perm)
- # Prefetch scriptlets, strip quotes from them (#169)
- postin = pkg[rpm.RPMTAG_POSTIN] or \
- pkg.scriptprog(rpm.RPMTAG_POSTINPROG)
- if postin:
- postin = quotes_regex.sub('', postin)
- postun = pkg[rpm.RPMTAG_POSTUN] or \
- pkg.scriptprog(rpm.RPMTAG_POSTUNPROG)
- if postun:
- postun = quotes_regex.sub('', postun)
-
if not devel_pkg:
if lib_path_regex.search(f):
lib_file = True

View File

@ -1,3 +1,29 @@
-------------------------------------------------------------------
Fri Feb 12 14:43:00 UTC 2016 - sleep_walker@opensuse.org
- add 'guixbuild' as standard group
- don't require %config for bash completion scripts in /etc
-------------------------------------------------------------------
Thu Feb 4 12:38:46 UTC 2016 - lnussel@suse.de
- whitelist systemd-importd (bnc#964935)
-------------------------------------------------------------------
Thu Jan 28 07:20:29 UTC 2016 - dmueller@suse.com
- enable tests during building
-------------------------------------------------------------------
Thu Jan 21 12:19:02 UTC 2016 - dmueller@suse.com
- add postin-speedup.diff, binaryinfo-speedup.diff
-------------------------------------------------------------------
Wed Jan 20 09:22:21 UTC 2016 - krahmer@suse.com
- whitelist iio-sensor-proxy (bsc#939191)
-------------------------------------------------------------------
Wed Jan 13 14:36:27 UTC 2016 - krahmer@suse.com

View File

@ -20,6 +20,7 @@
Name: rpmlint
BuildRequires: obs-service-format_spec_file
BuildRequires: python-pytest
BuildRequires: rpm-python
BuildRequires: xz
Summary: Rpm correctness checker
@ -37,7 +38,6 @@ Source98: update_git.sh
Source99: README.packaging.txt
Source100: syntax-validator.py
Url: https://github.com/rpm-software-management/rpmlint
BuildRoot: %{_tmppath}/%{name}-%{version}-build
Requires: /usr/bin/readelf
Requires: bash
Requires: checkbashisms
@ -106,6 +106,10 @@ Patch47: check-for-self-provides.diff
Patch48: add-check-for-tmpfiles-created-at-r.diff
Patch49: remove-files-attr-not-set-check.diff
Patch50: fix-shared-library-matching.diff
# https://github.com/rpm-software-management/rpmlint/commit/1436dd7bc41115af658cf8f36a3149ab90a61fcf.patch
Patch51: postin-speedup.diff
# https://github.com/rpm-software-management/rpmlint/commit/37fe9d4f237c2cb29fcb3b60d1ece189e578eeaf.patch and followup regression fixes
Patch52: binaryinfo-speedup.diff
# PATCHLIST END
# BuildArch must at the end. is a bug: https://bugzilla.suse.com/show_bug.cgi?id=926766
BuildArch: noarch
@ -144,8 +148,8 @@ cut '-d ' -f1 /usr/lib/obs/service/format_spec_file.files/licenses_changes.txt |
done
%__install -m 644 licenses.config %{buildroot}/%{_sysconfdir}/rpmlint/
%clean
rm -rf $RPM_BUILD_ROOT
%check
sh ./test.sh
%files
%defattr(-,root,root,0755)