diff --git a/pisi-install b/pisi-install index da75d3ef..fcc9bed7 100755 --- a/pisi-install +++ b/pisi-install @@ -39,7 +39,7 @@ def main(): package_fn = args[0] try: - ui.info('* Installing ' + package_fn) + ui.info('* Installing ' + package_fn + '\n') pisi.install.install(package_fn) except pisi.install.InstallError, estr: print '*** An installation error has occured:' diff --git a/pisi/archive.py b/pisi/archive.py index 372d82cb..2f0d7ea7 100644 --- a/pisi/archive.py +++ b/pisi/archive.py @@ -152,6 +152,9 @@ class ArchiveZip(ArchiveBase): def unpack_dir(self, path, targetDir): self.unpack_file_cond(lambda f:util.subpath(path,f), targetDir) + def unpack_dir_flat(self, path, targetDir): + self.unpack_file_cond(lambda f:util.subpath(path,f), targetDir, path) + def unpack(self, targetDir): self.unpack_file_cond(lambda f: True, targetDir) self.close() diff --git a/pisi/dependency.py b/pisi/dependency.py index fbdb433c..fb801df8 100644 --- a/pisi/dependency.py +++ b/pisi/dependency.py @@ -26,7 +26,7 @@ def satisfiesInstallDeps(pkg): deps = installDeps(pkg) print 'installdeps = ', deps return reduce(lambda x,y:x and y, - map(lambda x: satisfiesDep(pkg, x), deps)) + map(lambda x: satisfiesDep(pkg, x), deps),True) def runtimeDeps(pkg): return packagedb.get_package(pkg).runtimeDeps @@ -35,14 +35,17 @@ def satisfiesRuntimeDeps(pkg): deps = runtimeDeps(pkg) print 'runtimedeps = ', deps return reduce(lambda x,y:x and y, - map(lambda x: satisfiesDep(pkg, x), deps)) + map(lambda x: satisfiesDep(pkg, x), deps),True) def installable(pkg): """calculate if pkg is installable currently which means it has to satisfy both install and runtime dependencies""" if not packagedb.has_package(pkg): - ui.info("package " + pkg + - " is not installable due to lacking dependencies\n"); + ui.info("package " + pkg + " is not present in the package database\n"); + return False + elif not satisfiesRuntimeDeps(pkg) and satisfiesInstallDeps(pkg): + ui.info("package " + pkg + " does not satisfy dependencies\n"); return False else: - return satisfiesRuntimeDeps(pkg) and satisfiesInstallDeps(pkg) + return True + diff --git a/pisi/install.py b/pisi/install.py index bc2b324a..076df6b1 100644 --- a/pisi/install.py +++ b/pisi/install.py @@ -25,7 +25,6 @@ def install(package_fn): package = Package(package_fn, 'r') # extract control files util.clean_dir(config.install_dir()) - ui.info('extracting files\n') package.extract_PISI_files(config.install_dir()) # verify package @@ -46,7 +45,8 @@ def install(package_fn): raise InstallError("Package not installable") # unzip package in place - package.extract_dir_flat(config.destdir) + ui.info('Extracting files\n') + package.extract_dir_flat('install', config.destdir) # update databases diff --git a/pisi/installdb.py b/pisi/installdb.py index 8b5befdd..7aa96f83 100644 --- a/pisi/installdb.py +++ b/pisi/installdb.py @@ -16,16 +16,19 @@ class InstallDBError(Exception): pass def files_name(pkg, version, release): - return files_dir + '/' + pkg + '-' + version + '-' + release + '.xml' + return str(files_dir + '/' + pkg + '-' + version + '-' + release + '.xml') def files(pkg): + pkg = str(pkg) (status, version, release) = d[pkg] return file(files_name(pkg,version,release)) def is_recorded(pkg): + pkg = str(pkg) return d.has_key(pkg) def is_installed(pkg): + pkg = str(pkg) if is_recorded(pkg): (status, version, release) = d[pkg] return status=='i' @@ -33,10 +36,12 @@ def is_installed(pkg): return False def get_version(pkg): + pkg = str(pkg) (status, version, release) = d[pkg] return (version, release) def is_removed(pkg): + pkg = str(pkg) if is_recorded(pkg): (status, version, release) = d[pkg] return status=='r' @@ -45,16 +50,19 @@ def is_removed(pkg): def install(pkg, version, release, files_xml): """install package with specific version and release""" + pkg = str(pkg) if is_installed(pkg): raise InstallDBError("already installed") d[pkg] = ('i', version, release) util.copy_file(files_xml, files_name(pkg, version, release)) def remove(pkg): + pkg = str(pkg) (status, version, release) = d[pkg] d[pkg] = ('r', version, release) def purge(pkg): + pkg = str(pkg) if d.has_key(pkg): (status, version, release) = d[pkg] f = files_name(pkg, version, release)