* fix: download first, and then construct install operation

objects one by one, avoiding heap aggregation
This commit is contained in:
Eray Özkural
2006-05-08 12:19:52 +00:00
parent 20c7c81831
commit a54bf8074d
3 changed files with 15 additions and 10 deletions
+3 -2
View File
@@ -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
+10 -6
View File
@@ -9,7 +9,7 @@
#
# Please read the COPYING file.
#
# Author: Eray Ozkural <eray@pardus.org.tr>
# Author: Eray Ozkural <eray at pardus.org.tr>
"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
+2 -2
View File
@@ -13,8 +13,8 @@
# package database
# interface for update/query to local package repository
# Authors: Eray Ozkural <eray@pardus.org.tr>
# Baris Metin <baris@pardus.org.tr>
# Authors: Eray Ozkural <eray at pardus.org.tr>
# Baris Metin <baris at pardus.org.tr>
# we basically store everything in PackageInfo class
# yes, we are cheap