From a54bf8074d9cca0b05dcaf038b4aa390fb0f945a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eray=20=C3=96zkural?= Date: Mon, 8 May 2006 12:19:52 +0000 Subject: [PATCH] * fix: download first, and then construct install operation objects one by one, avoiding heap aggregation --- pisi/atomicoperations.py | 5 +++-- pisi/operations.py | 16 ++++++++++------ pisi/packagedb.py | 4 ++-- 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/pisi/atomicoperations.py b/pisi/atomicoperations.py index 8126ae38..872d2486 100644 --- a/pisi/atomicoperations.py +++ b/pisi/atomicoperations.py @@ -62,7 +62,7 @@ class Install(AtomicOperation): "Install class, provides install routines for pisi packages" @staticmethod - def from_name(name): + def from_name(name, ignore_dep = None): # download package and return an installer object # find package in repository repo = ctx.packagedb.which_repo(name) @@ -80,13 +80,14 @@ class Install(AtomicOperation): ctx.ui.debug(_("Package URI: %s") % pkg_path) - return Install(pkg_path) + return Install(pkg_path, ignore_dep) else: raise Error(_("Package %s not found in any active repository.") % name) def __init__(self, package_fname, ignore_dep = None): "initialize from a file name" super(Install, self).__init__(ignore_dep) + self.package_fname = package_fname self.package = pisi.package.Package(package_fname) self.package.read() self.metadata = self.package.metadata diff --git a/pisi/operations.py b/pisi/operations.py index 57da60c3..e841f41f 100644 --- a/pisi/operations.py +++ b/pisi/operations.py @@ -9,7 +9,7 @@ # # Please read the COPYING file. # -# Author: Eray Ozkural +# Author: Eray Ozkural "Package Operations: install/remove/upgrade" @@ -406,11 +406,15 @@ def upgrade_pkg_names(A = [], bypass_safety = False): return False ctx.ui.notify(ui.packagestogo, order = order) - - install_ops = [atomicoperations.Install.from_name(x) for x in order] - - for install in install_ops: - install.install(True) + + paths = [] + for x in order: + install_op = atomicoperations.Install.from_name(x) + paths.append(install_op.package_fname) + + for path in paths: + install_op = atomicoperations.Install(path) + install_op.install(True) def plan_upgrade(A, ignore_build = False): # try to construct a pisi graph of packages to diff --git a/pisi/packagedb.py b/pisi/packagedb.py index 48d5babb..48d20c6b 100644 --- a/pisi/packagedb.py +++ b/pisi/packagedb.py @@ -13,8 +13,8 @@ # package database # interface for update/query to local package repository -# Authors: Eray Ozkural -# Baris Metin +# Authors: Eray Ozkural +# Baris Metin # we basically store everything in PackageInfo class # yes, we are cheap