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

Re: [PATCH 1/2] We no longer write out /etc/rpm/platform, so don't offer to upgrade it.



Hi,

Hmm,

Wasn't this code also supposed to warn when upgrading from i386 -> x86_64, and
don't we still want to warn in that case ?

Regards,

Hans


On 06/01/2009 08:29 PM, Chris Lumens wrote:
---
  dispatch.py   |    3 +-
  flags.py      |    1 -
  iutil.py      |    8 +-----
  livecd.py     |    2 +-
  packages.py   |    2 +-
  upgrade.py    |   68 ---------------------------------------------------------
  yuminstall.py |    4 +-
  7 files changed, 7 insertions(+), 81 deletions(-)

diff --git a/dispatch.py b/dispatch.py
index d6fbcce..7dd2c54 100644
--- a/dispatch.py
+++ b/dispatch.py
@@ -37,7 +37,7 @@ from storage import storageComplete
  from storage.partitioning import doAutoPartition
  from bootloader import writeBootloader, bootloaderSetupChoices
  from flags import flags
-from upgrade import upgradeMountFilesystems, queryUpgradeArch
+from upgrade import upgradeMountFilesystems
  from upgrade import upgradeSwapSuggestion, upgradeMigrateFind
  from upgrade import findRootParts, queryUpgradeContinue
  from installmethod import doMethodComplete
@@ -83,7 +83,6 @@ installSteps = [
      ("autopartitionexecute", doAutoPartition, ),
      ("partition", ),
      ("upgrademount", upgradeMountFilesystems, ),
-    ("upgradearchitecture", queryUpgradeArch, ),
      ("upgradecontinue", queryUpgradeContinue, ),
      ("upgradeswapsuggestion", upgradeSwapSuggestion, ),
      ("addswap", ),
diff --git a/flags.py b/flags.py
index d49b252..ce77621 100644
--- a/flags.py
+++ b/flags.py
@@ -83,7 +83,6 @@ class Flags:
  	self.__dict__['flags']['selinux'] = SELINUX_DEFAULT
          self.__dict__['flags']['debug'] = 0
  	self.__dict__['flags']['targetarch'] = None
-	self.__dict__['flags']['updateRpmPlatform'] = False
          self.__dict__['flags']['cmdline'] = self.createCmdlineDict()
          self.__dict__['flags']['useIPv4'] = True
          self.__dict__['flags']['useIPv6'] = True
diff --git a/iutil.py b/iutil.py
index 7be6896..ba1d0b4 100644
--- a/iutil.py
+++ b/iutil.py
@@ -560,14 +560,14 @@ def isEfi():

      return efi

-## Generate the /etc/rpm/platform and /etc/rpm/macros files.
+## Generate the /etc/rpm/macros file.
  # @param root The root of the filesystem to create the files in.
  def writeRpmPlatform(root="/"):
      import rhpl.arch

      if flags.test:
          return
-    if not flags.updateRpmPlatform and os.access("%s/etc/rpm/platform" %(root,), os.R_OK):
+    if os.access("%s/etc/rpm/platform" %(root,), os.R_OK):
          return
      if not os.access("%s/etc/rpm" %(root,), os.X_OK):
          os.mkdir("%s/etc/rpm" %(root,))
@@ -581,10 +581,6 @@ def writeRpmPlatform(root="/"):
      # now make the current install believe it, too
      rhpl.arch.canonArch = myarch

-#    f = open("%s/etc/rpm/platform" %(root,), 'w+')
-#    f.write("%s-redhat-linux\n" %(myarch,))
-#    f.close()
-
      # FIXME: writing /etc/rpm/macros feels wrong somehow
      # temporary workaround for #92285
      if not (myarch.startswith("ppc64") or
diff --git a/livecd.py b/livecd.py
index 6c559a2..b186d00 100644
--- a/livecd.py
+++ b/livecd.py
@@ -348,7 +348,7 @@ class LiveCDCopyBackend(backend.AnacondaBackend):
      def doPostInstall(self, anaconda):
          self._doFilesystemMangling(anaconda)

-        # setup /etc/rpm/platform for the post-install environment
+        # setup /etc/rpm/ for the post-install environment
          iutil.writeRpmPlatform(anaconda.rootPath)

          # maybe heavy handed, but it'll do
diff --git a/packages.py b/packages.py
index f59cd7b..ba2f9e3 100644
--- a/packages.py
+++ b/packages.py
@@ -247,7 +247,7 @@ def setFileCons(anaconda):
      if flags.selinux:
          log.info("setting SELinux contexts for anaconda created files")

-        files = ["/etc/rpm/platform", "/etc/rpm/macros",
+        files = ["/etc/rpm/macros",
                   "/etc/lilo.conf.anaconda", "/lib64", "/usr/lib64",
                   "/etc/blkid.tab", "/etc/blkid.tab.old",
                   "/etc/mtab", "/etc/fstab", "/etc/resolv.conf",
diff --git a/upgrade.py b/upgrade.py
index cb9c07f..d5ecdd0 100644
--- a/upgrade.py
+++ b/upgrade.py
@@ -46,73 +46,6 @@ import rpm
  import logging
  log = logging.getLogger("anaconda")

-def guessGuestArch(rootdir):
-    """root path ->  None|"architecture"
-    Guess the architecture of installed system
-    """
-    iutil.resetRpmDb(rootdir)
-    ts = rpm.ts(rootdir)
-
-    packages = ["filesystem", "initscripts"]
-
-    #get information from packages
-    for pkg in packages:
-        try:
-            mi=ts.dbMatch("name",pkg)
-            for hdr in mi:
-                return hdr["arch"]
-        except:
-            pass
-
-    return None
-
-
-def isUpgradingArch(anaconda):
-    """anaconda ->  (bool, oldarch)
-    Check if the upgrade should change architecture of installation"""
-
-    def compareArch(a, b):
-        import re
-        if re.match("i.86", a) and re.match("i.86", b):
-            return True
-        else:
-            return a == b
-
-    try:
-        rpmplatform = open(anaconda.rootPath+"/etc/rpm/platform").readline().strip()
-        rpmarch = rpmplatform[:rpmplatform.index("-")]
-        return compareArch(rhpl.arch.canonArch, rpmarch), rpmarch
-    except IOError:
-        #try some fallback methods
-        rpmarch = guessGuestArch(anaconda.rootPath)
-        if rpmarch:
-            return compareArch(rhpl.arch.canonArch, rpmarch), rpmarch
-        else:
-            return False, "unknown"
-
-def queryUpgradeArch(anaconda):
-    archupgrade, oldrpmarch = isUpgradingArch(anaconda) #Check if we are to upgrade the architecture of previous product
-
-    if anaconda.dir == DISPATCH_FORWARD or not archupgrade:
-        return DISPATCH_FORWARD
-
-    rc = anaconda.intf.messageWindow(_("Proceed with upgrade?"),
-                       _("You have choosen the upgrade for %s "
-                         "architecture, but the installed system "
-                         "is for %s architecture. "
-                         "\n\n" % (rhpl.arch.canonArch, oldrpmarch,)) +
-                       _("Would you like to upgrade "
-                         " the installed system to the %s architecture?" % (rhpl.arch.canonArch,)),
-                         type="custom", custom_icon=["error","error"],
-                         custom_buttons=[_("_Exit installer"), _("_Continue")])
-
-    if rc == 0:
-        sys.exit(0)
-
-    flags.updateRpmPlatform = True
-
-    return DISPATCH_FORWARD
-
  def queryUpgradeContinue(anaconda):
      if anaconda.dir == DISPATCH_FORWARD:
          return
@@ -337,7 +270,6 @@ def setSteps(anaconda):
                  "upgrademount",
                  "upgrademigfind",
                  "upgrademigratefs",
-                "upgradearchitecture",
                  "enablefilesystems",
                  "upgradecontinue",
                  "reposetup",
diff --git a/yuminstall.py b/yuminstall.py
index 0e7a4da..e7f1d91 100644
--- a/yuminstall.py
+++ b/yuminstall.py
@@ -1427,9 +1427,9 @@ reposdir=/etc/anaconda.repos.d,/tmp/updates/anaconda.repos.d,/tmp/product/anacon
          self.initLog(anaconda.id, anaconda.rootPath)

          if flags.setupFilesystems:
-            # setup /etc/rpm/platform for the post-install environment
+            # setup /etc/rpm/ for the post-install environment
              iutil.writeRpmPlatform(anaconda.rootPath)
-
+
              try:
                  # FIXME: making the /var/lib/rpm symlink here is a hack to
                  # workaround db->close() errors from rpm


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