[Yum-devel] [PATCH 1/2] Add "distro-sync full", which will reinstall packages due to checksums.
James Antill
james at and.org
Tue Mar 29 14:20:11 UTC 2011
---
cli.py | 32 +++++++++++++++++++++++++++++++-
1 files changed, 31 insertions(+), 1 deletions(-)
diff --git a/cli.py b/cli.py
index 2267b86..eca1812 100644
--- a/cli.py
+++ b/cli.py
@@ -757,6 +757,13 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
installed version is older or newer. We allow "selection" but not
local packages (use tmprepo, or something). """
+ level = 'diff'
+ if userlist and userlist[0] in ('full', 'diff', 'different'):
+ level = userlist[0]
+ userlist = userlist[1:]
+ if level == 'different':
+ level = 'diff'
+
dupdates = []
ipkgs = {}
for pkg in sorted(self.rpmdb.returnPackages(patterns=userlist)):
@@ -794,8 +801,31 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
ipkg = ipkgs[ipkgname]
apkg = apkgs[ipkgname]
- if ipkg.verEQ(apkg):
+ if ipkg.verEQ(apkg): # Latest installed == Latest avail.
+ if level == 'diff':
+ continue
+
+ # level == full: do reinstalls if checksum doesn't match.
+ # do removals, if older installed versions.
+ for napkg in self.rpmdb.searchNames([ipkgname]):
+ if (not self.allowedMultipleInstalls(apkg) and
+ not napkg.verEQ(ipkg)):
+ dupdates.extend(self.remove(po=napkg))
+ continue
+
+ nayi = napkg.yumdb_info
+ for apkg in self.pkgSack.searchPkgTuple(napkg.pkgtup):
+ if ('checksum_type' in nayi and
+ 'checksum_data' in nayi and
+ nayi.checksum_type == apkg.checksum_type and
+ nayi.checksum_data == apkg.pkgId):
+ found = True
+ break
+ if found:
+ continue
+ dupdates.extend(self.reinstall(pkgtup=napkg.pkgtup))
continue
+
if self.allowedMultipleInstalls(apkg):
found = False
for napkg in self.rpmdb.searchNames([apkg.name]):
--
1.7.3.4
More information about the Yum-devel
mailing list