grp working, spec file integrated
authorDaniel Robbins <drobbins@gentoo.org>
Sun, 9 Nov 2003 01:51:30 +0000 (01:51 +0000)
committerDaniel Robbins <drobbins@gentoo.org>
Sun, 9 Nov 2003 01:51:30 +0000 (01:51 +0000)
git-svn-id: svn+ssh://svn.gentoo.org/var/svnroot/catalyst/trunk@71 d1e1f19c-881f-0410-ab34-b69fee027534

ChangeLog
catalyst
modules/targets.py
targets/grp/grp.sh [new file with mode: 0755]

index 79673a0fb5eb5f28f76dbe32d4d3358a31954243..0004f0521532bc0b890dc4201c1677a9aca6d3bd 100644 (file)
--- 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 <drobbins@gentoo.org>: spec file support integrated
+  into catalyst. Use "-f/--file specfile" as argument; see examples dir for examples.
+  
   08 Nov 2003; Daniel Robbins <drobbins@gentoo.org>: support functions for spec
   file parsing and reading added. Will get added to the code soon.
   
index aa0628e492fa6309ea575543dc36291d6cda0d3b..9c37fc026c359c04e1c5a27407c0eb5d8a56a723 100755 (executable)
--- 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)
index b1a7f8f2b3c71a2f0459665285f0a6024779768c..e8acc8c698959d86de6d59fbf2503b5c023ec761 100644 (file)
@@ -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 (executable)
index 0000000..0d8a8dc
--- /dev/null
@@ -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