[yum-commits] docs/yum.conf.5 yum/config.py
James Antill
james at osuosl.org
Thu Oct 31 13:36:56 UTC 2013
docs/yum.conf.5 | 12 +++++++++---
yum/config.py | 20 ++++++++++++++++++--
2 files changed, 27 insertions(+), 5 deletions(-)
New commits:
commit d0272d66ad1c36e85facc7deed2408409cfec83a
Author: James Antill <james at and.org>
Date: Tue Oct 15 15:28:51 2013 -0400
Mostly backwards compat. change to how distroverpkg config. works. BZ 1002977.
This is for rel-eng, now instead of just looking at the version of the
package which provides the "distro. release provide" we try to parse the
version out of the packages provides. This allows random verisons for
the package, which is apparently useful.
Speed of config. loading doesn't seem to be measurable. One change is
that .conf.distroverpkg is now a list to accomodate the new provide vs.
the old one. Also if anyone had a package providing redhat-release = blah,
$releasever is now "blah" instead of whatever the package version was.
diff --git a/docs/yum.conf.5 b/docs/yum.conf.5
index 5c73a39..5d8578d 100644
--- a/docs/yum.conf.5
+++ b/docs/yum.conf.5
@@ -284,9 +284,15 @@ Command-line option: \fB\-\-installroot\fP
.IP
\fBdistroverpkg\fR
-The package used by yum to determine the "version" of the distribution. This
-can be any installed package. Default is `redhat-release'. You can see what
-provides this manually by using: "yum whatprovides redhat-release".
+The package used by yum to determine the "version" of the distribution, this
+sets $releasever for use in config. files. This
+can be any installed package. Default is `system-release(releasever)',
+`redhat-release'. Yum will now look at the version provided by the provide,
+and if that is non-empty then will use the full V(-R), otherwise it uses the
+version of the package.
+ You can see what provides this manually by using:
+"yum whatprovides 'system-release(releasever)' redhat-release" and you can see
+what $releasever is most easily by using: "yum version".
.IP
\fBdiskspacecheck\fR
diff --git a/yum/config.py b/yum/config.py
index 17aa0ca..1cb4fc5 100644
--- a/yum/config.py
+++ b/yum/config.py
@@ -38,6 +38,7 @@ if not _use_iniparse:
from ConfigParser import NoSectionError, NoOptionError, ParsingError
from ConfigParser import ConfigParser
import rpmUtils.transaction
+import rpmUtils.miscutils
import Errors
import types
from misc import get_uuid, read_in_items_from_dot_dir
@@ -713,7 +714,7 @@ class StartupConf(BaseConfig):
debuglevel = IntOption(2, -4, 10)
errorlevel = IntOption(2, 0, 10)
- distroverpkg = Option('redhat-release')
+ distroverpkg = ListOption(['system-release(releasever)', 'redhat-release'])
installroot = Option('/')
config_file_path = Option('/etc/yum/yum.conf')
plugins = BoolOption(False)
@@ -1177,7 +1178,10 @@ def _getsysver(installroot, distroverpkg):
ts = rpmUtils.transaction.initReadOnlyTransaction(root=installroot)
ts.pushVSFlags(~(rpm._RPMVSF_NOSIGNATURES|rpm._RPMVSF_NODIGESTS))
try:
- idx = ts.dbMatch('provides', distroverpkg)
+ for distroverpkg_prov in distroverpkg:
+ idx = ts.dbMatch('provides', distroverpkg_prov)
+ if idx.count():
+ break
except TypeError, e:
# This is code for "cannot open rpmdb"
# this is for pep 352 compliance on python 2.6 and above :(
@@ -1200,6 +1204,18 @@ def _getsysver(installroot, distroverpkg):
except StopIteration:
raise Errors.YumBaseError("Error: rpmdb failed release provides. Try: rpm --rebuilddb")
releasever = hdr['version']
+
+ off = hdr[getattr(rpm, 'RPMTAG_PROVIDENAME')].index(distroverpkg_prov)
+ flag = hdr[getattr(rpm, 'RPMTAG_PROVIDEFLAGS')][off]
+ flag = rpmUtils.miscutils.flagToString(flag)
+ ver = hdr[getattr(rpm, 'RPMTAG_PROVIDEVERSION')][off]
+ if flag == 'EQ' and ver:
+ releasever = rpmUtils.miscutils.stringToVersion(releasever)
+ if releasever[2]:
+ releasever = "%s-%s" % (releasever[1], releasever[2]) # No epoch
+ else:
+ releasever = releasever[1] # No epoch or release, just version
+
del hdr
del idx
del ts
More information about the Yum-commits
mailing list