From c1b1984b44098542fc6d598b34168b9d12a6c49c Mon Sep 17 00:00:00 2001 From: Eric Edgar Date: Thu, 7 Apr 2005 00:08:51 +0000 Subject: [PATCH] Changes to allow cflags, chost, cxxflags in a spec file git-svn-id: svn+ssh://svn.gentoo.org/var/svnroot/catalyst/trunk@589 d1e1f19c-881f-0410-ab34-b69fee027534 --- ChangeLog | 6 +++++- modules/catalyst_support.py | 14 +++++++++++++- modules/generic_stage_target.py | 18 +++++++++++++----- 3 files changed, 31 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index cb9a3efc..f6c6f2ad 100644 --- 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 modules/catalyst_support.py, + modules/generic_stage_target.py: + Changes to allow cflags, chost, cxxflags in a spec file 06 Apr 2005; Eric Edgar targets/livecd-stage1/livecd-stage1-controller.sh, diff --git a/modules/catalyst_support.py b/modules/catalyst_support.py index 6c1f77de..555ab173 100644 --- a/modules/catalyst_support.py +++ b/modules/catalyst_support.py @@ -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: diff --git a/modules/generic_stage_target.py b/modules/generic_stage_target.py index fb72812b..42425019 100644 --- a/modules/generic_stage_target.py +++ b/modules/generic_stage_target.py @@ -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): -- 2.26.2