From 0689e9cac3b6ee44bbe1afaec390d212df82613b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eray=20=C3=96zkural?= Date: Fri, 29 Jul 2005 14:07:52 +0000 Subject: [PATCH] * install_pkg_files'i da seyettir * dependency'de gereken seyleri seyettirt --- pisi/dependency.py | 13 ++++++++----- pisi/operations.py | 5 +++-- pisi/toplevel.py | 24 ++++++++++++++++++------ 3 files changed, 29 insertions(+), 13 deletions(-) diff --git a/pisi/dependency.py b/pisi/dependency.py index 8c78f84b..6569ddaf 100644 --- a/pisi/dependency.py +++ b/pisi/dependency.py @@ -15,11 +15,7 @@ def satisfiesDep(pkg_name, depinfo): (version, release) = (pkg.version, pkg.release) return depinfo.satisfies(pkg_name, version, release) -def runtimeDeps(pkg): - return packagedb.get_package(pkg).runtimeDeps - -def satisfiesRuntimeDeps(pkg): - deps = runtimeDeps(pkg) +def satisfiesDeps(pkg, deps): for dep in deps: if not satisfiesDep(pkg, dep): ui.error('Package %s does not satisfy dependency %s\n' % @@ -27,6 +23,13 @@ def satisfiesRuntimeDeps(pkg): return False return True +def runtimeDeps(pkg): + return packagedb.get_package(pkg).runtimeDeps + +def satisfiesRuntimeDeps(pkg): + deps = runtimeDeps(pkg) + return satisfiesDeps(pkg, deps) + def installable(pkg): """calculate if pkg is installable currently which means it has to satisfy both install and runtime dependencies""" diff --git a/pisi/operations.py b/pisi/operations.py index 020f2d3b..152ea07e 100644 --- a/pisi/operations.py +++ b/pisi/operations.py @@ -43,11 +43,12 @@ def install_single(pkg): # package filename. Otherwise we'll try installing a package from # the package repository. if url.isRemoteFile() or os.path.exists(url.uri): - install_single_package(pkg) + install_single_file(pkg) else: install_single_name(pkg) -def install_single_uri(pkg_location): +def install_single_file(pkg_location): + """install a package file""" from install import Installer Installer(pkg_location).install() diff --git a/pisi/toplevel.py b/pisi/toplevel.py index d1c0ead0..4b0b93ea 100644 --- a/pisi/toplevel.py +++ b/pisi/toplevel.py @@ -27,34 +27,44 @@ def install_pkg_files(packages): """install a number of pisi package files""" from package import Package + for x in packages: + if not x.endswith(const.package_prefix): + ui.error('Mixing file names and package names not supported\n') + return False + # read the package information into memory first # regardless of which distribution they come from d_t = {} for x in packages: package = Package(x) package.read() - d_t[package.name] = package.metadata + d_t[package.metadata.package.name] = package.metadata # for this case, we have to determine the dependencies # that aren't already satisfied and try to install them - # from the repository. + # from the repository dep_unsatis = [] for name in d_t.keys(): - pkg = d_t[name] - deps = pkg.runtimeDeps - if not dependency.satisfiesDep(pkg, deps): + md = d_t[name] + deps = md.package.runtimeDeps + if not dependency.satisfiesDeps(md.package.name, deps): dep_unsatis.append(deps) # now determine if these unsatisfied dependencies could # be satisfied by installing packages from the repo # if so, then invoke install_pkg_names - install_pkg_names([x.package for x in dep_unsatis]) + if install_pkg_names([x.package for x in dep_unsatis]): + for x in packages: + operations.install_single_file(x) def install_pkg_names(A): """This is the real thing. It installs packages from the repository, trying to perform a minimum number of installs""" + + if len(A)==0: + return True # try to construct a pisi graph of packages to # install / reinstall @@ -87,6 +97,8 @@ def install_pkg_names(A): print l for x in l: operations.install_single_name(x) + + return True # everything went OK :) def remove(packages): #TODO: this for loop is just a placeholder