[PATCH] Don't use the rpmdb to figure out upgrade target arch (#748119).

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

 



This will fail if /var is on a separate partition, since we do not have
the logic to mount additional partitions at this point.  Instead, just
run a chrooted /bin/arch which should always succeed.
---
 pyanaconda/storage/__init__.py |   25 +++++--------------------
 1 files changed, 5 insertions(+), 20 deletions(-)

diff --git a/pyanaconda/storage/__init__.py b/pyanaconda/storage/__init__.py
index 4701074..079a3b8 100644
--- a/pyanaconda/storage/__init__.py
+++ b/pyanaconda/storage/__init__.py
@@ -1460,28 +1460,13 @@ class Storage(object):
         return 0
 
 def getReleaseString():
-    relArch = None
     relName = None
     relVer = None
 
-    import rpm
-    iutil.resetRpmDb()
-    ts = rpm.TransactionSet(ROOT_PATH)
-
-    # We get the arch from the initscripts package, but the version and name
-    # must come from reading the release file.
     try:
-        # pylint: disable-msg=E1101
-        mi = ts.dbMatch('provides', 'initscripts')
-    except Exception:
-        # This could happen in a variety of cases, but the biggest one is we're
-        # examining an installed system that doesn't use RPM.  Raise an
-        # exception for the caller to handle.
-        raise ValueError
-
-    for h in mi:
-        relArch = h['arch']
-        break
+        relArch = iutil.execWithCapture("arch", [], root=ROOT_PATH).strip()
+    except:
+        relArch = None
 
     filename = "%s/etc/redhat-release" % ROOT_PATH
     if os.access(filename, os.R_OK):
@@ -1548,8 +1533,8 @@ def findExistingRootDevices(anaconda, upgradeany=False):
                 device.teardown(recursive=True)
 
             if arch is None:
-                # we failed to determine the arch (for instance when there is a
-                # corrupted rpm database on the target system)
+                # we failed to determine the arch (for instance when we cant'
+                # run a binary on the target system)
                 log.info("findExistingRootDevices: no arch.")
                 continue
 
-- 
1.7.6

_______________________________________________
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