forked from pool/rpmlint
Ludwig Nussel
bda5d592a2
- add script update_git.sh based on qemu's to simplify importing a patch series from git after rebasing. * Patches dropped: 0001-Python-3-compatibility-tweaks.patch (upstream) 0001-Set-Python-3.4-magic-number-to-3310.patch (upstream) add-scoring-support.diff (different upstream solution) check-buildroot-during-install.diff (need to fix no-cleaning-of-buildroot check upstream) fix-versioned-prereq.diff (was disabled, not sure what it's useful for) ignore-non-readable-in-etc.diff (filtered anyways) locale-support.diff (drop) locale-update.diff (different upstream solution now) more-verbose-lsb-check.diff (drop) perl-versioned-rpath-deps.diff (upstream) rpmlint-1.5-disallow-var-run-and-var-lock.diff (upstream) rpmlint-1.5-Fix-setgroups-error-name.diff (upstream) rpmlint-decode-fix.diff (different upstream solution) rpmlint-fix-unexpanded-macros-for-array-values.patch (different upstream solution) stricter-tags-check.diff (merged in weak deps and check-for-self-provides.diff) suppress-for-perl-python.diff (use filter instead) suse-binary-info-compile-opts.diff (drop) suse-changelog.patch (change config instead) suse-mono-deps-checks.diff (useful?) suse-required-lsb-tags.diff (different upstream solution) verify-buildrequires.diff (very build system specific, drop) xdg-check-exception.diff (upstream) * renamed patches: script-interpreter-only-for-exec-scripts.diff -> script-interpreter-only-for-exec-sc.diff confusing-invalid-spec-name.patch OBS-URL: https://build.opensuse.org/package/show/devel:openSUSE:Factory:rpmlint/rpmlint?expand=0&rev=317
150 lines
5.5 KiB
Diff
150 lines
5.5 KiB
Diff
From 8cacb89fedba57086f1e02d326308142e6d70dbe Mon Sep 17 00:00:00 2001
|
|
From: Some One <nobody@opensuse.org>
|
|
Date: Thu, 9 Apr 2015 14:55:39 +0200
|
|
Subject: [PATCH] add-weak-dependencies.diff
|
|
|
|
===================================================================
|
|
---
|
|
Pkg.py | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++--
|
|
TagsCheck.py | 19 +++++++++++++++++++
|
|
2 files changed, 70 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/Pkg.py b/Pkg.py
|
|
index e97d7ef..cfaa5a9 100644
|
|
--- a/Pkg.py
|
|
+++ b/Pkg.py
|
|
@@ -466,6 +466,10 @@ class Pkg:
|
|
self._missingok_files = None
|
|
self._files = None
|
|
self._requires = None
|
|
+ self._suggests = None
|
|
+ self._supplements = None
|
|
+ self._enhances = None
|
|
+ self._recommends = None
|
|
self._req_names = -1
|
|
|
|
if header:
|
|
@@ -716,6 +720,22 @@ class Pkg:
|
|
self._gatherDepInfo()
|
|
return self._requires
|
|
|
|
+ def recommends(self):
|
|
+ self._gatherDepInfo()
|
|
+ return self._recommends
|
|
+
|
|
+ def suggests(self):
|
|
+ self._gatherDepInfo()
|
|
+ return self._suggests
|
|
+
|
|
+ def supplements(self):
|
|
+ self._gatherDepInfo()
|
|
+ return self._supplements
|
|
+
|
|
+ def enhances(self):
|
|
+ self._gatherDepInfo()
|
|
+ return self._enhances
|
|
+
|
|
def prereq(self):
|
|
"""Get package PreReqs as list of
|
|
(name, flags, (epoch, version, release)) tuples."""
|
|
@@ -752,7 +772,7 @@ class Pkg:
|
|
|
|
# internal function to gather dependency info used by the above ones
|
|
def _gather_aux(self, header, list, nametag, flagstag, versiontag,
|
|
- prereq=None):
|
|
+ prereq = None, strong_only = False, weak_only = False):
|
|
names = header[nametag]
|
|
flags = header[flagstag]
|
|
versions = header[versiontag]
|
|
@@ -763,7 +783,11 @@ class Pkg:
|
|
evr = stringToVersion(b2s(versions[loop]))
|
|
if prereq is not None and flags[loop] & PREREQ_FLAG:
|
|
prereq.append((name, flags[loop] & (~PREREQ_FLAG), evr))
|
|
- else:
|
|
+ elif strong_only and flags[loop] & rpm.RPMSENSE_STRONG:
|
|
+ list.append((names[loop], versions[loop], flags[loop] & (~rpm.RPMSENSE_STRONG)))
|
|
+ elif weak_only and not (flags[loop] & rpm.RPMSENSE_STRONG):
|
|
+ list.append((names[loop], versions[loop], flags[loop]))
|
|
+ elif not (weak_only or strong_only):
|
|
list.append((name, flags[loop], evr))
|
|
|
|
def _gatherDepInfo(self):
|
|
@@ -773,6 +797,10 @@ class Pkg:
|
|
self._provides = []
|
|
self._conflicts = []
|
|
self._obsoletes = []
|
|
+ self._suggests = []
|
|
+ self._supplements = []
|
|
+ self._enhances = []
|
|
+ self._recommends = []
|
|
|
|
self._gather_aux(self.header, self._requires,
|
|
rpm.RPMTAG_REQUIRENAME,
|
|
@@ -791,6 +819,26 @@ class Pkg:
|
|
rpm.RPMTAG_OBSOLETENAME,
|
|
rpm.RPMTAG_OBSOLETEFLAGS,
|
|
rpm.RPMTAG_OBSOLETEVERSION)
|
|
+ try:
|
|
+ self._gather_aux(self.header, self._recommends,
|
|
+ rpm.RPMTAG_RECOMMENDNAME,
|
|
+ rpm.RPMTAG_RECOMMENDFLAGS,
|
|
+ rpm.RPMTAG_RECOMMENDVERSION)
|
|
+ self._gather_aux(self.header, self._suggests,
|
|
+ rpm.RPMTAG_SUGGESTNAME,
|
|
+ rpm.RPMTAG_SUGGESTFLAGS,
|
|
+ rpm.RPMTAG_SUGGESTVERSION)
|
|
+ self._gather_aux(self.header, self._supplements,
|
|
+ rpm.RPMTAG_SUPPLEMENTNAME,
|
|
+ rpm.RPMTAG_SUPPLEMENTFLAGS,
|
|
+ rpm.RPMTAG_SUPPLEMENTVERSION)
|
|
+ self._gather_aux(self.header, self._enhances,
|
|
+ rpm.RPMTAG_ENHANCENAME,
|
|
+ rpm.RPMTAG_ENHANCEFLAGS,
|
|
+ rpm.RPMTAG_ENHANCEVERSION)
|
|
+ except:
|
|
+ pass
|
|
+
|
|
|
|
def scriptprog(self, which):
|
|
"""Get the specified script interpreter as a string.
|
|
@@ -805,6 +853,7 @@ class Pkg:
|
|
return b2s(prog)
|
|
|
|
|
|
+
|
|
def getInstalledPkgs(name):
|
|
"""Get list of installed package objects by name."""
|
|
|
|
diff --git a/TagsCheck.py b/TagsCheck.py
|
|
index bc79283..6528d5b 100644
|
|
--- a/TagsCheck.py
|
|
+++ b/TagsCheck.py
|
|
@@ -853,8 +853,27 @@ class TagsCheck(AbstractCheck.AbstractCheck):
|
|
value = Pkg.formatRequire(*c)
|
|
self._unexpanded_macros(pkg, 'Conflicts %s' % (value,), value)
|
|
|
|
+ for i in pkg.supplements():
|
|
+ value = Pkg.formatRequire(*i)
|
|
+ self._unexpanded_macros(pkg, 'Supplements %s' % (value,), value)
|
|
+
|
|
+ for i in pkg.suggests():
|
|
+ value = Pkg.formatRequire(*i)
|
|
+ self._unexpanded_macros(pkg, 'Suggests %s' % (value,), value)
|
|
+
|
|
+ for i in pkg.enhances():
|
|
+ value = Pkg.formatRequire(*i)
|
|
+ self._unexpanded_macros(pkg, 'Enhances %s' % (value,), value)
|
|
+
|
|
+ for i in pkg.recommends():
|
|
+ value = Pkg.formatRequire(*i)
|
|
+ self._unexpanded_macros(pkg, 'Recommends %s' % (value,), value)
|
|
+
|
|
obss = pkg.obsoletes()
|
|
if obss:
|
|
+ for obs in obss:
|
|
+ value = Pkg.formatRequire(*obs)
|
|
+ self._unexpanded_macros(pkg, 'Obsoletes %s' % (value,), value)
|
|
provs = pkg.provides()
|
|
for prov in provs:
|
|
for obs in obss:
|