Adds a config. option loadts_ignorenewrpm.
We save the new rpmdb version via. the special repo. "installed" so that
the new ts files can be loaded by old yum versions. This is a hack,
AFAIK there is no other way.
Currently all the "API" for this is hidden, because it's only run from
the cli parts ... and only activated via. load-ts ... may want to make
this more generic.
---
cli.py | 12 ++++++++++++
yum/__init__.py | 34 ++++++++++++++++++++++++++++++----
yum/config.py | 1 +
yum/transactioninfo.py | 1 +
4 files changed, 44 insertions(+), 4 deletions(-)
diff --git a/cli.py b/cli.py
index a4c7c79..c1dae95 100644
--- a/cli.py
+++ b/cli.py
@@ -482,6 +482,18 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
else:
self.reportDownloadSize(downloadpkgs, install_only)
+ cfr = self.tsInfo._check_future_rpmdbv
+ if (cfr is not None and
+ cfr[0] == self.tsInfo.state_counter and
+ self.tsInfo.futureRpmDBVersion() != cfr[1]):
+ msg = _("future rpmdb ver mismatched saved transaction version,")
+ if cfr[2]:
+ msg += _(" ignoring, as requested.")
+ self.logger.critical(_(msg))
+ else:
+ msg += _(" aborting.")
+ raise yum.Errors.YumBaseError(msg)
+
# confirm with user
if self._promptWanted():
if not self.userconfirm():
diff --git a/yum/__init__.py b/yum/__init__.py
index 5c44245..3d266e1 100644
--- a/yum/__init__.py
+++ b/yum/__init__.py
@@ -5034,9 +5034,11 @@ class YumBase(depsolve.Depsolve):
msg = "%s\n" % self.rpmdb.simpleVersion(main_only=True)[0]
msg += "%s\n" % self.ts.getTsFlags()
- msg += "%s\n" % len(self.repos.listEnabled())
+ msg += "%s\n" % (len(self.repos.listEnabled()) + 1)
for r in self.repos.listEnabled():
msg += "%s:%s:%s\n" % (r.id, len(r.sack), r.repoXML.revision)
+ # Save what we think the future rpmdbv will be.
+ msg += "%s:%s\n" % ('installed', self.tsInfo.futureRpmDBVersion())
msg += "%s\n" % len(self.tsInfo.getMembers())
for txmbr in self.tsInfo.getMembers():
msg += txmbr._dump()
@@ -5051,7 +5053,8 @@ class YumBase(depsolve.Depsolve):
raise Errors.YumBaseError(_("Could not save transaction file
%s: %s") % (filename, str(e)))
- def load_ts(self, filename, ignorerpm=None, ignoremissing=None):
+ def load_ts(self, filename, ignorerpm=None, ignoremissing=None,
+ ignorenewrpm=None):
"""loads a transaction from a .yumtx file"""
# check rpmversion - if not match throw a fit
# check repoversions (and repos)- if not match throw a fit
@@ -5067,21 +5070,30 @@ class YumBase(depsolve.Depsolve):
if ignorerpm is None:
ignorerpm = self.conf.loadts_ignorerpm
+ if ignorenewrpm is None:
+ ignorenewrpm = self.conf.loadts_ignorenewrpm
if ignoremissing is None:
ignoremissing = self.conf.loadts_ignoremissing
+
+ # Inherit this, because for the ending version to match the starting
+ # version must match.
+ if ignorerpm:
+ ignorenewrpm = True
# data format
# 0 == rpmdb version
# 1 == tsflags
# 2 == numrepos
# 3:numrepos = repos
+ # -- post 3.2.29 update: 'installed' repo. added with the values as
the
+ # new rpmdb version.
# 3+numrepos = num pkgs
# 3+numrepos+1 -> EOF= txmembers
# rpm db ver
rpmv = data[0].strip()
if rpmv != str(self.rpmdb.simpleVersion(main_only=True)[0]):
- msg = _("rpmdb ver mismatched saved transaction version, ")
+ msg = _("rpmdb ver mismatched saved transaction version,")
if ignorerpm:
msg += _(" ignoring, as requested.")
self.logger.critical(_(msg))
@@ -5104,8 +5116,17 @@ class YumBase(depsolve.Depsolve):
numrepos = int(data[2].strip())
repos = []
rindex=3+numrepos
+ future_rpmdbv = None
for r in data[3:rindex]:
- repos.append(r.strip().split(':'))
+ repo = r.strip().split(':')
+
+ if repo and repo[0] == 'installed':
+ # This is an update hack to list the _future_ rpmdb version.
+ # Doing it this way allows older yum's to load newer ts files.
+ future_rpmdbv = "%s:%s" % (repo[1], repo[2])
+ continue
+
+ repos.append(repo)
# pkgs/txmbrs
numpkgs = int(data[rindex].strip())
@@ -5224,6 +5245,11 @@ class YumBase(depsolve.Depsolve):
msg += _(" aborting.")
raise Errors.YumBaseError(msg)
+ if len(self.tsInfo) != pkgcount:
+ future_rpmdbv = None
+ if future_rpmdbv is not None:
+ self.tsInfo._check_future_rpmdbv = (pkgcount, future_rpmdbv,
+ ignorenewrpm)
return self.tsInfo.getMembers()
def _remove_old_deps(self):
diff --git a/yum/config.py b/yum/config.py
index 9c2db93..11b42f1 100644
--- a/yum/config.py
+++ b/yum/config.py
@@ -744,6 +744,7 @@ class YumConf(StartupConf):
loadts_ignoremissing = BoolOption(False)
loadts_ignorerpm = BoolOption(False)
+ loadts_ignorenewrpm = BoolOption(False)
clean_requirements_on_remove = BoolOption(False)
_reposlist = []
diff --git a/yum/transactioninfo.py b/yum/transactioninfo.py
index 55643ce..7dd0036 100644
--- a/yum/transactioninfo.py
+++ b/yum/transactioninfo.py
@@ -106,6 +106,7 @@ class TransactionData:
self.downgraded = []
self._future_rpmdbv = None
+ self._check_future_rpmdbv = None
def __len__(self):
return len(self.pkgdict)
--
1.7.3.4
_______________________________________________
Yum-devel mailing list
[email protected]
http://lists.baseurl.org/mailman/listinfo/yum-devel