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
|
|
|
---
|
2015-11-26 11:24:13 +01:00
|
|
|
Pkg.py | 29 +++++++++++++++++++++++++++--
|
2015-04-10 16:35:46 +02:00
|
|
|
TagsCheck.py | 19 +++++++++++++++++++
|
2015-11-26 11:24:13 +01:00
|
|
|
2 files changed, 46 insertions(+), 2 deletions(-)
|
2015-04-10 16:35:46 +02:00
|
|
|
|
|
|
|
diff --git a/Pkg.py b/Pkg.py
|
2015-11-26 11:24:13 +01:00
|
|
|
index 8884dce..360ec39 100644
|
2015-04-10 16:35:46 +02:00
|
|
|
--- a/Pkg.py
|
|
|
|
+++ b/Pkg.py
|
2015-11-26 11:24:13 +01:00
|
|
|
@@ -475,6 +475,10 @@ class Pkg(AbstractPkg):
|
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-11-26 11:24:13 +01:00
|
|
|
@@ -730,6 +734,22 @@ class Pkg(AbstractPkg):
|
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-11-26 11:24:13 +01:00
|
|
|
@@ -790,7 +810,7 @@ class Pkg(AbstractPkg):
|
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-11-26 11:24:13 +01:00
|
|
|
@@ -801,7 +821,11 @@ class Pkg(AbstractPkg):
|
2015-04-10 16:35:46 +02:00
|
|
|
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-11-26 11:24:13 +01:00
|
|
|
@@ -867,6 +891,7 @@ class Pkg(AbstractPkg):
|
|
|
|
return prog
|
2015-04-10 16:35:46 +02:00
|
|
|
|
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
|
2015-11-26 11:24:13 +01:00
|
|
|
index 13dbb95..00ec2e8 100644
|
2015-04-10 16:35:46 +02:00
|
|
|
--- a/TagsCheck.py
|
|
|
|
+++ b/TagsCheck.py
|
2015-11-26 11:24:13 +01:00
|
|
|
@@ -854,8 +854,27 @@ class TagsCheck(AbstractCheck.AbstractCheck):
|
2015-04-10 16:35:46 +02:00
|
|
|
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:
|