patch for bug 58840
authorJohn P. Davis <zhen@gentoo.org>
Mon, 2 Aug 2004 23:23:34 +0000 (23:23 +0000)
committerJohn P. Davis <zhen@gentoo.org>
Mon, 2 Aug 2004 23:23:34 +0000 (23:23 +0000)
git-svn-id: svn+ssh://svn.gentoo.org/var/svnroot/catalyst/trunk@423 d1e1f19c-881f-0410-ab34-b69fee027534

ChangeLog
modules/generic_stage_target.py
targets/stage1/build.py [new file with mode: 0755]
targets/stage1/build.sh [deleted file]
targets/stage1/stage1-chroot.sh
targets/stage1/stage1-preclean2-chroot.sh
targets/stage1/stage1.sh
targets/stage2/stage2-chroot.sh
targets/stage3/stage3-chroot.sh

index da66c8999b1e353cd40a1116fc198caeb0816f89..d88fcfc7ebe5cfdf3f70372007fb7ccf2a386bb5 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,14 @@
 # ChangeLog for gentoo/src/catalyst 
 # Copyright 2002-2004 Gentoo Technologies, Inc.; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo/src/catalyst/ChangeLog,v 1.73 2004/07/21 05:03:42 zhen Exp $
+# $Header: /var/cvsroot/gentoo/src/catalyst/ChangeLog,v 1.74 2004/08/02 23:23:34 zhen Exp $
+
+  02 Aug 2004; John Davis <zhen@gentoo.org> modules/generic_stage_target.py,
+  +targets/stage1/build.py, -targets/stage1/build.sh,
+  targets/stage1/stage1-chroot.sh, targets/stage1/stage1-preclean2-chroot.sh,
+  targets/stage1/stage1.sh, targets/stage2/stage2-chroot.sh,
+  targets/stage3/stage3-chroot.sh:
+  applied patch from bug #58840. it should fix up things for uclibc stages and
+  cascaded profiles. thanks to Mike Frysinger (vapier@gentoo.org) for the patch.
 
   21 Jul 2004; John Davis <zhen@gentoo.org> +livecd/files/gamecd-xinitrc,
   +livecd/files/gamecd.motd.txt, +livecd/files/generic-motd.txt,
index c4b1588d6e1401a1f3fded79cbf3abf6a13be0f5..bed9b6d6142eeda188fb27e803ad5a2e4837d05e 100644 (file)
@@ -1,6 +1,6 @@
 # Distributed under the GNU General Public License version 2
 # Copyright 2003-2004 Gentoo Technologies, Inc.
-# $Header: /var/cvsroot/gentoo/src/catalyst/modules/generic_stage_target.py,v 1.7 2004/07/14 17:23:16 zhen Exp $
+# $Header: /var/cvsroot/gentoo/src/catalyst/modules/generic_stage_target.py,v 1.8 2004/08/02 23:23:34 zhen Exp $
 
 """
 This class does all of the chroot setup, copying of files, etc. It is
@@ -89,6 +89,11 @@ class generic_stage_target(generic_target):
                        print "Building on",self.settings["hostarch"],"for alternate machine type",\
                                self.settings["mainarch"]
                
+               # grab build settings from the environment
+               for envvar in "CHOST", "CFLAGS", "CXXFLAGS":
+                       if os.environ.has_key(envvar):
+                       self.settings[envvar] = os.environ[envvar]
+               
                # define all of our core variables
                self.settings["target_profile"]=self.settings["profile"]
                self.settings["target_subpath"]=self.settings["rel_type"]+"/"+self.settings["target"]+\
diff --git a/targets/stage1/build.py b/targets/stage1/build.py
new file mode 100755 (executable)
index 0000000..ae64e0d
--- /dev/null
@@ -0,0 +1,35 @@
+#!/usr/bin/python
+# Copyright 1999-2004 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo/src/catalyst/targets/stage1/build.py,v 1.1 2004/08/02 23:23:34 zhen Exp $
+
+import portage
+
+# this loads files from the profiles ...
+# wrap it here to take care of the different
+# ways portage handles stacked profiles
+def scan_profile(file):
+       if "grab_stacked" in dir(portage):
+               return portage.grab_stacked(file, portage.settings.profiles, portage.grabfile, incremental_lines=1);
+       else:
+               return portage.stack_lists( portage.grab_multiple(file, portage.settings.profiles, portage.grabfile), incremental=1);
+
+# loaded the stacked packages / packages.build files
+pkgs = scan_profile("packages")
+buildpkgs = scan_profile("packages.build")
+
+# go through the packages list and strip off all the
+# crap to get just the <category>/<package> ... then
+# search the buildpkg list for it ... if it's found,
+# we replace the buildpkg item with the one in the
+# system profile (it may have <,>,=,etc... operators
+# and version numbers)
+for idx in range(0, len(pkgs)):
+       try:
+               bidx = buildpkgs.index(portage.dep_getkey(pkgs[idx]))
+               buildpkgs[bidx] = pkgs[idx]
+               if buildpkgs[bidx][0:1] == "*":
+                       buildpkgs[bidx] = buildpkgs[bidx][1:]
+       except: pass
+
+for b in buildpkgs: print b
diff --git a/targets/stage1/build.sh b/targets/stage1/build.sh
deleted file mode 100755 (executable)
index c589d01..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-#!/bin/bash
-# Copyright 1999-2003 Gentoo Technologies, Inc.
-# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo/src/catalyst/targets/stage1/Attic/build.sh,v 1.7 2004/06/18 18:06:21 zhen Exp $
-
-for x in `cat /etc/make.profile/packages.build | grep -v '^#'`
-do
-       myp=$(grep -E "${x}(-[^[:space:]]*)?[[:space:]]*$" /etc/make.profile/packages | grep -v '^#' | sed -e 's:^\*::' | cat )
-       if [ "$myp" = "" ]
-       then
-               #if not in the system profile, include it anyway
-               echo $x
-       else
-               echo $myp
-       fi
-done
-
index c2e07adcfc3f8bd64d23be2a7507963fb3525225..6aac3b45f5fe535a29dd1f8a9e7b135557be1983 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/bash
 # Copyright 1999-2004 Gentoo Technologies, Inc.
 # Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo/src/catalyst/targets/stage1/stage1-chroot.sh,v 1.19 2004/07/12 15:01:17 zhen Exp $
+# $Header: /var/cvsroot/gentoo/src/catalyst/targets/stage1/stage1-chroot.sh,v 1.20 2004/08/02 23:23:34 zhen Exp $
                
 /usr/sbin/env-update
 source /etc/profile
@@ -35,11 +35,10 @@ export ROOT=${1}
 install -d ${ROOT}
                
 ## START BUILD
-for x in $(/tmp/build.sh)
-do
-       #echo $x >> /tmp/build.log
-       export clst_buildpkgs="${clst_buildpkgs} ${x}"
-done
+export clst_buildpkgs="$(/tmp/build.py)"
+STAGE1_USE="$(source /etc/make.profile/make.defaults ; echo ${STAGE1_USE})"
+
+USE="-* build ${STAGE1_USE}" emerge ${clst_myemergeopts} --noreplace ${clst_buildpkgs} || exit 1
 
 if [ -n "${clst_VERBOSE}" ]
 then
index 28ac12ca2253b28ff9d3f635f2a608264673631b..71cbf88741592d89f77b29a389a96c4f9ceb7d89 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/bash
 # Copyright 1999-2004 Gentoo Technologies, Inc.
 # Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo/src/catalyst/targets/stage1/Attic/stage1-preclean2-chroot.sh,v 1.2 2004/05/17 01:21:17 zhen Exp $
+# $Header: /var/cvsroot/gentoo/src/catalyst/targets/stage1/Attic/stage1-preclean2-chroot.sh,v 1.3 2004/08/02 23:23:34 zhen Exp $
                
 #now, some finishing touches to initialize gcc-config....
 unset ROOT
@@ -14,5 +14,9 @@ then
 fi
 
 #stage1 is not going to have anything in zoneinfo, so save our Factory timezone
-rm -f /etc/localtime
-cp /usr/share/zoneinfo/Factory /etc/localtime
+if [ -d /usr/share/zoneinfo ] ; then
+       rm -f /etc/localtime
+       cp /usr/share/zoneinfo/Factory /etc/localtime
+else
+       echo UTC > /etc/TZ
+fi
index 4906e8fc26e798538e4dad2c68675afbb60b7cc4..d5a1db4e044deddda598d357a782c4f276949932 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/bash
 # Copyright 1999-2003 Gentoo Technologies, Inc.
 # Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo/src/catalyst/targets/stage1/Attic/stage1.sh,v 1.14 2004/07/03 00:33:37 zhen Exp $
+# $Header: /var/cvsroot/gentoo/src/catalyst/targets/stage1/Attic/stage1.sh,v 1.15 2004/08/02 23:23:34 zhen Exp $
 
 case $1 in
        enter)
@@ -10,7 +10,7 @@ case $1 in
 
        run)
                cp ${clst_sharedir}/targets/stage1/stage1-chroot.sh ${clst_chroot_path}/tmp
-               cp ${clst_sharedir}/targets/stage1/build.sh ${clst_chroot_path}/tmp
+               cp ${clst_sharedir}/targets/stage1/build.py ${clst_chroot_path}/tmp
                
                # set up "ROOT in chroot" dir
                install -d ${clst_chroot_path}/tmp/stage1root/etc
@@ -39,7 +39,7 @@ case $1 in
        
        clean)
                #clean runs after preclean with bind mounts unmounted
-               keepers="virtual/os-headers sys-devel/binutils sys-devel/gcc virtual/baselayout sys-libs/glibc virtual/libc virtual/kernel"
+               keepers="virtual/os-headers sys-devel/binutils sys-devel/gcc sys-apps/baselayout virtual/libc virtual/kernel"
                # set everything to uid 999 (nouser)
                cd ${clst_chroot_path}/tmp/stage1root
                install -d var/db/pkg2 
index ddcfd0f969ab7cc913f4b5ff21a1bcf2f7002590..5a2aaa6f4175b0df727452d7ca48b5531ede0289 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/sh
 # Copyright 1999-2003 Gentoo Technologies, Inc.
 # Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo/src/catalyst/targets/stage2/stage2-chroot.sh,v 1.4 2004/06/18 18:06:21 zhen Exp $
+# $Header: /var/cvsroot/gentoo/src/catalyst/targets/stage2/stage2-chroot.sh,v 1.5 2004/08/02 23:23:34 zhen Exp $
 
 /usr/sbin/env-update
 source /etc/profile
@@ -15,7 +15,7 @@ then
 fi
 
 if [ -n "${clst_DISTCC}" ]
-then   
+then
        export clst_myfeatures="${clst_myfeatures} distcc"
        export DISTCC_HOSTS="${clst_distcc_hosts}"
 
@@ -29,15 +29,13 @@ then
        export EMERGE_OPTS="--usepkg --buildpkg"
 fi
 
-grep GRP_STAGE23_USE /etc/make.profile/make.defaults > /tmp/stage23
-source /tmp/stage23
-rm -f /tmp/stage23
+GRP_STAGE23_USE="$(source /etc/make.profile/make.defaults ; echo ${GRP_STAGE23_USE})"
 
 if [ -f /usr/portage/profiles/${clst_profile}/parent ]
 then
-    export clst_bootstrap="bootstrap-cascade.sh"
+       export clst_bootstrap="bootstrap-cascade.sh"
 else
-    export clst_bootstrap=bootstrap.sh
+       export clst_bootstrap=bootstrap.sh
 fi
 
 ## setup the environment
index b6cf04c28d7b64cb5c9b379122660002af8251c9..76ca9751788db3f8df02c3d28dd466e3a662f3dd 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/bash
 # Copyright 1999-2003 Gentoo Technologies, Inc.
 # Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo/src/catalyst/targets/stage3/stage3-chroot.sh,v 1.7 2004/07/12 15:01:17 zhen Exp $
+# $Header: /var/cvsroot/gentoo/src/catalyst/targets/stage3/stage3-chroot.sh,v 1.8 2004/08/02 23:23:34 zhen Exp $
 
 /usr/sbin/env-update
 source /etc/profile
@@ -29,9 +29,7 @@ then
        export clst_myemergeopts="${clst_myemergeopts} --usepkg --buildpkg"
 fi
 
-grep GRP_STAGE23_USE /etc/make.profile/make.defaults > /tmp/stage23
-source /tmp/stage23
-rm -f /tmp/stage23
+GRP_STAGE23_USE="$(source /etc/make.profile/make.defaults ; echo ${GRP_STAGE23_USE})"
 
 # setup the build environment
 export FEATURES="${clst_myfeatures}"