* install_pkg_files'i da seyettir

* dependency'de gereken seyleri seyettirt
This commit is contained in:
Eray Özkural
2005-07-29 14:07:52 +00:00
parent bfc25e05ff
commit 0689e9cac3
3 changed files with 29 additions and 13 deletions
+8 -5
View File
@@ -15,11 +15,7 @@ def satisfiesDep(pkg_name, depinfo):
(version, release) = (pkg.version, pkg.release) (version, release) = (pkg.version, pkg.release)
return depinfo.satisfies(pkg_name, version, release) return depinfo.satisfies(pkg_name, version, release)
def runtimeDeps(pkg): def satisfiesDeps(pkg, deps):
return packagedb.get_package(pkg).runtimeDeps
def satisfiesRuntimeDeps(pkg):
deps = runtimeDeps(pkg)
for dep in deps: for dep in deps:
if not satisfiesDep(pkg, dep): if not satisfiesDep(pkg, dep):
ui.error('Package %s does not satisfy dependency %s\n' % ui.error('Package %s does not satisfy dependency %s\n' %
@@ -27,6 +23,13 @@ def satisfiesRuntimeDeps(pkg):
return False return False
return True return True
def runtimeDeps(pkg):
return packagedb.get_package(pkg).runtimeDeps
def satisfiesRuntimeDeps(pkg):
deps = runtimeDeps(pkg)
return satisfiesDeps(pkg, deps)
def installable(pkg): def installable(pkg):
"""calculate if pkg is installable currently """calculate if pkg is installable currently
which means it has to satisfy both install and runtime dependencies""" which means it has to satisfy both install and runtime dependencies"""
+3 -2
View File
@@ -43,11 +43,12 @@ def install_single(pkg):
# package filename. Otherwise we'll try installing a package from # package filename. Otherwise we'll try installing a package from
# the package repository. # the package repository.
if url.isRemoteFile() or os.path.exists(url.uri): if url.isRemoteFile() or os.path.exists(url.uri):
install_single_package(pkg) install_single_file(pkg)
else: else:
install_single_name(pkg) install_single_name(pkg)
def install_single_uri(pkg_location): def install_single_file(pkg_location):
"""install a package file"""
from install import Installer from install import Installer
Installer(pkg_location).install() Installer(pkg_location).install()
+18 -6
View File
@@ -27,34 +27,44 @@ def install_pkg_files(packages):
"""install a number of pisi package files""" """install a number of pisi package files"""
from package import Package 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 # read the package information into memory first
# regardless of which distribution they come from # regardless of which distribution they come from
d_t = {} d_t = {}
for x in packages: for x in packages:
package = Package(x) package = Package(x)
package.read() 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 # for this case, we have to determine the dependencies
# that aren't already satisfied and try to install them # that aren't already satisfied and try to install them
# from the repository. # from the repository
dep_unsatis = [] dep_unsatis = []
for name in d_t.keys(): for name in d_t.keys():
pkg = d_t[name] md = d_t[name]
deps = pkg.runtimeDeps deps = md.package.runtimeDeps
if not dependency.satisfiesDep(pkg, deps): if not dependency.satisfiesDeps(md.package.name, deps):
dep_unsatis.append(deps) dep_unsatis.append(deps)
# now determine if these unsatisfied dependencies could # now determine if these unsatisfied dependencies could
# be satisfied by installing packages from the repo # be satisfied by installing packages from the repo
# if so, then invoke install_pkg_names # 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): def install_pkg_names(A):
"""This is the real thing. It installs packages from """This is the real thing. It installs packages from
the repository, trying to perform a minimum number of the repository, trying to perform a minimum number of
installs""" installs"""
if len(A)==0:
return True
# try to construct a pisi graph of packages to # try to construct a pisi graph of packages to
# install / reinstall # install / reinstall
@@ -87,6 +97,8 @@ def install_pkg_names(A):
print l print l
for x in l: for x in l:
operations.install_single_name(x) operations.install_single_name(x)
return True # everything went OK :)
def remove(packages): def remove(packages):
#TODO: this for loop is just a placeholder #TODO: this for loop is just a placeholder