From 2da389927f159ce11eb0dcf2fbf73e13c5d728fa Mon Sep 17 00:00:00 2001 From: Faik Uygur Date: Wed, 17 Jun 2009 09:09:28 +0000 Subject: [PATCH] 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. --- pisi/operations/install.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/pisi/operations/install.py b/pisi/operations/install.py index 507c38d8..0f6999e8 100644 --- a/pisi/operations/install.py +++ b/pisi/operations/install.py @@ -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: