* unpack dir flat interface'i archivezip icin
* unicode sacmaligiyla ugras * reduce default arg istiyor tabii * bir takim ufak hatalar hala var
This commit is contained in:
+1
-1
@@ -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:'
|
||||
|
||||
@@ -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()
|
||||
|
||||
+8
-5
@@ -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
|
||||
|
||||
|
||||
+2
-2
@@ -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
|
||||
|
||||
|
||||
+9
-1
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user