* reinstall isini calistirtir

* bunun icin remove'u da fix et o da calissin ufaktan
This commit is contained in:
Eray Özkural
2005-07-18 13:32:38 +00:00
parent ee6e59f9d9
commit d4a6de7086
4 changed files with 47 additions and 30 deletions
+23 -23
View File
@@ -16,6 +16,7 @@ from packagedb import packagedb
import dependency
from metadata import MetaData
import comariface
import operations
#import conflicts
class InstallError(Exception):
@@ -85,38 +86,37 @@ class Installer:
raise InstallError("Package not installable")
#TODO:
if installdb.is_installed(pkginfo.name): # is this a reinstallation?
(iversion, irelease) = installdb.get_version(pkginfo.name)
if pkginfo.version == iversion and pkginfo.release == irelease:
if not ui.confirm('Re-install same version package?'):
raise InstallError('Package re-install declined')
else:
upgrade = False
# is this an upgrade?
# determine and report the kind of upgrade: version, release, build
if pkginfo.version > iversion:
ui.info('Upgrading to new upstream version')
upgrade = True
elif pkginfo.release > irelease:
ui.info('Upgrading to new distribution release')
upgrade = True
upgrade = False
# is this an upgrade?
# determine and report the kind of upgrade: version, release, build
if pkginfo.version > iversion:
ui.info('Upgrading to new upstream version')
upgrade = True
elif pkginfo.release > irelease:
ui.info('Upgrading to new distribution release')
upgrade = True
# is this a downgrade? confirm this action.
#
# burada bir gariplik var. Tam olarak ne yapmak istediğini
# anlamadığım için bırakıyorm. Ama bu kod çalışmıyor.
if not upgrade:
if pkginfo.version < iversion:
x = 'Downgrade to old upstream version?'
elif pkginfo.release < irelease:
x = 'Downgrade to old distribution release?'
if not ui.confirm(x):
raise InstallError('Package downgrade declined')
# is this a downgrade? confirm this action.
#
# burada bir gariplik var. Tam olarak ne yapmak istediğini
# anlamadığım için bırakıyorm. Ama bu kod çalışmıyor.
if not upgrade:
if pkginfo.version < iversion:
x = 'Downgrade to old upstream version?'
elif pkginfo.release < irelease:
x = 'Downgrade to old distribution release?'
if not ui.confirm(x):
raise InstallError('Package downgrade declined')
# remove old package then
remove(pkginfo.name)
operations.remove(pkginfo.name)
# unzip package in place
self.extractInstall()
+7 -5
View File
@@ -7,6 +7,7 @@ import os, fcntl
import bsddb.dbshelve as shelve
from config import config
from constants import const
from files import Files
import util
@@ -28,8 +29,9 @@ class InstallDB:
self.fdummy.close()
def files_name(self, pkg, version, release):
fn = pkg + '-' + version + '-' + release + '.xml'
return os.path.join(self.files_dir, fn)
from os.path import join
pkg_dir = join(config.lib_dir(), pkg + '-' + version + '-' + release)
return join(pkg_dir, const.files_xml)
def files(self, pkg):
pkg = str(pkg)
@@ -91,9 +93,9 @@ class InstallDB:
pkg = str(pkg)
if self.d.has_key(pkg):
(status, version, release) = self.d[pkg]
f = self.files_name(pkg, version, release)
if util.check_file(f):
os.unlink(f)
#f = self.files_name(pkg, version, release)
#if util.check_file(f):
# os.unlink(f)
del self.d[pkg]
installdb = InstallDB()
+10 -2
View File
@@ -1,4 +1,12 @@
import os
from config import config
from constants import const
from ui import ui
from package import Package
from installdb import installdb
from packagedb import packagedb
from os.path import join
# all package operation interfaces are here
@@ -8,8 +16,8 @@ def remove(package_name):
if not installdb.is_installed(package_name):
raise InstallError('Trying to remove nonexistent package '
+ package_name)
for fileinfo in installdb.files(package_name):
os.unlink(fileinfo.path)
for fileinfo in installdb.files(package_name).list:
os.unlink( join(config.destdir, fileinfo.path) )
installdb.remove(package_name)
+7
View File
@@ -91,5 +91,12 @@ class Package:
return join( config.lib_dir(), packageDir)
def pkg_dir_aux():
packageDir = self.metadata.package.name + '-' \
+ self.metadata.package.version + '-' \
+ self.metadata.package.release
return join( config.lib_dir(), packageDir)
def comar_dir(self):
return join( self.pkg_dir(), const.comar_dir_suffix)