Changes to allow cflags, chost, cxxflags in a spec file
authorEric Edgar <rocket@gentoo.org>
Thu, 7 Apr 2005 00:08:51 +0000 (00:08 +0000)
committerEric Edgar <rocket@gentoo.org>
Thu, 7 Apr 2005 00:08:51 +0000 (00:08 +0000)
git-svn-id: svn+ssh://svn.gentoo.org/var/svnroot/catalyst/trunk@589 d1e1f19c-881f-0410-ab34-b69fee027534

ChangeLog
modules/catalyst_support.py
modules/generic_stage_target.py

index cb9a3efcaa529c0d211df1ff778d4c916ff6a5db..f6c6f2ad8cf9b192728e363ec1bec175da1f7b99 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,10 @@
 # ChangeLog for gentoo/src/catalyst 
 # Copyright 2002-2005 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo/src/catalyst/ChangeLog,v 1.209 2005/04/06 23:23:57 rocket Exp $
+# $Header: /var/cvsroot/gentoo/src/catalyst/ChangeLog,v 1.210 2005/04/07 00:08:51 rocket Exp $
+
+  07 Apr 2005; Eric Edgar <rocket@gentoo.org> modules/catalyst_support.py,
+  modules/generic_stage_target.py:
+  Changes to allow cflags, chost, cxxflags in a spec file
 
   06 Apr 2005; Eric Edgar <rocket@gentoo.org>
   targets/livecd-stage1/livecd-stage1-controller.sh,
index 6c1f77de5add1845b75d2451bdc2653cba05f00d..555ab1734b53cb16341dd6e217bccbe1b754fc16 100644 (file)
@@ -1,6 +1,6 @@
 # Copyright 1999-2004 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo/src/catalyst/modules/catalyst_support.py,v 1.35 2005/04/04 17:48:32 rocket Exp $
+# $Header: /var/cvsroot/gentoo/src/catalyst/modules/catalyst_support.py,v 1.36 2005/04/07 00:08:51 rocket Exp $
 
 import sys,string,os,types,re,traceback,md5
 
@@ -77,6 +77,18 @@ def list_bashify(mylist):
        mypack=string.join(mypack)
        return mypack
 
+def list_to_string(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
+
 class CatalystError(Exception):
        def __init__(self, message):
                if message:
index fb72812ba0bca7256d877027cd83137c9ff01ade..42425019b7fb38eb6aff5da76a379d360544251a 100644 (file)
@@ -1,6 +1,6 @@
 # Copyright 1999-2004 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo/src/catalyst/modules/generic_stage_target.py,v 1.25 2005/04/04 17:48:32 rocket Exp $
+# $Header: /var/cvsroot/gentoo/src/catalyst/modules/generic_stage_target.py,v 1.26 2005/04/07 00:08:51 rocket Exp $
 
 """
 This class does all of the chroot setup, copying of files, etc. It is
@@ -20,7 +20,7 @@ class generic_stage_target(generic_target):
                        "profile","snapshot","source_subpath"])
                
                self.valid_values.extend(["version_stamp","target","subarch","rel_type","profile",\
-                       "snapshot","source_subpath","portage_confdir"])
+                       "snapshot","source_subpath","portage_confdir","cflags","cxxflags","chost","hostuse"])
                generic_target.__init__(self,addlargs,myspec)
                
                # map the mainarch we are running under to the mainarches we support for
@@ -101,7 +101,15 @@ class generic_stage_target(generic_target):
                for envvar in "CHOST", "CFLAGS", "CXXFLAGS":
                        if os.environ.has_key(envvar):
                                self.settings[envvar] = os.environ[envvar]
-               
+               if self.settings.has_key("chost"):
+                   self.settings["CHOST"]=list_to_string(self.settings["chost"])
+               if self.settings.has_key("cflags"):
+                   self.settings["CFLAGS"]=list_to_string(self.settings["cflags"])
+               if self.settings.has_key("cxxflags"):
+                   self.settings["CXXFLAGS"]=list_to_string(self.settings["cxxflags"])
+               if self.settings.has_key("hostuse"):
+                   self.settings["hostuse"]=list_to_string(self.settings["hostuse"])
+
                # define all of our core variables
                self.set_target_profile()
                self.set_target_subpath()
@@ -437,14 +445,14 @@ class generic_stage_target(generic_target):
                
                    if self.settings.has_key("CXXFLAGS"):
                            myf.write('CXXFLAGS="'+self.settings["CXXFLAGS"]+'"\n')
+                   else:
+                           myf.write('CXXFLAGS="${CFLAGS}"\n')
                            
                    if self.settings.has_key("portage_overlay"):
                                if type(self.settings["portage_overlay"])==types.StringType:
                                        self.settings[self.settings["portage_overlay"]]=[self.settings["portage_overlay"]]
                                        
                                myf.write('PORTDIR_OVERLAY="'+string.join(self.settings["portage_overlay"])+'"\n')
-                   else:
-                           myf.write('CXXFLAGS="${CFLAGS}"\n')
                    myf.close()
        
        def clean(self):