From ca5eacfc5f21e8c89781671ced4c7edb1d950ccb48847698bc980a0014b62459 Mon Sep 17 00:00:00 2001 From: OBS User unknown Date: Wed, 25 Jun 2008 17:08:32 +0000 Subject: [PATCH] OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/rpmlint?expand=0&rev=10 --- add-scoring-support.diff | 157 +++++---------------------------- fix-BinariesCheck-regex.diff | 19 ---- fix-tabs-indenting.diff | 14 +++ improve-postdep-check.diff | 94 -------------------- naming-policy-lib64.diff | 24 ----- no-badness-return.diff | 52 +++++++++++ no-dot-in-skel.diff | 11 --- rpmlint-0.82.tar.bz2 | 3 - rpmlint-0.83.tar.bz2 | 3 + rpmlint.changes | 7 ++ rpmlint.spec | 30 +++---- stricter-tags-check.diff | 2 +- suse-debuginfo.diff | 85 ++++++------------ suse-devel-dependencies.diff | 11 --- suse-version.diff | 25 +++--- syntax-validator.py | 3 +- try-harder-with-spec-name.diff | 41 --------- 17 files changed, 156 insertions(+), 425 deletions(-) delete mode 100644 fix-BinariesCheck-regex.diff create mode 100644 fix-tabs-indenting.diff delete mode 100644 improve-postdep-check.diff delete mode 100644 naming-policy-lib64.diff create mode 100644 no-badness-return.diff delete mode 100644 no-dot-in-skel.diff delete mode 100644 rpmlint-0.82.tar.bz2 create mode 100644 rpmlint-0.83.tar.bz2 delete mode 100644 suse-devel-dependencies.diff delete mode 100644 try-harder-with-spec-name.diff diff --git a/add-scoring-support.diff b/add-scoring-support.diff index 8db4f05..b3fe090 100644 --- a/add-scoring-support.diff +++ b/add-scoring-support.diff @@ -1,84 +1,14 @@ ---- Config.py -+++ Config.py -@@ -126,6 +126,17 @@ - else: - _filters_re = None - -+_scoring={} -+ -+def setBadness(s, score): -+ _scoring[s] = score -+ setOption('UseBadness', True) -+ -+def badness(s): -+ if _scoring.has_key(s): -+ return _scoring[s] -+ return 0 -+ - _non_named_group_re = re.compile('[^\\](\()[^:]') - def isFiltered(s): - global _filters --- Filter.py +++ Filter.py -@@ -11,19 +11,27 @@ - import Config - import Testing - -+_badness_score = 0 -+_diagnostic = list() -+ - def printInfo(pkg, reason, *details): -- if _print("I", pkg, reason, details) and Config.info: -- printDescriptions(reason) -+ _print("I", pkg, reason, details) - - def printWarning(pkg, reason, *details): -- if _print("W", pkg, reason, details) and Config.info: -- printDescriptions(reason) -+ _print("W", pkg, reason, details) - - def printError(pkg, reason, *details): -- if _print("E", pkg, reason, details) and Config.info: -- printDescriptions(reason) -+ _print("E", pkg, reason, details) - - def _print(type, pkg, reason, details): -+ global _badness_score, _diagnostic -+ -+ badness = Config.badness(reason) -+ if Config.getOption('UseBadness'): -+ type = "W" -+ if badness: -+ type = "E" -+ - ln = "" - if pkg.current_linenum is not None: - ln = "%s:" % pkg.current_linenum -@@ -31,14 +39,16 @@ - if pkg.arch is not None: - arch = ".%s" % pkg.arch - s = "%s%s:%s %s: %s" % (pkg.name, arch, ln, type, reason) -+ if badness: -+ s = s + " (Badness: %d)" % badness - for d in details: - s = s + " %s" % d - if Testing.isTest(): - Testing.addOutput(s) - else: - if not Config.isFiltered(s): -- sys.stdout.write(s) -- sys.stdout.write("\n") -+ _diagnostic.append(s + "\n") -+ _badness_score += badness - return 1 - - return 0 -@@ -52,12 +62,56 @@ +@@ -74,26 +74,28 @@ except KeyError: pass -+def _diag_compare(x,y): + + 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] + @@ -87,69 +17,28 @@ + + if (level_b > level_a): + return 1 -+ + +- where_b = y.split()[1] +- level_b = y.split()[2] + if (level_b < level_a): + return -1 -+ + +- if level_b > level_a: + if (where_b < where_a): -+ return 1 + 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 (where_b > where_a): -+ return -1 -+ + return -1 + + return 0 -+ -+def printAllReasons(): -+ global _badness_score, _diagnostic -+ _diagnostic.sort(_diag_compare) -+ last_reason='' -+ for diag in _diagnostic: -+ if Config.info: -+ reason = diag.split()[2] -+ if reason != last_reason: -+ if len(last_reason): -+ printDescriptions(last_reason) -+ last_reason=reason -+ sys.stdout.write(diag) -+ if Config.info and len(last_reason): -+ printDescriptions(last_reason) -+ _diagnostic = list() -+ return _badness_score > 1000 -+ - _details={} - - def addDetails(*details): - for idx in range(len(details)/2): - _details[details[idx*2]]=details[idx*2+1] - -+def BadnessScore(): -+ global _badness_score -+ -+ return _badness_score -+ - # Filter.py ends here - - # Local variables: ---- README -+++ README -@@ -79,6 +79,7 @@ - FilesCheck.py - SystemLibPaths list of strings ('/lib', '/usr/lib', '/usr/X11R6/lib') - UseBzip2 boolean 1 -+UseBadness boolean 0 - UseDefaultRunlevels boolean 1 - UseEpoch boolean 0 - UseIndexedJars boolean 1 ---- rpmlint.py -+++ rpmlint.py -@@ -146,6 +146,10 @@ - sys.stderr.write('Interrupted, exiting while scanning all packages\n') - sys.exit(2) - -+ if printAllReasons(): -+ sys.stdout.write('RPMLINT: E: BADNESS is %d - threshold exceeded. aborting the build.\n' % BadnessScore() ) -+ sys.exit(1) -+ - finally: - pkg and pkg.cleanup() + def printAllReasons(): + threshold = badnessThreshold() diff --git a/fix-BinariesCheck-regex.diff b/fix-BinariesCheck-regex.diff deleted file mode 100644 index c62254c..0000000 --- a/fix-BinariesCheck-regex.diff +++ /dev/null @@ -1,19 +0,0 @@ ---- - BinariesCheck.py | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -Index: BinariesCheck.py -=================================================================== ---- BinariesCheck.py.orig -+++ BinariesCheck.py -@@ -26,8 +26,8 @@ class BinaryInfo: - needed_regex=re.compile('\s+\(NEEDED\).*\[(\S+)\]') - rpath_regex=re.compile('\s+\(RPATH\).*\[(\S+)\]') - soname_regex=re.compile('\s+\(SONAME\).*\[(\S+)\]') -- comment_regex=re.compile('^\s+\[\d+\]\s+\.comment\s+') -- pic_regex=re.compile('^\s+\[\d+\]\s+\.rela?\.(data|text)') -+ comment_regex=re.compile('^\s+\[\s*\d+\]\s+\.comment\s+') -+ pic_regex=re.compile('^\s+\[\s*\d+\]\s+\.rela?\.(data|text)') - non_pic_regex=re.compile('TEXTREL', re.MULTILINE) - undef_regex=re.compile('^undefined symbol:\s+(\S+)') - unused_regex=re.compile('^\s+(\S+)') diff --git a/fix-tabs-indenting.diff b/fix-tabs-indenting.diff new file mode 100644 index 0000000..e66936d --- /dev/null +++ b/fix-tabs-indenting.diff @@ -0,0 +1,14 @@ +--- SpecCheck.py ++++ SpecCheck.py +@@ -342,9 +342,9 @@ class SpecCheck(AbstractCheck.AbstractCh + (ifarch_regex.search(line) or if_regex.search(line) or + endif_regex.search(line)): + if defattr_regex.search(line): +- files_has_defattr = 1; ++ files_has_defattr = 1; + elif not (files_has_defattr or attr_regex.search(line)): +- printError(pkg, 'files-attr-not-set') ++ printError(pkg, 'files-attr-not-set') + + # TODO: check scriptlets for these too + if current_section == 'files' and noarch: diff --git a/improve-postdep-check.diff b/improve-postdep-check.diff deleted file mode 100644 index a3af851..0000000 --- a/improve-postdep-check.diff +++ /dev/null @@ -1,94 +0,0 @@ ---- PostCheck.py -+++ PostCheck.py -@@ -33,7 +33,7 @@ - # shells that grok the -n switch for debugging - syntaxcheck_shells = ('/bin/sh', '/bin/bash') - --percent_regex = re.compile('%{?\w{3,}', re.MULTILINE) -+percent_regex = re.compile('^[^#]*%{?\w{3,}', re.MULTILINE) - bracket_regex=re.compile('^[^#]*if.*[^ :\]]\]', re.MULTILINE) - home_regex=re.compile('[^a-zA-Z]+~/|\${?HOME(\W|$)', re.MULTILINE) - dangerous_command_regex=re.compile("(^|[;\|`]|&&|$\()\s*(?:\S*/s?bin/)?(cp|mv|ln|tar|rpm|chmod|chown|rm|cpio|install|perl|userdel|groupdel)\s", re.MULTILINE) -@@ -44,14 +44,49 @@ - menu_regex=re.compile('^/usr/lib/menu/|^/etc/menu-methods/|^/usr/share/applications/') - bogus_var_regex=re.compile('(\${?RPM_BUILD_(ROOT|DIR)}?)') - -+# [foo, (bar, baz)]: -+# if a script contains foo then the rpm must prerequire bar or contain baz - prereq_assoc = ( - # ['chkconfig', ('chkconfig', '/sbin/chkconfig')], - ['chkfontpath', ('chkfontpath', '/usr/sbin/chkfontpath')], - ['rpm-helper', ('rpm-helper',)], -+ ['cp', ('coreutils', '/bin/cp')], -+ ['ln', ('coreutils', '/bin/ln')], -+ ['mv', ('coreutils', '/bin/mv')], -+ ['rm', ('coreutils', '/bin/rm')], -+ ['rmdir', ('coreutils', '/bin/rmdir')], -+ ['cat', ('coreutils', '/bin/cat')], -+ ['cut', ('coreutils', '/usr/bin/cut')], -+ ['uname', ('coreutils', '/bin/uname')], -+ ['md5sum', ('coreutils', '/usr/bin/md5sum')], -+ ['pear', ('php5-pear', '/usr/bin/pear')], -+ ['update-alternatives', ('update-alternatives', '/usr/sbin/update-alternatives')], -+ ['a2enmod', ('apache2', '/usr/sbin/a2enmod')], -+ -+ ['sed', ('sed', '/bin/sed')], -+ ['awk', ('gawk', '/usr/bin/awk')], -+ ['gawk', ('gawk', '/usr/bin/gawk')], -+ ['grep', ('grep', '/usr/bin/grep')], -+ ['useradd', ('pwdutils', '/usr/sbin/useradd')], -+ ['groupadd', ('pwdutils', '/usr/sbin/groupadd')], -+ ['chkstat', ('permissions', '/usr/bin/chkstat')], -+ ['diff', ('diffutils', '/usr/bin/diff')], -+ ['cmp', ('diffutils', '/usr/bin/cmp')], -+ ['patch', ('patch', '/usr/bin/patch')], -+ ['fillup', ('fillup', '/bin/fillup')], -+ ['tar', ('tar', '/bin/tar')], -+ ['cpio', ('cpio', '/bin/cpio')], -+ ['odbcinst', ('unixODBC', '/usr/bin/odbcinst')], -+ ['install-info', ('info', '/sbin/install-info')], -+ ['gpg', ('gpg2', '/usr/bin/gpg')], -+ ['nm', ('binutils', '/usr/bin/nm')], -+ ['edit-xml-catalog', ('awk', '/usr/bin/awk')], -+ ['usermod', ('pwdutils', '/usr/sbin/usermod')], - ) - -+# \b is word boundary - for p in prereq_assoc: -- p[0] = re.compile('^[^#]+' + p[0], re.MULTILINE) -+ p[0] = re.compile('^[^#]+\\b(' + p[0] + ')\\b', re.MULTILINE) - - # pychecker fix - del p -@@ -163,15 +196,17 @@ - printError(pkg, 'update-menus-without-menu-file-in-' + tag[2]) - if tmp_regex.search(script): - printError(pkg, 'use-tmp-in-' + tag[2]) -+ - for c in prereq_assoc: -- if c[0].search(script): -+ res = c[0].search(script) -+ if res: - found=0 - for p in c[1]: - if p in prereq or p in files: - found=1 - break - if not found: -- printError(pkg, 'no-prereq-on', c[1][0]) -+ printError(pkg, 'no-prereq-on', c[1][0], 'or', c[1][1], 'for', res.group(1)) - - if prog in syntaxcheck_shells: - if incorrect_shell_script(prog, script): -@@ -230,6 +265,11 @@ - policy type was found in the scriptlet. These types are subject to change - on a policy version upgrade. Use the restorecon command which queries the - currently loaded policy for the correct type instead.''', -+ -+'no-prereq-on', -+'''Your rpm post/postun scripts contain a call to a command that is missing -+from the rpm prereq list. This might cause the package to fail during -+installation due to the required program not being available yet.''' - ) - - # PostCheck.py ends here diff --git a/naming-policy-lib64.diff b/naming-policy-lib64.diff deleted file mode 100644 index e9108fe..0000000 --- a/naming-policy-lib64.diff +++ /dev/null @@ -1,24 +0,0 @@ ---- NamingPolicyCheck.py -+++ NamingPolicyCheck.py -@@ -85,14 +85,14 @@ check=NamingPolicyCheck() - # if somone as a elegant solution, I will be happy to implement and test it. - - --check.add_check('xmms', '^xmms-', '^/usr/lib/xmms/') --check.add_check('python', '^python-', '^/usr/lib/python[1-9](-[1-9])?') --check.add_check('perl5', '^perl-', '^/usr/lib/perl5/vendor_perl') --check.add_check('apache2', '^apache2-mod_', '^/usr/lib/apache2-') -+check.add_check('xmms', '^xmms-', '^/usr/lib(64)?/xmms/') -+check.add_check('python', '^python-', '^/usr/lib(64)?/python[1-9](-[1-9])?') -+check.add_check('perl5', '^perl-', '^/usr/lib(64)?/perl5/vendor_perl') -+check.add_check('apache2', '^apache2-mod_', '^/usr/lib(64)?/apache2-') - check.add_check('fortune', '^fortune-', '^/usr/share/games/fortunes/') --check.add_check('php', '^php-', '/usr/lib/php/extensions/') --check.add_check('ruby', '^ruby-', '/usr/lib/ruby/[1-9](-[1-9])?/') --check.add_check('ocaml', '^ocaml-', '/usr/lib/ocaml/') -+check.add_check('php', '^php-', '/usr/lib(64)?/php/extensions/') -+check.add_check('ruby', '^ruby-', '/usr/lib(64)?/ruby/[1-9](-[1-9])?/') -+check.add_check('ocaml', '^ocaml-', '/usr/lib(64)?/ocaml/') - - # these exception should be added - # apache2 => apache2-devel diff --git a/no-badness-return.diff b/no-badness-return.diff new file mode 100644 index 0000000..9d5f319 --- /dev/null +++ b/no-badness-return.diff @@ -0,0 +1,52 @@ +Index: Filter.py +=================================================================== +--- Filter.py (Revision 1434) ++++ Filter.py (Arbeitskopie) +@@ -96,10 +96,6 @@ def _diag_compare(x,y): + + + def printAllReasons(): +- threshold = badnessThreshold() +- if threshold < 0: +- return 0 +- + global _badness_score, _diagnostic + _diagnostic.sort(_diag_compare) + last_reason='' +@@ -114,8 +110,6 @@ def printAllReasons(): + if Config.info and len(last_reason): + printDescriptions(last_reason) + _diagnostic = list() +- return _badness_score > threshold +- + + _details={} + +Index: rpmlint.py +=================================================================== +--- rpmlint.py (Revision 1434) ++++ rpmlint.py (Arbeitskopie) +@@ -155,9 +155,7 @@ def main(): + sys.stderr.write('Interrupted, exiting while scanning all packages\n') + sys.exit(2) + +- if printAllReasons(): +- sys.stderr.write('rpmlint: E: badness %d exceeds threshold %d, aborting.\n' % (badnessScore(), badnessThreshold())) +- sys.exit(66) ++ printAllReasons() + + finally: + pkg and pkg.cleanup() +@@ -165,6 +163,12 @@ def main(): + % (packages_checked, specfiles_checked, + printed_messages["E"], printed_messages["W"]) + ++ if (badnessThreshold() >= 0): ++ if badnessScore() >= badnessThreshold(): ++ sys.stderr.write('rpmlint: E: badness %d exceeds threshold %d, aborting.\n' % (badnessScore(), badnessThreshold())) ++ sys.exit(66) ++ sys.exit(0) ++ + if printed_messages["E"] > 0: + sys.exit(64) + elif printed_messages["W"] > 0: diff --git a/no-dot-in-skel.diff b/no-dot-in-skel.diff deleted file mode 100644 index bab7180..0000000 --- a/no-dot-in-skel.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- FilesCheck.py -+++ FilesCheck.py -@@ -824,7 +824,7 @@ class FilesCheck(AbstractCheck.AbstractCheck): - printError(pkg, 'version-control-internal-file', f) - elif f.endswith('/.htaccess'): - printError(pkg, 'htaccess-file', f) -- elif hidden_file_regex.search(f): -+ elif hidden_file_regex.search(f) and not f.startswith("/etc/skel/"): - printWarning(pkg, 'hidden-file-or-dir', f) - elif manifest_perl_regex.search(f): - printWarning(pkg, 'manifest-in-perl-module', f) diff --git a/rpmlint-0.82.tar.bz2 b/rpmlint-0.82.tar.bz2 deleted file mode 100644 index 673b82f..0000000 --- a/rpmlint-0.82.tar.bz2 +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:fc9168bb9d950d9ee7282c71a683693156b3f7c697598309b0a9bf978e8e367b -size 79182 diff --git a/rpmlint-0.83.tar.bz2 b/rpmlint-0.83.tar.bz2 new file mode 100644 index 0000000..1358cd6 --- /dev/null +++ b/rpmlint-0.83.tar.bz2 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a4bb8e93c14e86c7d0d2774bcb9147f5de54e117dd573e989f45a927feffd29d +size 81991 diff --git a/rpmlint.changes b/rpmlint.changes index 67ee735..1054a7e 100644 --- a/rpmlint.changes +++ b/rpmlint.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Mon Jun 23 00:43:46 CEST 2008 - dmueller@suse.de + +- update to 0.83: + * removed upstreamed patches + * a couple of new checks, bugfixes + ------------------------------------------------------------------- Wed Jun 18 14:33:09 CEST 2008 - dmueller@suse.de diff --git a/rpmlint.spec b/rpmlint.spec index 280b531..3921e9c 100644 --- a/rpmlint.spec +++ b/rpmlint.spec @@ -1,5 +1,5 @@ # -# spec file for package rpmlint (Version 0.82) +# spec file for package rpmlint (Version 0.83) # # Copyright (c) 2008 SUSE LINUX Products GmbH, Nuernberg, Germany. # This file and all modifications and additions to the pristine @@ -14,8 +14,8 @@ Name: rpmlint BuildRequires: rpm-python Summary: Rpm correctness checker -Version: 0.82 -Release: 57 +Version: 0.83 +Release: 1 Source0: %{name}-%{version}.tar.bz2 Source1: config Source1001: config.in @@ -47,6 +47,7 @@ Patch4: invalid-filerequires.diff Patch5: suse-bzip-bigger-than-100k.diff Patch6: suse-filesystem.diff Patch7: suse-checks.diff +Patch8: suse-debuginfo.diff Patch9: no-doc-for-lib.diff Patch10: add-scoring-support.diff Patch11: suse-spec-bzip2.diff @@ -63,7 +64,6 @@ Patch21: fix-buildroot-test.diff Patch22: better-wrong-script.diff Patch23: buildroot-doc.diff Patch24: sysv5-init-checks.diff -Patch25: suse-devel-dependencies.diff Patch26: ignore-non-readable-in-etc.diff Patch27: detailed-desktop-file-check.diff Patch29: rpmgroup-checks.diff @@ -72,7 +72,6 @@ Patch31: only-reg-files-are-scripts.diff Patch33: check-buildroot-during-install.diff Patch34: verify-buildrequires.diff Patch35: fix-versioned-prereq.diff -Patch36: improve-postdep-check.diff Patch37: buildroot-in-scripts.diff Patch38: fix-patch-detection.diff Patch39: libtool-wrapper-check.diff @@ -80,19 +79,16 @@ Patch41: perl-versioned-rpath-deps.diff Patch42: check-cron-dependency.diff Patch46: locale-support.diff Patch47: noarch-lib64.diff -Patch48: try-harder-with-spec-name.diff Patch49: stricter-tags-check.diff Patch50: suse-no-run-ldconfig.diff Patch51: description-check.diff Patch52: suppress-for-perl-python.diff -Patch53: no-dot-in-skel.diff Patch54: locale-update.diff -Patch55: suse-debuginfo.diff -Patch56: fix-BinariesCheck-regex.diff Patch57: suse-mono-deps-checks.diff Patch58: add-weak-dependencies.diff -Patch59: naming-policy-lib64.diff Patch60: selfconflicts-provide.diff +Patch61: fix-tabs-indenting.diff +Patch62: no-badness-return.diff %py_requires %description @@ -116,6 +112,7 @@ Authors: %patch5 %patch6 %patch7 +%patch8 %patch9 %patch10 %patch11 @@ -132,7 +129,6 @@ Authors: %patch22 %patch23 %patch24 -%patch25 %patch26 %patch27 %patch29 @@ -141,7 +137,6 @@ Authors: %patch33 %patch34 %patch35 -%patch36 %patch37 %patch38 %patch39 @@ -149,19 +144,16 @@ Authors: %patch42 %patch46 %patch47 -%patch48 %patch49 %patch50 %patch51 %patch52 -%patch53 %patch54 -%patch55 -%patch56 %patch57 %patch58 -%patch59 %patch60 +%patch61 +%patch62 cp -p %{SOURCE1} . cp -p %{SOURCE2} . cp -p %{SOURCE3} . @@ -200,6 +192,10 @@ rm -rf $RPM_BUILD_ROOT /usr/share/man/man1/rpmlint.1.gz %changelog +* Mon Jun 23 2008 dmueller@suse.de +- update to 0.83: + * removed upstreamed patches + * a couple of new checks, bugfixes * Wed Jun 18 2008 dmueller@suse.de - fix exception in tags check (bnc#399655) - add a warning for self-conflicts diff --git a/stricter-tags-check.diff b/stricter-tags-check.diff index 5aa2a04..8dbf0fe 100644 --- a/stricter-tags-check.diff +++ b/stricter-tags-check.diff @@ -40,7 +40,7 @@ + useless_reqs.add(r) + else: + if r[0] != '/': -+ printWarning(pkg, 'useless-explicit-requires', 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: diff --git a/suse-debuginfo.diff b/suse-debuginfo.diff index 102b6bc..b0a6daf 100644 --- a/suse-debuginfo.diff +++ b/suse-debuginfo.diff @@ -1,17 +1,6 @@ -From: Jan Blunck -Subject: Add checks for static libraries missing symtab and debuginfo - -Static libraries without a symbol table are not linkable. Binaries linking -against static libraries without debuginfo are not debuggable. ---- - BinariesCheck.py | 31 +++++++++++++++++++++++++++++-- - 1 file changed, 29 insertions(+), 2 deletions(-) - -Index: BinariesCheck.py -=================================================================== ---- BinariesCheck.py.orig +--- BinariesCheck.py +++ BinariesCheck.py -@@ -32,6 +32,8 @@ class BinaryInfo: +@@ -34,6 +34,8 @@ undef_regex=re.compile('^undefined symbol:\s+(\S+)') unused_regex=re.compile('^\s+(\S+)') debug_file_regex=re.compile('\.debug$') @@ -20,55 +9,34 @@ Index: BinariesCheck.py def __init__(self, pkg, path, file, is_ar): self.had_error=0 -@@ -42,6 +44,8 @@ class BinaryInfo: - self.comment=0 - self.soname=0 +@@ -46,6 +48,8 @@ self.non_pic=1 + self.stack = 0 + self.exec_stack = 0 + self.debuginfo=0 + self.symtab=0 is_debug=BinaryInfo.debug_file_regex.search(path) -@@ -65,6 +69,10 @@ class BinaryInfo: - r=BinaryInfo.soname_regex.search(l) - if r: - self.soname=r.group(1) -+ if BinaryInfo.debuginfo_regex.search(l): -+ self.debuginfo=1 -+ if BinaryInfo.symtab_regex.search(l): -+ self.symtab=1 +@@ -87,6 +91,14 @@ + self.exec_stack = 1 + continue + ++ if BinaryInfo.debuginfo_regex.search(l): ++ self.debuginfo=1 ++ continue ++ ++ if BinaryInfo.symtab_regex.search(l): ++ self.symtab=1 ++ continue ++ if self.non_pic: self.non_pic=BinaryInfo.non_pic_regex.search(res[1]) else: -@@ -114,6 +122,7 @@ shared_object_regex=re.compile('shared o - executable_regex=re.compile('executable') - libc_regex=re.compile('libc\.') - ldso_soname_regex=re.compile('^ld(-linux(-(ia|x86_)64))?\.so') -+ar_regex=re.compile('\.a$') - so_regex=re.compile('/lib(64)?/[^/]+\.so(\.[0-9]+)*$') - validso_regex=re.compile('(\.so\.\d+(\.\d+)*|\d\.so)$') - sparc_regex=re.compile('SPARC32PLUS|SPARC V9|UltraSPARC') -@@ -171,7 +180,7 @@ class BinariesCheck(AbstractCheck.Abstra - - for i in info: - is_elf = string.find(i[1], 'ELF') != -1 -- is_ar = string.find(i[1], 'current ar archive') != -1 -+ is_ar = ar_regex.search(i[0]) - is_ocaml_native = string.find(i[1], 'Objective caml native') != -1 - is_shell = string.find(i[1], "shell script") != -1 - is_binary = is_elf or is_ar or is_ocaml_native -@@ -196,13 +205,23 @@ class BinariesCheck(AbstractCheck.Abstra - - # stripped ? - if not unstrippable.search(i[0]) and not is_ocaml_native: -- if not_stripped.search(i[1]) and \ -+ if not is_ar and not_stripped.search(i[1]) and \ - (os.environ.get('BUILD_IS_RUNNING', None) == None or \ - os.environ.get('BUILD_DEBUG_FLAGS','').find('-g') != -1): - printWarning(pkg, 'unstripped-binary-or-object', i[0]) - +@@ -216,6 +228,17 @@ # inspect binary file bin_info=BinaryInfo(pkg, pkg.dirName()+i[0], i[0], is_ar) + + # stripped static library + if is_ar: + if bin_info.had_error: @@ -79,14 +47,14 @@ Index: BinariesCheck.py + (os.environ.get('BUILD_IS_RUNNING', None) == None or \ + os.environ.get('BUILD_DEBUG_FLAGS','').find('-g') != -1): + printWarning(pkg, 'static-library-without-debuginfo', i[0]) - ++ # so name in library if so_regex.search(i[0]): -@@ -441,6 +460,14 @@ with the intended shared libraries only. - + has_lib.append(i[0]) +@@ -430,6 +453,14 @@ 'ldd-failed', '''Executing ldd on this file failed, all checks could not be run.''', -+ + +'static-library-without-symtab', +'''The static library doesn't contain any symbols and therefore can't be linked +against. This may indicated that it was strip.''', @@ -94,6 +62,7 @@ Index: BinariesCheck.py +'static-library-without-debuginfo', +'''The static library doesn't contain any debuginfo. Binaries linking against +this static library can't be properly debugged.''', - ) - - # BinariesCheck.py ends here ++ + '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 diff --git a/suse-devel-dependencies.diff b/suse-devel-dependencies.diff deleted file mode 100644 index 1dcadc4..0000000 --- a/suse-devel-dependencies.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- TagsCheck.py -+++ TagsCheck.py -@@ -515,7 +515,7 @@ - break - if has_so: - for d in deps: -- if d[0] == base: -+ if d[0].startswith(base): - dep=d - break - if not dep: diff --git a/suse-version.diff b/suse-version.diff index df8698c..7de333b 100644 --- a/suse-version.diff +++ b/suse-version.diff @@ -1,30 +1,32 @@ --- SpecCheck.py +++ SpecCheck.py -@@ -47,6 +47,7 @@ - buildprereq_regex = re.compile('^BuildPreReq:\s*(.+?)\s*$', re.IGNORECASE) - use_utf8 = Config.getOption('UseUTF8', Config.USEUTF8_DEFAULT) - macro_regex = re.compile('(%+)[{(]?(\w+)') +@@ -52,6 +52,7 @@ + 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+)') # Only check for /lib, /usr/lib, /usr/X11R6/lib # TODO: better handling of X libraries and modules. -@@ -287,6 +288,12 @@ +@@ -306,7 +307,13 @@ if lib_package_regex.search(line): lib = 1 +- res = prereq_regex.search(line) + res = suse_version_regex.search(line) -+ if res and int(res.group(1)) > 0 and int(res.group(1)) < 1010: ++ if res and int(res.group(1)) > 0 and int(res.group(1)) < 1020: + printWarning(pkg, "obsolete-suse-version-check", res.group(1)) + elif res and int(res.group(1)) > 1100: + printError(pkg, "invalid-suse-version-check", res.group(1)) + - res = prereq_regex.search(line) ++ eres = prereq_regex.search(line) if res: printWarning(pkg, 'prereq-use', res.group(2)) -@@ -514,6 +521,15 @@ - problems, restrict future package/provides naming, and may match something it - was originally not inteded to match -- make the Obsoletes versioned if - possible.''', + +@@ -568,6 +575,16 @@ + set which may result in security issues in the resulting binary package + depending on the system where the package is built. Add default attributes + using %defattr before it in the %files section, or use per line %attr's.''', + +'obsolete-suse-version-check', +'''The specfile contains a comparison of %suse_version against a suse release @@ -34,6 +36,7 @@ +'invalid-suse-version-check', +'''The specfile contains a comparison of %suse_version against a suse release +that does not exist. Please double check.''' ++ ) # SpecCheck.py ends here diff --git a/syntax-validator.py b/syntax-validator.py index c2ce71f..9ca393f 100644 --- a/syntax-validator.py +++ b/syntax-validator.py @@ -6,5 +6,6 @@ import sys for filename in sys.argv[1:]: try: compile(open(filename).read(), filename, 'exec') - except: + except Exception, e: + print e exit(1) diff --git a/try-harder-with-spec-name.diff b/try-harder-with-spec-name.diff deleted file mode 100644 index 7ea01de..0000000 --- a/try-harder-with-spec-name.diff +++ /dev/null @@ -1,41 +0,0 @@ ---- SpecCheck.py -+++ SpecCheck.py -@@ -169,18 +169,22 @@ - - # lookup spec file - files = pkg.files() -- for f in files.keys(): -- if f.endswith('.spec'): -- self._spec_file = pkg.dirName() + "/" + f -- break -+ if (pkg.name + ".spec") in files.keys(): -+ self._spec_file = pkg.name + ".spec" -+ else: -+ for f in files.keys(): -+ if f.endswith('.spec'): -+ self._spec_file = f -+ break -+ - if not self._spec_file: - printError(pkg, "no-spec-file") - else: -- if f != pkg.name + ".spec": -- printError(pkg, "invalid-spec-name", f) -+ if self._spec_file != pkg.name + ".spec": -+ printError(pkg, "invalid-spec-name", self._spec_file) - - # check content of spec file -- spec_lines = Pkg.readlines(self._spec_file) -+ spec_lines = Pkg.readlines(pkg.dirName() + "/" + self._spec_file) - self.check_spec(pkg, spec_lines) - - def check_spec(self, pkg, spec_lines): -@@ -219,7 +223,7 @@ - } - - if self._spec_file: -- if use_utf8 and not Pkg.is_utf8(self._spec_file): -+ if use_utf8 and not Pkg.is_utf8(pkg.dirName() + "/" + self._spec_file): - printError(pkg, "non-utf8-spec-file", self._spec_file) - - # gather info from spec lines