From: Eric Edgar Date: Thu, 26 Jan 2006 19:56:32 +0000 (+0000) Subject: Separation of kerncache from snapcache X-Git-Tag: CATALYST_2_0_6_916~451 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=6a1da1220d4725770786bba58a3cde41c6fdafef;p=catalyst.git Separation of kerncache from snapcache git-svn-id: svn+ssh://svn.gentoo.org/var/svnroot/catalyst/trunk@1043 d1e1f19c-881f-0410-ab34-b69fee027534 --- diff --git a/ChangeLog b/ChangeLog index e521dfb1..1ad87e41 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,14 @@ # Copyright 2002-2006 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo/src/catalyst/ChangeLog,v 1.528 2006/01/26 15:36:46 wolf31o2 Exp $ +# $Header: /var/cvsroot/gentoo/src/catalyst/ChangeLog,v 1.529 2006/01/26 19:56:32 rocket Exp $ + + 26 Jan 2006; Eric Edgar + examples/generic_stage_template.spec, examples/grp_template.spec, + examples/livecd-stage1_template.spec, + examples/livecd-stage2_template.spec, examples/netboot2_template.spec, + examples/netboot_template.spec, examples/stage4_template.spec, + examples/tinderbox_template.spec, modules/generic_stage_target.py, + targets/support/kmerge.sh: + Separation of kerncache from snapcache 26 Jan 2006; Chris Gianelloni catalyst: It helps if I actually increment the version number. diff --git a/examples/generic_stage_template.spec b/examples/generic_stage_template.spec index 4094890c..7bc3d9ce 100644 --- a/examples/generic_stage_template.spec +++ b/examples/generic_stage_template.spec @@ -91,3 +91,9 @@ cxxflags: # example: # ldflags: -Wl,-O1 -Wl,-z,now ldflags: + +# Setting the option overrides the location of the pkgcache +pkgcache_path: + +# Setting the option overrides the location of the kerncache +kerncache_path: diff --git a/examples/grp_template.spec b/examples/grp_template.spec index 3e5e3163..4ccbc2e3 100644 --- a/examples/grp_template.spec +++ b/examples/grp_template.spec @@ -106,3 +106,10 @@ grp/cd2/type: # example: # grp/cd2/packages: dante tsocks sys-apps/eject minicom links acpid apmd parted whois tcpdump cvs zip unzip netcat partimage app-admin/sudo app-cdr/cdrtools gnome emacs dev-lang/ruby enlightenment kde mozilla-firefox mozilla-thunderbird xfce4 openbox fluxbox sylpheed openoffice-bin gimp xemacs xmms abiword gaim xchat pan tetex xcdroast k3b samba nmap gradm ettercap ethereal mplayer grp/cd2/packages: + +# Setting the option overrides the location of the pkgcache +pkgcache_path: + +# Setting the option overrides the location of the kerncache +kerncache_path: + diff --git a/examples/livecd-stage1_template.spec b/examples/livecd-stage1_template.spec index cadeac20..529881b7 100644 --- a/examples/livecd-stage1_template.spec +++ b/examples/livecd-stage1_template.spec @@ -80,3 +80,8 @@ livecd/use: # example: # livecd/packages: livecd-tools dhcpcd acpid apmd gentoo-sources coldplug fxload irssi gpm syslog-ng parted links raidtools dosfstools nfs-utils jfsutils xfsprogs e2fsprogs reiserfsprogs ntfsprogs pwgen rp-pppoe screen mirrorselect penggy iputils hwdata-knoppix hwsetup lvm2 evms vim pptpclient mdadm ethtool wireless-tools prism54-firmware wpa_supplicant livecd/packages: + +# Setting the option overrides the location of the pkgcache +pkgcache_path: + + diff --git a/examples/livecd-stage2_template.spec b/examples/livecd-stage2_template.spec index 770ef1d3..97d39391 100644 --- a/examples/livecd-stage2_template.spec +++ b/examples/livecd-stage2_template.spec @@ -318,3 +318,10 @@ livecd/empty: # example: # livecd/rm: /lib/*.a /usr/lib/*.a /usr/lib/gcc-lib/*/*/libgcj* /etc/dispatch-conf.conf /etc/etc-update.conf /etc/*- /etc/issue* /etc/make.conf /etc/man.conf /etc/*.old /root/.viminfo /usr/sbin/bootsplash* /usr/sbin/fb* /usr/sbin/fsck.cramfs /usr/sbin/fsck.minix /usr/sbin/mkfs.minix /usr/sbin/mkfs.bfs /usr/sbin/mkfs.cramfs /lib/security/pam_access.so /lib/security/pam_chroot.so /lib/security/pam_debug.so /lib/security/pam_ftp.so /lib/security/pam_issue.so /lib/security/pam_mail.so /lib/security/pam_motd.so /lib/security/pam_mkhomedir.so /lib/security/pam_postgresok.so /lib/security/pam_rhosts_auth.so /lib/security/pam_userdb.so /usr/share/consolefonts/1* /usr/share/consolefonts/7* /usr/share/consolefonts/8* /usr/share/consolefonts/9* /usr/share/consolefonts/A* /usr/share/consolefonts/C* /usr/share/consolefonts/E* /usr/share/consolefonts/G* /usr/share/consolefonts/L* /usr/share/consolefonts/M* /usr/share/consolefonts/R* /usr/share/consolefonts/a* /usr/share/consolefonts/c* /usr/share/consolefonts/dr* /usr/share/consolefonts/g* /usr/share/consolefonts/i* /usr/share/consolefonts/k* /usr/share/consolefonts/l* /usr/share/consolefonts/r* /usr/share/consolefonts/s* /usr/share/consolefonts/t* /usr/share/consolefonts/v* /etc/splash/livecd-2005.0/16* /etc/splash/livecd-2005.0/12* /etc/splash/livecd-2005.0/6* /etc/splash/livecd-2005.0/8* /etc/splash/livecd-2005.0/images/silent-16* /etc/splash/livecd-2005.0/images/silent-12* /etc/splash/livecd-2005.0/images/silent-6* /etc/splash/livecd-2005.0/images/silent-8* /etc/splash/livecd-2005.0/images/verbose-16* /etc/splash/livecd-2005.0/images/verbose-12* /etc/splash/livecd-2005.0/images/verbose-6* /etc/splash/livecd-2005.0/images/verbose-8* /etc/make.conf.example /etc/make.globals /etc/resolv.conf livecd/rm: + +# Setting the option overrides the location of the pkgcache +pkgcache_path: + +# Setting the option overrides the location of the kerncache +kerncache_path: + diff --git a/examples/netboot2_template.spec b/examples/netboot2_template.spec index a1bd1351..fe10b274 100644 --- a/examples/netboot2_template.spec +++ b/examples/netboot2_template.spec @@ -286,3 +286,10 @@ netboot2/packages/xfsprogs/files: /sbin/fsck.xfs /sbin/mkfs.xfs /sbin/xfs_repair + +# Setting the option overrides the location of the pkgcache +pkgcache_path: + +# Setting the option overrides the location of the kerncache +kerncache_path: + diff --git a/examples/netboot_template.spec b/examples/netboot_template.spec index 41d3335d..2caf28fb 100644 --- a/examples/netboot_template.spec +++ b/examples/netboot_template.spec @@ -124,3 +124,10 @@ netboot/packages/reiserfsprogs/files: # example: # netboot/extra_files: /lib/libresolv.so.2 /lib/libnss_compat.so.2 /lib/libnss_dns.so.2 /lib/libnss_files.so.2 /sbin/consoletype netboot/extra_files: + +# Setting the option overrides the location of the pkgcache +pkgcache_path: + +# Setting the option overrides the location of the kerncache +kerncache_path: + diff --git a/examples/stage4_template.spec b/examples/stage4_template.spec index e523d50f..f5d87f79 100644 --- a/examples/stage4_template.spec +++ b/examples/stage4_template.spec @@ -256,3 +256,10 @@ stage4/empty: # example: # stage4/rm: /lib/*.a /usr/lib/*.a /usr/lib/gcc-lib/*/*/libgcj* /etc/dispatch-conf.conf /etc/etc-update.conf /etc/*- /etc/issue* /etc/make.conf /etc/man.conf /etc/*.old /root/.viminfo /usr/sbin/bootsplash* /usr/sbin/fb* /usr/sbin/fsck.cramfs /usr/sbin/fsck.minix /usr/sbin/mkfs.minix /usr/sbin/mkfs.bfs /usr/sbin/mkfs.cramfs /lib/security/pam_access.so /lib/security/pam_chroot.so /lib/security/pam_debug.so /lib/security/pam_ftp.so /lib/security/pam_issue.so /lib/security/pam_mail.so /lib/security/pam_motd.so /lib/security/pam_mkhomedir.so /lib/security/pam_postgresok.so /lib/security/pam_rhosts_auth.so /lib/security/pam_userdb.so /usr/share/consolefonts/1* /usr/share/consolefonts/7* /usr/share/consolefonts/8* /usr/share/consolefonts/9* /usr/share/consolefonts/A* /usr/share/consolefonts/C* /usr/share/consolefonts/E* /usr/share/consolefonts/G* /usr/share/consolefonts/L* /usr/share/consolefonts/M* /usr/share/consolefonts/R* /usr/share/consolefonts/a* /usr/share/consolefonts/c* /usr/share/consolefonts/dr* /usr/share/consolefonts/g* /usr/share/consolefonts/i* /usr/share/consolefonts/k* /usr/share/consolefonts/l* /usr/share/consolefonts/r* /usr/share/consolefonts/s* /usr/share/consolefonts/t* /usr/share/consolefonts/v* /etc/splash/livecd-2005.0/16* /etc/splash/livecd-2005.0/12* /etc/splash/livecd-2005.0/6* /etc/splash/livecd-2005.0/8* /etc/splash/livecd-2005.0/images/silent-16* /etc/splash/livecd-2005.0/images/silent-12* /etc/splash/livecd-2005.0/images/silent-6* /etc/splash/livecd-2005.0/images/silent-8* /etc/splash/livecd-2005.0/images/verbose-16* /etc/splash/livecd-2005.0/images/verbose-12* /etc/splash/livecd-2005.0/images/verbose-6* /etc/splash/livecd-2005.0/images/verbose-8* /etc/make.conf.example /etc/make.globals /etc/resolv.conf stage4/rm: + +# Setting the option overrides the location of the pkgcache +pkgcache_path: + +# Setting the option overrides the location of the kerncache +kerncache_path: + diff --git a/examples/tinderbox_template.spec b/examples/tinderbox_template.spec index db09899e..d26d880c 100644 --- a/examples/tinderbox_template.spec +++ b/examples/tinderbox_template.spec @@ -78,3 +78,10 @@ tinderbox/use: # exampleL # tinderbox/packages: dante tsocks sys-apps/eject minicom links acpid apmd parted whois tcpdump cvs zip unzip netcat partimage app-admin/sudo app-cdr/cdrtools gnome emacs dev-lang/ruby enlightenment kde mozilla-firefox mozilla-thunderbird xfce4 openbox fluxbox sylpheed openoffice-bin gimp xemacs xmms abiword gaim xchat pan tetex xcdroast k3b samba nmap gradm ettercap ethereal mplayer tinderbox/packages: + +# Setting the option overrides the location of the pkgcache +pkgcache_path: + +# Setting the option overrides the location of the kerncache +kerncache_path: + diff --git a/modules/generic_stage_target.py b/modules/generic_stage_target.py index 9989af8f..cf6631b7 100644 --- a/modules/generic_stage_target.py +++ b/modules/generic_stage_target.py @@ -1,6 +1,6 @@ # Copyright 1999-2005 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.122 2006/01/25 16:07:35 rocket Exp $ +# $Header: /var/cvsroot/gentoo/src/catalyst/modules/generic_stage_target.py,v 1.123 2006/01/26 19:56:32 rocket Exp $ """ This class does all of the chroot setup, copying of files, etc. It is @@ -20,7 +20,8 @@ class generic_stage_target(generic_target): self.valid_values.extend(["version_stamp","target","subarch","rel_type","profile",\ "snapshot","source_subpath","portage_confdir","cflags","cxxflags",\ - "ldflags","chost","hostuse","portage_overlay","distcc_hosts","makeopts"]) + "ldflags","chost","hostuse","portage_overlay","distcc_hosts","makeopts",\ + "pkgcache_path","kerncache_path"]) self.set_valid_build_kernel_vars(addlargs) generic_target.__init__(self,myspec,addlargs) @@ -177,6 +178,12 @@ class generic_stage_target(generic_target): print "Location of the package cache is " + self.settings["pkgcache_path"] self.mounts.append("/usr/portage/packages") self.mountmap["/usr/portage/packages"]=self.settings["pkgcache_path"] + + if self.settings.has_key("KERNCACHE"): + self.set_kerncache_path() + print "Location of the kerncache is " + self.settings["kerncache_path"] + self.mounts.append("/tmp/kerncache") + self.mountmap["/tmp/kerncache"]=self.settings["kerncache_path"] if self.settings.has_key("CCACHE"): if os.environ.has_key("CCACHE_DIR"): @@ -251,9 +258,17 @@ class generic_stage_target(generic_target): if self.settings.has_key("pkgcache_path"): if type(self.settings["pkgcache_path"]) != types.StringType: self.settings["pkgcache_path"]=normpath(string.join(self.settings["pkgcache_path"])) + else: + self.settings["pkgcache_path"]=normpath(self.settings["storedir"]+"/packages/"+\ + self.settings["target_subpath"]+"/") - self.settings["pkgcache_path"]=normpath(self.settings["storedir"]+"/packages/"+\ - self.settings["target_subpath"]+"/") + def set_kerncache_path(self): + if self.settings.has_key("kerncache_path"): + if type(self.settings["kerncache_path"]) != types.StringType: + self.settings["kerncache_path"]=normpath(string.join(self.settings["kerncache_path"])) + else: + self.settings["kerncache_path"]=normpath(self.settings["storedir"]+"/kerncache/"+\ + self.settings["target_subpath"]+"/") def set_target_path(self): self.settings["target_path"]=normpath(self.settings["storedir"]+"/builds/"+\ @@ -618,6 +633,10 @@ class generic_stage_target(generic_target): if not os.path.exists(self.settings["pkgcache_path"]): os.makedirs(self.settings["pkgcache_path"],0755) + if self.settings.has_key("KERNCACHE"): + if not os.path.exists(self.settings["kerncache_path"]): + os.makedirs(self.settings["kerncache_path"],0755) + print display_msg cmd(unpack_cmd,error_msg,env=self.env) @@ -1277,6 +1296,22 @@ class generic_stage_target(generic_target): os.chown(myemp,mystat[ST_UID],mystat[ST_GID]) os.chmod(myemp,mystat[ST_MODE]) + def clear_kerncache(self): + if self.settings.has_key("KERNCACHE"): + print "purging the kerncache ..." + + myemp=self.settings["kerncache_path"] + if os.path.isdir(myemp): + print "Emptying directory",myemp + # stat the dir, delete the dir, recreate the dir and set + # the proper perms and ownership + mystat=os.stat(myemp) + #cmd("rm -rf "+myemp, "Could not remove existing file: "+myemp,env=self.env) + shutil.rmtree(myemp) + os.makedirs(myemp,0755) + os.chown(myemp,mystat[ST_UID],mystat[ST_GID]) + os.chmod(myemp,mystat[ST_MODE]) + def clear_autoresume(self): # clean resume points since they are no longer needed if self.settings.has_key("AUTORESUME"): @@ -1324,5 +1359,8 @@ class generic_stage_target(generic_target): print "clearing package cache ..." self.clear_packages() + + print "clearing kerncache ..." + self.clear_kerncache() #vim: ts=4 sw=4 sta et sts=4 ai diff --git a/targets/support/kmerge.sh b/targets/support/kmerge.sh index 588a8197..a6910995 100755 --- a/targets/support/kmerge.sh +++ b/targets/support/kmerge.sh @@ -4,21 +4,23 @@ source /tmp/chroot-functions.sh +mkdir -p /tmp/kerncache + check_genkernel_version -PKGDIR=/usr/portage/packages/gk_binaries/${clst_kname}/ebuilds +PKGDIR=/tmp/kerncache/${clst_kname}/ebuilds setup_gk_args() { # default genkernel args GK_ARGS="${clst_gk_mainargs} \ ${clst_kernel_gk_kernargs} \ - --cachedir=/usr/portage/packages/gk_binaries/${clst_kname}-genkernel_cache-${clst_version_stamp} \ + --cachedir=/tmp/kerncache/${clst_kname}-genkernel_cache-${clst_version_stamp} \ --no-mountboot \ --kerneldir=/usr/src/linux \ --kernel-config=/var/tmp/${clst_kname}.config \ - --modulespackage=/usr/portage/packages/gk_binaries/${clst_kname}-modules-${clst_version_stamp}.tar.bz2 \ - --minkernpackage=/usr/portage/packages/gk_binaries/${clst_kname}-kernel-initrd-${clst_version_stamp}.tar.bz2 \ - --kerncache=/usr/portage/packages/gk_binaries/${clst_kname}-kerncache-${clst_version_stamp}.tar.bz2 all" + --modulespackage=/tmp/kerncache/${clst_kname}-modules-${clst_version_stamp}.tar.bz2 \ + --minkernpackage=/tmp/kerncache/${clst_kname}-kernel-initrd-${clst_version_stamp}.tar.bz2 \ + --kerncache=/tmp/kerncache/${clst_kname}-kerncache-${clst_version_stamp}.tar.bz2 all" # extra genkernel options that we have to test for if [ "${clst_splash_type}" == "bootsplash" -a -n "${clst_splash_theme}" ] then @@ -84,7 +86,7 @@ genkernel_compile(){ genkernel ${GK_ARGS} || exit 1 fi fi - md5sum /var/tmp/${clst_kname}.config|awk '{print $1}' > /usr/portage/packages/gk_binaries/${clst_kname}/${clst_kname}-${clst_version_stamp}.CONFIG + md5sum /var/tmp/${clst_kname}.config|awk '{print $1}' > /tmp/kerncache/${clst_kname}/${clst_kname}-${clst_version_stamp}.CONFIG } build_kernel() { @@ -121,9 +123,9 @@ eval "clst_ksource=\$clst_boot_kernel_${filtered_kname}_sources" # real benefit in using the pkgcache for kernel source ebuilds. USE_MATCH=0 -if [ -e /usr/portage/packages/gk_binaries/${clst_kname}/${clst_kname}-${clst_version_stamp}.USE ] +if [ -e /tmp/kerncache/${clst_kname}/${clst_kname}-${clst_version_stamp}.USE ] then - STR1=$(for i in `cat /usr/portage/packages/gk_binaries/${clst_kname}/${clst_kname}-${clst_version_stamp}.USE`; do echo $i; done|sort) + STR1=$(for i in `cat /tmp/kerncache/${clst_kname}/${clst_kname}-${clst_version_stamp}.USE`; do echo $i; done|sort) STR2=$(for i in ${clst_kernel_use}; do echo $i; done|sort) if [ "${STR1}" = "${STR2}" ] then @@ -132,18 +134,18 @@ then else if [ -n "${clst_KERNCACHE}" ] then - [ -d /usr/portage/packages/gk_binaries/${clst_kname}/ebuilds ] && \ - rm -r /usr/portage/packages/gk_binaries/${clst_kname}/ebuilds - [ -e /usr/portage/packages/gk_binaries/${clst_kname}/usr/src/linux/.config ] && \ - rm /usr/portage/packages/gk_binaries/${clst_kname}/usr/src/linux/.config + [ -d /tmp/kerncache/${clst_kname}/ebuilds ] && \ + rm -r /tmp/kerncache/${clst_kname}/ebuilds + [ -e /tmp/kerncache/${clst_kname}/usr/src/linux/.config ] && \ + rm /tmp/kerncache/${clst_kname}/usr/src/linux/.config fi fi fi EXTRAVERSION_MATCH=0 -if [ -e /usr/portage/packages/gk_binaries/${clst_kname}/${clst_kname}-${clst_version_stamp}.EXTRAVERSION ] +if [ -e /tmp/kerncache/${clst_kname}/${clst_kname}-${clst_version_stamp}.EXTRAVERSION ] then - STR1=`cat /usr/portage/packages/gk_binaries/${clst_kname}/${clst_kname}-${clst_version_stamp}.EXTRAVERSION` + STR1=`cat /tmp/kerncache/${clst_kname}/${clst_kname}-${clst_version_stamp}.EXTRAVERSION` STR2=${clst_kextraversion} if [ "${STR1}" = "${STR2}" ] then @@ -156,9 +158,9 @@ then fi CONFIG_MATCH=0 -if [ -e /usr/portage/packages/gk_binaries/${clst_kname}/${clst_kname}-${clst_version_stamp}.CONFIG ] +if [ -e /tmp/kerncache/${clst_kname}/${clst_kname}-${clst_version_stamp}.CONFIG ] then - STR1=`cat /usr/portage/packages/gk_binaries/${clst_kname}/${clst_kname}-${clst_version_stamp}.CONFIG` + STR1=`cat /tmp/kerncache/${clst_kname}/${clst_kname}-${clst_version_stamp}.CONFIG` STR2=`md5sum /var/tmp/${clst_kname}.config|awk '{print $1}'` if [ "${STR1}" = "${STR2}" ] then @@ -174,17 +176,17 @@ if [ "${USE_MATCH}" = "0" -o "${EXTRAVERSION_MATCH}" = "0" -o "${CONFIG_MATCH}" then echo "Cleaning up ${clst_kname} kernel install ..." echo "This may take some time ..." - if [ -d /usr/portage/packages/gk_binaries/${clst_kname}/ ] + if [ -d /tmp/kerncache/${clst_kname}/ ] then - rm -r /usr/portage/packages/gk_binaries/${clst_kname}/ || exit 1 + rm -r /tmp/kerncache/${clst_kname}/ || exit 1 fi fi -mkdir -p /usr/portage/packages/gk_binaries/${clst_kname} +mkdir -p /tmp/kerncache/${clst_kname} if [ -n "${clst_KERNCACHE}" ] then - ROOT=/usr/portage/packages/gk_binaries/${clst_kname} PKGDIR=${PKGDIR} USE="${USE} symlink build" emerge --nodeps -ukb "${clst_ksource}" || exit 1 + ROOT=/tmp/kerncache/${clst_kname} PKGDIR=${PKGDIR} USE="${USE} symlink build" emerge --nodeps -ukb "${clst_ksource}" || exit 1 KERNELVERSION=`/usr/lib/portage/bin/portageq best_visible / "${clst_ksource}"` if [ ! -e /etc/portage/profile/package.provided ] then @@ -197,7 +199,7 @@ then fi fi [ -d /usr/src/linux ] && rm /usr/src/linux - ln -s /usr/portage/packages/gk_binaries/${clst_kname}/usr/src/linux /usr/src/linux + ln -s /tmp/kerncache/${clst_kname}/usr/src/linux /usr/src/linux else USE="${USE} symlink build" emerge "${clst_ksource}" || exit 1 fi @@ -210,9 +212,9 @@ then then echo "Setting extraversion to ${clst_kextraversion}" sed -i -e "s:EXTRAVERSION \(=.*\):EXTRAVERSION \1-${clst_kextraversion}:" /usr/src/linux/Makefile - echo ${clst_kextraversion} > /usr/portage/packages/gk_binaries/${clst_kname}/${clst_kname}-${clst_version_stamp}.EXTRAVERSION + echo ${clst_kextraversion} > /tmp/kerncache/${clst_kname}/${clst_kname}-${clst_version_stamp}.EXTRAVERSION else - touch /usr/portage/packages/gk_binaries/${clst_kname}/${clst_kname}-${clst_version_stamp}.EXTRAVERSION + touch /tmp/kerncache/${clst_kname}/${clst_kname}-${clst_version_stamp}.EXTRAVERSION fi fi @@ -227,4 +229,4 @@ clst_fudgeuname=${VER}.${PAT}.${SUB}${EXV} /sbin/modules-update --assume-kernel=${clst_fudgeuname} unset USE -echo ${clst_kernel_use} > /usr/portage/packages/gk_binaries/${clst_kname}/${clst_kname}-${clst_version_stamp}.USE +echo ${clst_kernel_use} > /tmp/kerncache/${clst_kname}/${clst_kname}-${clst_version_stamp}.USE