1 |
From: Matt Turner <mattst88@×××××.com> |
2 |
|
3 |
Since Python 2.2 'in' has been preferred to has_key() since it is |
4 |
shorter, more readable, and faster. has_key() has been deprecated since |
5 |
2.6 and was removed in 3.0. |
6 |
|
7 |
See: |
8 |
http://www.python.org/dev/peps/pep-0290/#testing-dictionary-membership |
9 |
|
10 |
Scripted with |
11 |
sed -i -e 's/if \(not \)\?\(.*\)\.has_key(\(.*\))/if \3 \1in \2/' |
12 |
--- |
13 |
catalyst | 24 ++-- |
14 |
modules/catalyst/config.py | 2 +- |
15 |
modules/catalyst_lock.py | 20 ++-- |
16 |
modules/catalyst_support.py | 6 +- |
17 |
modules/embedded_target.py | 2 +- |
18 |
modules/generic_stage_target.py | 232 +++++++++++++++++++------------------- |
19 |
modules/grp_target.py | 8 +- |
20 |
modules/livecd_stage1_target.py | 8 +- |
21 |
modules/livecd_stage2_target.py | 16 ++-- |
22 |
modules/netboot2_target.py | 24 ++-- |
23 |
modules/netboot_target.py | 16 ++-- |
24 |
modules/snapshot_target.py | 4 +- |
25 |
modules/stage1_target.py | 10 +- |
26 |
modules/stage2_target.py | 12 +- |
27 |
modules/stage3_target.py | 2 +- |
28 |
modules/stage4_target.py | 4 +- |
29 |
16 files changed, 195 insertions(+), 195 deletions(-) |
30 |
|
31 |
diff --git a/catalyst b/catalyst |
32 |
index 3d31599..93114e9 100755 |
33 |
--- a/catalyst |
34 |
+++ b/catalyst |
35 |
@@ -100,7 +100,7 @@ def parse_config(myconfig): |
36 |
|
37 |
# now, load up the values into conf_values so that we can use them |
38 |
for x in confdefaults.keys(): |
39 |
- if myconf.has_key(x): |
40 |
+ if x in myconf: |
41 |
print "Setting",x,"to config file value \""+myconf[x]+"\"" |
42 |
conf_values[x]=myconf[x] |
43 |
else: |
44 |
@@ -156,19 +156,19 @@ def parse_config(myconfig): |
45 |
# print "Tarball creation enabled." |
46 |
# conf_values["TARBALL"]="1" |
47 |
|
48 |
- if myconf.has_key("digests"): |
49 |
+ if "digests" in myconf: |
50 |
conf_values["digests"]=myconf["digests"] |
51 |
- if myconf.has_key("contents"): |
52 |
+ if "contents" in myconf: |
53 |
conf_values["contents"]=myconf["contents"] |
54 |
|
55 |
- if myconf.has_key("envscript"): |
56 |
+ if "envscript" in myconf: |
57 |
print "Envscript support enabled." |
58 |
conf_values["ENVSCRIPT"]=myconf["envscript"] |
59 |
|
60 |
- if myconf.has_key("var_tmpfs_portage"): |
61 |
+ if "var_tmpfs_portage" in myconf: |
62 |
conf_values["var_tmpfs_portage"]=myconf["var_tmpfs_portage"]; |
63 |
|
64 |
- if myconf.has_key("port_logdir"): |
65 |
+ if "port_logdir" in myconf: |
66 |
conf_values["port_logdir"]=myconf["port_logdir"]; |
67 |
|
68 |
def import_modules(): |
69 |
@@ -206,7 +206,7 @@ def import_modules(): |
70 |
|
71 |
def build_target(addlargs, targetmap): |
72 |
try: |
73 |
- if not targetmap.has_key(addlargs["target"]): |
74 |
+ if addlargs["target"] not in targetmap: |
75 |
raise CatalystError,"Target \""+addlargs["target"]+"\" not available." |
76 |
|
77 |
mytarget=targetmap[addlargs["target"]](conf_values, addlargs) |
78 |
@@ -324,9 +324,9 @@ if __name__ == "__main__": |
79 |
|
80 |
# Start checking that digests are valid now that the hash_map was imported |
81 |
# from catalyst_support |
82 |
- if conf_values.has_key("digests"): |
83 |
+ if "digests" in conf_values: |
84 |
for i in conf_values["digests"].split(): |
85 |
- if not hash_map.has_key(i): |
86 |
+ if i not in hash_map: |
87 |
print |
88 |
print i+" is not a valid digest entry" |
89 |
print "Valid digest entries:" |
90 |
@@ -342,8 +342,8 @@ if __name__ == "__main__": |
91 |
print |
92 |
print "Catalyst aborting...." |
93 |
sys.exit(2) |
94 |
- if conf_values.has_key("hash_function"): |
95 |
- if not hash_map.has_key(conf_values["hash_function"]): |
96 |
+ if "hash_function" in conf_values: |
97 |
+ if conf_values["hash_function"] not in hash_map: |
98 |
print |
99 |
print conf_values["hash_function"]+\ |
100 |
" is not a valid hash_function entry" |
101 |
@@ -379,7 +379,7 @@ if __name__ == "__main__": |
102 |
print "!!! catalyst: Could not parse commandline, exiting." |
103 |
sys.exit(1) |
104 |
|
105 |
- if not addlargs.has_key("target"): |
106 |
+ if "target" not in addlargs: |
107 |
raise CatalystError, "Required value \"target\" not specified." |
108 |
|
109 |
# everything is setup, so the build is a go |
110 |
diff --git a/modules/catalyst/config.py b/modules/catalyst/config.py |
111 |
index 4e9d69c..00da343 100644 |
112 |
--- a/modules/catalyst/config.py |
113 |
+++ b/modules/catalyst/config.py |
114 |
@@ -63,7 +63,7 @@ class ParserBase: |
115 |
mobjs[1] = mobjs[1].strip().strip('"') |
116 |
|
117 |
# # Check that this key doesn't exist already in the spec |
118 |
-# if values.has_key(mobjs[0]): |
119 |
+# if mobjs[0] in values: |
120 |
# raise Exception("You have a duplicate key (" + mobjs[0] + ") in your spec. Please fix it") |
121 |
|
122 |
# Start a new array using the first element of mobjs |
123 |
diff --git a/modules/catalyst_lock.py b/modules/catalyst_lock.py |
124 |
index 960b10c..5311cf8 100644 |
125 |
--- a/modules/catalyst_lock.py |
126 |
+++ b/modules/catalyst_lock.py |
127 |
@@ -57,7 +57,7 @@ class LockDir: |
128 |
|
129 |
def set_gid(self,gid): |
130 |
if not self.islocked(): |
131 |
-# if self.settings.has_key("DEBUG"): |
132 |
+# if "DEBUG" in self.settings: |
133 |
# print "setting gid to", gid |
134 |
self.gid=gid |
135 |
|
136 |
@@ -69,7 +69,7 @@ class LockDir: |
137 |
if lockdir[-1] == "/": |
138 |
lockdir=lockdir[:-1] |
139 |
self.lockdir=normpath(lockdir) |
140 |
-# if self.settings.has_key("DEBUG"): |
141 |
+# if "DEBUG" in self.settings: |
142 |
# print "setting lockdir to", self.lockdir |
143 |
else: |
144 |
raise "the lock object needs a path to a dir" |
145 |
@@ -77,13 +77,13 @@ class LockDir: |
146 |
def set_lockfilename(self,lockfilename): |
147 |
if not self.islocked(): |
148 |
self.lockfilename=lockfilename |
149 |
-# if self.settings.has_key("DEBUG"): |
150 |
+# if "DEBUG" in self.settings: |
151 |
# print "setting lockfilename to", self.lockfilename |
152 |
|
153 |
def set_lockfile(self): |
154 |
if not self.islocked(): |
155 |
self.lockfile=normpath(self.lockdir+'/'+self.lockfilename) |
156 |
-# if self.settings.has_key("DEBUG"): |
157 |
+# if "DEBUG" in self.settings: |
158 |
# print "setting lockfile to", self.lockfile |
159 |
|
160 |
def read_lock(self): |
161 |
@@ -208,7 +208,7 @@ class LockDir: |
162 |
os.unlink(self.lockfile) |
163 |
os.close(self.myfd) |
164 |
self.myfd=None |
165 |
-# if self.settings.has_key("DEBUG"): |
166 |
+# if "DEBUG" in self.settings: |
167 |
# print "Unlinked lockfile..." |
168 |
except SystemExit, e: |
169 |
raise |
170 |
@@ -257,7 +257,7 @@ class LockDir: |
171 |
except SystemExit, e: |
172 |
raise |
173 |
except Exception, e: |
174 |
-# if self.settings.has_key("DEBUG"): |
175 |
+# if "DEBUG" in self.settings: |
176 |
# print "lockfile(): Hardlink: Link failed." |
177 |
# print "Exception: ",e |
178 |
pass |
179 |
@@ -297,7 +297,7 @@ class LockDir: |
180 |
self.hardlock_paths[self.lockdir]=self.myhardlock |
181 |
|
182 |
def remove_hardlock_file_from_cleanup(self): |
183 |
- if self.hardlock_paths.has_key(self.lockdir): |
184 |
+ if self.lockdir in self.hardlock_paths: |
185 |
del self.hardlock_paths[self.lockdir] |
186 |
print self.hardlock_paths |
187 |
|
188 |
@@ -356,10 +356,10 @@ class LockDir: |
189 |
hostpid = parts[1].split("-") |
190 |
host = "-".join(hostpid[:-1]) |
191 |
pid = hostpid[-1] |
192 |
- if not mylist.has_key(filename): |
193 |
+ if filename not in mylist: |
194 |
mylist[filename] = {} |
195 |
|
196 |
- if not mylist[filename].has_key(host): |
197 |
+ if host not in mylist[filename]: |
198 |
mylist[filename][host] = [] |
199 |
mylist[filename][host].append(pid) |
200 |
mycount += 1 |
201 |
@@ -370,7 +370,7 @@ class LockDir: |
202 |
|
203 |
results.append("Found %(count)s locks" % {"count":mycount}) |
204 |
for x in mylist.keys(): |
205 |
- if mylist[x].has_key(myhost): |
206 |
+ if myhost in mylist[x]: |
207 |
mylockname = self.hardlock_name(x) |
208 |
if self.hardlink_is_mine(mylockname, self.lockfile) or \ |
209 |
not os.path.exists(self.lockfile): |
210 |
diff --git a/modules/catalyst_support.py b/modules/catalyst_support.py |
211 |
index 6dbcfb7..316dfa3 100644 |
212 |
--- a/modules/catalyst_support.py |
213 |
+++ b/modules/catalyst_support.py |
214 |
@@ -295,7 +295,7 @@ def spawn_bash(mycommand,env={},debug=False,opt_name=None,**keywords): |
215 |
args=[BASH_BINARY] |
216 |
if not opt_name: |
217 |
opt_name=mycommand.split()[0] |
218 |
- if not env.has_key("BASH_ENV"): |
219 |
+ if "BASH_ENV" not in env: |
220 |
env["BASH_ENV"] = "/etc/spork/is/not/valid/profile.env" |
221 |
if debug: |
222 |
args.append("-x") |
223 |
@@ -558,7 +558,7 @@ def file_locate(settings,filelist,expand=1): |
224 |
#if expand=1, non-absolute paths will be accepted and |
225 |
# expanded to os.getcwd()+"/"+localpath if file exists |
226 |
for myfile in filelist: |
227 |
- if not settings.has_key(myfile): |
228 |
+ if myfile not in settings: |
229 |
#filenames such as cdtar are optional, so we don't assume the variable is defined. |
230 |
pass |
231 |
else: |
232 |
@@ -680,7 +680,7 @@ def addl_arg_parse(myspec,addlargs,requiredspec,validspec): |
233 |
myspec[x]=addlargs[x] |
234 |
|
235 |
for x in requiredspec: |
236 |
- if not myspec.has_key(x): |
237 |
+ if x not in myspec: |
238 |
messages.append("Required argument \""+x+"\" not specified.") |
239 |
|
240 |
if messages: |
241 |
diff --git a/modules/embedded_target.py b/modules/embedded_target.py |
242 |
index 6d34a57..f38ea00 100644 |
243 |
--- a/modules/embedded_target.py |
244 |
+++ b/modules/embedded_target.py |
245 |
@@ -24,7 +24,7 @@ class embedded_target(generic_stage_target): |
246 |
self.valid_values=[] |
247 |
self.valid_values.extend(["embedded/empty","embedded/rm","embedded/unmerge","embedded/fs-prepare","embedded/fs-finish","embedded/mergeroot","embedded/packages","embedded/fs-type","embedded/runscript","boot/kernel","embedded/linuxrc"]) |
248 |
self.valid_values.extend(["embedded/use"]) |
249 |
- if addlargs.has_key("embedded/fs-type"): |
250 |
+ if "embedded/fs-type" in addlargs: |
251 |
self.valid_values.append("embedded/fs-ops") |
252 |
|
253 |
generic_stage_target.__init__(self,spec,addlargs) |
254 |
diff --git a/modules/generic_stage_target.py b/modules/generic_stage_target.py |
255 |
index 1c3ce1e..9e49ee8 100644 |
256 |
--- a/modules/generic_stage_target.py |
257 |
+++ b/modules/generic_stage_target.py |
258 |
@@ -78,21 +78,21 @@ class generic_stage_target(generic_target): |
259 |
msg("Can't find/load "+x+".py plugin in "+\ |
260 |
self.settings["sharedir"]+"/arch/") |
261 |
|
262 |
- if self.settings.has_key("chost"): |
263 |
+ if "chost" in self.settings: |
264 |
hostmachine = self.settings["chost"].split("-")[0] |
265 |
- if not machinemap.has_key(hostmachine): |
266 |
+ if hostmachine not in machinemap: |
267 |
raise CatalystError, "Unknown host machine type "+hostmachine |
268 |
self.settings["hostarch"]=machinemap[hostmachine] |
269 |
else: |
270 |
hostmachine = self.settings["subarch"] |
271 |
- if machinemap.has_key(hostmachine): |
272 |
+ if hostmachine in machinemap: |
273 |
hostmachine = machinemap[hostmachine] |
274 |
self.settings["hostarch"]=hostmachine |
275 |
- if self.settings.has_key("cbuild"): |
276 |
+ if "cbuild" in self.settings: |
277 |
buildmachine = self.settings["cbuild"].split("-")[0] |
278 |
else: |
279 |
buildmachine = os.uname()[4] |
280 |
- if not machinemap.has_key(buildmachine): |
281 |
+ if buildmachine not in machinemap: |
282 |
raise CatalystError, "Unknown build machine type "+buildmachine |
283 |
self.settings["buildarch"]=machinemap[buildmachine] |
284 |
self.settings["crosscompile"]=(self.settings["hostarch"]!=\ |
285 |
@@ -169,11 +169,11 @@ class generic_stage_target(generic_target): |
286 |
file_locate(self.settings,["source_path","snapshot_path","distdir"],\ |
287 |
expand=0) |
288 |
""" If we are using portage_confdir, check that as well. """ |
289 |
- if self.settings.has_key("portage_confdir"): |
290 |
+ if "portage_confdir" in self.settings: |
291 |
file_locate(self.settings,["portage_confdir"],expand=0) |
292 |
|
293 |
""" Setup our mount points """ |
294 |
- if self.settings.has_key("SNAPCACHE"): |
295 |
+ if "SNAPCACHE" in self.settings: |
296 |
self.mounts=["/proc","/dev","/usr/portage","/usr/portage/distfiles","/var/tmp/portage"] |
297 |
self.mountmap={"/proc":"/proc","/dev":"/dev","/dev/pts":"/dev/pts",\ |
298 |
"/usr/portage":self.settings["snapshot_cache_path"]+"/portage",\ |
299 |
@@ -191,7 +191,7 @@ class generic_stage_target(generic_target): |
300 |
Configure any user specified options (either in catalyst.conf or on |
301 |
the command line). |
302 |
""" |
303 |
- if self.settings.has_key("PKGCACHE"): |
304 |
+ if "PKGCACHE" in self.settings: |
305 |
self.set_pkgcache_path() |
306 |
print "Location of the package cache is "+\ |
307 |
self.settings["pkgcache_path"] |
308 |
@@ -199,15 +199,15 @@ class generic_stage_target(generic_target): |
309 |
self.mountmap["/usr/portage/packages"]=\ |
310 |
self.settings["pkgcache_path"] |
311 |
|
312 |
- if self.settings.has_key("KERNCACHE"): |
313 |
+ if "KERNCACHE" in self.settings: |
314 |
self.set_kerncache_path() |
315 |
print "Location of the kerncache is "+\ |
316 |
self.settings["kerncache_path"] |
317 |
self.mounts.append("/tmp/kerncache") |
318 |
self.mountmap["/tmp/kerncache"]=self.settings["kerncache_path"] |
319 |
|
320 |
- if self.settings.has_key("CCACHE"): |
321 |
- if os.environ.has_key("CCACHE_DIR"): |
322 |
+ if "CCACHE" in self.settings: |
323 |
+ if "CCACHE_DIR" in os.environ: |
324 |
ccdir=os.environ["CCACHE_DIR"] |
325 |
del os.environ["CCACHE_DIR"] |
326 |
else: |
327 |
@@ -221,39 +221,39 @@ class generic_stage_target(generic_target): |
328 |
""" for the chroot: """ |
329 |
self.env["CCACHE_DIR"]="/var/tmp/ccache" |
330 |
|
331 |
- if self.settings.has_key("ICECREAM"): |
332 |
+ if "ICECREAM" in self.settings: |
333 |
self.mounts.append("/var/cache/icecream") |
334 |
self.mountmap["/var/cache/icecream"]="/var/cache/icecream" |
335 |
self.env["PATH"]="/usr/lib/icecc/bin:"+self.env["PATH"] |
336 |
|
337 |
- if self.settings.has_key("port_logdir"): |
338 |
+ if "port_logdir" in self.settings: |
339 |
self.mounts.append("/var/log/portage") |
340 |
self.mountmap["/var/log/portage"]=self.settings["port_logdir"] |
341 |
self.env["PORT_LOGDIR"]="/var/log/portage" |
342 |
self.env["PORT_LOGDIR_CLEAN"]='find "${PORT_LOGDIR}" -type f ! -name "summary.log*" -mtime +30 -delete' |
343 |
|
344 |
def override_cbuild(self): |
345 |
- if self.makeconf.has_key("CBUILD"): |
346 |
+ if "CBUILD" in self.makeconf: |
347 |
self.settings["CBUILD"]=self.makeconf["CBUILD"] |
348 |
|
349 |
def override_chost(self): |
350 |
- if self.makeconf.has_key("CHOST"): |
351 |
+ if "CHOST" in self.makeconf: |
352 |
self.settings["CHOST"]=self.makeconf["CHOST"] |
353 |
|
354 |
def override_cflags(self): |
355 |
- if self.makeconf.has_key("CFLAGS"): |
356 |
+ if "CFLAGS" in self.makeconf: |
357 |
self.settings["CFLAGS"]=self.makeconf["CFLAGS"] |
358 |
|
359 |
def override_cxxflags(self): |
360 |
- if self.makeconf.has_key("CXXFLAGS"): |
361 |
+ if "CXXFLAGS" in self.makeconf: |
362 |
self.settings["CXXFLAGS"]=self.makeconf["CXXFLAGS"] |
363 |
|
364 |
def override_ldflags(self): |
365 |
- if self.makeconf.has_key("LDFLAGS"): |
366 |
+ if "LDFLAGS" in self.makeconf: |
367 |
self.settings["LDFLAGS"]=self.makeconf["LDFLAGS"] |
368 |
|
369 |
def set_install_mask(self): |
370 |
- if self.settings.has_key("install_mask"): |
371 |
+ if "install_mask" in self.settings: |
372 |
if type(self.settings["install_mask"])!=types.StringType: |
373 |
self.settings["install_mask"]=\ |
374 |
string.join(self.settings["install_mask"]) |
375 |
@@ -275,7 +275,7 @@ class generic_stage_target(generic_target): |
376 |
"source_subpath should have been a string. Perhaps you have something wrong in your spec file?" |
377 |
|
378 |
def set_pkgcache_path(self): |
379 |
- if self.settings.has_key("pkgcache_path"): |
380 |
+ if "pkgcache_path" in self.settings: |
381 |
if type(self.settings["pkgcache_path"])!=types.StringType: |
382 |
self.settings["pkgcache_path"]=\ |
383 |
normpath(string.join(self.settings["pkgcache_path"])) |
384 |
@@ -285,7 +285,7 @@ class generic_stage_target(generic_target): |
385 |
self.settings["target_subpath"]+"/") |
386 |
|
387 |
def set_kerncache_path(self): |
388 |
- if self.settings.has_key("kerncache_path"): |
389 |
+ if "kerncache_path" in self.settings: |
390 |
if type(self.settings["kerncache_path"])!=types.StringType: |
391 |
self.settings["kerncache_path"]=\ |
392 |
normpath(string.join(self.settings["kerncache_path"])) |
393 |
@@ -296,7 +296,7 @@ class generic_stage_target(generic_target): |
394 |
def set_target_path(self): |
395 |
self.settings["target_path"]=normpath(self.settings["storedir"]+\ |
396 |
"/builds/"+self.settings["target_subpath"]+".tar.bz2") |
397 |
- if self.settings.has_key("AUTORESUME")\ |
398 |
+ if "AUTORESUME" in self.settings\ |
399 |
and os.path.exists(self.settings["autoresume_path"]+\ |
400 |
"setup_target_path"): |
401 |
print \ |
402 |
@@ -316,31 +316,31 @@ class generic_stage_target(generic_target): |
403 |
os.makedirs(self.settings["storedir"]+"/builds/") |
404 |
|
405 |
def set_fsscript(self): |
406 |
- if self.settings.has_key(self.settings["spec_prefix"]+"/fsscript"): |
407 |
+ if self.settings["spec_prefix"]+"/fsscript" in self.settings: |
408 |
self.settings["fsscript"]=\ |
409 |
self.settings[self.settings["spec_prefix"]+"/fsscript"] |
410 |
del self.settings[self.settings["spec_prefix"]+"/fsscript"] |
411 |
|
412 |
def set_rcadd(self): |
413 |
- if self.settings.has_key(self.settings["spec_prefix"]+"/rcadd"): |
414 |
+ if self.settings["spec_prefix"]+"/rcadd" in self.settings: |
415 |
self.settings["rcadd"]=\ |
416 |
self.settings[self.settings["spec_prefix"]+"/rcadd"] |
417 |
del self.settings[self.settings["spec_prefix"]+"/rcadd"] |
418 |
|
419 |
def set_rcdel(self): |
420 |
- if self.settings.has_key(self.settings["spec_prefix"]+"/rcdel"): |
421 |
+ if self.settings["spec_prefix"]+"/rcdel" in self.settings: |
422 |
self.settings["rcdel"]=\ |
423 |
self.settings[self.settings["spec_prefix"]+"/rcdel"] |
424 |
del self.settings[self.settings["spec_prefix"]+"/rcdel"] |
425 |
|
426 |
def set_cdtar(self): |
427 |
- if self.settings.has_key(self.settings["spec_prefix"]+"/cdtar"): |
428 |
+ if self.settings["spec_prefix"]+"/cdtar" in self.settings: |
429 |
self.settings["cdtar"]=\ |
430 |
normpath(self.settings[self.settings["spec_prefix"]+"/cdtar"]) |
431 |
del self.settings[self.settings["spec_prefix"]+"/cdtar"] |
432 |
|
433 |
def set_iso(self): |
434 |
- if self.settings.has_key(self.settings["spec_prefix"]+"/iso"): |
435 |
+ if self.settings["spec_prefix"]+"/iso" in self.settings: |
436 |
if self.settings[self.settings["spec_prefix"]+"/iso"].startswith('/'): |
437 |
self.settings["iso"]=\ |
438 |
normpath(self.settings[self.settings["spec_prefix"]+"/iso"]) |
439 |
@@ -353,12 +353,12 @@ class generic_stage_target(generic_target): |
440 |
del self.settings[self.settings["spec_prefix"]+"/iso"] |
441 |
|
442 |
def set_fstype(self): |
443 |
- if self.settings.has_key(self.settings["spec_prefix"]+"/fstype"): |
444 |
+ if self.settings["spec_prefix"]+"/fstype" in self.settings: |
445 |
self.settings["fstype"]=\ |
446 |
self.settings[self.settings["spec_prefix"]+"/fstype"] |
447 |
del self.settings[self.settings["spec_prefix"]+"/fstype"] |
448 |
|
449 |
- if not self.settings.has_key("fstype"): |
450 |
+ if "fstype" not in self.settings: |
451 |
self.settings["fstype"]="normal" |
452 |
for x in self.valid_values: |
453 |
if x == self.settings["spec_prefix"]+"/fstype": |
454 |
@@ -366,15 +366,15 @@ class generic_stage_target(generic_target): |
455 |
"/fstype is being set to the default of \"normal\"\n" |
456 |
|
457 |
def set_fsops(self): |
458 |
- if self.settings.has_key("fstype"): |
459 |
+ if "fstype" in self.settings: |
460 |
self.valid_values.append("fsops") |
461 |
- if self.settings.has_key(self.settings["spec_prefix"]+"/fsops"): |
462 |
+ if self.settings["spec_prefix"]+"/fsops" in self.settings: |
463 |
self.settings["fsops"]=\ |
464 |
self.settings[self.settings["spec_prefix"]+"/fsops"] |
465 |
del self.settings[self.settings["spec_prefix"]+"/fsops"] |
466 |
|
467 |
def set_source_path(self): |
468 |
- if self.settings.has_key("SEEDCACHE")\ |
469 |
+ if "SEEDCACHE" in self.settings\ |
470 |
and os.path.isdir(normpath(self.settings["storedir"]+"/tmp/"+\ |
471 |
self.settings["source_subpath"]+"/")): |
472 |
self.settings["source_path"]=normpath(self.settings["storedir"]+\ |
473 |
@@ -398,7 +398,7 @@ class generic_stage_target(generic_target): |
474 |
self.settings["source_subpath"]+".tar.bz2\n") |
475 |
|
476 |
def set_dest_path(self): |
477 |
- if self.settings.has_key("root_path"): |
478 |
+ if "root_path" in self.settings: |
479 |
self.settings["destpath"]=normpath(self.settings["chroot_path"]+\ |
480 |
self.settings["root_path"]) |
481 |
else: |
482 |
@@ -426,7 +426,7 @@ class generic_stage_target(generic_target): |
483 |
hash_function=self.settings["hash_function"],verbose=False) |
484 |
|
485 |
def set_snapcache_path(self): |
486 |
- if self.settings.has_key("SNAPCACHE"): |
487 |
+ if "SNAPCACHE" in self.settings: |
488 |
self.settings["snapshot_cache_path"]=\ |
489 |
normpath(self.settings["snapshot_cache"]+"/"+\ |
490 |
self.settings["snapshot"]+"/") |
491 |
@@ -448,7 +448,7 @@ class generic_stage_target(generic_target): |
492 |
"/tmp/"+self.settings["rel_type"]+"/"+".autoresume-"+\ |
493 |
self.settings["target"]+"-"+self.settings["subarch"]+"-"+\ |
494 |
self.settings["version_stamp"]+"/") |
495 |
- if self.settings.has_key("AUTORESUME"): |
496 |
+ if "AUTORESUME" in self.settings: |
497 |
print "The autoresume path is " + self.settings["autoresume_path"] |
498 |
if not os.path.exists(self.settings["autoresume_path"]): |
499 |
os.makedirs(self.settings["autoresume_path"],0755) |
500 |
@@ -459,7 +459,7 @@ class generic_stage_target(generic_target): |
501 |
"-controller.sh") |
502 |
|
503 |
def set_iso_volume_id(self): |
504 |
- if self.settings.has_key(self.settings["spec_prefix"]+"/volid"): |
505 |
+ if self.settings["spec_prefix"]+"/volid" in self.settings: |
506 |
self.settings["iso_volume_id"]=\ |
507 |
self.settings[self.settings["spec_prefix"]+"/volid"] |
508 |
if len(self.settings["iso_volume_id"])>32: |
509 |
@@ -474,18 +474,18 @@ class generic_stage_target(generic_target): |
510 |
"setup_confdir","portage_overlay",\ |
511 |
"base_dirs","bind","chroot_setup","setup_environment",\ |
512 |
"run_local","preclean","unbind","clean"] |
513 |
-# if self.settings.has_key("TARBALL") or \ |
514 |
+# if "TARBALL" in self.settings or \ |
515 |
# not self.settings.has_key("FETCH"): |
516 |
- if not self.settings.has_key("FETCH"): |
517 |
+ if "FETCH" not in self.settings: |
518 |
self.settings["action_sequence"].append("capture") |
519 |
self.settings["action_sequence"].append("clear_autoresume") |
520 |
|
521 |
def set_use(self): |
522 |
- if self.settings.has_key(self.settings["spec_prefix"]+"/use"): |
523 |
+ if self.settings["spec_prefix"]+"/use" in self.settings: |
524 |
self.settings["use"]=\ |
525 |
self.settings[self.settings["spec_prefix"]+"/use"] |
526 |
del self.settings[self.settings["spec_prefix"]+"/use"] |
527 |
- if not self.settings.has_key("use"): |
528 |
+ if "use" not in self.settings: |
529 |
self.settings["use"]="" |
530 |
if type(self.settings["use"])==types.StringType: |
531 |
self.settings["use"]=self.settings["use"].split() |
532 |
@@ -503,14 +503,14 @@ class generic_stage_target(generic_target): |
533 |
pass |
534 |
|
535 |
def set_rm(self): |
536 |
- if self.settings.has_key(self.settings["spec_prefix"]+"/rm"): |
537 |
+ if self.settings["spec_prefix"]+"/rm" in self.settings: |
538 |
if type(self.settings[self.settings["spec_prefix"]+\ |
539 |
"/rm"])==types.StringType: |
540 |
self.settings[self.settings["spec_prefix"]+"/rm"]=\ |
541 |
self.settings[self.settings["spec_prefix"]+"/rm"].split() |
542 |
|
543 |
def set_linuxrc(self): |
544 |
- if self.settings.has_key(self.settings["spec_prefix"]+"/linuxrc"): |
545 |
+ if self.settings["spec_prefix"]+"/linuxrc" in self.settings: |
546 |
if type(self.settings[self.settings["spec_prefix"]+\ |
547 |
"/linuxrc"])==types.StringType: |
548 |
self.settings["linuxrc"]=\ |
549 |
@@ -518,7 +518,7 @@ class generic_stage_target(generic_target): |
550 |
del self.settings[self.settings["spec_prefix"]+"/linuxrc"] |
551 |
|
552 |
def set_busybox_config(self): |
553 |
- if self.settings.has_key(self.settings["spec_prefix"]+"/busybox_config"): |
554 |
+ if self.settings["spec_prefix"]+"/busybox_config" in self.settings: |
555 |
if type(self.settings[self.settings["spec_prefix"]+\ |
556 |
"/busybox_config"])==types.StringType: |
557 |
self.settings["busybox_config"]=\ |
558 |
@@ -526,7 +526,7 @@ class generic_stage_target(generic_target): |
559 |
del self.settings[self.settings["spec_prefix"]+"/busybox_config"] |
560 |
|
561 |
def set_portage_overlay(self): |
562 |
- if self.settings.has_key("portage_overlay"): |
563 |
+ if "portage_overlay" in self.settings: |
564 |
if type(self.settings["portage_overlay"])==types.StringType: |
565 |
self.settings["portage_overlay"]=\ |
566 |
self.settings["portage_overlay"].split() |
567 |
@@ -534,7 +534,7 @@ class generic_stage_target(generic_target): |
568 |
string.join(self.settings["portage_overlay"])+"\"" |
569 |
|
570 |
def set_overlay(self): |
571 |
- if self.settings.has_key(self.settings["spec_prefix"]+"/overlay"): |
572 |
+ if self.settings["spec_prefix"]+"/overlay" in self.settings: |
573 |
if type(self.settings[self.settings["spec_prefix"]+\ |
574 |
"/overlay"])==types.StringType: |
575 |
self.settings[self.settings["spec_prefix"]+"/overlay"]=\ |
576 |
@@ -542,7 +542,7 @@ class generic_stage_target(generic_target): |
577 |
"/overlay"].split() |
578 |
|
579 |
def set_root_overlay(self): |
580 |
- if self.settings.has_key(self.settings["spec_prefix"]+"/root_overlay"): |
581 |
+ if self.settings["spec_prefix"]+"/root_overlay" in self.settings: |
582 |
if type(self.settings[self.settings["spec_prefix"]+\ |
583 |
"/root_overlay"])==types.StringType: |
584 |
self.settings[self.settings["spec_prefix"]+"/root_overlay"]=\ |
585 |
@@ -554,7 +554,7 @@ class generic_stage_target(generic_target): |
586 |
self.settings["root_path"]="/" |
587 |
|
588 |
def set_valid_build_kernel_vars(self,addlargs): |
589 |
- if addlargs.has_key("boot/kernel"): |
590 |
+ if "boot/kernel" in addlargs: |
591 |
if type(addlargs["boot/kernel"])==types.StringType: |
592 |
loopy=[addlargs["boot/kernel"]] |
593 |
else: |
594 |
@@ -573,14 +573,14 @@ class generic_stage_target(generic_target): |
595 |
self.valid_values.append("boot/kernel/"+x+"/softlevel") |
596 |
self.valid_values.append("boot/kernel/"+x+"/use") |
597 |
self.valid_values.append("boot/kernel/"+x+"/packages") |
598 |
- if addlargs.has_key("boot/kernel/"+x+"/packages"): |
599 |
+ if "boot/kernel/"+x+"/packages" in addlargs: |
600 |
if type(addlargs["boot/kernel/"+x+\ |
601 |
"/packages"])==types.StringType: |
602 |
addlargs["boot/kernel/"+x+"/packages"]=\ |
603 |
[addlargs["boot/kernel/"+x+"/packages"]] |
604 |
|
605 |
def set_build_kernel_vars(self): |
606 |
- if self.settings.has_key(self.settings["spec_prefix"]+"/gk_mainargs"): |
607 |
+ if self.settings["spec_prefix"]+"/gk_mainargs" in self.settings: |
608 |
self.settings["gk_mainargs"]=\ |
609 |
self.settings[self.settings["spec_prefix"]+"/gk_mainargs"] |
610 |
del self.settings[self.settings["spec_prefix"]+"/gk_mainargs"] |
611 |
@@ -634,7 +634,7 @@ class generic_stage_target(generic_target): |
612 |
clst_unpack_hash=read_from_clst(self.settings["autoresume_path"]+\ |
613 |
"unpack") |
614 |
|
615 |
- if self.settings.has_key("SEEDCACHE"): |
616 |
+ if "SEEDCACHE" in self.settings: |
617 |
if os.path.isdir(self.settings["source_path"]): |
618 |
""" SEEDCACHE Is a directory, use rsync """ |
619 |
unpack_cmd="rsync -a --delete "+self.settings["source_path"]+\ |
620 |
@@ -676,7 +676,7 @@ class generic_stage_target(generic_target): |
621 |
error_msg="Tarball extraction of "+self.settings["source_path"]+\ |
622 |
" to "+self.settings["chroot_path"]+" failed." |
623 |
|
624 |
- if self.settings.has_key("AUTORESUME"): |
625 |
+ if "AUTORESUME" in self.settings: |
626 |
if os.path.isdir(self.settings["source_path"]) \ |
627 |
and os.path.exists(self.settings["autoresume_path"]+"unpack"): |
628 |
""" Autoresume is valid, SEEDCACHE is valid """ |
629 |
@@ -703,7 +703,7 @@ class generic_stage_target(generic_target): |
630 |
invalid_snapshot=True |
631 |
else: |
632 |
""" No autoresume, SEEDCACHE """ |
633 |
- if self.settings.has_key("SEEDCACHE"): |
634 |
+ if "SEEDCACHE" in self.settings: |
635 |
""" SEEDCACHE so let's run rsync and let it clean up """ |
636 |
if os.path.isdir(self.settings["source_path"]): |
637 |
unpack=True |
638 |
@@ -727,7 +727,7 @@ class generic_stage_target(generic_target): |
639 |
self.mount_safety_check() |
640 |
|
641 |
if invalid_snapshot: |
642 |
- if self.settings.has_key("AUTORESUME"): |
643 |
+ if "AUTORESUME" in self.settings: |
644 |
print "No Valid Resume point detected, cleaning up..." |
645 |
|
646 |
self.clear_autoresume() |
647 |
@@ -739,18 +739,18 @@ class generic_stage_target(generic_target): |
648 |
if not os.path.exists(self.settings["chroot_path"]+"/tmp"): |
649 |
os.makedirs(self.settings["chroot_path"]+"/tmp",1777) |
650 |
|
651 |
- if self.settings.has_key("PKGCACHE"): |
652 |
+ if "PKGCACHE" in self.settings: |
653 |
if not os.path.exists(self.settings["pkgcache_path"]): |
654 |
os.makedirs(self.settings["pkgcache_path"],0755) |
655 |
|
656 |
- if self.settings.has_key("KERNCACHE"): |
657 |
+ if "KERNCACHE" in self.settings: |
658 |
if not os.path.exists(self.settings["kerncache_path"]): |
659 |
os.makedirs(self.settings["kerncache_path"],0755) |
660 |
|
661 |
print display_msg |
662 |
cmd(unpack_cmd,error_msg,env=self.env) |
663 |
|
664 |
- if self.settings.has_key("source_path_hash"): |
665 |
+ if "source_path_hash" in self.settings: |
666 |
myf=open(self.settings["autoresume_path"]+"unpack","w") |
667 |
myf.write(self.settings["source_path_hash"]) |
668 |
myf.close() |
669 |
@@ -764,7 +764,7 @@ class generic_stage_target(generic_target): |
670 |
snapshot_hash=read_from_clst(self.settings["autoresume_path"]+\ |
671 |
"unpack_portage") |
672 |
|
673 |
- if self.settings.has_key("SNAPCACHE"): |
674 |
+ if "SNAPCACHE" in self.settings: |
675 |
snapshot_cache_hash=\ |
676 |
read_from_clst(self.settings["snapshot_cache_path"]+\ |
677 |
"catalyst-hash") |
678 |
@@ -796,7 +796,7 @@ class generic_stage_target(generic_target): |
679 |
self.settings["chroot_path"]+"/usr" |
680 |
unpack_errmsg="Error unpacking snapshot" |
681 |
|
682 |
- if self.settings.has_key("AUTORESUME") \ |
683 |
+ if "AUTORESUME" in self.settings \ |
684 |
and os.path.exists(self.settings["chroot_path"]+\ |
685 |
"/usr/portage/") \ |
686 |
and os.path.exists(self.settings["autoresume_path"]\ |
687 |
@@ -807,7 +807,7 @@ class generic_stage_target(generic_target): |
688 |
unpack=False |
689 |
|
690 |
if unpack: |
691 |
- if self.settings.has_key("SNAPCACHE"): |
692 |
+ if "SNAPCACHE" in self.settings: |
693 |
self.snapshot_lock_object.write_lock() |
694 |
if os.path.exists(destdir): |
695 |
print cleanup_msg |
696 |
@@ -819,7 +819,7 @@ class generic_stage_target(generic_target): |
697 |
print "Unpacking portage tree (This can take a long time) ..." |
698 |
cmd(unpack_cmd,unpack_errmsg,env=self.env) |
699 |
|
700 |
- if self.settings.has_key("SNAPCACHE"): |
701 |
+ if "SNAPCACHE" in self.settings: |
702 |
myf=open(self.settings["snapshot_cache_path"]+"catalyst-hash","w") |
703 |
myf.write(self.settings["snapshot_path_hash"]) |
704 |
myf.close() |
705 |
@@ -829,11 +829,11 @@ class generic_stage_target(generic_target): |
706 |
myf.write(self.settings["snapshot_path_hash"]) |
707 |
myf.close() |
708 |
|
709 |
- if self.settings.has_key("SNAPCACHE"): |
710 |
+ if "SNAPCACHE" in self.settings: |
711 |
self.snapshot_lock_object.unlock() |
712 |
|
713 |
def config_profile_link(self): |
714 |
- if self.settings.has_key("AUTORESUME") \ |
715 |
+ if "AUTORESUME" in self.settings \ |
716 |
and os.path.exists(self.settings["autoresume_path"]+\ |
717 |
"config_profile_link"): |
718 |
print \ |
719 |
@@ -852,12 +852,12 @@ class generic_stage_target(generic_target): |
720 |
touch(self.settings["autoresume_path"]+"config_profile_link") |
721 |
|
722 |
def setup_confdir(self): |
723 |
- if self.settings.has_key("AUTORESUME") \ |
724 |
+ if "AUTORESUME" in self.settings \ |
725 |
and os.path.exists(self.settings["autoresume_path"]+\ |
726 |
"setup_confdir"): |
727 |
print "Resume point detected, skipping setup_confdir operation..." |
728 |
else: |
729 |
- if self.settings.has_key("portage_confdir"): |
730 |
+ if "portage_confdir" in self.settings: |
731 |
print "Configuring /etc/portage..." |
732 |
cmd("rsync -a "+self.settings["portage_confdir"]+"/ "+\ |
733 |
self.settings["chroot_path"]+"/etc/portage/",\ |
734 |
@@ -866,7 +866,7 @@ class generic_stage_target(generic_target): |
735 |
|
736 |
def portage_overlay(self): |
737 |
""" We copy the contents of our overlays to /usr/local/portage """ |
738 |
- if self.settings.has_key("portage_overlay"): |
739 |
+ if "portage_overlay" in self.settings: |
740 |
for x in self.settings["portage_overlay"]: |
741 |
if os.path.exists(x): |
742 |
print "Copying overlay dir " +x |
743 |
@@ -879,7 +879,7 @@ class generic_stage_target(generic_target): |
744 |
|
745 |
def root_overlay(self): |
746 |
""" Copy over the root_overlay """ |
747 |
- if self.settings.has_key(self.settings["spec_prefix"]+"/root_overlay"): |
748 |
+ if self.settings["spec_prefix"]+"/root_overlay" in self.settings: |
749 |
for x in self.settings[self.settings["spec_prefix"]+\ |
750 |
"/root_overlay"]: |
751 |
if os.path.exists(x): |
752 |
@@ -902,7 +902,7 @@ class generic_stage_target(generic_target): |
753 |
os.makedirs(self.mountmap[x],0755) |
754 |
|
755 |
src=self.mountmap[x] |
756 |
- if self.settings.has_key("SNAPCACHE") and x == "/usr/portage": |
757 |
+ if "SNAPCACHE" in self.settings and x == "/usr/portage": |
758 |
self.snapshot_lock_object.read_lock() |
759 |
if os.uname()[0] == "FreeBSD": |
760 |
if src == "/dev": |
761 |
@@ -913,7 +913,7 @@ class generic_stage_target(generic_target): |
762 |
self.settings["chroot_path"]+x) |
763 |
else: |
764 |
if src == "tmpfs": |
765 |
- if self.settings.has_key("var_tmpfs_portage"): |
766 |
+ if "var_tmpfs_portage" in self.settings: |
767 |
retval=os.system("mount -t tmpfs -o size="+\ |
768 |
self.settings["var_tmpfs_portage"]+"G "+src+" "+\ |
769 |
self.settings["chroot_path"]+x) |
770 |
@@ -951,7 +951,7 @@ class generic_stage_target(generic_target): |
771 |
ouch=1 |
772 |
warn("Couldn't umount bind mount: "+mypath+x) |
773 |
|
774 |
- if self.settings.has_key("SNAPCACHE") and x == "/usr/portage": |
775 |
+ if "SNAPCACHE" in self.settings and x == "/usr/portage": |
776 |
try: |
777 |
""" |
778 |
It's possible the snapshot lock object isn't created yet. |
779 |
@@ -978,7 +978,7 @@ class generic_stage_target(generic_target): |
780 |
self.override_cflags() |
781 |
self.override_cxxflags() |
782 |
self.override_ldflags() |
783 |
- if self.settings.has_key("AUTORESUME") \ |
784 |
+ if "AUTORESUME" in self.settings \ |
785 |
and os.path.exists(self.settings["autoresume_path"]+"chroot_setup"): |
786 |
print "Resume point detected, skipping chroot_setup operation..." |
787 |
else: |
788 |
@@ -990,7 +990,7 @@ class generic_stage_target(generic_target): |
789 |
"Could not copy resolv.conf into place.",env=self.env) |
790 |
|
791 |
""" Copy over the envscript, if applicable """ |
792 |
- if self.settings.has_key("ENVSCRIPT"): |
793 |
+ if "ENVSCRIPT" in self.settings: |
794 |
if not os.path.exists(self.settings["ENVSCRIPT"]): |
795 |
raise CatalystError,\ |
796 |
"Can't find envscript "+self.settings["ENVSCRIPT"] |
797 |
@@ -1025,9 +1025,9 @@ class generic_stage_target(generic_target): |
798 |
myf=open(self.settings["chroot_path"]+"/etc/portage/make.conf","w") |
799 |
myf.write("# These settings were set by the catalyst build script that automatically\n# built this stage.\n") |
800 |
myf.write("# Please consult /usr/share/portage/config/make.conf.example for a more\n# detailed example.\n") |
801 |
- if self.settings.has_key("CFLAGS"): |
802 |
+ if "CFLAGS" in self.settings: |
803 |
myf.write('CFLAGS="'+self.settings["CFLAGS"]+'"\n') |
804 |
- if self.settings.has_key("CXXFLAGS"): |
805 |
+ if "CXXFLAGS" in self.settings: |
806 |
if self.settings["CXXFLAGS"]!=self.settings["CFLAGS"]: |
807 |
myf.write('CXXFLAGS="'+self.settings["CXXFLAGS"]+'"\n') |
808 |
else: |
809 |
@@ -1035,10 +1035,10 @@ class generic_stage_target(generic_target): |
810 |
else: |
811 |
myf.write('CXXFLAGS="${CFLAGS}"\n') |
812 |
|
813 |
- if self.settings.has_key("LDFLAGS"): |
814 |
+ if "LDFLAGS" in self.settings: |
815 |
myf.write("# LDFLAGS is unsupported. USE AT YOUR OWN RISK!\n") |
816 |
myf.write('LDFLAGS="'+self.settings["LDFLAGS"]+'"\n') |
817 |
- if self.settings.has_key("CBUILD"): |
818 |
+ if "CBUILD" in self.settings: |
819 |
myf.write("# This should not be changed unless you know exactly what you are doing. You\n# should probably be using a different stage, instead.\n") |
820 |
myf.write('CBUILD="'+self.settings["CBUILD"]+'"\n') |
821 |
|
822 |
@@ -1047,10 +1047,10 @@ class generic_stage_target(generic_target): |
823 |
|
824 |
""" Figure out what our USE vars are for building """ |
825 |
myusevars=[] |
826 |
- if self.settings.has_key("HOSTUSE"): |
827 |
+ if "HOSTUSE" in self.settings: |
828 |
myusevars.extend(self.settings["HOSTUSE"]) |
829 |
|
830 |
- if self.settings.has_key("use"): |
831 |
+ if "use" in self.settings: |
832 |
myusevars.extend(self.settings["use"]) |
833 |
|
834 |
if myusevars: |
835 |
@@ -1064,7 +1064,7 @@ class generic_stage_target(generic_target): |
836 |
print "\tpackage.use in the profile and portage_confdir. You've been warned!" |
837 |
|
838 |
""" Setup the portage overlay """ |
839 |
- if self.settings.has_key("portage_overlay"): |
840 |
+ if "portage_overlay" in self.settings: |
841 |
myf.write('PORTDIR_OVERLAY="/usr/local/portage"\n') |
842 |
|
843 |
myf.close() |
844 |
@@ -1074,18 +1074,18 @@ class generic_stage_target(generic_target): |
845 |
touch(self.settings["autoresume_path"]+"chroot_setup") |
846 |
|
847 |
def fsscript(self): |
848 |
- if self.settings.has_key("AUTORESUME") \ |
849 |
+ if "AUTORESUME" in self.settings \ |
850 |
and os.path.exists(self.settings["autoresume_path"]+"fsscript"): |
851 |
print "Resume point detected, skipping fsscript operation..." |
852 |
else: |
853 |
- if self.settings.has_key("fsscript"): |
854 |
+ if "fsscript" in self.settings: |
855 |
if os.path.exists(self.settings["controller_file"]): |
856 |
cmd("/bin/bash "+self.settings["controller_file"]+\ |
857 |
" fsscript","fsscript script failed.",env=self.env) |
858 |
touch(self.settings["autoresume_path"]+"fsscript") |
859 |
|
860 |
def rcupdate(self): |
861 |
- if self.settings.has_key("AUTORESUME") \ |
862 |
+ if "AUTORESUME" in self.settings \ |
863 |
and os.path.exists(self.settings["autoresume_path"]+"rcupdate"): |
864 |
print "Resume point detected, skipping rcupdate operation..." |
865 |
else: |
866 |
@@ -1095,7 +1095,7 @@ class generic_stage_target(generic_target): |
867 |
touch(self.settings["autoresume_path"]+"rcupdate") |
868 |
|
869 |
def clean(self): |
870 |
- if self.settings.has_key("AUTORESUME") \ |
871 |
+ if "AUTORESUME" in self.settings \ |
872 |
and os.path.exists(self.settings["autoresume_path"]+"clean"): |
873 |
print "Resume point detected, skipping clean operation..." |
874 |
else: |
875 |
@@ -1130,11 +1130,11 @@ class generic_stage_target(generic_target): |
876 |
touch(self.settings["autoresume_path"]+"clean") |
877 |
|
878 |
def empty(self): |
879 |
- if self.settings.has_key("AUTORESUME") \ |
880 |
+ if "AUTORESUME" in self.settings \ |
881 |
and os.path.exists(self.settings["autoresume_path"]+"empty"): |
882 |
print "Resume point detected, skipping empty operation..." |
883 |
else: |
884 |
- if self.settings.has_key(self.settings["spec_prefix"]+"/empty"): |
885 |
+ if self.settings["spec_prefix"]+"/empty" in self.settings: |
886 |
if type(self.settings[self.settings["spec_prefix"]+\ |
887 |
"/empty"])==types.StringType: |
888 |
self.settings[self.settings["spec_prefix"]+"/empty"]=\ |
889 |
@@ -1158,11 +1158,11 @@ class generic_stage_target(generic_target): |
890 |
touch(self.settings["autoresume_path"]+"empty") |
891 |
|
892 |
def remove(self): |
893 |
- if self.settings.has_key("AUTORESUME") \ |
894 |
+ if "AUTORESUME" in self.settings \ |
895 |
and os.path.exists(self.settings["autoresume_path"]+"remove"): |
896 |
print "Resume point detected, skipping remove operation..." |
897 |
else: |
898 |
- if self.settings.has_key(self.settings["spec_prefix"]+"/rm"): |
899 |
+ if self.settings["spec_prefix"]+"/rm" in self.settings: |
900 |
for x in self.settings[self.settings["spec_prefix"]+"/rm"]: |
901 |
""" |
902 |
We're going to shell out for all these cleaning |
903 |
@@ -1180,7 +1180,7 @@ class generic_stage_target(generic_target): |
904 |
raise |
905 |
|
906 |
def preclean(self): |
907 |
- if self.settings.has_key("AUTORESUME") \ |
908 |
+ if "AUTORESUME" in self.settings \ |
909 |
and os.path.exists(self.settings["autoresume_path"]+"preclean"): |
910 |
print "Resume point detected, skipping preclean operation..." |
911 |
else: |
912 |
@@ -1195,7 +1195,7 @@ class generic_stage_target(generic_target): |
913 |
raise CatalystError, "Build failed, could not execute preclean" |
914 |
|
915 |
def capture(self): |
916 |
- if self.settings.has_key("AUTORESUME") \ |
917 |
+ if "AUTORESUME" in self.settings \ |
918 |
and os.path.exists(self.settings["autoresume_path"]+"capture"): |
919 |
print "Resume point detected, skipping capture operation..." |
920 |
else: |
921 |
@@ -1220,7 +1220,7 @@ class generic_stage_target(generic_target): |
922 |
touch(self.settings["autoresume_path"]+"capture") |
923 |
|
924 |
def run_local(self): |
925 |
- if self.settings.has_key("AUTORESUME") \ |
926 |
+ if "AUTORESUME" in self.settings \ |
927 |
and os.path.exists(self.settings["autoresume_path"]+"run_local"): |
928 |
print "Resume point detected, skipping run_local operation..." |
929 |
else: |
930 |
@@ -1257,7 +1257,7 @@ class generic_stage_target(generic_target): |
931 |
self.env[varname]="true" |
932 |
else: |
933 |
self.env[varname]="false" |
934 |
- if self.settings.has_key("makeopts"): |
935 |
+ if "makeopts" in self.settings: |
936 |
self.env["MAKEOPTS"]=self.settings["makeopts"] |
937 |
|
938 |
def run(self): |
939 |
@@ -1269,18 +1269,18 @@ class generic_stage_target(generic_target): |
940 |
""" Check for mounts right away and abort if we cannot unmount them """ |
941 |
self.mount_safety_check() |
942 |
|
943 |
- if self.settings.has_key("CLEAR_AUTORESUME"): |
944 |
+ if "CLEAR_AUTORESUME" in self.settings: |
945 |
self.clear_autoresume() |
946 |
|
947 |
- if self.settings.has_key("PURGETMPONLY"): |
948 |
+ if "PURGETMPONLY" in self.settings: |
949 |
self.purge() |
950 |
return |
951 |
|
952 |
- if self.settings.has_key("PURGEONLY"): |
953 |
+ if "PURGEONLY" in self.settings: |
954 |
self.purge() |
955 |
return |
956 |
|
957 |
- if self.settings.has_key("PURGE"): |
958 |
+ if "PURGE" in self.settings: |
959 |
self.purge() |
960 |
|
961 |
for x in self.settings["action_sequence"]: |
962 |
@@ -1295,11 +1295,11 @@ class generic_stage_target(generic_target): |
963 |
self.chroot_lock.unlock() |
964 |
|
965 |
def unmerge(self): |
966 |
- if self.settings.has_key("AUTORESUME") \ |
967 |
+ if "AUTORESUME" in self.settings \ |
968 |
and os.path.exists(self.settings["autoresume_path"]+"unmerge"): |
969 |
print "Resume point detected, skipping unmerge operation..." |
970 |
else: |
971 |
- if self.settings.has_key(self.settings["spec_prefix"]+"/unmerge"): |
972 |
+ if self.settings["spec_prefix"]+"/unmerge" in self.settings: |
973 |
if type(self.settings[self.settings["spec_prefix"]+\ |
974 |
"/unmerge"])==types.StringType: |
975 |
self.settings[self.settings["spec_prefix"]+"/unmerge"]=\ |
976 |
@@ -1327,7 +1327,7 @@ class generic_stage_target(generic_target): |
977 |
touch(self.settings["autoresume_path"]+"unmerge") |
978 |
|
979 |
def target_setup(self): |
980 |
- if self.settings.has_key("AUTORESUME") \ |
981 |
+ if "AUTORESUME" in self.settings \ |
982 |
and os.path.exists(self.settings["autoresume_path"]+"target_setup"): |
983 |
print "Resume point detected, skipping target_setup operation..." |
984 |
else: |
985 |
@@ -1338,11 +1338,11 @@ class generic_stage_target(generic_target): |
986 |
touch(self.settings["autoresume_path"]+"target_setup") |
987 |
|
988 |
def setup_overlay(self): |
989 |
- if self.settings.has_key("AUTORESUME") \ |
990 |
+ if "AUTORESUME" in self.settings \ |
991 |
and os.path.exists(self.settings["autoresume_path"]+"setup_overlay"): |
992 |
print "Resume point detected, skipping setup_overlay operation..." |
993 |
else: |
994 |
- if self.settings.has_key(self.settings["spec_prefix"]+"/overlay"): |
995 |
+ if self.settings["spec_prefix"]+"/overlay" in self.settings: |
996 |
for x in self.settings[self.settings["spec_prefix"]+"/overlay"]: |
997 |
if os.path.exists(x): |
998 |
cmd("rsync -a "+x+"/ "+\ |
999 |
@@ -1352,12 +1352,12 @@ class generic_stage_target(generic_target): |
1000 |
touch(self.settings["autoresume_path"]+"setup_overlay") |
1001 |
|
1002 |
def create_iso(self): |
1003 |
- if self.settings.has_key("AUTORESUME") \ |
1004 |
+ if "AUTORESUME" in self.settings \ |
1005 |
and os.path.exists(self.settings["autoresume_path"]+"create_iso"): |
1006 |
print "Resume point detected, skipping create_iso operation..." |
1007 |
else: |
1008 |
""" Create the ISO """ |
1009 |
- if self.settings.has_key("iso"): |
1010 |
+ if "iso" in self.settings: |
1011 |
cmd("/bin/bash "+self.settings["controller_file"]+" iso "+\ |
1012 |
self.settings["iso"],"ISO creation script failed.",\ |
1013 |
env=self.env) |
1014 |
@@ -1369,13 +1369,13 @@ class generic_stage_target(generic_target): |
1015 |
print "An ISO Image will not be created." |
1016 |
|
1017 |
def build_packages(self): |
1018 |
- if self.settings.has_key("AUTORESUME") \ |
1019 |
+ if "AUTORESUME" in self.settings \ |
1020 |
and os.path.exists(self.settings["autoresume_path"]+\ |
1021 |
"build_packages"): |
1022 |
print "Resume point detected, skipping build_packages operation..." |
1023 |
else: |
1024 |
- if self.settings.has_key(self.settings["spec_prefix"]+"/packages"): |
1025 |
- if self.settings.has_key("AUTORESUME") \ |
1026 |
+ if self.settings["spec_prefix"]+"/packages" in self.settings: |
1027 |
+ if "AUTORESUME" in self.settings \ |
1028 |
and os.path.exists(self.settings["autoresume_path"]+\ |
1029 |
"build_packages"): |
1030 |
print "Resume point detected, skipping build_packages operation..." |
1031 |
@@ -1394,11 +1394,11 @@ class generic_stage_target(generic_target): |
1032 |
"build aborting due to error." |
1033 |
|
1034 |
def build_kernel(self): |
1035 |
- if self.settings.has_key("AUTORESUME") \ |
1036 |
+ if "AUTORESUME" in self.settings \ |
1037 |
and os.path.exists(self.settings["autoresume_path"]+"build_kernel"): |
1038 |
print "Resume point detected, skipping build_kernel operation..." |
1039 |
else: |
1040 |
- if self.settings.has_key("boot/kernel"): |
1041 |
+ if "boot/kernel" in self.settings: |
1042 |
try: |
1043 |
mynames=self.settings["boot/kernel"] |
1044 |
if type(mynames)==types.StringType: |
1045 |
@@ -1411,7 +1411,7 @@ class generic_stage_target(generic_target): |
1046 |
env=self.env) |
1047 |
|
1048 |
for kname in mynames: |
1049 |
- if self.settings.has_key("AUTORESUME") \ |
1050 |
+ if "AUTORESUME" in self.settings \ |
1051 |
and os.path.exists(self.settings["autoresume_path"]\ |
1052 |
+"build_kernel_"+kname): |
1053 |
print "Resume point detected, skipping build_kernel for "+kname+" operation..." |
1054 |
@@ -1518,7 +1518,7 @@ class generic_stage_target(generic_target): |
1055 |
"build aborting due to kernel build error." |
1056 |
|
1057 |
def bootloader(self): |
1058 |
- if self.settings.has_key("AUTORESUME") \ |
1059 |
+ if "AUTORESUME" in self.settings \ |
1060 |
and os.path.exists(self.settings["autoresume_path"]+"bootloader"): |
1061 |
print "Resume point detected, skipping bootloader operation..." |
1062 |
else: |
1063 |
@@ -1532,7 +1532,7 @@ class generic_stage_target(generic_target): |
1064 |
raise CatalystError,"Script aborting due to error." |
1065 |
|
1066 |
def livecd_update(self): |
1067 |
- if self.settings.has_key("AUTORESUME") \ |
1068 |
+ if "AUTORESUME" in self.settings \ |
1069 |
and os.path.exists(self.settings["autoresume_path"]+\ |
1070 |
"livecd_update"): |
1071 |
print "Resume point detected, skipping build_packages operation..." |
1072 |
@@ -1565,7 +1565,7 @@ class generic_stage_target(generic_target): |
1073 |
os.chmod(myemp,mystat[ST_MODE]) |
1074 |
|
1075 |
def clear_packages(self): |
1076 |
- if self.settings.has_key("PKGCACHE"): |
1077 |
+ if "PKGCACHE" in self.settings: |
1078 |
print "purging the pkgcache ..." |
1079 |
|
1080 |
myemp=self.settings["pkgcache_path"] |
1081 |
@@ -1583,7 +1583,7 @@ class generic_stage_target(generic_target): |
1082 |
os.chmod(myemp,mystat[ST_MODE]) |
1083 |
|
1084 |
def clear_kerncache(self): |
1085 |
- if self.settings.has_key("KERNCACHE"): |
1086 |
+ if "KERNCACHE" in self.settings: |
1087 |
print "purging the kerncache ..." |
1088 |
|
1089 |
myemp=self.settings["kerncache_path"] |
1090 |
@@ -1602,11 +1602,11 @@ class generic_stage_target(generic_target): |
1091 |
|
1092 |
def clear_autoresume(self): |
1093 |
""" Clean resume points since they are no longer needed """ |
1094 |
- if self.settings.has_key("AUTORESUME"): |
1095 |
+ if "AUTORESUME" in self.settings: |
1096 |
print "Removing AutoResume Points: ..." |
1097 |
myemp=self.settings["autoresume_path"] |
1098 |
if os.path.isdir(myemp): |
1099 |
- if self.settings.has_key("AUTORESUME"): |
1100 |
+ if "AUTORESUME" in self.settings: |
1101 |
print "Emptying directory",myemp |
1102 |
""" |
1103 |
stat the dir, delete the dir, recreate the dir and set |
1104 |
@@ -1626,7 +1626,7 @@ class generic_stage_target(generic_target): |
1105 |
def gen_contents_file(self,file): |
1106 |
if os.path.exists(file+".CONTENTS"): |
1107 |
os.remove(file+".CONTENTS") |
1108 |
- if self.settings.has_key("contents"): |
1109 |
+ if "contents" in self.settings: |
1110 |
if os.path.exists(file): |
1111 |
myf=open(file+".CONTENTS","w") |
1112 |
keys={} |
1113 |
@@ -1644,7 +1644,7 @@ class generic_stage_target(generic_target): |
1114 |
def gen_digest_file(self,file): |
1115 |
if os.path.exists(file+".DIGESTS"): |
1116 |
os.remove(file+".DIGESTS") |
1117 |
- if self.settings.has_key("digests"): |
1118 |
+ if "digests" in self.settings: |
1119 |
if os.path.exists(file): |
1120 |
myf=open(file+".DIGESTS","w") |
1121 |
keys={} |
1122 |
@@ -1675,7 +1675,7 @@ class generic_stage_target(generic_target): |
1123 |
print "clearing chroot ..." |
1124 |
self.clear_chroot() |
1125 |
|
1126 |
- if not self.settings.has_key("PURGETMPONLY"): |
1127 |
+ if "PURGETMPONLY" not in self.settings: |
1128 |
print "clearing package cache ..." |
1129 |
self.clear_packages() |
1130 |
|
1131 |
diff --git a/modules/grp_target.py b/modules/grp_target.py |
1132 |
index 12eab08..654b5e5 100644 |
1133 |
--- a/modules/grp_target.py |
1134 |
+++ b/modules/grp_target.py |
1135 |
@@ -17,14 +17,14 @@ class grp_target(generic_stage_target): |
1136 |
|
1137 |
self.valid_values=self.required_values[:] |
1138 |
self.valid_values.extend(["grp/use"]) |
1139 |
- if not addlargs.has_key("grp"): |
1140 |
+ if "grp" not in addlargs: |
1141 |
raise CatalystError,"Required value \"grp\" not specified in spec." |
1142 |
|
1143 |
self.required_values.extend(["grp"]) |
1144 |
if type(addlargs["grp"])==types.StringType: |
1145 |
addlargs["grp"]=[addlargs["grp"]] |
1146 |
|
1147 |
- if addlargs.has_key("grp/use"): |
1148 |
+ if "grp/use" in addlargs: |
1149 |
if type(addlargs["grp/use"])==types.StringType: |
1150 |
addlargs["grp/use"]=[addlargs["grp/use"]] |
1151 |
|
1152 |
@@ -36,7 +36,7 @@ class grp_target(generic_stage_target): |
1153 |
|
1154 |
def set_target_path(self): |
1155 |
self.settings["target_path"]=normpath(self.settings["storedir"]+"/builds/"+self.settings["target_subpath"]+"/") |
1156 |
- if self.settings.has_key("AUTORESUME") \ |
1157 |
+ if "AUTORESUME" in self.settings \ |
1158 |
and os.path.exists(self.settings["autoresume_path"]+"setup_target_path"): |
1159 |
print "Resume point detected, skipping target path setup operation..." |
1160 |
else: |
1161 |
@@ -63,7 +63,7 @@ class grp_target(generic_stage_target): |
1162 |
|
1163 |
def set_use(self): |
1164 |
generic_stage_target.set_use(self) |
1165 |
- if self.settings.has_key("use"): |
1166 |
+ if "use" in self.settings: |
1167 |
self.settings["use"].append("bindist") |
1168 |
else: |
1169 |
self.settings["use"]=["bindist"] |
1170 |
diff --git a/modules/livecd_stage1_target.py b/modules/livecd_stage1_target.py |
1171 |
index 17254bb..5b552b9 100644 |
1172 |
--- a/modules/livecd_stage1_target.py |
1173 |
+++ b/modules/livecd_stage1_target.py |
1174 |
@@ -25,7 +25,7 @@ class livecd_stage1_target(generic_stage_target): |
1175 |
|
1176 |
def set_target_path(self): |
1177 |
self.settings["target_path"]=normpath(self.settings["storedir"]+"/builds/"+self.settings["target_subpath"]) |
1178 |
- if self.settings.has_key("AUTORESUME") \ |
1179 |
+ if "AUTORESUME" in self.settings \ |
1180 |
and os.path.exists(self.settings["autoresume_path"]+"setup_target_path"): |
1181 |
print "Resume point detected, skipping target path setup operation..." |
1182 |
else: |
1183 |
@@ -46,7 +46,7 @@ class livecd_stage1_target(generic_stage_target): |
1184 |
|
1185 |
def set_use(self): |
1186 |
generic_stage_target.set_use(self) |
1187 |
- if self.settings.has_key("use"): |
1188 |
+ if "use" in self.settings: |
1189 |
self.settings["use"].append("livecd") |
1190 |
self.settings["use"].append("bindist") |
1191 |
else: |
1192 |
@@ -55,14 +55,14 @@ class livecd_stage1_target(generic_stage_target): |
1193 |
|
1194 |
def set_packages(self): |
1195 |
generic_stage_target.set_packages(self) |
1196 |
- if self.settings.has_key(self.settings["spec_prefix"]+"/packages"): |
1197 |
+ if self.settings["spec_prefix"]+"/packages" in self.settings: |
1198 |
if type(self.settings[self.settings["spec_prefix"]+"/packages"]) == types.StringType: |
1199 |
self.settings[self.settings["spec_prefix"]+"/packages"] = \ |
1200 |
self.settings[self.settings["spec_prefix"]+"/packages"].split() |
1201 |
self.settings[self.settings["spec_prefix"]+"/packages"].append("app-misc/livecd-tools") |
1202 |
|
1203 |
def set_pkgcache_path(self): |
1204 |
- if self.settings.has_key("pkgcache_path"): |
1205 |
+ if "pkgcache_path" in self.settings: |
1206 |
if type(self.settings["pkgcache_path"]) != types.StringType: |
1207 |
self.settings["pkgcache_path"]=normpath(string.join(self.settings["pkgcache_path"])) |
1208 |
else: |
1209 |
diff --git a/modules/livecd_stage2_target.py b/modules/livecd_stage2_target.py |
1210 |
index 4fbd645..f816b21 100644 |
1211 |
--- a/modules/livecd_stage2_target.py |
1212 |
+++ b/modules/livecd_stage2_target.py |
1213 |
@@ -27,7 +27,7 @@ class livecd_stage2_target(generic_stage_target): |
1214 |
"gamecd/conf","livecd/xdm","livecd/xsession","livecd/volid"]) |
1215 |
|
1216 |
generic_stage_target.__init__(self,spec,addlargs) |
1217 |
- if not self.settings.has_key("livecd/type"): |
1218 |
+ if "livecd/type" not in self.settings: |
1219 |
self.settings["livecd/type"] = "generic-livecd" |
1220 |
|
1221 |
file_locate(self.settings, ["cdtar","controller_file"]) |
1222 |
@@ -46,7 +46,7 @@ class livecd_stage2_target(generic_stage_target): |
1223 |
|
1224 |
def set_target_path(self): |
1225 |
self.settings["target_path"]=normpath(self.settings["storedir"]+"/builds/"+self.settings["target_subpath"]+"/") |
1226 |
- if self.settings.has_key("AUTORESUME") \ |
1227 |
+ if "AUTORESUME" in self.settings \ |
1228 |
and os.path.exists(self.settings["autoresume_path"]+"setup_target_path"): |
1229 |
print "Resume point detected, skipping target path setup operation..." |
1230 |
else: |
1231 |
@@ -60,7 +60,7 @@ class livecd_stage2_target(generic_stage_target): |
1232 |
|
1233 |
def run_local(self): |
1234 |
# what modules do we want to blacklist? |
1235 |
- if self.settings.has_key("livecd/modblacklist"): |
1236 |
+ if "livecd/modblacklist" in self.settings: |
1237 |
try: |
1238 |
myf=open(self.settings["chroot_path"]+"/etc/modprobe.d/blacklist.conf","a") |
1239 |
except: |
1240 |
@@ -85,12 +85,12 @@ class livecd_stage2_target(generic_stage_target): |
1241 |
error_msg="Rsync of "+self.settings["source_path"]+" to "+self.settings["chroot_path"]+" failed." |
1242 |
invalid_snapshot=False |
1243 |
|
1244 |
- if self.settings.has_key("AUTORESUME"): |
1245 |
+ if "AUTORESUME" in self.settings: |
1246 |
if os.path.isdir(self.settings["source_path"]) and \ |
1247 |
os.path.exists(self.settings["autoresume_path"]+"unpack"): |
1248 |
print "Resume point detected, skipping unpack operation..." |
1249 |
unpack=False |
1250 |
- elif self.settings.has_key("source_path_hash"): |
1251 |
+ elif "source_path_hash" in self.settings: |
1252 |
if self.settings["source_path_hash"] != clst_unpack_hash: |
1253 |
invalid_snapshot=True |
1254 |
|
1255 |
@@ -109,7 +109,7 @@ class livecd_stage2_target(generic_stage_target): |
1256 |
if not os.path.exists(self.settings["chroot_path"]+"/tmp"): |
1257 |
os.makedirs(self.settings["chroot_path"]+"/tmp",1777) |
1258 |
|
1259 |
- if self.settings.has_key("PKGCACHE"): |
1260 |
+ if "PKGCACHE" in self.settings: |
1261 |
if not os.path.exists(self.settings["pkgcache_path"]): |
1262 |
os.makedirs(self.settings["pkgcache_path"],0755) |
1263 |
|
1264 |
@@ -119,7 +119,7 @@ class livecd_stage2_target(generic_stage_target): |
1265 |
print display_msg |
1266 |
cmd(unpack_cmd,error_msg,env=self.env) |
1267 |
|
1268 |
- if self.settings.has_key("source_path_hash"): |
1269 |
+ if "source_path_hash" in self.settings: |
1270 |
myf=open(self.settings["autoresume_path"]+"unpack","w") |
1271 |
myf.write(self.settings["source_path_hash"]) |
1272 |
myf.close() |
1273 |
@@ -131,7 +131,7 @@ class livecd_stage2_target(generic_stage_target): |
1274 |
"config_profile_link","setup_confdir","portage_overlay",\ |
1275 |
"bind","chroot_setup","setup_environment","run_local",\ |
1276 |
"build_kernel"] |
1277 |
- if not self.settings.has_key("FETCH"): |
1278 |
+ if "FETCH" not in self.settings: |
1279 |
self.settings["action_sequence"] += ["bootloader","preclean",\ |
1280 |
"livecd_update","root_overlay","fsscript","rcupdate","unmerge",\ |
1281 |
"unbind","remove","empty","target_setup",\ |
1282 |
diff --git a/modules/netboot2_target.py b/modules/netboot2_target.py |
1283 |
index ebc3be0..1ab7e7d 100644 |
1284 |
--- a/modules/netboot2_target.py |
1285 |
+++ b/modules/netboot2_target.py |
1286 |
@@ -27,7 +27,7 @@ class netboot2_target(generic_stage_target): |
1287 |
]) |
1288 |
|
1289 |
try: |
1290 |
- if addlargs.has_key("netboot2/packages"): |
1291 |
+ if "netboot2/packages" in addlargs: |
1292 |
if type(addlargs["netboot2/packages"]) == types.StringType: |
1293 |
loopy=[addlargs["netboot2/packages"]] |
1294 |
else: |
1295 |
@@ -45,7 +45,7 @@ class netboot2_target(generic_stage_target): |
1296 |
def set_target_path(self): |
1297 |
self.settings["target_path"]=normpath(self.settings["storedir"]+"/builds/"+\ |
1298 |
self.settings["target_subpath"]+"/") |
1299 |
- if self.settings.has_key("AUTORESUME") \ |
1300 |
+ if "AUTORESUME" in self.settings \ |
1301 |
and os.path.exists(self.settings["autoresume_path"]+"setup_target_path"): |
1302 |
print "Resume point detected, skipping target path setup operation..." |
1303 |
else: |
1304 |
@@ -63,24 +63,24 @@ class netboot2_target(generic_stage_target): |
1305 |
myfiles=[] |
1306 |
|
1307 |
# check for autoresume point |
1308 |
- if self.settings.has_key("AUTORESUME") \ |
1309 |
+ if "AUTORESUME" in self.settings \ |
1310 |
and os.path.exists(self.settings["autoresume_path"]+"copy_files_to_image"): |
1311 |
print "Resume point detected, skipping target path setup operation..." |
1312 |
else: |
1313 |
- if self.settings.has_key("netboot2/packages"): |
1314 |
+ if "netboot2/packages" in self.settings: |
1315 |
if type(self.settings["netboot2/packages"]) == types.StringType: |
1316 |
loopy=[self.settings["netboot2/packages"]] |
1317 |
else: |
1318 |
loopy=self.settings["netboot2/packages"] |
1319 |
|
1320 |
for x in loopy: |
1321 |
- if self.settings.has_key("netboot2/packages/"+x+"/files"): |
1322 |
+ if "netboot2/packages/"+x+"/files" in self.settings: |
1323 |
if type(self.settings["netboot2/packages/"+x+"/files"]) == types.ListType: |
1324 |
myfiles.extend(self.settings["netboot2/packages/"+x+"/files"]) |
1325 |
else: |
1326 |
myfiles.append(self.settings["netboot2/packages/"+x+"/files"]) |
1327 |
|
1328 |
- if self.settings.has_key("netboot2/extra_files"): |
1329 |
+ if "netboot2/extra_files" in self.settings: |
1330 |
if type(self.settings["netboot2/extra_files"]) == types.ListType: |
1331 |
myfiles.extend(self.settings["netboot2/extra_files"]) |
1332 |
else: |
1333 |
@@ -96,11 +96,11 @@ class netboot2_target(generic_stage_target): |
1334 |
touch(self.settings["autoresume_path"]+"copy_files_to_image") |
1335 |
|
1336 |
def setup_overlay(self): |
1337 |
- if self.settings.has_key("AUTORESUME") \ |
1338 |
+ if "AUTORESUME" in self.settings \ |
1339 |
and os.path.exists(self.settings["autoresume_path"]+"setup_overlay"): |
1340 |
print "Resume point detected, skipping setup_overlay operation..." |
1341 |
else: |
1342 |
- if self.settings.has_key("netboot2/overlay"): |
1343 |
+ if "netboot2/overlay" in self.settings: |
1344 |
for x in self.settings["netboot2/overlay"]: |
1345 |
if os.path.exists(x): |
1346 |
cmd("rsync -a "+x+"/ "+\ |
1347 |
@@ -120,11 +120,11 @@ class netboot2_target(generic_stage_target): |
1348 |
raise CatalystError,"Failed to move kernel images!" |
1349 |
|
1350 |
def remove(self): |
1351 |
- if self.settings.has_key("AUTORESUME") \ |
1352 |
+ if "AUTORESUME" in self.settings \ |
1353 |
and os.path.exists(self.settings["autoresume_path"]+"remove"): |
1354 |
print "Resume point detected, skipping remove operation..." |
1355 |
else: |
1356 |
- if self.settings.has_key(self.settings["spec_prefix"]+"/rm"): |
1357 |
+ if self.settings["spec_prefix"]+"/rm" in self.settings: |
1358 |
for x in self.settings[self.settings["spec_prefix"]+"/rm"]: |
1359 |
# we're going to shell out for all these cleaning operations, |
1360 |
# so we get easy glob handling |
1361 |
@@ -132,11 +132,11 @@ class netboot2_target(generic_stage_target): |
1362 |
os.system("rm -rf " + self.settings["chroot_path"] + self.settings["merge_path"] + x) |
1363 |
|
1364 |
def empty(self): |
1365 |
- if self.settings.has_key("AUTORESUME") \ |
1366 |
+ if "AUTORESUME" in self.settings \ |
1367 |
and os.path.exists(self.settings["autoresume_path"]+"empty"): |
1368 |
print "Resume point detected, skipping empty operation..." |
1369 |
else: |
1370 |
- if self.settings.has_key("netboot2/empty"): |
1371 |
+ if "netboot2/empty" in self.settings: |
1372 |
if type(self.settings["netboot2/empty"])==types.StringType: |
1373 |
self.settings["netboot2/empty"]=self.settings["netboot2/empty"].split() |
1374 |
for x in self.settings["netboot2/empty"]: |
1375 |
diff --git a/modules/netboot_target.py b/modules/netboot_target.py |
1376 |
index de7ff36..c77943b 100644 |
1377 |
--- a/modules/netboot_target.py |
1378 |
+++ b/modules/netboot_target.py |
1379 |
@@ -25,7 +25,7 @@ class netboot_target(generic_stage_target): |
1380 |
self.required_values=[] |
1381 |
|
1382 |
try: |
1383 |
- if addlargs.has_key("netboot/packages"): |
1384 |
+ if "netboot/packages" in addlargs: |
1385 |
if type(addlargs["netboot/packages"]) == types.StringType: |
1386 |
loopy=[addlargs["netboot/packages"]] |
1387 |
else: |
1388 |
@@ -38,7 +38,7 @@ class netboot_target(generic_stage_target): |
1389 |
|
1390 |
generic_stage_target.__init__(self,spec,addlargs) |
1391 |
self.set_build_kernel_vars(addlargs) |
1392 |
- if addlargs.has_key("netboot/busybox_config"): |
1393 |
+ if "netboot/busybox_config" in addlargs: |
1394 |
file_locate(self.settings, ["netboot/busybox_config"]) |
1395 |
|
1396 |
# Custom Kernel Tarball --- use that instead ... |
1397 |
@@ -46,7 +46,7 @@ class netboot_target(generic_stage_target): |
1398 |
# unless the user wants specific CFLAGS/CXXFLAGS, let's use -Os |
1399 |
|
1400 |
for envvar in "CFLAGS", "CXXFLAGS": |
1401 |
- if not os.environ.has_key(envvar) and not addlargs.has_key(envvar): |
1402 |
+ if not os.environ.has_key(envvar) and not addlargs.has_key(envvar) |
1403 |
self.settings[envvar] = "-Os -pipe" |
1404 |
|
1405 |
def set_root_path(self): |
1406 |
@@ -56,7 +56,7 @@ class netboot_target(generic_stage_target): |
1407 |
|
1408 |
# def build_packages(self): |
1409 |
# # build packages |
1410 |
-# if self.settings.has_key("netboot/packages"): |
1411 |
+# if "netboot/packages" in self.settings: |
1412 |
# mypack=list_bashify(self.settings["netboot/packages"]) |
1413 |
# try: |
1414 |
# cmd("/bin/bash "+self.settings["controller_file"]+" packages "+mypack,env=self.env) |
1415 |
@@ -66,7 +66,7 @@ class netboot_target(generic_stage_target): |
1416 |
|
1417 |
def build_busybox(self): |
1418 |
# build busybox |
1419 |
- if self.settings.has_key("netboot/busybox_config"): |
1420 |
+ if "netboot/busybox_config" in self.settings: |
1421 |
mycmd = self.settings["netboot/busybox_config"] |
1422 |
else: |
1423 |
mycmd = "" |
1424 |
@@ -79,20 +79,20 @@ class netboot_target(generic_stage_target): |
1425 |
def copy_files_to_image(self): |
1426 |
# create image |
1427 |
myfiles=[] |
1428 |
- if self.settings.has_key("netboot/packages"): |
1429 |
+ if "netboot/packages" in self.settings: |
1430 |
if type(self.settings["netboot/packages"]) == types.StringType: |
1431 |
loopy=[self.settings["netboot/packages"]] |
1432 |
else: |
1433 |
loopy=self.settings["netboot/packages"] |
1434 |
|
1435 |
for x in loopy: |
1436 |
- if self.settings.has_key("netboot/packages/"+x+"/files"): |
1437 |
+ if "netboot/packages/"+x+"/files" in self.settings: |
1438 |
if type(self.settings["netboot/packages/"+x+"/files"]) == types.ListType: |
1439 |
myfiles.extend(self.settings["netboot/packages/"+x+"/files"]) |
1440 |
else: |
1441 |
myfiles.append(self.settings["netboot/packages/"+x+"/files"]) |
1442 |
|
1443 |
- if self.settings.has_key("netboot/extra_files"): |
1444 |
+ if "netboot/extra_files" in self.settings: |
1445 |
if type(self.settings["netboot/extra_files"]) == types.ListType: |
1446 |
myfiles.extend(self.settings["netboot/extra_files"]) |
1447 |
else: |
1448 |
diff --git a/modules/snapshot_target.py b/modules/snapshot_target.py |
1449 |
index 81ab083..e93a86a 100644 |
1450 |
--- a/modules/snapshot_target.py |
1451 |
+++ b/modules/snapshot_target.py |
1452 |
@@ -31,11 +31,11 @@ class snapshot_target(generic_stage_target): |
1453 |
pass |
1454 |
|
1455 |
def run(self): |
1456 |
- if self.settings.has_key("PURGEONLY"): |
1457 |
+ if "PURGEONLY" in self.settings: |
1458 |
self.purge() |
1459 |
return |
1460 |
|
1461 |
- if self.settings.has_key("PURGE"): |
1462 |
+ if "PURGE" in self.settings: |
1463 |
self.purge() |
1464 |
|
1465 |
self.setup() |
1466 |
diff --git a/modules/stage1_target.py b/modules/stage1_target.py |
1467 |
index 6a439ec..aa43926 100644 |
1468 |
--- a/modules/stage1_target.py |
1469 |
+++ b/modules/stage1_target.py |
1470 |
@@ -33,24 +33,24 @@ class stage1_target(generic_stage_target): |
1471 |
# XXX: How do these override_foo() functions differ from the ones in generic_stage_target and why aren't they in stage3_target? |
1472 |
|
1473 |
def override_chost(self): |
1474 |
- if self.settings.has_key("chost"): |
1475 |
+ if "chost" in self.settings: |
1476 |
self.settings["CHOST"]=list_to_string(self.settings["chost"]) |
1477 |
|
1478 |
def override_cflags(self): |
1479 |
- if self.settings.has_key("cflags"): |
1480 |
+ if "cflags" in self.settings: |
1481 |
self.settings["CFLAGS"]=list_to_string(self.settings["cflags"]) |
1482 |
|
1483 |
def override_cxxflags(self): |
1484 |
- if self.settings.has_key("cxxflags"): |
1485 |
+ if "cxxflags" in self.settings: |
1486 |
self.settings["CXXFLAGS"]=list_to_string(self.settings["cxxflags"]) |
1487 |
|
1488 |
def override_ldflags(self): |
1489 |
- if self.settings.has_key("ldflags"): |
1490 |
+ if "ldflags" in self.settings: |
1491 |
self.settings["LDFLAGS"]=list_to_string(self.settings["ldflags"]) |
1492 |
|
1493 |
def set_portage_overlay(self): |
1494 |
generic_stage_target.set_portage_overlay(self) |
1495 |
- if self.settings.has_key("portage_overlay"): |
1496 |
+ if "portage_overlay" in self.settings: |
1497 |
print "\nWARNING !!!!!" |
1498 |
print "\tUsing an portage overlay for earlier stages could cause build issues." |
1499 |
print "\tIf you break it, you buy it. Don't complain to us about it." |
1500 |
diff --git a/modules/stage2_target.py b/modules/stage2_target.py |
1501 |
index 34f4471..4b3c29a 100644 |
1502 |
--- a/modules/stage2_target.py |
1503 |
+++ b/modules/stage2_target.py |
1504 |
@@ -16,7 +16,7 @@ class stage2_target(generic_stage_target): |
1505 |
generic_stage_target.__init__(self,spec,addlargs) |
1506 |
|
1507 |
def set_source_path(self): |
1508 |
- if self.settings.has_key("SEEDCACHE") and os.path.isdir(normpath(self.settings["storedir"]+"/tmp/"+self.settings["source_subpath"]+"/tmp/stage1root/")): |
1509 |
+ if "SEEDCACHE") and os.path.isdir(normpath(self.settings["storedir"]+"/tmp/"+self.settings["source_subpath"]+"/tmp/stage1root/") in self.settings: |
1510 |
self.settings["source_path"]=normpath(self.settings["storedir"]+"/tmp/"+self.settings["source_subpath"]+"/tmp/stage1root/") |
1511 |
else: |
1512 |
self.settings["source_path"]=normpath(self.settings["storedir"]+"/builds/"+self.settings["source_subpath"]+".tar.bz2") |
1513 |
@@ -34,24 +34,24 @@ class stage2_target(generic_stage_target): |
1514 |
# generic_stage_target and why aren't they in stage3_target? |
1515 |
|
1516 |
def override_chost(self): |
1517 |
- if self.settings.has_key("chost"): |
1518 |
+ if "chost" in self.settings: |
1519 |
self.settings["CHOST"]=list_to_string(self.settings["chost"]) |
1520 |
|
1521 |
def override_cflags(self): |
1522 |
- if self.settings.has_key("cflags"): |
1523 |
+ if "cflags" in self.settings: |
1524 |
self.settings["CFLAGS"]=list_to_string(self.settings["cflags"]) |
1525 |
|
1526 |
def override_cxxflags(self): |
1527 |
- if self.settings.has_key("cxxflags"): |
1528 |
+ if "cxxflags" in self.settings: |
1529 |
self.settings["CXXFLAGS"]=list_to_string(self.settings["cxxflags"]) |
1530 |
|
1531 |
def override_ldflags(self): |
1532 |
- if self.settings.has_key("ldflags"): |
1533 |
+ if "ldflags" in self.settings: |
1534 |
self.settings["LDFLAGS"]=list_to_string(self.settings["ldflags"]) |
1535 |
|
1536 |
def set_portage_overlay(self): |
1537 |
generic_stage_target.set_portage_overlay(self) |
1538 |
- if self.settings.has_key("portage_overlay"): |
1539 |
+ if "portage_overlay" in self.settings: |
1540 |
print "\nWARNING !!!!!" |
1541 |
print "\tUsing an portage overlay for earlier stages could cause build issues." |
1542 |
print "\tIf you break it, you buy it. Don't complain to us about it." |
1543 |
diff --git a/modules/stage3_target.py b/modules/stage3_target.py |
1544 |
index 8c839df..4d3a008 100644 |
1545 |
--- a/modules/stage3_target.py |
1546 |
+++ b/modules/stage3_target.py |
1547 |
@@ -17,7 +17,7 @@ class stage3_target(generic_stage_target): |
1548 |
|
1549 |
def set_portage_overlay(self): |
1550 |
generic_stage_target.set_portage_overlay(self) |
1551 |
- if self.settings.has_key("portage_overlay"): |
1552 |
+ if "portage_overlay" in self.settings: |
1553 |
print "\nWARNING !!!!!" |
1554 |
print "\tUsing an overlay for earlier stages could cause build issues." |
1555 |
print "\tIf you break it, you buy it. Don't complain to us about it." |
1556 |
diff --git a/modules/stage4_target.py b/modules/stage4_target.py |
1557 |
index 591f9b2..65c9dd0 100644 |
1558 |
--- a/modules/stage4_target.py |
1559 |
+++ b/modules/stage4_target.py |
1560 |
@@ -31,9 +31,9 @@ class stage4_target(generic_stage_target): |
1561 |
"preclean","rcupdate","unmerge","unbind","remove","empty",\ |
1562 |
"clean"] |
1563 |
|
1564 |
-# if self.settings.has_key("TARBALL") or \ |
1565 |
+# if "TARBALL" in self.settings or \ |
1566 |
# not self.settings.has_key("FETCH"): |
1567 |
- if not self.settings.has_key("FETCH"): |
1568 |
+ if "FETCH" not in self.settings: |
1569 |
self.settings["action_sequence"].append("capture") |
1570 |
self.settings["action_sequence"].append("clear_autoresume") |
1571 |
|
1572 |
-- |
1573 |
1.7.8.6 |