File fix-shared-library-matching.diff of Package rpmlint-tests

From: Some One <nobody@opensuse.org>
Date: Thu, 9 Apr 2015 14:55:39 +0200
Subject: [PATCH] fix shared library matching

Avoids e.g.
[  332s] glib2-devel.i586: E: library-without-ldconfig-postun (Badness: 300) /usr/share/gdb/auto-load/usr/lib/libglib-2.0.so.0.4600.1-gdb.py
---
 FilesCheck.py | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/FilesCheck.py b/FilesCheck.py
index 81c5680..622b3b3 100644
--- a/FilesCheck.py
+++ b/FilesCheck.py
@@ -615,7 +615,9 @@ 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)?$')
-lib_regex = re.compile('lib(64)?/lib[^/]*(\.so\..*|-[0-9.]+\.so)')
+# matches properly versioned shared libraries like libfoo.so.1.2.3 as well as
+# weird ones like libfoo-1.2.3.so
+lib_regex = re.compile('/lib(?:64)?/lib[^/]*(?:\.so\.[\d.]+|-[\d.]+\.so)$')
 ldconfig_regex = re.compile('^[^#]*ldconfig', re.MULTILINE)
 depmod_regex = re.compile('^[^#]*depmod', re.MULTILINE)
 install_info_regex = re.compile('^[^#]*install-info', re.MULTILINE)
@@ -1018,7 +1020,7 @@ class FilesCheck(AbstractCheck.AbstractCheck):
 
                 # check ldconfig call in %post and %postun
                 if lib_regex.search(f):
-                    if devel_pkg:
+                    if devel_pkg and not (sofile_regex.search(f) and stat.S_ISLNK(mode)):
                         printError(pkg, 'non-devel-file-in-devel-package', f)
                     if not postin:
                         printError(pkg, 'library-without-ldconfig-postin', f)
openSUSE Build Service is sponsored by