diff options
author | Benedikt Boehm <hollow@gentoo.org> | 2005-11-23 21:29:13 +0000 |
---|---|---|
committer | Benedikt Boehm <hollow@gentoo.org> | 2005-11-23 21:29:13 +0000 |
commit | b00544f2160effea271029b13867a52f50a6178a (patch) | |
tree | 0b1617aec18a85ffee52f253b901edbd83657f4b /stages | |
parent | Adding current patchsets used by portage. (diff) | |
download | misc-b00544f2160effea271029b13867a52f50a6178a.tar.gz misc-b00544f2160effea271029b13867a52f50a6178a.tar.bz2 misc-b00544f2160effea271029b13867a52f50a6178a.zip |
add stage building scripts
svn path=/; revision=93
Diffstat (limited to 'stages')
-rwxr-xr-x | stages/build-stages | 143 | ||||
-rw-r--r-- | stages/vserver-amd64.conf | 36 | ||||
-rw-r--r-- | stages/vserver-athlon-xp.conf | 36 | ||||
-rw-r--r-- | stages/vserver-i686.conf | 36 | ||||
-rw-r--r-- | stages/vserver-pentium3.conf | 36 | ||||
-rw-r--r-- | stages/vserver-pentium4.conf | 36 | ||||
-rw-r--r-- | stages/vserver-x86.conf | 36 |
7 files changed, 359 insertions, 0 deletions
diff --git a/stages/build-stages b/stages/build-stages new file mode 100755 index 0000000..95d5cd9 --- /dev/null +++ b/stages/build-stages @@ -0,0 +1,143 @@ +#!/bin/bash +# +# build-stages - Build vserver stages +# Copyright (C) 2005 Christian Heim <phreak@gentoo.org> +# Benedikt Boehm <hollow@gentoo.org> +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA +# +# v0.1 - initial release + +trap "exit 1" INT + +if [ -r /sbin/functions.sh ]; then + source /sbin/functions.sh +else + echo "/sbin/functions.sh missing. Are you running Gentoo?" +fi + +die() { + eerror ${1:-<no error message>} + exit ${2:-1} +} + +usage() { + echo "Usage: build-stages <spec>" + echo + echo "<spec> Stages spec file" +} + +# checking command line +if [ $# -ne 1 ]; then + usage + exit +fi + +# check root privs +[ "$(id -u)" != "0" ] && die "Need root privileges" + +# read spec file +[ ! -r $1 ] && die "No read-access to $1" +source $1 + +# set default values +: ${type:=default} +: ${version:=$(date +%Y%m%d)} +: ${sync_snapshots:=1} +: ${sync_source:=ftp.join.uni-muenster.de::gentoo/snapshots/} +: ${snapshot:=latest} +: ${stage1:=1} +: ${stage2:=1} +: ${stage3:=1} + +# set subsources +stage_name=${arch}-${version} +: ${stage1_seed:=seed} +: ${stage2_subsource:=${type}/stage1-${stage_name}} +: ${stage3_subsource:=${type}/stage2-${stage_name}} + +# setup all the path variables +cdir=$(source /etc/catalyst/catalyst.conf; echo ${storedir:-/var/tmp/catalyst}) +tmpdir=${cdir}/tmp +snapdir=${cdir}/snapshots +builddir=${cdir}/builds +stagedir=${builddir}/${type} + +mkdir -p ${stagedir} + +# check config +[ -z "${arch}" ] && die "arch not set. please fix your config file" +[ -z "${profile}" ] && die "profile not set. please fix your config file" + +# display some common info +einfo "Building stages for:" +einfo +einfo " arch: ${arch}" +einfo " type: ${type}" +einfo " version: ${version}" +einfo " snapshot: ${snapshot}" +einfo " profile: ${profile}" +einfo +echo + +build_stage() { + [ $# -ne 2 ] && return 1 + + local target=$1 + local subsource=$2 + + local stagefile=${stagedir}/${target}-${arch}-${version}.tar.bz2 + + if [ -f ${stagefile} ]; then + einfo "${target} is cached at ${stagefile}" + return + fi + + einfo "Building ${target} ..." + + # we need a seed stage + [ ! -f ${builddir}/${subsource}.tar.bz2 ] && die "subsource ${builddir}/${subsource}.tar.bz2 does not exist" + + # Now run catalyst and gather stats about the build + /usr/bin/time -v \ + --output=${stagefile}.stats \ + catalyst -C \ + subarch=${arch} \ + version_stamp=${version} \ + rel_type=${type} \ + profile=${profile} \ + snapshot=${snapshot} \ + target=${target} \ + source_subpath=${subsource} \ + || die "catalyst failed to build ${target}" + + # Generate digest + cd ${stagedir} + md5sum $(basename ${stagefile}) > $(basename ${stagefile}).md5 + + # Generate file listings of the tarball + tar -tjf ${stagefile} > ${stagefile}.CONTENTS +} + +if [ ${sync_snapshots} -eq 1 ]; then + einfo "Syncing snapshots" + rsync -av ${sync_source}/ ${snapdir}/ +fi + +[ $stage1 -eq 1 ] && build_stage stage1 ${stage1_seed} +[ $stage2 -eq 1 ] && build_stage stage2 ${stage2_subsource} +[ $stage3 -eq 1 ] && build_stage stage3 ${stage3_subsource} + +einfo "All stages built successfully" diff --git a/stages/vserver-amd64.conf b/stages/vserver-amd64.conf new file mode 100644 index 0000000..076e2e2 --- /dev/null +++ b/stages/vserver-amd64.conf @@ -0,0 +1,36 @@ +# build-stages sample spec file + +# stage sub arch +arch=amd64 + +# release type (arbitrary id string) +type=vserver + +# release version +version=20051003 + +# portage snapshot +snapshot=${version} + +# should we sync the portage snapshots? +sync_snapshots=0 + +# snapshots rsync source +sync_source=trumpetti.atm.tut.fi::gentoo/snapshots + +# portage profile +profile=default-linux/amd64/2005.1/vserver + +# stages to build (0/1) +stage1=1 +stage2=1 +stage3=1 + +# if you're building a stage1, give the seed stage here +stage1_seed=stage2-amd64-2005.1 + +# if you're not building stage1 give the subsource for stage2 here +#stage2_subsource=${type}/stage1-${arch}-${version} + +# if you're not building stage2 give the subsource for stage3 here +#stage3_subsource=${type}/stage2-${arch}-${version} diff --git a/stages/vserver-athlon-xp.conf b/stages/vserver-athlon-xp.conf new file mode 100644 index 0000000..c14ad6b --- /dev/null +++ b/stages/vserver-athlon-xp.conf @@ -0,0 +1,36 @@ +# build-stages sample spec file + +# stage sub arch +arch=athlon-xp + +# release type (arbitrary id string) +type=vserver + +# release version +version=20051003 + +# portage snapshot +snapshot=${version} + +# should we sync the portage snapshots? +sync_snapshots=0 + +# snapshots rsync source +sync_source=trumpetti.atm.tut.fi::gentoo/snapshots + +# portage profile +profile=default-linux/x86/2005.1/vserver + +# stages to build (0/1) +stage1=1 +stage2=1 +stage3=1 + +# if you're building a stage1, give the seed stage here +stage1_seed=stage2-i686-2005.1 + +# if you're not building stage1 give the subsource for stage2 here +#stage2_subsource=${type}/stage1-${arch}-${version} + +# if you're not building stage2 give the subsource for stage3 here +#stage3_subsource=${type}/stage2-${arch}-${version} diff --git a/stages/vserver-i686.conf b/stages/vserver-i686.conf new file mode 100644 index 0000000..77d843b --- /dev/null +++ b/stages/vserver-i686.conf @@ -0,0 +1,36 @@ +# build-stages sample spec file + +# stage sub arch +arch=i686 + +# release type (arbitrary id string) +type=vserver + +# release version +version=20051003 + +# portage snapshot +snapshot=${version} + +# should we sync the portage snapshots? +sync_snapshots=0 + +# snapshots rsync source +sync_source=trumpetti.atm.tut.fi::gentoo/snapshots + +# portage profile +profile=default-linux/x86/2005.1/vserver + +# stages to build (0/1) +stage1=1 +stage2=1 +stage3=1 + +# if you're building a stage1, give the seed stage here +stage1_seed=stage2-i686-2005.1 + +# if you're not building stage1 give the subsource for stage2 here +#stage2_subsource=${type}/stage1-${arch}-${version} + +# if you're not building stage2 give the subsource for stage3 here +#stage3_subsource=${type}/stage2-${arch}-${version} diff --git a/stages/vserver-pentium3.conf b/stages/vserver-pentium3.conf new file mode 100644 index 0000000..461c761 --- /dev/null +++ b/stages/vserver-pentium3.conf @@ -0,0 +1,36 @@ +# build-stages sample spec file + +# stage sub arch +arch=pentium3 + +# release type (arbitrary id string) +type=vserver + +# release version +version=20051003 + +# portage snapshot +snapshot=${version} + +# should we sync the portage snapshots? +sync_snapshots=0 + +# snapshots rsync source +sync_source=trumpetti.atm.tut.fi::gentoo/snapshots + +# portage profile +profile=default-linux/x86/2005.1/vserver + +# stages to build (0/1) +stage1=1 +stage2=1 +stage3=1 + +# if you're building a stage1, give the seed stage here +stage1_seed=stage2-i686-2005.1 + +# if you're not building stage1 give the subsource for stage2 here +#stage2_subsource=${type}/stage1-${arch}-${version} + +# if you're not building stage2 give the subsource for stage3 here +#stage3_subsource=${type}/stage2-${arch}-${version} diff --git a/stages/vserver-pentium4.conf b/stages/vserver-pentium4.conf new file mode 100644 index 0000000..5113738 --- /dev/null +++ b/stages/vserver-pentium4.conf @@ -0,0 +1,36 @@ +# build-stages sample spec file + +# stage sub arch +arch=pentium4 + +# release type (arbitrary id string) +type=vserver + +# release version +version=20051003 + +# portage snapshot +snapshot=${version} + +# should we sync the portage snapshots? +sync_snapshots=0 + +# snapshots rsync source +sync_source=trumpetti.atm.tut.fi::gentoo/snapshots + +# portage profile +profile=default-linux/x86/2005.1/vserver + +# stages to build (0/1) +stage1=1 +stage2=1 +stage3=1 + +# if you're building a stage1, give the seed stage here +stage1_seed=stage2-i686-2005.1 + +# if you're not building stage1 give the subsource for stage2 here +#stage2_subsource=${type}/stage1-${arch}-${version} + +# if you're not building stage2 give the subsource for stage3 here +#stage3_subsource=${type}/stage2-${arch}-${version} diff --git a/stages/vserver-x86.conf b/stages/vserver-x86.conf new file mode 100644 index 0000000..d10da60 --- /dev/null +++ b/stages/vserver-x86.conf @@ -0,0 +1,36 @@ +# build-stages sample spec file + +# stage sub arch +arch=x86 + +# release type (arbitrary id string) +type=vserver + +# release version +version=20051003 + +# portage snapshot +snapshot=${version} + +# should we sync the portage snapshots? +sync_snapshots=0 + +# snapshots rsync source +sync_source=trumpetti.atm.tut.fi::gentoo/snapshots + +# portage profile +profile=default-linux/x86/2005.1/vserver + +# stages to build (0/1) +stage1=1 +stage2=1 +stage3=1 + +# if you're building a stage1, give the seed stage here +stage1_seed=stage2-i686-2005.1 + +# if you're not building stage1 give the subsource for stage2 here +#stage2_subsource=${type}/stage1-${arch}-${version} + +# if you're not building stage2 give the subsource for stage3 here +#stage3_subsource=${type}/stage2-${arch}-${version} |