From 517bb29aeac4a081f37b70eea26dd559c31584e7 Mon Sep 17 00:00:00 2001 From: Ville Skyttä Date: Oct 15 2006 08:22:26 +0000 Subject: - Accumulated bugfixes since 0.78: #209876, #209889, #210110, 210261. - Filter messages about gpg-pubkeys for now. --- diff --git a/rpmlint-0.78-svn-fixes.patch b/rpmlint-0.78-svn-fixes.patch new file mode 100644 index 0000000..c22b05c --- /dev/null +++ b/rpmlint-0.78-svn-fixes.patch @@ -0,0 +1,193 @@ +Index: TagsCheck.py +=================================================================== +--- TagsCheck.py (revision 1282) ++++ TagsCheck.py (revision 1289) +@@ -595,7 +595,7 @@ + if not ret: + printWarning(pkg, 'no-version-in-last-changelog') + elif version and release: +- srpm=pkg[rpm.RPMTAG_SOURCERPM] ++ srpm = pkg[rpm.RPMTAG_SOURCERPM] or '' + # only check when source name correspond to name + if srpm[0:-8] == '%s-%s-%s' % (name, version, release): + expected=version + '-' + release +Index: FilesCheck.py +=================================================================== +--- FilesCheck.py (revision 1282) ++++ FilesCheck.py (revision 1289) +@@ -228,8 +228,12 @@ + text_characters = "".join(map(chr, range(32, 127)) + list("\n\r\t\b")) + _null_trans = string.maketrans("", "") + +-def istextfile(f): +- s=open(f).read(512) ++def istextfile(f, pkg): ++ try: ++ s = open(f).read(512) ++ except Exception, e: # eg. https://bugzilla.redhat.com/209876 ++ printWarning(pkg, 'read-error', e) ++ return 0 + + if "\0" in s: + return 0 +@@ -589,7 +593,7 @@ + if stat.S_ISREG(mode): + path=pkg.dirName() + '/' + f + if os.access(path, os.R_OK): +- if istextfile(path): ++ if istextfile(path, pkg): + line=open(path).readline() + res=None + # ignore perl module shebang -- TODO: disputed... +@@ -917,6 +921,12 @@ + packaged as arch dependent, or something else. Verify what the case is, and + if there's no way to produce useful debuginfo out of it, disable creation of + the debuginfo package.''', ++ ++'read-error', ++'''This file could not be read. A reason for this could be that the info about ++it in the rpm header indicates that it is supposed to be a readable normal file ++but it actually is not in the filesystem. Because of this, some checks will ++be skipped.''', + ) + + # FilesCheck.py ends here +Index: Pkg.py +=================================================================== +--- Pkg.py (revision 1282) ++++ Pkg.py (revision 1289) +@@ -58,17 +58,21 @@ + + # utilities + ++var_regex=re.compile('^(.*)\${?(\w+)}?(.*)$') ++ + def shell_var_value(var, script): +- assign_regex=re.compile(re.escape(var) + '\s*=\s*(.+)\s*(#.*)*$', ++ assign_regex=re.compile('\\b' + re.escape(var) + '\s*=\s*(.+)\s*(#.*)*$', + re.MULTILINE) + res=assign_regex.search(script) + if res: ++ res2 = var_regex.search(res.group(1)) ++ if res2: ++ if res2.group(2) == var: # infinite loop ++ return None + return substitute_shell_vars(res.group(1), script) + else: + return None + +-var_regex=re.compile('^(.*)\${?([^}]+)}?(.*)$') +- + def substitute_shell_vars(val, script): + res=var_regex.search(val) + if res: +Index: rpmlint.py +=================================================================== +--- rpmlint.py (revision 1282) ++++ rpmlint.py (revision 1289) +@@ -98,6 +98,8 @@ + f=os.path.abspath(os.path.join(d, i)) + st=os.stat(f) + if stat.S_ISREG(st[stat.ST_MODE]): ++ if f[-4:] != '.rpm' and f[-4:] != '.spm': ++ continue + try: + pkg=Pkg.Pkg(f, extract_dir) + runChecks(pkg) +Index: BinariesCheck.py +=================================================================== +--- BinariesCheck.py (revision 1282) ++++ BinariesCheck.py (revision 1289) +@@ -32,7 +32,7 @@ + undef_regex=re.compile('^undefined symbol:\s+(\S+)') + debug_file_regex=re.compile('\.debug$') + +- def __init__(self, pkg, path, file): ++ def __init__(self, pkg, path, file, is_ar): + self.objdump_error=0 + self.needed=[] + self.rpath=[] +@@ -75,7 +75,7 @@ + + # undefined symbol check makes sense only for installed packages + # skip debuginfo: https://bugzilla.redhat.com/190599 +- if not is_debug and isinstance(pkg, Pkg.InstalledPkg): ++ if not is_ar and not is_debug and isinstance(pkg, Pkg.InstalledPkg): + # We could do this with objdump, but it's _much_ simpler with ldd. + res = Pkg.getstatusoutput(('env', 'LC_ALL=C', 'ldd', '-d', '-r', path)) + if not res[0]: +@@ -89,7 +89,6 @@ + path_regex=re.compile('(.*/)([^/]+)') + numeric_dir_regex=re.compile('/usr(?:/share)/man/man./(.*)\.[0-9](?:\.gz|\.bz2)') + versioned_dir_regex=re.compile('[^.][0-9]') +-binary_regex=re.compile('ELF|current ar archive') + usr_share=re.compile('^/usr/share/') + etc=re.compile('^/etc/') + not_stripped=re.compile('not stripped') +@@ -137,7 +136,7 @@ + binary_in_usr_lib=0 + has_usr_lib_file=0 + +- res=srcname_regex.search(pkg[rpm.RPMTAG_SOURCERPM]) ++ res = srcname_regex.search(pkg[rpm.RPMTAG_SOURCERPM] or '') + if res: + multi_pkg=(pkg.name != res.group(1)) + else: +@@ -149,7 +148,9 @@ + break + + for i in info: +- is_binary=binary_regex.search(i[1]) ++ is_elf = string.find(i[1], 'ELF') != -1 ++ is_ar = string.find(i[1], 'current ar archive') != -1 ++ is_binary = is_elf or is_ar + + if is_binary: + binary=binary+1 +@@ -175,7 +176,7 @@ + printWarning(pkg, 'unstripped-binary-or-object', i[0]) + + # inspect binary file +- bin_info=BinaryInfo(pkg, pkg.dirName()+i[0], i[0]) ++ bin_info=BinaryInfo(pkg, pkg.dirName()+i[0], i[0], is_ar) + + # so name in library + if so_regex.search(i[0]): +Index: I18NCheck.py +=================================================================== +--- I18NCheck.py (revision 1282) ++++ I18NCheck.py (revision 1289) +@@ -99,7 +99,7 @@ + locales=[] # list of locales for this packages + webapp=False + +- i18n_tags = pkg[HEADER_I18NTABLE] ++ i18n_tags = pkg[HEADER_I18NTABLE] or () + #i18n_files = pkg.langFiles() + + for i in i18n_tags: +Index: InitScriptCheck.py +=================================================================== +--- InitScriptCheck.py (revision 1282) ++++ InitScriptCheck.py (revision 1289) +@@ -71,7 +71,10 @@ + lsb_tags = {} + # check common error in file content + fd=open(pkg.dirName() + '/' + f, 'r') +- for line in fd.readlines(): ++ content = fd.readlines() ++ fd.close() ++ content_str = "".join(content) ++ for line in content: + line = line[:-1] # chomp + # TODO check if there is only one line like this + if line.startswith('### BEGIN INIT INFO'): +@@ -131,7 +134,7 @@ + if name != basename: + error=1 + if name[0] == '$': +- value=Pkg.substitute_shell_vars(name, line) ++ value = Pkg.substitute_shell_vars(name, content_str) + if value == basename: + error=0 + if error: diff --git a/rpmlint.config b/rpmlint.config index 1dc1c67..5eb6e98 100644 --- a/rpmlint.config +++ b/rpmlint.config @@ -55,3 +55,4 @@ addFilter("outside-libdir-files") addFilter("-debuginfo no-documentation") addFilter("-debuginfo [^ ]+ /usr/lib/debug/") addFilter("non-standard-dir-in-usr libexec") +addFilter(" gpg-pubkey ") diff --git a/rpmlint.spec b/rpmlint.spec index daa28d3..a297db3 100644 --- a/rpmlint.spec +++ b/rpmlint.spec @@ -1,6 +1,6 @@ Name: rpmlint Version: 0.78 -Release: 1%{?dist} +Release: 2%{?dist} Summary: Tool for checking common errors in RPM packages Group: Development/Tools @@ -10,6 +10,7 @@ Source0: http://rpmlint.zarb.org/download/%{name}-%{version}.tar.bz2 Source1: %{name}.config Patch0: %{name}-0.78-distregex.patch Patch1: %{name}-0.77-compile.patch +Patch2: %{name}-0.78-svn-fixes.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildArch: noarch @@ -31,6 +32,7 @@ and source packages can be checked. %setup -q %patch0 %patch1 +%patch2 sed -i -e /MenuCheck/d Config.py @@ -65,6 +67,10 @@ rm -rf $RPM_BUILD_ROOT %changelog +* Sun Oct 15 2006 Ville Skyttä - 0.78-2 +- Accumulated bugfixes since 0.78: #209876, #209889, #210110, 210261. +- Filter messages about gpg-pubkeys for now. + * Sun Sep 24 2006 Ville Skyttä - 0.78-1 - 0.78, fixes #198605, #198616, #198705, #198707, #200032, #206383. - /etc/profile.d/* filtering no longer needed.