/[smeserver]/rpms/booty/sme8/booty-0.80.6-Do-not-duplicate-getDiskPart-everywhere.patch
ViewVC logotype

Contents of /rpms/booty/sme8/booty-0.80.6-Do-not-duplicate-getDiskPart-everywhere.patch

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.1 - (show annotations) (download)
Sat Sep 17 21:16:16 2011 UTC (13 years, 1 month ago) by slords
Branch: MAIN
CVS Tags: booty-0_80_6-10_el5_sme, booty-0_80_6-10, HEAD
Upstream import

1 From e9afb53ba37b0edfc64c4b38201b4c282bec510a Mon Sep 17 00:00:00 2001
2 From: Ales Kozumplik <akozumpl@redhat.com>
3 Date: Wed, 2 Mar 2011 15:12:08 +0100
4 Subject: [booty rhel5-branch 2/3] Do not duplicate getDiskPart() everywhere.
5
6 Related: rhbz#572862
7 ---
8 bootloaderInfo.py | 35 ++---------------------------------
9 bootyutil.py | 48 ++++++++++++++++++++++++++++++++++++++++++++++++
10 checkbootloader.py | 35 +----------------------------------
11 3 files changed, 51 insertions(+), 67 deletions(-)
12 create mode 100644 bootyutil.py
13
14 diff --git a/bootloaderInfo.py b/bootloaderInfo.py
15 index bca1321..245b4f5 100644
16 --- a/bootloaderInfo.py
17 +++ b/bootloaderInfo.py
18 @@ -32,6 +32,8 @@ import rhpl.executil
19 import booty
20 import checkbootloader
21
22 +from bootyutil import getDiskPart
23 +
24 if rhpl.getArch() not in ("s390", "s390x"):
25 import block
26
27 @@ -2041,39 +2043,6 @@ class sparcBootloaderInfo(bootloaderInfo):
28 ###############
29 # end of boot loader objects... these are just some utility functions used
30
31 -# return (disk, partition number) eg ('hda', 1)
32 -def getDiskPart(dev):
33 - cut = len(dev)
34 - if dev[-1] in string.digits:
35 - if (dev.startswith('rd/') or dev.startswith('ida/') or
36 - dev.startswith('cciss/') or dev.startswith('sx8/') or
37 - dev.startswith('mapper/')):
38 - if dev[-2] == 'p':
39 - cut = -1
40 - elif dev[-3] == 'p' and dev[-2] in string.digits:
41 - cut = -2
42 - else:
43 - if dev[-2] in string.digits:
44 - cut = -2
45 - else:
46 - cut = -1
47 -
48 - name = dev[:cut]
49 -
50 - # hack off the trailing 'p' from /dev/cciss/*, for example
51 - if name[-1] == 'p':
52 - for letter in name:
53 - if letter not in string.letters and letter != "/":
54 - name = name[:-1]
55 - break
56 -
57 - if cut < 0:
58 - partNum = int(dev[cut:]) - 1
59 - else:
60 - partNum = None
61 -
62 - return (name, partNum)
63 -
64 # hackery to determine if we should do root=LABEL=/ or whatnot
65 # as usual, knows too much about anaconda
66 def getRootDevName(initrd, fsset, rootDev, instRoot):
67 diff --git a/bootyutil.py b/bootyutil.py
68 new file mode 100644
69 index 0000000..cbfab5c
70 --- /dev/null
71 +++ b/bootyutil.py
72 @@ -0,0 +1,48 @@
73 +#
74 +# bootyutil.py: functions commonly used by various booty and anaconda modules
75 +#
76 +# Copyright 2011 Red Hat, Inc.
77 +#
78 +# This software may be freely redistributed under the terms of the GNU
79 +# library public license.
80 +#
81 +# You should have received a copy of the GNU Library Public License
82 +# along with this program; if not, write to the Free Software
83 +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
84 +#
85 +#
86 +
87 +import string
88 +
89 +# return (disk, partition number) eg ('hda', 1)
90 +def getDiskPart(dev):
91 + cut = len(dev)
92 + if dev[-1] in string.digits:
93 + if (dev.startswith('rd/') or dev.startswith('ida/') or
94 + dev.startswith('cciss/') or dev.startswith('sx8/') or
95 + dev.startswith('mapper/')):
96 + if dev[-2] == 'p':
97 + cut = -1
98 + elif dev[-3] == 'p' and dev[-2] in string.digits:
99 + cut = -2
100 + else:
101 + if dev[-2] in string.digits:
102 + cut = -2
103 + else:
104 + cut = -1
105 +
106 + name = dev[:cut]
107 +
108 + # hack off the trailing 'p' from /dev/cciss/*, for example
109 + if name[-1] == 'p':
110 + for letter in name:
111 + if letter not in string.letters and letter != "/":
112 + name = name[:-1]
113 + break
114 +
115 + if cut < 0:
116 + partNum = int(dev[cut:]) - 1
117 + else:
118 + partNum = None
119 +
120 + return (name, partNum)
121 diff --git a/checkbootloader.py b/checkbootloader.py
122 index 4b51056..512e880 100644
123 --- a/checkbootloader.py
124 +++ b/checkbootloader.py
125 @@ -23,40 +23,7 @@ liloConfigFile = "/etc/lilo.conf"
126 yabootConfigFile = "/etc/yaboot.conf"
127 siloConfigFile = "/etc/silo.conf"
128
129 -
130 -# XXX: this is cut and pasted directly from booty/bootloaderInfo.py
131 -# should eventually just go from there
132 -def getDiskPart(dev):
133 - """Return (disk, partition number) tuple for dev"""
134 - cut = len(dev)
135 - if (dev[:3] == "rd/" or dev[:4] == "ida/" or
136 - dev[:6] == "cciss/"):
137 - if dev[-2] == 'p':
138 - cut = -1
139 - elif dev[-3] == 'p':
140 - cut = -2
141 - else:
142 - if dev[-2] in string.digits:
143 - cut = -2
144 - elif dev[-1] in string.digits:
145 - cut = -1
146 -
147 - name = dev[:cut]
148 -
149 - # hack off the trailing 'p' from /dev/cciss/*, for example
150 - if name[-1] == 'p':
151 - for letter in name:
152 - if letter not in string.letters and letter != "/":
153 - name = name[:-1]
154 - break
155 -
156 - if cut < 0:
157 - partNum = int(dev[cut:]) - 1
158 - else:
159 - partNum = None
160 -
161 - return (name, partNum)
162 -
163 +from bootyutil import getDiskPart
164
165 def getRaidDisks(raidDevice, raidLevel=None, stripPart=1):
166 rc = []
167 --
168 1.7.3.3
169

admin@koozali.org
ViewVC Help
Powered by ViewVC 1.2.1 RSS 2.0 feed