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