Check for reinstalls as in install_pkg_names

This is actually added for YALI. YALI now gives all the packages with
their full paths. But when an exception happens and retry is selected
from YALI, to continue the packages where YALI left pisi has to check
the list and should not install the already installed packages as done
in install_pkg_names.
This commit is contained in:
Faik Uygur
2009-06-17 09:09:28 +00:00
parent a4a674e52d
commit 2da389927f
+17
View File
@@ -10,6 +10,7 @@
# Please read the COPYING file.
#
import os
import sys
import gettext
@@ -111,12 +112,28 @@ def install_pkg_names(A, reinstall = False):
def install_pkg_files(package_URIs, reinstall = False):
"""install a number of pisi package files"""
installdb = pisi.db.installdb.InstallDB()
ctx.ui.debug('A = %s' % str(package_URIs))
for x in package_URIs:
if not x.endswith(ctx.const.package_suffix):
raise Exception(_('Mixing file names and package names not supported yet.'))
# filter packages that are already installed
tobe_installed, already_installed = [], set()
if not reinstall:
for x in package_URIs:
if not x.endswith(ctx.const.delta_package_suffix) and x.endswith(ctx.const.package_suffix):
pkg_name, pkg_version = pisi.util.parse_package_name(os.path.basename(x))
if installdb.has_package(pkg_name):
already_installed.add(pkg_name)
else:
tobe_installed.append(x)
if already_installed:
ctx.ui.warning(_("The following package(s) are already installed and are not going to be installed again:\n") +
util.strlist(already_installed))
package_URIs = tobe_installed
if ctx.config.get_option('ignore_dependency'):
# simple code path then
for x in package_URIs: