Remove the second upgrade check from yuminstall.py.
This was largely a duplicate of what we do when looking for upgradable
roots. Along the way, however, I've gotten rid of the ability to upgrade
from one arch to another. We were already saying it was unlikely to work.
---
pyanaconda/backend.py | 3 --
pyanaconda/installclass.py | 12 +++++-
pyanaconda/storage/__init__.py | 19 ++++++++--
pyanaconda/yuminstall.py | 79 ----------------------------------------
4 files changed, 26 insertions(+), 87 deletions(-)
+ import rpm
+ iutil.resetRpmDb(mountpoint)
+ ts = rpm.TransactionSet(mountpoint)
+
+ # We get the arch from the initscripts package, but the version and name
+ # must come from reading the release file.
+ mi = ts.dbMatch('provides', 'initscripts')
+ for h in mi:
+ relArch = h['arch']
+ break
+
filename = "%s/etc/redhat-release" % mountpoint
if os.access(filename, os.R_OK):
with open(filename) as f:
@@ -1406,7 +1418,7 @@ def getReleaseString(mountpoint):
relName = product
relVer = version.split()[0]
if os.access(anaconda.rootPath + "/etc/fstab", os.R_OK):
- (product, version) = getReleaseString(anaconda.rootPath)
+ (arch, product, version) = getReleaseString(anaconda.rootPath)
+
if upgradeany or
- anaconda.instClass.productUpgradable(product, version):
+ anaconda.instClass.productUpgradable(arch, product, version):
rootDevs.append((device, "%s %s" % (product, version)))
else:
notUpgradable.append((product, version, device.name))
diff --git a/pyanaconda/yuminstall.py b/pyanaconda/yuminstall.py
index 1dac081..55053e9 100644
--- a/pyanaconda/yuminstall.py
+++ b/pyanaconda/yuminstall.py
@@ -1598,85 +1598,6 @@ reposdir=/etc/anaconda.repos.d,/tmp/updates/anaconda.repos.d,/tmp/product/anacon
# ensure that /etc/mtab is a symlink to /proc/self/mounts
anaconda.storage.makeMtab(root=anaconda.rootPath)
- def checkSupportedUpgrade(self, anaconda):
- if anaconda.dir == DISPATCH_BACK:
- return
- self._checkUpgradeVersion(anaconda)
- self._checkUpgradeArch(anaconda)
-
- def _checkUpgradeVersion(self, anaconda):
- # Figure out current version for upgrade nag and for determining weird
- # upgrade cases
- supportedUpgradeVersion = -1
- for pkgtup in self.ayum.rpmdb.whatProvides('redhat-release', None, None):
- n, a, e, v, r = pkgtup
- if supportedUpgradeVersion <= 0:
- val = rpmUtils.miscutils.compareEVR((None, '3', '1'),
- (e, v,r))
- if val > 0:
- supportedUpgradeVersion = 0
- else:
- supportedUpgradeVersion = 1
- break
-
- if "Red Hat Enterprise Linux" not in productName:
- supportedUpgradeVersion = 1
-
- if supportedUpgradeVersion == 0:
- rc = anaconda.intf.messageWindow(_("Warning"),
- _("You appear to be upgrading from a system "
- "which is too old to upgrade to this "
- "version of %s. Are you sure you wish to "
- "continue the upgrade "
- "process?") %(productName,),
- type = "yesno")
- if rc == 0:
- iutil.resetRpmDb(anaconda.rootPath)
- sys.exit(0)
-
- def _checkUpgradeArch(self, anaconda):
- def compareArch(a, b):
- if re.match("i.86", a) and re.match("i.86", b):
- return True
- else:
- return a == b
-
- # get the arch of the initscripts package
- try:
- pkgs = self.ayum.pkgSack.returnNewestByName('initscripts' )
- except yum.Errors.PackageSackError:
- log.info("no packages named initscripts")
- return None
-
- pkgs = self.ayum.bestPackagesFromList(pkgs)
- if len(pkgs) == 0:
- log.info("no best package")
- return
- myarch = pkgs[0].arch
-
- log.info("initscripts is arch: %s" %(myarch,))
- for po in self.ayum.rpmdb.getProvides('initscripts'):
- log.info("po.arch is arch: %s" %(po.arch,))
- if not compareArch(po.arch, myarch):
- rc = anaconda.intf.messageWindow(_("Warning"),
- _("The arch of the release of %(productName)s you "
- "are upgrading to appears to be %(myarch)s which "
- "does not match your previously installed arch of "
- "%(arch)s. This is likely to not succeed. Are "
- "you sure you wish to continue the upgrade "
- "process?")
- % {'productName': productName,
- 'myarch': myarch,
- 'arch': po.arch},
- type="yesno")
- if rc == 0:
- iutil.resetRpmDb(anaconda.rootPath)
- sys.exit(0)
- else:
- log.warning("upgrade between possibly incompatible "
- "arches %s -> %s" %(po.arch, myarch))
- break
-
def doInstall(self, anaconda):
log.info("Preparing to install packages")
--
1.7.4.1
_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list