[PATCH 4/6] Use iutil arch specifiers rather than rhpl

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

 



Switch to using iutil.isFoo() methods rather than checking the
value of rhpl.getArch()
---
 booty/__init__.py        |   17 +++++++----------
 booty/bootloaderInfo.py  |   13 ++++++-------
 booty/checkbootloader.py |    1 -
 booty/ppc.py             |    7 +++----
 booty/x86.py             |    3 +--
 5 files changed, 17 insertions(+), 24 deletions(-)

diff --git a/booty/__init__.py b/booty/__init__.py
index fc34a56..9ee6398 100644
--- a/booty/__init__.py
+++ b/booty/__init__.py
@@ -16,7 +16,7 @@
 #
 """Module for manipulation and creation of boot loader configurations"""
 
-import rhpl
+import iutil
 from bootloaderInfo import *
 from bootloader import *
 
@@ -30,25 +30,22 @@ class BootyNoKernelWarning:
 # return instance of the appropriate bootloader for our arch
 def getBootloader(storage):
     """Get the bootloader info object for your architecture"""
-    if rhpl.getArch() == 'i386':
+    if iutil.isX86():
         import x86
         return x86.x86BootloaderInfo(storage)
-    elif rhpl.getArch() == 'ia64':
+    elif iutil.isIA64():
         import ia64
         return ia64.ia64BootloaderInfo(storage)
-    elif rhpl.getArch() == 's390' or rhpl.getArch() == "s390x":
+    elif iutil.isS390():
         import s390
         return s390.s390BootloaderInfo(storage)
-    elif rhpl.getArch() == "alpha":
+    elif iutil.isAlpha():
         import alpha
         return alpha.alphaBootloaderInfo(storage)
-    elif rhpl.getArch() == "x86_64":
-        import x86
-        return x86.x86BootloaderInfo(storage)
-    elif rhpl.getArch() == "ppc":
+    elif iutil.isPPC():
         import ppc
         return ppc.ppcBootloaderInfo(storage)
-    elif rhpl.getArch() == "sparc":
+    elif iutil.isSparc():
         import sparc
         return sparc.sparcBootloaderInfo(storage)
     else:
diff --git a/booty/bootloaderInfo.py b/booty/bootloaderInfo.py
index 0cee1f6..bdfb1d9 100644
--- a/booty/bootloaderInfo.py
+++ b/booty/bootloaderInfo.py
@@ -29,7 +29,6 @@ _ = lambda x: gettext.ldgettext("anaconda", x)
 N_ = lambda x: x
 
 from lilo import LiloConfigFile
-import rhpl
 
 from flags import flags
 import iutil
@@ -40,13 +39,13 @@ import booty
 import checkbootloader
 from util import getDiskPart
 
-if rhpl.getArch() not in ("s390", "s390x"):
+if not iutil.isS390():
     import block
 
 dosFilesystems = ('FAT', 'fat16', 'fat32', 'ntfs', 'hpfs')
 
 def doesDualBoot():
-    if rhpl.getArch() == "i386" or rhpl.getArch() == "x86_64":
+    if iutil.isX86():
         return 1
     return 0
 
@@ -112,7 +111,7 @@ class KernelArguments:
         newArgs = []
         cfgFilename = "/tmp/install.cfg"
 
-        if rhpl.getArch() == "s390":
+        if iutil.isS390():
             self.cargs = []
             f = open(cfgFilename)
             for line in f:
@@ -189,7 +188,7 @@ class BootImages:
             if not self.images.has_key(dev.name):
                 if type in dosFilesystems and doesDualBoot():
                     self.images[dev.name] = ("Other", "Other", type)
-                elif type in ("hfs", "hfs+") and rhpl.getPPCMachine() == "PMac":
+                elif type in ("hfs", "hfs+") and iutil.getPPCMachine() == "PMac":
                     self.images[dev.name] = ("Other", "Other", type)
                 else:
                     self.images[dev.name] = (None, None, type)
@@ -228,7 +227,7 @@ class BootImages:
                 # maybe questionable, but the first ntfs or fat is likely to
                 # be the correct one to boot with XP using ntfs
                 foundDos = True
-            elif type == "appleboot" and rhpl.getPPCMachine() == "PMac" and part.bootable:
+            elif type == "appleboot" and iutil.getPPCMachine() == "PMac" and part.bootable:
                 foundAppleBootstrap = True
             elif type in ["hfs", "hfs+"] and foundAppleBootstrap:
                 # questionable for same reason as above, but on mac this time
@@ -505,7 +504,7 @@ class bootloaderInfo:
             else:
                 device = console
 
-            if not device and rhpl.getArch() != "ia64":
+            if not device and iutil.isIA64():
                 self.serialDevice = "ttyS0"
                 self.serialOptions = ""
             else:
diff --git a/booty/checkbootloader.py b/booty/checkbootloader.py
index 9508e14..1b1ca1d 100644
--- a/booty/checkbootloader.py
+++ b/booty/checkbootloader.py
@@ -17,7 +17,6 @@
 
 import os
 import string
-import rhpl
 
 from util import getDiskPart
 import iutil
diff --git a/booty/ppc.py b/booty/ppc.py
index 8cd4275..e5320c3 100644
--- a/booty/ppc.py
+++ b/booty/ppc.py
@@ -5,14 +5,13 @@ from booty import BootyNoKernelWarning
 from util import getDiskPart
 from bootloaderInfo import *
 import iutil
-import rhpl
 
 class ppcBootloaderInfo(bootloaderInfo):
     def getBootDevs(self, bl):
         import parted
 
         retval = []
-        machine = rhpl.getPPCMachine()
+        machine = iutil.getPPCMachine()
 
         if machine == 'pSeries':
             for dev in self.storage.fsset.devices:
@@ -74,7 +73,7 @@ class ppcBootloaderInfo(bootloaderInfo):
         f.write("enablenetboot\n")        
 
         yabootProg = "/sbin/mkofboot"
-        if rhpl.getPPCMachine() == "PMac":
+        if iutil.getPPCMachine() == "PMac":
             # write out the first hfs/hfs+ partition as being macosx
             for (label, longlabel, device) in chainList:
                 if ((not label) or (label == "")):
@@ -84,7 +83,7 @@ class ppcBootloaderInfo(bootloaderInfo):
             
             f.write("magicboot=/usr/lib/yaboot/ofboot\n")
 
-        elif rhpl.getPPCMachine() == "pSeries":
+        elif iutil.getPPCMachine() == "pSeries":
             f.write("nonvram\n")
             f.write("fstype=raw\n")
 
diff --git a/booty/x86.py b/booty/x86.py
index d0972c8..3890e69 100644
--- a/booty/x86.py
+++ b/booty/x86.py
@@ -7,7 +7,6 @@ from bootloaderInfo import *
 from flags import flags
 import checkbootloader
 import iutil
-import rhpl
 
 class x86BootloaderInfo(efiBootloaderInfo):
     def setPassword(self, val, isCrypted = 1):
@@ -413,7 +412,7 @@ class x86BootloaderInfo(efiBootloaderInfo):
                 config.addEntry("message", message, replace = 0)
 
         if not config.testEntry('lba32'):
-            if bl.above1024 and rhpl.getArch() != "x86_64":
+            if bl.above1024 and not iutil.isX86(bits=32):
                 config.addEntry("lba32", replace = 0)
 
         return config
-- 
1.6.1

_______________________________________________
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