* fix: download first, and then construct install operation
objects one by one, avoiding heap aggregation
This commit is contained in:
@@ -62,7 +62,7 @@ class Install(AtomicOperation):
|
|||||||
"Install class, provides install routines for pisi packages"
|
"Install class, provides install routines for pisi packages"
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def from_name(name):
|
def from_name(name, ignore_dep = None):
|
||||||
# download package and return an installer object
|
# download package and return an installer object
|
||||||
# find package in repository
|
# find package in repository
|
||||||
repo = ctx.packagedb.which_repo(name)
|
repo = ctx.packagedb.which_repo(name)
|
||||||
@@ -80,13 +80,14 @@ class Install(AtomicOperation):
|
|||||||
|
|
||||||
ctx.ui.debug(_("Package URI: %s") % pkg_path)
|
ctx.ui.debug(_("Package URI: %s") % pkg_path)
|
||||||
|
|
||||||
return Install(pkg_path)
|
return Install(pkg_path, ignore_dep)
|
||||||
else:
|
else:
|
||||||
raise Error(_("Package %s not found in any active repository.") % name)
|
raise Error(_("Package %s not found in any active repository.") % name)
|
||||||
|
|
||||||
def __init__(self, package_fname, ignore_dep = None):
|
def __init__(self, package_fname, ignore_dep = None):
|
||||||
"initialize from a file name"
|
"initialize from a file name"
|
||||||
super(Install, self).__init__(ignore_dep)
|
super(Install, self).__init__(ignore_dep)
|
||||||
|
self.package_fname = package_fname
|
||||||
self.package = pisi.package.Package(package_fname)
|
self.package = pisi.package.Package(package_fname)
|
||||||
self.package.read()
|
self.package.read()
|
||||||
self.metadata = self.package.metadata
|
self.metadata = self.package.metadata
|
||||||
|
|||||||
+10
-6
@@ -9,7 +9,7 @@
|
|||||||
#
|
#
|
||||||
# Please read the COPYING file.
|
# 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"
|
"Package Operations: install/remove/upgrade"
|
||||||
|
|
||||||
@@ -406,11 +406,15 @@ def upgrade_pkg_names(A = [], bypass_safety = False):
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
ctx.ui.notify(ui.packagestogo, order = order)
|
ctx.ui.notify(ui.packagestogo, order = order)
|
||||||
|
|
||||||
install_ops = [atomicoperations.Install.from_name(x) for x in order]
|
paths = []
|
||||||
|
for x in order:
|
||||||
for install in install_ops:
|
install_op = atomicoperations.Install.from_name(x)
|
||||||
install.install(True)
|
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):
|
def plan_upgrade(A, ignore_build = False):
|
||||||
# try to construct a pisi graph of packages to
|
# try to construct a pisi graph of packages to
|
||||||
|
|||||||
+2
-2
@@ -13,8 +13,8 @@
|
|||||||
# package database
|
# package database
|
||||||
# interface for update/query to local package repository
|
# interface for update/query to local package repository
|
||||||
|
|
||||||
# Authors: Eray Ozkural <eray@pardus.org.tr>
|
# Authors: Eray Ozkural <eray at pardus.org.tr>
|
||||||
# Baris Metin <baris@pardus.org.tr>
|
# Baris Metin <baris at pardus.org.tr>
|
||||||
|
|
||||||
# we basically store everything in PackageInfo class
|
# we basically store everything in PackageInfo class
|
||||||
# yes, we are cheap
|
# yes, we are cheap
|
||||||
|
|||||||
Reference in New Issue
Block a user