From b2476b9e05ce9b6d943a24850446bef15b8d2b019efd30412ead8c00b7f58e0f Mon Sep 17 00:00:00 2001 From: Ruediger Oertel Date: Thu, 28 Oct 2010 11:38:59 +0000 Subject: [PATCH] Accepting request 51510 from Base:System Accepted submit request 51510 from user dirkmueller OBS-URL: https://build.opensuse.org/request/show/51510 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/rpmlint?expand=0&rev=72 --- BrandingPolicyCheck.py | 18 ++++++++------ CheckBuildDate.py | 49 ++++++++++++++++++++++++++++++++++++++ CheckDBUSServices.py | 5 ++-- CheckFilelist.py | 6 +++++ CheckKDE4Deps.py | 6 +++++ CheckPolkitPrivs.py | 8 +++++-- CheckSUIDPermissions.py | 16 +++++++++---- KMPPolicyCheck.py | 14 ++++++++++- add-weak-dependencies.diff | 33 ++++++++++++++++--------- config | 1 + rpmlint.changes | 10 ++++++++ rpmlint.spec | 2 ++ 12 files changed, 141 insertions(+), 27 deletions(-) create mode 100644 CheckBuildDate.py diff --git a/BrandingPolicyCheck.py b/BrandingPolicyCheck.py index 92fc2d4..80947ed 100644 --- a/BrandingPolicyCheck.py +++ b/BrandingPolicyCheck.py @@ -35,8 +35,8 @@ class BrandingPolicyCheck(AbstractCheck.AbstractCheck): (r[0].find('-theme-') >= 0 or r[0].find('-branding-') >= 0)): printError(pkg,'suse-branding-specific-branding-req', r[0]) if r[0].endswith('branding') or r[0].endswith('theme'): - if (r[2] != rpm.RPMSENSE_EQUAL or not r[1].startswith('1')): - printError(pkg,'suse-branding-unversioned-req', r[0]) + if (r[1] != rpm.RPMSENSE_EQUAL or not r[2].startswith('1')): + printError(pkg,'suse-branding-unversioned-requires', r[0]) # verify that it doesn't conflict with branding for r in pkg_conflicts: @@ -99,13 +99,13 @@ class BrandingPolicyCheck(AbstractCheck.AbstractCheck): if not branding_provide: printError(pkg,'suse-branding-no-branding-provide') else: - if (len(branding_provide) < 2 or branding_provide[2] != rpm.RPMSENSE_EQUAL): - printError(pkg, 'suse-branding-unversioned-prov', branding_provide[0]) + if (len(branding_provide) < 2 or branding_provide[1] != rpm.RPMSENSE_EQUAL): + printError(pkg, 'suse-branding-unversioned-provides', branding_provide[0]) for r in pkg.requires(): if r[0].find('-theme-') >= 0 or r[0].find('-branding-') >= 0: - if (r[2] != rpm.RPMSENSE_EQUAL or not r[1].startswith('1')): - printError(pkg, 'suse-branding-unversioned-req', r[0]) + if (r[1] != rpm.RPMSENSE_EQUAL or not r[2].startswith('1')): + printError(pkg, 'suse-branding-unversioned-requires', r[0]) check=BrandingPolicyCheck() @@ -115,11 +115,15 @@ if Config.info: 'suse-branding-specific-branding-req', """bla""", 'suse-branding-no-branding-provides', -"""bla""", +"""Please add a provides entry similar to 'Provides: %name-branding = %version'.""", +'suse-branding-unversioned-provides', +"""Please make sure that your provides entry reads like 'Provides: %name-branding = %version'.""", 'suse-branding-supplement-missing', """branding packages should provide a supplemnent in the form Supplements: packageand(basepackage:branding-) """, +'suse-branding-unversioned-requires', +"""Please make sure that your requires entry reads like 'Requires: %name-branding = '.""", 'suse-branding-missing-conflicts', """Any branding flavor package that provides the generic branding must also conflict with all other branding packages via a special diff --git a/CheckBuildDate.py b/CheckBuildDate.py new file mode 100644 index 0000000..67677d1 --- /dev/null +++ b/CheckBuildDate.py @@ -0,0 +1,49 @@ +############################################################################# +# File : CheckBuilDate.py +# Package : rpmlint +# Author : Cristian Rodriguez +# Purpose : Check for binaries containing build date +############################################################################# + +from Filter import * +import AbstractCheck +import rpm +import re +import os +import commands +import Config +import stat +import time + +class BuildDateCheck(AbstractCheck.AbstractFilesCheck): + def __init__(self): + AbstractCheck.AbstractFilesCheck.__init__(self, "CheckBuildDate", ".*") + self.looksliketime = re.compile('(2[0-3]|[01]?[0-9]):([0-5]?[0-9]):([0-5]?[0-9])') + self.istoday = re.compile(time.strftime("%b %e %Y")) + + def check_file(self, pkg, filename): + if filename.startswith('/usr/lib/debug') or pkg.isSource(): + return + + if not stat.S_ISREG(pkg.files()[filename].mode): + return + + grep_date = pkg.grep(self.istoday, filename) + + if len(grep_date): + printWarning(pkg, "file-contains-current-date", filename) + + grep_time = pkg.grep(self.looksliketime, filename) + + if len(grep_date) and len(grep_time): + printError(pkg, "file-contains-date-and-time", filename) + +check=BuildDateCheck() + +if Config.info: + addDetails( +'file-contains-current-date', +"""Your file contains the current date, this may cause the package to rebuild in excess.""", +'file-contains-date-and-time', +"""Your file uses __DATE and __TIME__ this causes the package to rebuild when not needed""" +) diff --git a/CheckDBUSServices.py b/CheckDBUSServices.py index c5c60f5..cc3aa0b 100644 --- a/CheckDBUSServices.py +++ b/CheckDBUSServices.py @@ -51,6 +51,7 @@ check=DBUSServiceCheck() if Config.info: addDetails( 'suse-dbus-unauthorized-service', -"""The package installs an unauthorized DBUS service. -Please contact security@suse.de for review.""", +"""The package installs a DBUS system service file. If the package +is intended for inclusion in any SUSE product please open a bug +report to request review of the service by the security team.""", ) diff --git a/CheckFilelist.py b/CheckFilelist.py index 6a9f8f5..247230f 100644 --- a/CheckFilelist.py +++ b/CheckFilelist.py @@ -453,4 +453,10 @@ if Config.info: if not 'error' in check: continue + addDetails('suse-filelist-forbidden', """ +Your package installs files or directories in a location that have +previously been blacklisted. Please have a look at the particular +file and see if the SUSE Packaging Guidelines propose a better place +on where to install the file or not install it at all.""") + addDetails(check['error'], check['details']) diff --git a/CheckKDE4Deps.py b/CheckKDE4Deps.py index f11d305..078db78 100644 --- a/CheckKDE4Deps.py +++ b/CheckKDE4Deps.py @@ -53,6 +53,10 @@ _kde4_libakonadi4 = ( "libakonadiprotocolinternals.so.1", ) +_kde4_knotificationdep = ( + "libknotificationitem-1.so", +) + class KDE4Check(AbstractCheck.AbstractCheck): def __init__(self): AbstractCheck.AbstractCheck.__init__(self, "CheckKDE4Deps") @@ -104,6 +108,8 @@ class KDE4Check(AbstractCheck.AbstractCheck): printError(pkg,"suse-kde4-excessive-dependency", "%kde4_akonadi_requires") if not "akonadi-runtime" in pkg_requires and libakonadi4_dep: printError(pkg,"suse-kde4-missing-dependency", "%kde4_akonadi_requires") + if not "libknotificationitem-1" in pkg_requires and _kde4_knotificationdep: + printError(pkg, "suse-kde4-missing-dependency", "kde4_knotification_requires") check=KDE4Check() diff --git a/CheckPolkitPrivs.py b/CheckPolkitPrivs.py index e43f2de..7219e78 100644 --- a/CheckPolkitPrivs.py +++ b/CheckPolkitPrivs.py @@ -115,9 +115,13 @@ check=PolkitCheck() if Config.info: addDetails( 'polkit-unauthorized-file', -"""Please contact security@suse.de for review.""", +"""If the package is intended for inclusion in any SUSE product +please open a bug report to request review of the package by the +security team""", 'polkit-unauthorized-privilege', -"""Please contact security@suse.de for review.""", +"""If the package is intended for inclusion in any SUSE product +please open a bug report to request review of the package by the +security team""", 'polkit-cant-acquire-privilege', """Usability can be improved by allowing users to acquire privileges via authentication. Use e.g. 'auth_admin' instead of 'no' and make diff --git a/CheckSUIDPermissions.py b/CheckSUIDPermissions.py index 18caed5..b820ef7 100644 --- a/CheckSUIDPermissions.py +++ b/CheckSUIDPermissions.py @@ -141,7 +141,9 @@ check=SUIDCheck() if Config.info: addDetails( 'permissions-unauthorized-file', -"""Please remove the unauthorized files or contact security@suse.de for review.""", +"""If the package is intended for inclusion in any SUSE product +please open a bug report to request review of the package by the +security team""", 'permissions-symlink', """permissions handling for symlinks is useless. Please contact security@suse.de to remove the entry.""", @@ -158,9 +160,15 @@ remove the slash.""", 'permissions-incorrect-owner', """please use the %attr macro to set the correct ownership.""", 'permissions-file-setuid-bit', -"""Please remove the setuid/setgid bits or contact security@suse.de for review.""", +"""If the package is intended for inclusion in any SUSE product +please open a bug report to request review of the program by the +security team""", 'permissions-directory-setuid-bit', -"""Please contact security@suse.de for review.""", +"""If the package is intended for inclusion in any SUSE product +please open a bug report to request review of the package by the +security team""", 'permissions-world-writable', -"""Please remove the world writable permissions or contact security@suse.de for review.""" +"""If the package is intended for inclusion in any SUSE product +please open a bug report to request review of the package by the +security team""", ) diff --git a/KMPPolicyCheck.py b/KMPPolicyCheck.py index 22db3b0..8217cf5 100644 --- a/KMPPolicyCheck.py +++ b/KMPPolicyCheck.py @@ -69,10 +69,22 @@ check=KMPPolicyCheck() if Config.info: addDetails( +'suse-policy-kmp-missing-requires', +"""Make sure you have extended '%suse_kernel_module_package' by + '-p %_sourcedir/preamble', a file named 'preamble' as source and there + specified 'Requires: kernel-%1'. + """, +'suse-policy-kmp-excessive-enhances', +""" """, +'suse-policy-kmp-missing-enhances', +"""Make sure you have extended '%suse_kernel_module_package' by + '-p %_sourcedir/preamble', a file named 'preamble' as source and there + specified 'Enhances: kernel-%1'. + """, 'suse-policy-kmp-excessive-supplements', """ """, 'suse-policy-kmp-missing-supplements', -"""make sure that your buildrequires includes kernel-syms and module-init-tools +"""Make sure your 'BuildRequires:' include 'kernel-syms' and 'module-init-tools' for proper dependencies to be built. """, ) diff --git a/add-weak-dependencies.diff b/add-weak-dependencies.diff index f6a488f..f397d01 100644 --- a/add-weak-dependencies.diff +++ b/add-weak-dependencies.diff @@ -34,7 +34,7 @@ def prereq(self): """Get package PreReqs as list of (name, flags, (epoch, version, release)) tuples.""" -@@ -692,7 +712,7 @@ +@@ -692,18 +712,25 @@ # internal function to gather dependency info used by the above ones def _gather_aux(self, header, list, nametag, flagstag, versiontag, @@ -43,7 +43,13 @@ names = header[nametag] flags = header[flagstag] versions = header[versiontag] -@@ -703,7 +723,11 @@ + ++ print "versions", versions ++ + if versions: + for loop in range(len(versions)): ++ print "looping over", versions[loop], type(versions[loop]) + evr = stringToVersion(versions[loop]) if prereq is not None and flags[loop] & PREREQ_FLAG: prereq.append((names[loop], flags[loop] & (~PREREQ_FLAG), evr)) @@ -56,7 +62,7 @@ list.append((names[loop], flags[loop], evr)) def _gatherDepInfo(self): -@@ -713,6 +737,10 @@ +@@ -713,6 +740,10 @@ self._provides = [] self._conflicts = [] self._obsoletes = [] @@ -67,27 +73,32 @@ self._gather_aux(self.header, self._requires, rpm.RPMTAG_REQUIRENAME, -@@ -732,6 +760,27 @@ +@@ -732,6 +763,32 @@ rpm.RPMTAG_OBSOLETEFLAGS, rpm.RPMTAG_OBSOLETEVERSION) + try: + self._gather_aux(self.header, self._recommends, + rpm.RPMTAG_SUGGESTSNAME, ++ rpm.RPMTAG_SUGGESTSFLAGS, + rpm.RPMTAG_SUGGESTSVERSION, -+ rpm.RPMTAG_SUGGESTSFLAGS, strong_only=True) ++ strong_only=True) + self._gather_aux(self.header, self._suggests, + rpm.RPMTAG_SUGGESTSNAME, ++ rpm.RPMTAG_SUGGESTSFLAGS, + rpm.RPMTAG_SUGGESTSVERSION, -+ rpm.RPMTAG_SUGGESTSFLAGS, weak_only=True) -+ self._gather_aux(self.header, self._enhances, -+ rpm.RPMTAG_ENHANCESNAME, -+ rpm.RPMTAG_ENHANCESVERSION, -+ rpm.RPMTAG_ENHANCESFLAGS, weak_only=True) ++ weak_only=True) + self._gather_aux(self.header, self._supplements, + rpm.RPMTAG_ENHANCESNAME, ++ rpm.RPMTAG_ENHANCESFLAGS, + rpm.RPMTAG_ENHANCESVERSION, -+ rpm.RPMTAG_ENHANCESFLAGS, strong_only=True) ++ strong_only=True) ++ self._gather_aux(self.header, self._enhances, ++ rpm.RPMTAG_ENHANCESNAME, ++ rpm.RPMTAG_ENHANCESFLAGS, ++ rpm.RPMTAG_ENHANCESVERSION, ++ weak_only=True) ++ + except: + pass + diff --git a/config b/config index 3b33212..b61c324 100644 --- a/config +++ b/config @@ -35,6 +35,7 @@ addCheck("CheckKDE4Deps") addCheck("KMPPolicyCheck") addCheck("CheckAlternativesGhostFiles") addCheck("BashismsCheck") +addCheck("CheckBuildDate") # stuff autobuild takes care about addFilter(".*invalid-version.*") diff --git a/rpmlint.changes b/rpmlint.changes index 3aad2a5..6e9a118 100644 --- a/rpmlint.changes +++ b/rpmlint.changes @@ -1,3 +1,13 @@ +------------------------------------------------------------------- +Wed Oct 27 14:18:14 CEST 2010 - dmueller@suse.de + +- fix supplements parsing (bnc#648404) + +------------------------------------------------------------------- +Thu Oct 21 11:15:29 CEST 2010 - dmueller@suse.de + +- add build time check (bnc#635351) + ------------------------------------------------------------------- Tue Oct 19 13:30:41 UTC 2010 - lnussel@suse.de diff --git a/rpmlint.spec b/rpmlint.spec index 2fb7ac3..1b723d8 100644 --- a/rpmlint.spec +++ b/rpmlint.spec @@ -48,6 +48,7 @@ Source19: CheckAlternativesGhostFiles.py Source20: rpmgroups.config Source21: BashismsCheck.py Source22: CheckGNOMEMacros.py +Source23: CheckBuildDate.py Source100: syntax-validator.py Url: http://rpmlint.zarb.org/ License: GPLv2+ @@ -210,6 +211,7 @@ cp -p %{SOURCE18} . cp -p %{SOURCE19} . cp -p %{SOURCE21} . cp -p %{SOURCE22} . +cp -p %{SOURCE23} . %build make %{?_smp_mflags}