On Fri, 2011-11-04 at 16:04 +0100, Zdeněk Pavlas wrote:
> ---
> 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:
The "if False:" thing is just a way so that you can move/add sections
to the conditional without having to change anything from "if" to
"elif" ... and so all the conditionals line up.
> + if not po.pkgtup in opkgtups:
> + ret.append(("remove", pkgtup2str(*po.pkgtup)))
The * is wrong here ... we also generally don't do it for non-function
arguments as RHEL-5 python is too old to accept that.
> 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
Doesn't this mean it doesn't install any installonly packages?
> 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():
_______________________________________________
Yum-devel mailing list
[email protected]
http://lists.baseurl.org/mailman/listinfo/yum-devel