Re: [PATCH master] Tell user when nothing can be upgraded (#592605)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Ack.

On 06/07/2010 11:33 PM, Brian C. Lane wrote:
When no upgradable partitions and at least one non-upgradable partition
are found display a dialog to the user warning them that it cannot be
upgraded. Let them continue to install or exit.

So, for example, if the user has only a Fedora 9 install they will be
told to upgrade to intermediate releases before upgrading to the
current release.

If the user has Fedora 11 and Fedora 9 they will not be shown the warning
and Fedora11 will be presented as a potential upgrade candidate.
---
  pyanaconda/iw/examine_gui.py   |    2 +-
  pyanaconda/rescue.py           |    2 +-
  pyanaconda/storage/__init__.py |   11 ++++++++---
  pyanaconda/upgrade.py          |   21 ++++++++++++++++++---
  4 files changed, 28 insertions(+), 8 deletions(-)

diff --git a/pyanaconda/iw/examine_gui.py b/pyanaconda/iw/examine_gui.py
index 56c9605..ee3f1b6 100644
--- a/pyanaconda/iw/examine_gui.py
+++ b/pyanaconda/iw/examine_gui.py
@@ -95,7 +95,7 @@ class UpgradeExamineWindow (InstallWindow):
          # we might get here after storage reset that obsoleted
          # root device objects we had found
          if not self.anaconda.rootParts:
-            self.anaconda.rootParts = upgrade.findExistingRoots(self.anaconda,
+            (self.anaconda.rootParts, notUpgradable) = upgrade.findExistingRoots(self.anaconda,
                                                                  flags.cmdline.has_key("upgradeany"))
              upgrade.setUpgradeRoot(self.anaconda)

diff --git a/pyanaconda/rescue.py b/pyanaconda/rescue.py
index e8e2876..f0171b3 100644
--- a/pyanaconda/rescue.py
+++ b/pyanaconda/rescue.py
@@ -326,7 +326,7 @@ def runRescue(anaconda):
      import storage
      storage.storageInitialize(anaconda)

-    disks = upgrade.findExistingRoots(anaconda, upgradeany=True)
+    (disks, notUpgradable) = upgrade.findExistingRoots(anaconda, upgradeany=True)

      if not disks:
          root = None
diff --git a/pyanaconda/storage/__init__.py b/pyanaconda/storage/__init__.py
index 76f369a..e3a5a50 100644
--- a/pyanaconda/storage/__init__.py
+++ b/pyanaconda/storage/__init__.py
@@ -1262,8 +1262,12 @@ def getReleaseString(mountpoint):
      return (relName, relVer)

  def findExistingRootDevices(anaconda, upgradeany=False):
-    """ Return a list of all root filesystems in the device tree. """
+    """ Return a tuple of:
+        list of all root filesystems in the device tree.
+        list of previous installs that cannot be upgraded.
+    """
      rootDevs = []
+    notUpgradable = []

      if not os.path.exists(anaconda.rootPath):
          iutil.mkdirChain(anaconda.rootPath)
@@ -1298,13 +1302,14 @@ def findExistingRootDevices(anaconda, upgradeany=False):
                 anaconda.instClass.productUpgradable(product, version):
                  rootDevs.append((device, "%s %s" % (product, version)))
              else:
+                notUpgradable.append((product, version, device.name))
                  log.info("product %s version %s found on %s is not upgradable"
-                         % (product, version, device.name))
+                         % notUpgradable[-1])

          # this handles unmounting the filesystem
          device.teardown(recursive=True)

-    return rootDevs
+    return (rootDevs, notUpgradable)

  def mountExistingSystem(anaconda, rootEnt,
                          allowDirty=None, warnDirty=None,
diff --git a/pyanaconda/upgrade.py b/pyanaconda/upgrade.py
index 54dd05a..489a90a 100644
--- a/pyanaconda/upgrade.py
+++ b/pyanaconda/upgrade.py
@@ -77,9 +77,25 @@ def findRootParts(anaconda):
      if anaconda.dir == DISPATCH_BACK:
          return
      if anaconda.rootParts is None:
-        anaconda.rootParts = findExistingRoots(anaconda,
+        (anaconda.rootParts, notUpgradable) = findExistingRoots(anaconda,
                                                 flags.cmdline.has_key("upgradeany"))

+        if notUpgradable and not anaconda.rootParts:
+            oldInstalls = ""
+            for info in notUpgradable:
+                oldInstalls += " on ".join(info)
+                oldInstalls += "\n"
+            rc = anaconda.intf.messageWindow(_("Cannot Upgrade"),
+                    _("Your current installation cannot be upgraded. This "
+                      "is likely due to it being too old. Only the previous 2 "
+                      "release may be upgraded. To upgrade older releases "
+                      "you must first upgrade to all intermediate releases.\n\n"
+                      "%s" % (oldInstalls)),
+                type="custom", custom_icon=["error","error"],
+                custom_buttons=[_("_Exit installer"), _("_Continue")])
+            if rc == 0:
+                sys.exit(0)
+
      setUpgradeRoot(anaconda)

      if anaconda.rootParts is not None and len(anaconda.rootParts)>  0:
@@ -88,8 +104,7 @@ def findRootParts(anaconda):
          anaconda.dispatch.skipStep("findinstall", skip = 1)

  def findExistingRoots(anaconda, upgradeany=False):
-    rootparts = findExistingRootDevices(anaconda, upgradeany=upgradeany)
-    return rootparts
+    return findExistingRootDevices(anaconda, upgradeany=upgradeany)

  def bindMountDevDirectory(instPath):
      getFormat("bind",

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list


[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux