Move list_bashify() from catalyst.support to catalyst.util
authorAndrew Gaffney <agaffney@gentoo.org>
Sun, 11 Jan 2009 21:42:21 +0000 (15:42 -0600)
committerAndrew Gaffney <agaffney@gentoo.org>
Sun, 11 Jan 2009 21:42:21 +0000 (15:42 -0600)
ChangeLog
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

index 288a43cb84fd33ddb7b13a8fa9251f29edb7e372..4afc247d1e01f0088b03a56c8987715e47ca5c8c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,13 @@
 # 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:
index b9dd95d5eda2fa20df9519e86d5192acf81445b8..27dac0a450d7f9d31baf66f36d5f47e27f08dd46 100644 (file)
@@ -2,6 +2,8 @@
 This module contains miscellaneous functions for outputting messages
 """
 
+import sys
+
 def msg(mymsg, verblevel=1):
        if verbosity >= verblevel:
                print mymsg
index 2c209121756009228b058e41da2ee02c174a1972..44911a10da0d3bbc45708d07b2f21703c2c7fd14 100644 (file)
@@ -205,18 +205,6 @@ valid_config_file_values.append("SEEDCACHE")
 
 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]
index 89710fdad60ac5ca6686088c665ddced96243b4a..2f5c97fd7aaf2994a4a018855f5402b1c79baa35 100644 (file)
@@ -1331,8 +1331,8 @@ class generic_stage_target(generic_target):
                                                "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"]+\
index b483216003f6a0c0e7c436cffeb9ed572126986b..4b9428b77df0e86299d7fe47c85a50975d21e76a 100644 (file)
@@ -6,6 +6,7 @@ The builder class for GRP (Gentoo Reference Platform) builds.
 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):
@@ -49,7 +50,7 @@ class grp_target(generic_stage_target):
        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)
index f00627af17aae273b8a8887ed70229c261240961..bb0263725e708720c0f9e078fb5158dfe1be2aed 100644 (file)
@@ -6,6 +6,7 @@ Builder class for a netboot build.
 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):
@@ -58,7 +59,7 @@ class netboot_target(generic_stage_target):
 #      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:
@@ -102,7 +103,7 @@ class netboot_target(generic_stage_target):
 
                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."
index c6965d479ccdea9c3432e1af7212ac016acc404a..f0827761082a22b31ceea5ff649d1f06f59c2802 100644 (file)
@@ -6,6 +6,7 @@ Builder class for a netboot build, version 2
 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):
@@ -85,7 +86,7 @@ class netboot2_target(generic_stage_target):
 
                        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!"
index 85ba6abb6283602df26f8542cced52ea331c6c9d..7b4a6f3094a23df7a4b3c366b2d7dd0e8f8742b7 100644 (file)
@@ -5,6 +5,7 @@ builder class for the tinderbox target
 
 from catalyst.support import *
 from generic_stage import *
+import catalyst.util
 
 class tinderbox_target(generic_stage_target):
        def __init__(self,spec,addlargs):
@@ -19,7 +20,7 @@ class tinderbox_target(generic_stage_target):
                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()
index 1f90e65ffbd6b951e6fb7a256cb8249ce5a2ada4..c27f5f0670aa08d3e75a30267668981a0ed2bb89 100644 (file)
@@ -45,3 +45,15 @@ def readfile(file):
                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
+