Added a patch from Andrew Gaffney <agaffney@gentoo.org> from bug #173826 to improve...
authorChris Gianelloni <wolf31o2@gentoo.org>
Thu, 12 Apr 2007 11:57:06 +0000 (11:57 +0000)
committerChris Gianelloni <wolf31o2@gentoo.org>
Thu, 12 Apr 2007 11:57:06 +0000 (11:57 +0000)
git-svn-id: svn+ssh://svn.gentoo.org/var/svnroot/catalyst/trunk@1229 d1e1f19c-881f-0410-ab34-b69fee027534

ChangeLog
modules/netboot2_target.py
targets/netboot2/netboot2-controller.sh
targets/netboot2/netboot2-copyfile.sh
targets/support/functions.sh
targets/support/netboot2-final.sh
targets/support/pre-kmerge.sh

index 48fa771c057bb1588d641fc7c93dc98092dfccc6..c69861e4f142ebf0547c55f0e7f71a70c538089c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,13 @@
 # Copyright 2002-2007 Gentoo Foundation; Distributed under the GPL v2
 # $Id: $
 
+  12 Apr 2007; Chris Gianelloni <wolf31o2@gentoo.org>
+  modules/netboot2_target.py, targets/netboot2/netboot2-controller.sh,
+  targets/netboot2/netboot2-copyfile.sh, targets/support/functions.sh,
+  targets/support/netboot2-final.sh, targets/support/pre-kmerge.sh:
+  Added a patch from Andrew Gaffney <agaffney@gentoo.org> from bug #173826 to
+  improve the netboot2 target.
+
   10 Apr 2007; Chris Gianelloni <wolf31o2@gentoo.org>
   modules/generic_stage_target.py:
   Added a patch from Mike Frysinger <vapier@gentoo.org> for bug #173740 to
   Made sure bindist was used for all emerges in GRP.
 
   07 Jul 2005; Eric Edgar <rocket@gentoo.org> targets/grp/grp-chroot.sh:
-  Fix USE flags for grp build
+  Fix USE flags for GRP build
 
   07 Jul 2005; Eric Edgar <rocket@gentoo.org> targets/grp/grp-chroot.sh,
   targets/stage4/stage4-chroot.sh:
-  let grp use the users environment variables and removed extra
-  grp_stage23_use from stage4
+  let GRP use the users environment variables and removed extra
+  GRP_STAGE23_USE from stage4
 
   07 Jul 2005; Eric Edgar <rocket@gentoo.org>
   targets/stage2/stage2-chroot.sh, targets/stage3/stage3-chroot.sh:
 
   07 Jul 2005; Eric Edgar <rocket@gentoo.org> targets/support/rc-update.sh:
   fix bug 98165. Change the separator on rcadd/rcdel from : to | This will
-  impact all previous spec files that use this option. Its beejays fault
+  impact all previous spec files that use this option. It's beejay's fault.
 
   06 Jul 2005; Chris Gianelloni <wolf31o2@gentoo.org> arch/ppc.py:
   Changed to use linux32 for ppc32 support when build host is ppc64.
 
   20 May 2005; Chris Gianelloni <wolf31o2@gentoo.org> AUTHORS, catalyst,
   files/catalyst.conf:
-  Retired zhen and added storedir to default catalyst.conf.
+  Retired John Davis <zhen@gentoo.org> and added storedir to default
+  catalyst.conf.
 
   20 May 2005; Chris Gianelloni <wolf31o2@gentoo.org>
   targets/support/livecdfs-update.sh:
   targets/support/create-iso.sh, targets/support/kmerge.sh,
   targets/support/target_image_setup.sh,
   targets/tinderbox/tinderbox-controller.sh:
-  Fix some exception handling in catalyst_support.py
-  remove intermediate destination folder of iso and tarball
-  Add additional tests for folders not found on host but defined
-          in spec file.  Keep catalyst from erroring in this case.
-  Change exit code on shell scripts so that errors are reported to catalyst
-          and causes catalyst to die on errors
-  Fix bug in livecd-stage1-chroot.sh so that it uses USE flags properly
-  Added additional check for mkisofs.  Informs user of where to get the program.
-  Removed autoresume code from ccache and distcc installation until I can figure
-          out a way to have the autoresume flag go someplace outside the chroot.
+  Fix some exception handling in catalyst_support.py, remove intermediate
+  destination folder of iso and tarball, add additional tests for folders not
+  found on host but defined in spec file, keep catalyst from erroring in this
+  case, change exit code on shell scripts so that errors are reported to
+  catalyst and causes catalyst to die on errors, fix bug in
+  livecd-stage1-chroot.sh so that it uses USE flags properly, added additional
+  check for mkisofs that informs the user of where to get the program, and
+  removed the autoresume code from ccache and distcc installation until I can
+  figure out a way to have the autoresume flag go someplace outside the chroot.
 
   26 Apr 2005; Eric Edgar <rocket@gentoo.org> catalyst:
   Remove bind mounts before rm operations happen at startup
   targets/support/pre-kmerge.sh:
   Fix ctrl-c error if pre-kmerge.sh is running by sourcing
   /tmp/chroot-functions.sh and removed extra equal sign to fix a genkernel
-  caching bug; Also adding preliminary support for initramfs_overlay from genkernel
+  caching bug; Also adding preliminary support for initramfs_overlay from
+  genkernel
 
   14 Apr 2005; Eric Edgar <rocket@gentoo.org>
   modules/generic_stage_target.py, targets/support/kmerge.sh:
   added envscripts support (fixes bug #39832) massive cleanup of tree to prepare
   it for ebuild - added headers to everything and removed deprecated dirs
 
-  14 Jan 2004; zhen <zhen@gentoo.org> arch/mips.py, modules/targets.py:
+  14 Jan 2004; John Davis <zhen@gentoo.org> arch/mips.py, modules/targets.py:
   adding Kumba's patches for MIPS
 
   16 Dec 2003; Guy Martin <gmsoft@gentoo.org> : arch/hppa.py,modules/targets.py:
   24 Oct 2003; Daniel Robbins <drobbins@gentoo.org>: major code rework in 
   progress on the python parts.
   
-  17 Oct 2003; zhen <zhen@gentoo.org> files/grp/x86/x86.conf,
+  17 Oct 2003; John Davis <zhen@gentoo.org> files/grp/x86/x86.conf,
   files/grp/x86/x86.pkg.cd1, files/grp/x86/x86.pkg.cd2, files/grp/x86/x86.src,
   files/livecd/x86-basic/base.pkg, files/livecd/x86-basic/kern.pkg:
   for organiation's sake, I have moved the files, such as livecd foundations,
   into catalyst/files. It will make it easier for us when ebuild time comes
   around.
 
-  15 Oct 2003; zhen <zhen@gentoo.org> targets/stage3/stage3.sh:
+  15 Oct 2003; John Davis <zhen@gentoo.org> targets/stage3/stage3.sh:
   All preliminary target build scripts are now added and coded to near as spec
   that we can have at this point.
 
index 6fe0886ebeda170c163d9055b2802cf12e3db58b..3d7cbafee949e785ecee12eae6223c618a6babff 100644 (file)
@@ -10,15 +10,17 @@ from generic_stage_target import *
 class netboot2_target(generic_stage_target):
        def __init__(self,spec,addlargs):
                self.required_values=[
-                       "boot/kernel",
-                       "netboot2/builddate",
-                       "netboot2/packages",                    
-                       "netboot2/use"                  
+                       "boot/kernel"
                ]
                self.valid_values=self.required_values[:]
-               self.valid_values.extend(self.required_values)
-               self.valid_values.extend(["netboot2/extra_files"])
-                       
+               self.valid_values.extend([
+                       "netboot2/packages",
+                       "netboot2/use",
+                       "netboot2/extra_files",
+                       "netboot2/overlay",
+                       "netboot2/busybox_config"
+               ])
+
                try:
                        if addlargs.has_key("netboot2/packages"):
                                if type(addlargs["netboot2/packages"]) == types.StringType:
@@ -31,20 +33,9 @@ class netboot2_target(generic_stage_target):
                except:
                        raise CatalystError,"configuration error in netboot2/packages."
                
-               
-
                generic_stage_target.__init__(self,spec,addlargs)
                self.set_build_kernel_vars()
-
-               # Merge packages into the buildroot, and pick out certain files to place in
-               # /tmp/image
-               self.settings["merge_path"]=normpath("/tmp/image")
-
-       def set_dest_path(self):
-               if self.settings.has_key("merge_path"):
-                       self.settings["destpath"]=normpath(self.settings["chroot_path"]+self.settings["merge_path"])
-               else:
-                       self.settings["destpath"]=normpath(self.settings["chroot_path"])
+               self.settings["merge_path"]=normpath("/tmp/image/")
 
        def set_target_path(self):
                self.settings["target_path"]=normpath(self.settings["storedir"]+"/builds/"+\
@@ -99,6 +90,17 @@ class netboot2_target(generic_stage_target):
 
                        touch(self.settings["autoresume_path"]+"copy_files_to_image")
 
+       def setup_overlay(self):        
+               if self.settings.has_key("AUTORESUME") \
+               and os.path.exists(self.settings["autoresume_path"]+"setup_overlay"):
+                       print "Resume point detected, skipping setup_overlay operation..."
+               else:
+                       if self.settings.has_key("netboot2/overlay"):
+                               for x in self.settings["netboot2/overlay"]: 
+                                       if os.path.exists(x):
+                                               cmd("rsync -a "+x+"/ "+\
+                                                       self.settings["chroot_path"], "netboot2/overlay: "+x+" copy failed.",env=self.env)
+                               touch(self.settings["autoresume_path"]+"setup_overlay")
 
        def move_kernels(self):
                # we're done, move the kernels to builds/*
@@ -112,13 +114,47 @@ class netboot2_target(generic_stage_target):
                        self.unbind()
                        raise CatalystError,"Failed to move kernel images!"
 
+       def remove(self):
+               if self.settings.has_key("AUTORESUME") \
+                       and os.path.exists(self.settings["autoresume_path"]+"remove"):
+                       print "Resume point detected, skipping remove operation..."
+               else:
+                       if self.settings.has_key(self.settings["spec_prefix"]+"/rm"):
+                               for x in self.settings[self.settings["spec_prefix"]+"/rm"]:
+                                       # we're going to shell out for all these cleaning operations,
+                                       # so we get easy glob handling
+                                       print "netboot2: removing " + x
+                                       os.system("rm -rf " + self.settings["chroot_path"] + self.settings["merge_path"] + x)
+
+       def empty(self):                
+               if self.settings.has_key("AUTORESUME") \
+                       and os.path.exists(self.settings["autoresume_path"]+"empty"):
+                       print "Resume point detected, skipping empty operation..."
+               else:
+                       if self.settings.has_key("netboot2/empty"):
+                               if type(self.settings["netboot2/empty"])==types.StringType:
+                                       self.settings["netboot2/empty"]=self.settings["netboot2/empty"].split()
+                               for x in self.settings["netboot2/empty"]:
+                                       myemp=self.settings["chroot_path"] + self.settings["merge_path"] + x
+                                       if not os.path.isdir(myemp):
+                                               print x,"not a directory or does not exist, skipping 'empty' operation."
+                                               continue
+                                       print "Emptying directory", x
+                                       # stat the dir, delete the dir, recreate the dir and set
+                                       # the proper perms and ownership
+                                       mystat=os.stat(myemp)
+                                       shutil.rmtree(myemp)
+                                       os.makedirs(myemp,0755)
+                                       os.chown(myemp,mystat[ST_UID],mystat[ST_GID])
+                                       os.chmod(myemp,mystat[ST_MODE])
+               touch(self.settings["autoresume_path"]+"empty")
 
        def set_action_sequence(self):
            self.settings["action_sequence"]=["unpack","unpack_snapshot","config_profile_link",
                                        "setup_confdir","bind","chroot_setup",\
                                        "setup_environment","build_packages","root_overlay",\
-                                       "copy_files_to_image","build_kernel","move_kernels",\
-                                       "unbind","clean","clear_autoresume"]
+                                       "copy_files_to_image","setup_overlay","build_kernel","move_kernels",\
+                                       "remove","empty","unbind","clean","clear_autoresume"]
 
 def register(foo):
        foo.update({"netboot2":netboot2_target})
index dc7c64ad98a772f32ac28d69ec9ee0c042c0d6f8..c5ee152a7b1b13114987ed6010db6ffd811d1e17 100644 (file)
@@ -14,6 +14,11 @@ case ${1} in
        ;;
        pre-kmerge)
                # Sets up the build environment before any kernels are compiled
+               if [ -z "${clst_netboot2_busybox_config}" ]; then
+                       cp ${clst_sharedir}/targets/netboot2/nb-busybox.cf ${clst_chroot_path}/tmp/busy-config
+               else
+                       cp ${clst_netboot2_busybox_config} ${clst_chroot_path}/tmp/busy-config
+               fi
                exec_in_chroot ${clst_sharedir}/targets/support/pre-kmerge.sh
        ;;
        post-kmerge)
index b8146d733bcb41d685afac6933438b88f407e0ed..66dfd0af80b6b8cf85cee614c8c8ab09dc1a64a6 100644 (file)
@@ -18,4 +18,3 @@ do
                fi
        fi
 done
-echo ""
index 34bd98b4bdb6cc3a647f6d7e0975449949123524..7b40afece148102c6bc53647986578af0aa75a7e 100755 (executable)
@@ -124,6 +124,11 @@ extract_kernels() {
                then 
                        mv ${1}/initramfs-* ${1}/${x}.igz
                fi
+
+               if [ -e ${1}/System.map-* ];
+               then
+                       mv ${1}/System.map-* ${1}/System.map-${x}
+               fi
        done
 }
 
index 48a6747224a19ac30f28cc7cdecd773b8192d734..2cc9d57c4cd1a896b648427b242f3ca5c79d16e8 100755 (executable)
@@ -14,6 +14,7 @@ mkdir ${clst_target_path}kernels/misc
 for x in ${clst_boot_kernel}; do
        mv ${clst_target_path}boot/${x} ${clst_target_path}kernels
        mv ${clst_target_path}boot/${x}.igz ${clst_target_path}kernels/misc
+       mv ${clst_target_path}boot/System.map-${x} ${clst_target_path}kernels/misc
 done
 
 rmdir ${clst_target_path}boot
@@ -31,7 +32,15 @@ case ${clst_hostarch} in
                sleep 0
                ;;
        sparc*)
-               sleep 0
+               if [ "${clst_hostarch}" == "sparc" ]; then
+                       piggyback=piggyback
+               else
+                       piggyback=piggyback64
+               fi
+               for x in ${clst_boot_kernel}; do
+                       elftoaout ${clst_target_path}/kernels/${x} -o ${clst_target_path}${x}-a.out
+                       ${piggyback} ${clst_target_path}/${x}-a.out ${clst_target_path}kernels/misc/System.map-${x} ${clst_target_path}kernels/misc/${x}.igz
+               done
                ;;
        ia64)
                sleep 0
index b8805e719355aafd140ab9ec9cbb325149146615..a224a2318e73ad575afc869bb539420a2fc7d8b4 100755 (executable)
@@ -34,17 +34,17 @@ case ${clst_target} in
 
                # Set the netboot builddate/hostname in linuxrc and copy to proper arch
                # directory in genkernel
-               sed -e "s/@@MYDATE@@/${clst_netboot2_builddate}/g" \
+               sed -e "s/@@MYDATE@@/$(date '+%Y%m%d')/g" \
                    -e "s/@@RELVER@@/${clst_version_stamp}/g" \
-                       ${clst_root_path}usr/share/genkernel/netboot/linuxrc.x \
-                               > ${clst_root_path}usr/share/genkernel/${clst_hostarch}/linuxrc
+                       /usr/share/genkernel/netboot/linuxrc.x \
+                       > /usr/share/genkernel/${clst_hostarch}/linuxrc
 
                echo ">>> Copying support files to ${clst_root_path} ..."
-               cp -pPRf ${clst_root_path}usr/share/genkernel/netboot/misc/* \
+               cp -pPRf /usr/share/genkernel/netboot/misc/* \
                        ${clst_merge_path}
 
                echo ">>> Copying busybox config ..."
-               cp -f ${clst_root_path}usr/share/genkernel/${clst_hostarch}/nb-busybox.cf \
-                       ${clst_root_path}usr/share/genkernel/${clst_hostarch}/busy-config
+               cp -f /tmp/busy-config \
+                       /usr/share/genkernel/${clst_hostarch}/busy-config
        ;;
 esac