SHA256
1
0
forked from pool/rpmlint

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
This commit is contained in:
Ruediger Oertel 2010-10-28 11:38:59 +00:00 committed by Git OBS Bridge
parent 4631dc0a35
commit b2476b9e05
12 changed files with 141 additions and 27 deletions

View File

@ -35,8 +35,8 @@ class BrandingPolicyCheck(AbstractCheck.AbstractCheck):
(r[0].find('-theme-') >= 0 or r[0].find('-branding-') >= 0)): (r[0].find('-theme-') >= 0 or r[0].find('-branding-') >= 0)):
printError(pkg,'suse-branding-specific-branding-req', r[0]) printError(pkg,'suse-branding-specific-branding-req', r[0])
if r[0].endswith('branding') or r[0].endswith('theme'): if r[0].endswith('branding') or r[0].endswith('theme'):
if (r[2] != rpm.RPMSENSE_EQUAL or not r[1].startswith('1')): if (r[1] != rpm.RPMSENSE_EQUAL or not r[2].startswith('1')):
printError(pkg,'suse-branding-unversioned-req', r[0]) printError(pkg,'suse-branding-unversioned-requires', r[0])
# verify that it doesn't conflict with branding # verify that it doesn't conflict with branding
for r in pkg_conflicts: for r in pkg_conflicts:
@ -99,13 +99,13 @@ class BrandingPolicyCheck(AbstractCheck.AbstractCheck):
if not branding_provide: if not branding_provide:
printError(pkg,'suse-branding-no-branding-provide') printError(pkg,'suse-branding-no-branding-provide')
else: else:
if (len(branding_provide) < 2 or branding_provide[2] != rpm.RPMSENSE_EQUAL): if (len(branding_provide) < 2 or branding_provide[1] != rpm.RPMSENSE_EQUAL):
printError(pkg, 'suse-branding-unversioned-prov', branding_provide[0]) printError(pkg, 'suse-branding-unversioned-provides', branding_provide[0])
for r in pkg.requires(): for r in pkg.requires():
if r[0].find('-theme-') >= 0 or r[0].find('-branding-') >= 0: if r[0].find('-theme-') >= 0 or r[0].find('-branding-') >= 0:
if (r[2] != rpm.RPMSENSE_EQUAL or not r[1].startswith('1')): if (r[1] != rpm.RPMSENSE_EQUAL or not r[2].startswith('1')):
printError(pkg, 'suse-branding-unversioned-req', r[0]) printError(pkg, 'suse-branding-unversioned-requires', r[0])
check=BrandingPolicyCheck() check=BrandingPolicyCheck()
@ -115,11 +115,15 @@ if Config.info:
'suse-branding-specific-branding-req', 'suse-branding-specific-branding-req',
"""bla""", """bla""",
'suse-branding-no-branding-provides', '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', 'suse-branding-supplement-missing',
"""branding packages should provide a supplemnent in the form """branding packages should provide a supplemnent in the form
Supplements: packageand(basepackage:branding-<flavour>) Supplements: packageand(basepackage:branding-<flavour>)
""", """,
'suse-branding-unversioned-requires',
"""Please make sure that your requires entry reads like 'Requires: %name-branding = <versionnumber>'.""",
'suse-branding-missing-conflicts', 'suse-branding-missing-conflicts',
"""Any branding flavor package that provides the generic branding """Any branding flavor package that provides the generic branding
must also conflict with all other branding packages via a special must also conflict with all other branding packages via a special

49
CheckBuildDate.py Normal file
View File

@ -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"""
)

View File

@ -51,6 +51,7 @@ check=DBUSServiceCheck()
if Config.info: if Config.info:
addDetails( addDetails(
'suse-dbus-unauthorized-service', 'suse-dbus-unauthorized-service',
"""The package installs an unauthorized DBUS service. """The package installs a DBUS system service file. If the package
Please contact security@suse.de for review.""", is intended for inclusion in any SUSE product please open a bug
report to request review of the service by the security team.""",
) )

View File

@ -453,4 +453,10 @@ if Config.info:
if not 'error' in check: if not 'error' in check:
continue 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']) addDetails(check['error'], check['details'])

View File

@ -53,6 +53,10 @@ _kde4_libakonadi4 = (
"libakonadiprotocolinternals.so.1", "libakonadiprotocolinternals.so.1",
) )
_kde4_knotificationdep = (
"libknotificationitem-1.so",
)
class KDE4Check(AbstractCheck.AbstractCheck): class KDE4Check(AbstractCheck.AbstractCheck):
def __init__(self): def __init__(self):
AbstractCheck.AbstractCheck.__init__(self, "CheckKDE4Deps") AbstractCheck.AbstractCheck.__init__(self, "CheckKDE4Deps")
@ -104,6 +108,8 @@ class KDE4Check(AbstractCheck.AbstractCheck):
printError(pkg,"suse-kde4-excessive-dependency", "%kde4_akonadi_requires") printError(pkg,"suse-kde4-excessive-dependency", "%kde4_akonadi_requires")
if not "akonadi-runtime" in pkg_requires and libakonadi4_dep: if not "akonadi-runtime" in pkg_requires and libakonadi4_dep:
printError(pkg,"suse-kde4-missing-dependency", "%kde4_akonadi_requires") 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() check=KDE4Check()

View File

@ -115,9 +115,13 @@ check=PolkitCheck()
if Config.info: if Config.info:
addDetails( addDetails(
'polkit-unauthorized-file', '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', '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', 'polkit-cant-acquire-privilege',
"""Usability can be improved by allowing users to acquire privileges """Usability can be improved by allowing users to acquire privileges
via authentication. Use e.g. 'auth_admin' instead of 'no' and make via authentication. Use e.g. 'auth_admin' instead of 'no' and make

View File

@ -141,7 +141,9 @@ check=SUIDCheck()
if Config.info: if Config.info:
addDetails( addDetails(
'permissions-unauthorized-file', '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-symlink',
"""permissions handling for symlinks is useless. Please contact """permissions handling for symlinks is useless. Please contact
security@suse.de to remove the entry.""", security@suse.de to remove the entry.""",
@ -158,9 +160,15 @@ remove the slash.""",
'permissions-incorrect-owner', 'permissions-incorrect-owner',
"""please use the %attr macro to set the correct ownership.""", """please use the %attr macro to set the correct ownership.""",
'permissions-file-setuid-bit', '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', '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', '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""",
) )

View File

@ -69,10 +69,22 @@ check=KMPPolicyCheck()
if Config.info: if Config.info:
addDetails( 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-excessive-supplements',
""" """, """ """,
'suse-policy-kmp-missing-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. for proper dependencies to be built.
""", """,
) )

View File

@ -34,7 +34,7 @@
def prereq(self): def prereq(self):
"""Get package PreReqs as list of """Get package PreReqs as list of
(name, flags, (epoch, version, release)) tuples.""" (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 # internal function to gather dependency info used by the above ones
def _gather_aux(self, header, list, nametag, flagstag, versiontag, def _gather_aux(self, header, list, nametag, flagstag, versiontag,
@ -43,7 +43,13 @@
names = header[nametag] names = header[nametag]
flags = header[flagstag] flags = header[flagstag]
versions = header[versiontag] 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: if prereq is not None and flags[loop] & PREREQ_FLAG:
prereq.append((names[loop], flags[loop] & (~PREREQ_FLAG), prereq.append((names[loop], flags[loop] & (~PREREQ_FLAG),
evr)) evr))
@ -56,7 +62,7 @@
list.append((names[loop], flags[loop], evr)) list.append((names[loop], flags[loop], evr))
def _gatherDepInfo(self): def _gatherDepInfo(self):
@@ -713,6 +737,10 @@ @@ -713,6 +740,10 @@
self._provides = [] self._provides = []
self._conflicts = [] self._conflicts = []
self._obsoletes = [] self._obsoletes = []
@ -67,27 +73,32 @@
self._gather_aux(self.header, self._requires, self._gather_aux(self.header, self._requires,
rpm.RPMTAG_REQUIRENAME, rpm.RPMTAG_REQUIRENAME,
@@ -732,6 +760,27 @@ @@ -732,6 +763,32 @@
rpm.RPMTAG_OBSOLETEFLAGS, rpm.RPMTAG_OBSOLETEFLAGS,
rpm.RPMTAG_OBSOLETEVERSION) rpm.RPMTAG_OBSOLETEVERSION)
+ try: + try:
+ self._gather_aux(self.header, self._recommends, + self._gather_aux(self.header, self._recommends,
+ rpm.RPMTAG_SUGGESTSNAME, + rpm.RPMTAG_SUGGESTSNAME,
+ rpm.RPMTAG_SUGGESTSFLAGS,
+ rpm.RPMTAG_SUGGESTSVERSION, + rpm.RPMTAG_SUGGESTSVERSION,
+ rpm.RPMTAG_SUGGESTSFLAGS, strong_only=True) + strong_only=True)
+ self._gather_aux(self.header, self._suggests, + self._gather_aux(self.header, self._suggests,
+ rpm.RPMTAG_SUGGESTSNAME, + rpm.RPMTAG_SUGGESTSNAME,
+ rpm.RPMTAG_SUGGESTSFLAGS,
+ rpm.RPMTAG_SUGGESTSVERSION, + rpm.RPMTAG_SUGGESTSVERSION,
+ rpm.RPMTAG_SUGGESTSFLAGS, weak_only=True) + weak_only=True)
+ self._gather_aux(self.header, self._enhances,
+ rpm.RPMTAG_ENHANCESNAME,
+ rpm.RPMTAG_ENHANCESVERSION,
+ rpm.RPMTAG_ENHANCESFLAGS, weak_only=True)
+ self._gather_aux(self.header, self._supplements, + self._gather_aux(self.header, self._supplements,
+ rpm.RPMTAG_ENHANCESNAME, + rpm.RPMTAG_ENHANCESNAME,
+ rpm.RPMTAG_ENHANCESFLAGS,
+ rpm.RPMTAG_ENHANCESVERSION, + 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: + except:
+ pass + pass
+ +

1
config
View File

@ -35,6 +35,7 @@ addCheck("CheckKDE4Deps")
addCheck("KMPPolicyCheck") addCheck("KMPPolicyCheck")
addCheck("CheckAlternativesGhostFiles") addCheck("CheckAlternativesGhostFiles")
addCheck("BashismsCheck") addCheck("BashismsCheck")
addCheck("CheckBuildDate")
# stuff autobuild takes care about # stuff autobuild takes care about
addFilter(".*invalid-version.*") addFilter(".*invalid-version.*")

View File

@ -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 Tue Oct 19 13:30:41 UTC 2010 - lnussel@suse.de

View File

@ -48,6 +48,7 @@ Source19: CheckAlternativesGhostFiles.py
Source20: rpmgroups.config Source20: rpmgroups.config
Source21: BashismsCheck.py Source21: BashismsCheck.py
Source22: CheckGNOMEMacros.py Source22: CheckGNOMEMacros.py
Source23: CheckBuildDate.py
Source100: syntax-validator.py Source100: syntax-validator.py
Url: http://rpmlint.zarb.org/ Url: http://rpmlint.zarb.org/
License: GPLv2+ License: GPLv2+
@ -210,6 +211,7 @@ cp -p %{SOURCE18} .
cp -p %{SOURCE19} . cp -p %{SOURCE19} .
cp -p %{SOURCE21} . cp -p %{SOURCE21} .
cp -p %{SOURCE22} . cp -p %{SOURCE22} .
cp -p %{SOURCE23} .
%build %build
make %{?_smp_mflags} make %{?_smp_mflags}