SHA256
1
0
forked from pool/rpmlint
rpmlint/add-weak-dependencies.diff
Ludwig Nussel 912bea2445 Accepting request 346358 from home:lnussel:branches:devel:openSUSE:Factory:rpmlint
- rpmlint 1.8 update
 * python 3 fixes
 * Add support for file triggers
 * Mechanism to black list certain C calls
 * new error: non-devel-file-in-devel-package
 * appdata check configurable
 * project moved to github
 * Patches dropped:
  avoid-mismatched-libregex.diff
  filename-non-utf8-exception.diff
  fix-ghost-file-handling.diff
  save-content-to-an-array.diff
  fix-TmpFilesCheck-pattern-match.diff
  move-ghost-file-check-to-TmpFilesCh.diff

OBS-URL: https://build.opensuse.org/request/show/346358
OBS-URL: https://build.opensuse.org/package/show/devel:openSUSE:Factory:rpmlint/rpmlint?expand=0&rev=353
2015-11-26 10:24:13 +00:00

111 lines
3.8 KiB
Diff

From: Some One <nobody@opensuse.org>
Date: Thu, 9 Apr 2015 14:55:39 +0200
Subject: [PATCH] add-weak-dependencies.diff
===================================================================
---
Pkg.py | 29 +++++++++++++++++++++++++++--
TagsCheck.py | 19 +++++++++++++++++++
2 files changed, 46 insertions(+), 2 deletions(-)
diff --git a/Pkg.py b/Pkg.py
index 8884dce..360ec39 100644
--- a/Pkg.py
+++ b/Pkg.py
@@ -475,6 +475,10 @@ class Pkg(AbstractPkg):
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:
@@ -730,6 +734,22 @@ class Pkg(AbstractPkg):
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."""
@@ -790,7 +810,7 @@ class Pkg(AbstractPkg):
# 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]
@@ -801,7 +821,11 @@ class Pkg(AbstractPkg):
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):
@@ -867,6 +891,7 @@ class Pkg(AbstractPkg):
return prog
+
def getInstalledPkgs(name):
"""Get list of installed package objects by name."""
diff --git a/TagsCheck.py b/TagsCheck.py
index 13dbb95..00ec2e8 100644
--- a/TagsCheck.py
+++ b/TagsCheck.py
@@ -854,8 +854,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: