[Yum-devel] [PATCH] yum-debug-restore: restore installonly pkgs. BZ 737597.

Zdeněk Pavlas zpavlas at redhat.com
Fri Nov 4 15:04:11 UTC 2011


---
 yum-debug-restore.py |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/yum-debug-restore.py b/yum-debug-restore.py
index fd95741..27deea3 100755
--- a/yum-debug-restore.py
+++ b/yum-debug-restore.py
@@ -107,11 +107,14 @@ def pkg_data2list(yb, opkgtups, opkgmaps, install_latest, ignore_arch):
     ret = []
     npkgtups = set()
     npkgmaps = {}
+    installonly = set(yb.conf.installonlypkgs)
     for po in sorted(yb.rpmdb.returnPackages()):
         arch = po.arch
         if ignore_arch:
             arch = None
-        if False: pass
+        if po.name in installonly:
+            if not po.pkgtup in opkgtups:
+                ret.append(("remove", pkgtup2str(*po.pkgtup)))
         elif (po.name, arch) not in opkgmaps:
             ret.append(("remove", str(po)))
         elif po.pkgtup not in opkgtups:
@@ -129,6 +132,8 @@ def pkg_data2list(yb, opkgtups, opkgmaps, install_latest, ignore_arch):
             npkgmaps[(po.name, None)] = po
 
     for name, arch in sorted(opkgmaps):
+        if name in installonly:
+            continue
         if ignore_arch and arch is not None:
             continue
         if (name, arch) in npkgmaps:
@@ -139,6 +144,9 @@ def pkg_data2list(yb, opkgtups, opkgmaps, install_latest, ignore_arch):
             ret.append(("install", "%s.%s" % (name, arch)))
         else:
             ret.append(("install", pkgtup2str(opkgmaps[(name, arch)])))
+    for pkgtup in opkgtups:
+        if pkgtup[0] in installonly and not pkgtup in npkgtups:
+            ret.append(("remove", pkgtup2str(pkgtup)))
     return ret
 
 def main():
-- 
1.7.4.4



More information about the Yum-devel mailing list