Kaydet (Commit) 0646b325 authored tarafından root's avatar root

fix distribution upgrade

üst 12c64ed6
......@@ -165,6 +165,12 @@ class Install(AtomicOperation):
self.trigger = inary.trigger.Trigger()
self.ask_reinstall = False
self.old_files = self.installdb.get_files(self.pkginfo.name)
self.old_pkginfo = self.installdb.get_info(self.pkginfo.name)
(iversion_s, irelease_s) = self.installdb.get_version(self.pkginfo.name)[:2]
self.old_path = self.installdb.pkg_dir(
self.pkginfo.name, iversion_s, irelease_s)
def install(self, ask_reinstall=True):
# Any package should remove the package it replaces before
......@@ -279,7 +285,7 @@ class Install(AtomicOperation):
(iversion_s, irelease_s) = self.installdb.get_version(pkg.name)[:2]
pkg_version = inary.version.make_version(pkg.version)
iversion = inary.version.make_version(iversion_s)
if pkg_version > iversion:
if pkg_version > iversion or pkg.distributionRelease > self.installdb.get_distro_release(pkg.name)[1]:
if ctx.config.get_option('store_lib_info'):
self.store_old_paths = os.path.join(
ctx.config.old_paths_cache_dir(), pkg.name)
......@@ -295,7 +301,10 @@ class Install(AtomicOperation):
# is this an upgrade?
# determine and report the kind of upgrade: version, release
if pkg_release > irelease:
if pkg.distributionRelease > self.installdb.get_distro_release(pkg.name)[1]:
ctx.ui.info(_('Upgrading to new distribution.'))
self.operation = UPGRADE
elif pkg_release > irelease:
ctx.ui.info(_('Upgrading to new release.'))
self.operation = UPGRADE
# is this a downgrade? confirm this action.
......@@ -312,10 +321,6 @@ class Install(AtomicOperation):
# schedule for reinstall
self.old_files = self.installdb.get_files(pkg.name)
self.old_pkginfo = self.installdb.get_info(pkg.name)
self.old_path = self.installdb.pkg_dir(
pkg.name, iversion_s, irelease_s)
def preinstall(self):
if 'postOps' in self.metadata.package.isA:
......@@ -355,6 +360,8 @@ class Install(AtomicOperation):
_('Post-install configuration of \"{}\" package failed.').format(self.pkginfo.name))
self.installdb.mark_pending(self.pkginfo.name)
return 0
if self.old_path != self.package.pkg_dir():
util.clean_dir(self.old_path)
def extract_install(self):
"""unzip package in place"""
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment