[rhel5-branch] Use getDiskPart() from bootyutil.

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

 



So some code duplication and bugs are avoided.

Related: rhbz#572862
---
 fsset.py |   34 +++-------------------------------
 1 files changed, 3 insertions(+), 31 deletions(-)

diff --git a/fsset.py b/fsset.py
index 54753a0..c958cdd 100644
--- a/fsset.py
+++ b/fsset.py
@@ -32,6 +32,7 @@ import lvm
 import types
 from flags import flags
 
+import bootyutil
 import rhpl
 from rhpl.translate import _, N_
 
@@ -3186,37 +3187,8 @@ def ext2FormatFilesystem(argList, messageFile, windowCreator, mntpoint):
 
     return 1
 
-# copy and paste job from booty/bootloaderInfo.py...
-def getDiskPart(dev):
-    cut = len(dev)
-    if (dev.startswith('rd/') or dev.startswith('ida/') or
-            dev.startswith('cciss/') or dev.startswith('sx8/') or
-            dev.startswith('mapper/')):
-        if dev[-2] == 'p':
-            cut = -1
-        elif dev[-3] == 'p':
-            cut = -2
-    else:
-        if dev[-2] in string.digits:
-            cut = -2
-        elif dev[-1] in string.digits:
-            cut = -1
-
-    name = dev[:cut]
-    
-    # hack off the trailing 'p' from /dev/cciss/*, for example
-    if name[-1] == 'p':
-        for letter in name:
-            if letter not in string.letters and letter != "/":
-                name = name[:-1]
-                break
-
-    if cut < 0:
-        partNum = int(dev[cut:]) - 1
-    else:
-        partNum = None
-
-    return (name, partNum)
+# The code for getDiskPart() is already present in booty, delegate the call there.
+getDiskPart = bootyutil.getDiskPart
 
 def getExtFSFlagsFeatures(device):
 
-- 
1.7.3.3

_______________________________________________
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