# Copyright 2002-2009 Gentoo Foundation; 2008-2009 Various authors (see AUTHORS)
# Distributed under the GPL v2
+ 11 Jan 2009; Andrew Gaffney <agaffney@gentoo.org>
+ modules/catalyst/output.py, modules/catalyst/support.py,
+ modules/catalyst/target/generic_stage.py, modules/catalyst/target/grp.py,
+ modules/catalyst/target/netboot.py, modules/catalyst/target/netboot2.py,
+ modules/catalyst/target/tinderbox.py, modules/catalyst/util.py:
+ Move list_bashify() from catalyst.support to catalyst.util
+
11 Jan 2009; Andrew Gaffney <agaffney@gentoo.org>
modules/catalyst/support.py, modules/catalyst/target/generic_stage.py,
modules/catalyst/target/livecd_stage2.py, modules/catalyst/util.py:
This module contains miscellaneous functions for outputting messages
"""
+import sys
+
def msg(mymsg, verblevel=1):
if verbosity >= verblevel:
print mymsg
verbosity=1
-def list_bashify(mylist):
- if type(mylist)==types.StringType:
- mypack=[mylist]
- else:
- mypack=mylist[:]
- for x in range(0,len(mypack)):
- # surround args with quotes for passing to bash,
- # allows things like "<" to remain intact
- mypack[x]="'"+mypack[x]+"'"
- mypack=string.join(mypack)
- return mypack
-
def list_to_string(mylist):
if type(mylist)==types.StringType:
mypack=[mylist]
"build_packages"):
print "Resume point detected, skipping build_packages operation..."
else:
- mypack=\
- list_bashify(self.settings[self.settings["spec_prefix"]\
+ mypack = \
+ catalyst.util.list_bashify(self.settings[self.settings["spec_prefix"] \
+"/packages"])
try:
cmd("/bin/bash "+self.settings["controller_file"]+\
import os,types,glob
from catalyst.support import *
from generic_stage import *
+import catalyst.util
class grp_target(generic_stage_target):
def __init__(self,spec,addlargs):
def run_local(self):
for pkgset in self.settings["grp"]:
# example call: "grp.sh run pkgset cd1 xmms vim sys-apps/gleep"
- mypackages=list_bashify(self.settings["grp/"+pkgset+"/packages"])
+ mypackages = catalyst.util.list_bashify(self.settings["grp/"+pkgset+"/packages"])
try:
cmd("/bin/bash "+self.settings["controller_file"]+" run "+self.settings["grp/"+pkgset+"/type"]\
+" "+pkgset+" "+mypackages,env=self.env)
import os,string,types
from catalyst.support import *
from generic_stage import *
+import catalyst.util
class netboot_target(generic_stage_target):
def __init__(self,spec,addlargs):
# def build_packages(self):
# # build packages
# if "netboot/packages" in self.settings:
-# mypack=list_bashify(self.settings["netboot/packages"])
+# mypack = catalyst.util.list_bashify(self.settings["netboot/packages"])
# try:
# cmd("/bin/bash "+self.settings["controller_file"]+" packages "+mypack,env=self.env)
# except CatalystError:
try:
cmd("/bin/bash "+self.settings["controller_file"]+\
- " image " + list_bashify(myfiles),env=self.env)
+ " image " + catalyst.util.list_bashify(myfiles),env=self.env)
except CatalystError:
self.unbind()
raise CatalystError,"netboot build aborting due to error."
import os,string,types
from catalyst.support import *
from generic_stage import *
+import catalyst.util
class netboot2_target(generic_stage_target):
def __init__(self,spec,addlargs):
try:
cmd("/bin/bash "+self.settings["controller_file"]+\
- " image " + list_bashify(myfiles),env=self.env)
+ " image " + catalyst.util.list_bashify(myfiles),env=self.env)
except CatalystError:
self.unbind()
raise CatalystError,"Failed to copy files to image!"
from catalyst.support import *
from generic_stage import *
+import catalyst.util
class tinderbox_target(generic_stage_target):
def __init__(self,spec,addlargs):
try:
if os.path.exists(self.settings["controller_file"]):
cmd("/bin/bash "+self.settings["controller_file"]+" run "+\
- list_bashify(self.settings["tinderbox/packages"]),"run script failed.",env=self.env)
+ catalyst.util.list_bashify(self.settings["tinderbox/packages"]),"run script failed.",env=self.env)
except CatalystError:
self.unbind()
return None
#raise CatalystError, "Could not read file " + file
+def list_bashify(mylist):
+ if isinstance(mylist, str):
+ mypack = [mylist]
+ else:
+ mypack = mylist[:]
+ for x in range(0,len(mypack)):
+ # surround args with quotes for passing to bash,
+ # allows things like "<" to remain intact
+ mypack[x] = "'" + mypack[x] + "'"
+ mypack = "".join(mypack)
+ return mypack
+