2015-04-10 16:35:46 +02:00
|
|
|
From: Some One <nobody@opensuse.org>
|
|
|
|
Date: Thu, 9 Apr 2015 14:55:39 +0200
|
|
|
|
Subject: [PATCH] add-weak-dependencies.diff
|
|
|
|
|
2010-10-29 10:29:16 +02:00
|
|
|
===================================================================
|
2015-04-10 16:35:46 +02:00
|
|
|
---
|
|
|
|
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:
|
2009-08-28 22:12:54 +02:00
|
|
|
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
|
2008-05-01 14:19:31 +02:00
|
|
|
|
|
|
|
if header:
|
2015-04-10 16:35:46 +02:00
|
|
|
@@ -716,6 +720,22 @@ class Pkg:
|
2008-05-01 14:19:31 +02:00
|
|
|
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):
|
2010-10-14 14:32:03 +02:00
|
|
|
"""Get package PreReqs as list of
|
|
|
|
(name, flags, (epoch, version, release)) tuples."""
|
2015-04-10 16:35:46 +02:00
|
|
|
@@ -752,7 +772,7 @@ class Pkg:
|
2008-05-01 14:19:31 +02:00
|
|
|
|
|
|
|
# internal function to gather dependency info used by the above ones
|
2010-10-14 14:32:03 +02:00
|
|
|
def _gather_aux(self, header, list, nametag, flagstag, versiontag,
|
2015-04-10 16:35:46 +02:00
|
|
|
- prereq=None):
|
2010-04-01 16:20:38 +02:00
|
|
|
+ prereq = None, strong_only = False, weak_only = False):
|
2008-05-01 14:19:31 +02:00
|
|
|
names = header[nametag]
|
|
|
|
flags = header[flagstag]
|
2010-10-14 14:32:03 +02:00
|
|
|
versions = header[versiontag]
|
2015-04-10 16:35:46 +02:00
|
|
|
@@ -763,7 +783,11 @@ class Pkg:
|
|
|
|
evr = stringToVersion(b2s(versions[loop]))
|
2009-08-28 22:12:54 +02:00
|
|
|
if prereq is not None and flags[loop] & PREREQ_FLAG:
|
2014-02-21 15:54:14 +01:00
|
|
|
prereq.append((name, flags[loop] & (~PREREQ_FLAG), evr))
|
2008-05-01 14:19:31 +02:00
|
|
|
- else:
|
|
|
|
+ elif strong_only and flags[loop] & rpm.RPMSENSE_STRONG:
|
|
|
|
+ list.append((names[loop], versions[loop], flags[loop] & (~rpm.RPMSENSE_STRONG)))
|
2010-04-01 16:20:38 +02:00
|
|
|
+ elif weak_only and not (flags[loop] & rpm.RPMSENSE_STRONG):
|
2008-05-01 14:19:31 +02:00
|
|
|
+ list.append((names[loop], versions[loop], flags[loop]))
|
|
|
|
+ elif not (weak_only or strong_only):
|
2014-02-24 13:07:04 +01:00
|
|
|
list.append((name, flags[loop], evr))
|
2008-05-01 14:19:31 +02:00
|
|
|
|
|
|
|
def _gatherDepInfo(self):
|
2015-04-10 16:35:46 +02:00
|
|
|
@@ -773,6 +797,10 @@ class Pkg:
|
2008-05-01 14:19:31 +02:00
|
|
|
self._provides = []
|
|
|
|
self._conflicts = []
|
|
|
|
self._obsoletes = []
|
|
|
|
+ self._suggests = []
|
|
|
|
+ self._supplements = []
|
|
|
|
+ self._enhances = []
|
|
|
|
+ self._recommends = []
|
|
|
|
|
|
|
|
self._gather_aux(self.header, self._requires,
|
|
|
|
rpm.RPMTAG_REQUIRENAME,
|
2015-04-10 16:35:46 +02:00
|
|
|
@@ -791,6 +819,26 @@ class Pkg:
|
2012-09-13 18:07:20 +02:00
|
|
|
rpm.RPMTAG_OBSOLETENAME,
|
|
|
|
rpm.RPMTAG_OBSOLETEFLAGS,
|
|
|
|
rpm.RPMTAG_OBSOLETEVERSION)
|
2008-05-01 14:19:31 +02:00
|
|
|
+ try:
|
|
|
|
+ self._gather_aux(self.header, self._recommends,
|
2014-02-24 13:07:04 +01:00
|
|
|
+ rpm.RPMTAG_RECOMMENDNAME,
|
|
|
|
+ rpm.RPMTAG_RECOMMENDFLAGS,
|
|
|
|
+ rpm.RPMTAG_RECOMMENDVERSION)
|
2008-05-01 14:19:31 +02:00
|
|
|
+ self._gather_aux(self.header, self._suggests,
|
2014-02-24 13:07:04 +01:00
|
|
|
+ rpm.RPMTAG_SUGGESTNAME,
|
|
|
|
+ rpm.RPMTAG_SUGGESTFLAGS,
|
|
|
|
+ rpm.RPMTAG_SUGGESTVERSION)
|
2010-10-28 13:38:59 +02:00
|
|
|
+ self._gather_aux(self.header, self._supplements,
|
2014-02-24 13:07:04 +01:00
|
|
|
+ rpm.RPMTAG_SUPPLEMENTNAME,
|
|
|
|
+ rpm.RPMTAG_SUPPLEMENTFLAGS,
|
|
|
|
+ rpm.RPMTAG_SUPPLEMENTVERSION)
|
2010-10-28 13:38:59 +02:00
|
|
|
+ self._gather_aux(self.header, self._enhances,
|
2014-02-24 13:07:04 +01:00
|
|
|
+ rpm.RPMTAG_ENHANCENAME,
|
|
|
|
+ rpm.RPMTAG_ENHANCEFLAGS,
|
|
|
|
+ rpm.RPMTAG_ENHANCEVERSION)
|
2012-09-13 18:08:27 +02:00
|
|
|
+ except:
|
|
|
|
+ pass
|
2010-10-28 13:38:59 +02:00
|
|
|
+
|
2012-09-13 18:07:20 +02:00
|
|
|
|
|
|
|
def scriptprog(self, which):
|
|
|
|
"""Get the specified script interpreter as a string.
|
2015-04-10 16:35:46 +02:00
|
|
|
@@ -805,6 +853,7 @@ class Pkg:
|
|
|
|
return b2s(prog)
|
|
|
|
|
2012-09-13 18:07:20 +02:00
|
|
|
|
2010-10-14 14:32:03 +02:00
|
|
|
+
|
2008-05-01 14:19:31 +02:00
|
|
|
def getInstalledPkgs(name):
|
|
|
|
"""Get list of installed package objects by name."""
|
2010-10-14 14:32:03 +02:00
|
|
|
|
2015-04-10 16:35:46 +02:00
|
|
|
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:
|