From d13ad04bcf4be21b5c0f2a79aac2f49fbb9624ac Mon Sep 17 00:00:00 2001 From: Daniel Robbins Date: Sun, 9 Nov 2003 01:51:30 +0000 Subject: [PATCH] grp working, spec file integrated git-svn-id: svn+ssh://svn.gentoo.org/var/svnroot/catalyst/trunk@71 d1e1f19c-881f-0410-ab34-b69fee027534 --- ChangeLog | 5 ++++- catalyst | 16 +++++++++++---- modules/targets.py | 5 ++++- targets/grp/grp.sh | 49 ++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 69 insertions(+), 6 deletions(-) create mode 100755 targets/grp/grp.sh diff --git a/ChangeLog b/ChangeLog index 79673a0f..0004f052 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,7 +1,10 @@ # ChangeLog for gentoo/src/catalyst # Copyright 2002-2003 Gentoo Technologies, Inc.; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo/src/catalyst/ChangeLog,v 1.10 2003/11/08 23:53:15 drobbins Exp $ +# $Header: /var/cvsroot/gentoo/src/catalyst/ChangeLog,v 1.11 2003/11/09 01:51:30 drobbins Exp $ + 08 Nov 2003; Daniel Robbins : spec file support integrated + into catalyst. Use "-f/--file specfile" as argument; see examples dir for examples. + 08 Nov 2003; Daniel Robbins : support functions for spec file parsing and reading added. Will get added to the code soon. diff --git a/catalyst b/catalyst index aa0628e4..9c37fc02 100755 --- a/catalyst +++ b/catalyst @@ -24,7 +24,8 @@ elif sys.argv[1] in ["-v","--version"]: sys.exit(1) if os.getuid()!=0: #non-root callers can't go any further than here. - die("This script requires root privileges to operate.") + print "catalyst: This script requires root privileges to operate." + sys.exit(1) myspec={} myconf={} @@ -66,11 +67,18 @@ if "ccache" in string.split(myspec["options"]): if "pkgcache" in string.split(myspec["options"]): print "Package cache support enabled." myspec["PKGCACHE"]="1" -#determine target, call target constructor and hand it the rest of the arguments -try: +if sys.argv[1] in ["-f", "--file" ]: + try: + addlargs=read_spec(sys.argv[2]) + except: + raise CatalystError,"Unable to read spec file",sys.argv[2] + unparsedargs=sys.argv[3:] +else: addlargs={} - arg_parse(myspec,addlargs) + unparsedargs=sys.argv[1:] +try: + arg_parse(myspec,addlargs,unparsedargs) if not targetmap.has_key(myspec["target"]): raise CatalystError,"Target \""+myspec["target"]+"\" not available." mytarget=targetmap[myspec["target"]](myspec,addlargs) diff --git a/modules/targets.py b/modules/targets.py index b1a7f8f2..e8acc8c6 100644 --- a/modules/targets.py +++ b/modules/targets.py @@ -65,6 +65,9 @@ class generic_stage_target(generic_target): if self.settings["target"]=="grp": #grp creates a directory of packages and sources rather than a compressed tarball self.settings["target_path"]=st+"/builds/"+self.settings["target_subpath"] + #since we have a directory here, we need to create it + if not os.path.exists(self.settings["target_path"]): + os.makedirs(self.settings["target_path"]) else: self.settings["target_path"]=st+"/builds/"+self.settings["target_subpath"]+".tar.bz2" @@ -171,7 +174,7 @@ class generic_stage_target(generic_target): 'CFLAGS="'+self.settings["CFLAGS"]+'"', 'CHOST="'+self.settings["CHOST"]+'"'] myusevars=[] - if self.setttings.has_key("HOSTUSE"): + if self.settings.has_key("HOSTUSE"): myusevars.extend(self.settings["HOSTUSE"]) if self.settings["target"]=="grp": myusevars.append("bindist") diff --git a/targets/grp/grp.sh b/targets/grp/grp.sh new file mode 100755 index 00000000..0d8a8dc0 --- /dev/null +++ b/targets/grp/grp.sh @@ -0,0 +1,49 @@ +# Copyright 1999-2003 Gentoo Technologies, Inc. +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo/src/catalyst/targets/grp/Attic/grp.sh,v 1.1 2003/11/09 01:51:30 drobbins Exp $ + +case $1 in +enter) + $clst_CHROOT $clst_chroot_path + ;; +run) + shift + export clst_grp_type=$1 + shift + export clst_grp_target=$1 + shift + export clst_grp_packages="$*" + $clst_CHROOT $clst_chroot_path /bin/bash << EOF + env-update + source /etc/profile + if [ -n "${clst_CCACHE}" ] + then + export FEATURES="ccache" + emerge --oneshot --nodeps ccache || exit 1 + fi + if [ ${clst_rel_type} = "hardened" ] + then + emerge --oneshot --nodeps hardened-gcc || exit 1 + fi + export CONFIG_PROTECT="-*" + + USE="build" emerge portage + + if [ "$clst_grp_type" = "pkgset" ] + then + unset DISTDIR + export PKGDIR="/tmp/grp/$clst_grp_target" + emerge --usepkg --buildpkg --noreplace $clst_grp_packages || exit 1 + else + export DISTDIR="/tmp/grp/$clst_grp_target" + unset PKGDIR + emerge --fetchonly $clst_grp_packages || exit 1 + fi +EOF + [ $? -ne 0 ] && exit 1 + ;; +*) + exit 1 + ;; +esac +exit 0 -- 2.26.2