diff options
-rwxr-xr-x | dist | 84 | ||||
-rwxr-xr-x | install | 241 | ||||
-rwxr-xr-x | publish | 48 | ||||
-rw-r--r-- | release.txt | 63 | ||||
-rwxr-xr-x | stage | 11 | ||||
-rwxr-xr-x | tag | 44 | ||||
-rwxr-xr-x | test | 84 |
7 files changed, 575 insertions, 0 deletions
@@ -0,0 +1,84 @@ +#! /usr/bin/env bash + +# Prepare build2 distribution. +# +# Usage: dist [-t] +# +# -t +# Toolchain only. +# +usage="usage: $0 [-t]" + +owd=`pwd` +trap "{ cd $owd; exit 1; }" ERR + +function info () { echo "$*" 1>&2; } +function error () { info "$*"; exit 1; } + +toolchain="libbutl build2 libbpkg bpkg" +extras="brep" + +while [ $# -gt 0 ]; do + case $1 in + -t) + extras= + shift + ;; + *) + error "unexpected $1" + ;; + esac +done + +tools="$toolchain $extras" + +v=`sed -e 's/^\(.*\)\.\(.*\)\..*$/\1.\2/' build2-toolchain/version` + +if [ -z "$v" ]; then + error "unable to extract version from `cat build2-toolchain/version`" +fi + +# Check that everything is committed and pushed. +# +info "checking repositories..." +for t in $tools build2-toolchain; do + git/check --master --clean --synced --submodule $t +done + +# Update the development build since we use it to dist/package. +# +info "making sure everythings is up to date..." +b build2/ bpkg/ + +# +# +mkdir -p build2-$v + +function dist() +{ + local p=$1; shift + local pv=`cat $p/version` + local f="$p-$pv.tar.gz" + b "dist($p-default/)" + rm -f build2-$v/$p-$pv.* + cp /tmp/$f build2-$v/ + cd build2-$v + sha256sum -b $f >$f.sha256 + cd .. + echo build2-$v/$f +} + +for t in $tools; do + f=`dist $t` + mkdir -p cppget.org/repository/1/alpha/$t + cp $f cppget.org/repository/1/alpha/$t/ +done + +dist build2-toolchain + +# Regenerate repository manifests. +# +cppget.org/update cppget.org/repository/1/ + +cd $owd +info "distribution in build2-$v/" @@ -0,0 +1,241 @@ +#! /usr/bin/env bash + +# Test installation of the build2 toolchain distribution. Essentially, this +# is an automated build2-toolchain/INSTALL. +# +# Usage: install [options] <build2-toolchain-archive> <build2-repo> +# +# -i <dir> +# Target installation directory instead of default /tmp/build2-install. +# +# -l <dir> +# Prerequisite library (libodb, libodb-sqlite) installation directory +# instead of default /usr/local. +# +# -s +# Use sudo when installing. +# +# -t +# Install toolchain only. +# +# --cxx <path> +# C++ compiler to use, g++ by default. +# +# --cxxflags <flags> +# C++ compiler flags to use, -W -Wall -Wno-unknown-pragmas by default. +# +# --cppflags <flags> +# Extra C++ preprocessor flags to use. +# +# For example: +# +# install /tmp/build2-toolchain-0.1.0.tar.gz http://pkg.cppget.org/1/alpha +# +usage="usage: $0 [options] <build2-toolchain-archive> <build2-repo>" + +owd=`pwd` +trap "{ cd $owd; exit 1; }" ERR + +function info () { echo "$*" 1>&2; } +function error () { info "$*"; exit 1; } + +tca= +rep= +tmp=/tmp +lib="/usr/local" # Library (libodb, etc) installation directory. +ins="$tmp/build2-install" # Our installation directory. +sudo= +extras=brep # Extras to build. +extras_show=brep-loader # Extra programs (in bin/) to test with --version. +pmc="build2-toolchain" # bpkg configuration directory +cxx="g++" +cxxflags="-W -Wall -Wno-unknown-pragmas" +cppflags= + +while [ $# -gt 0 ]; do + case $1 in + -s) + sudo=sudo + shift + ;; + -i) + shift + ins=${1%/} + shift + ;; + -l) + shift + lib=${1%/} + shift + ;; + -t) + extras= + shift + ;; + --cxx) + shift + cxx=$1 + shift + ;; + --cxxflags) + shift + cxxflags="$1" + shift + ;; + --cppflags) + shift + cppflags="$1" + shift + ;; + *) + if [ -z "$tca" ]; then + tca=${1%/}; shift + else + rep=$1; break + fi + ;; + esac +done + +if [ -z "$tca" ]; then + error $usage +fi + +if [ -z "$rep" ]; then + error $usage +fi + +cd $tmp + +# Download archive if it is an HTTP URL. +# +if [[ $tca == http://* ]]; then + url=$tca + tca=`echo "$url" | sed -e 's%^.*/\(.*\)$%\1%' -` + if [ -z "$tca" ]; then + error "unable to extract archive name from $url" + fi + rm -f $tca + wget $url +elif [[ $tca != /* ]]; then + tca=$owd/$tca +fi + +if [[ $rep != http://* && $rep != /* ]]; then + rep=$owd/$rep +fi + +if [[ $ins != /* ]]; then + ins=$owd/$ins +fi + +# Warm sudo up so that the rest of this script can continue unattended. +# +if [ "$sudo" ]; then + $sudo echo >/dev/null +fi + +tcb=`basename $tca .tar.gz` + +# Unpack. +# +rm -rf $tcb +rm -rf $tcb.disabled +tar xfz $tca + +# Bootstrap. +# +cd $tcb/build2 +./bootstrap --cxx $cxx --cxxflags "$cxxflags" +./build/b-boot \ + config.cxx=$cxx \ + config.cxx.coptions="$cxxflags" \ + config.bin.rpath=$ins-boot/lib update +cd .. + +./build2/build/b \ + config.cxx=$cxx \ + config.cxx.coptions="$cxxflags" \ + config.cxx.poptions="$cppflags -I$lib/include" \ + config.cxx.loptions=-L$lib/lib \ + config.bin.rpath="$ins-boot/lib $lib/lib" \ + config.install.root=$ins-boot \ + config.install.root.sudo=$sudo \ + configure + +./build2/build/b update + +$sudo mkdir -p $ins-boot +$sudo rm -rf $ins-boot/* +./build2/build/b install + +function show () # <dir> <prog>... +{ + local d=$1; shift + for p in $*; do + if [ `which $p` != "$d/bin/$p" ]; then + error "wrong $p path: `which $p`" + fi + + $p --version 1>&2 + done +} + +# Disable any rpaths that may still be pointing inside the build directory. +# +cd $tmp +mv $tcb $tcb.disabled + +OLDPATH="$PATH" +PATH="$ins-boot/bin:$OLDPATH" +show $ins-boot b bpkg + +# Rebuild via the package manager. +# +mkdir -p $pmc +rm -rf $pmc/* +rm -rf $pmc.disabled +cd $pmc + +bpkg create \ + cxx \ + config.cxx=$cxx \ + config.cxx.coptions="$cxxflags" \ + config.cxx.poptions="$cppflags -I$lib/include" \ + config.cxx.loptions=-L$lib/lib \ + config.bin.rpath="$ins/lib $lib/lib" \ + config.install.root=$ins \ + config.install.root.sudo=$sudo \ + +bpkg add $rep +bpkg fetch +bpkg build --yes build2 bpkg + +$sudo mkdir -p $ins +$sudo rm -rf $ins/* +bpkg install build2 bpkg + +cd $tmp +mv $pmc $pmc.disabled + +PATH="$ins/bin:$OLDPATH" +show $ins b bpkg + +mv $pmc.disabled $pmc + +# Build extras using the bpkg-built toolchain. +# +if [ ! -z "$extras" ]; then + cd $pmc + bpkg build --yes $extras + bpkg install $extras + cd $tmp + + mv $pmc $pmc.disabled + show $ins $extras_show + mv $pmc.disabled $pmc +fi + +mv $tcb.disabled $tcb + +cd $owd @@ -0,0 +1,48 @@ +#! /usr/bin/env bash + +# Publish build2 to build2.org/cppget.org. +# +# Usage: publish [<rsync-options>] +# +usage="$0 [<rsync-options>]" + +owd=`pwd` +trap "{ cd $owd; exit 1; }" ERR + +function info () { echo "$*" 1>&2; } +function error () { info "$*"; exit 1; } + +v=`sed -e 's/^\(.*\)\.\(.*\)\..*$/\1.\2/' build2-toolchain/version` + +if [ -z "$v" ]; then + error "unable to extract version from `cat build2-toolchain/version`" +fi + +d="build2-$v" + +if [ ! -d "$d" ]; then + error "distribution directory $d does not exist" +fi + +function sync () +{ + rsync -v -rlpt --copy-unsafe-links --prune-empty-dirs --delete-after $* \ +$d/ build2.org:/var/www/download.build2.org/public/$v/ + + cppget.org/publish cppget.org/repository/1/ cppget.org $* +} + +sync --dry-run $* + +r= +while [ -z "$r" ]; do + read -r -p "Continue? [yes/no]: " r + + case "$r" in + yes) ;; + no) exit 0 ;; + *) r= ;; + esac +done + +sync --progress $* diff --git a/release.txt b/release.txt new file mode 100644 index 0000000..1279c7d --- /dev/null +++ b/release.txt @@ -0,0 +1,63 @@ +TODO +==== + +@@ Run tests in each project/package + +Setup +===== + +- Set passwordless sudo, logins to freebsd, cppget1 + +- Make symlinks to development b, bpkg in /usr/local/bin/, used as the latest + toolchain. + +- Boot cppget1, freebsd VMs, make sure data/time is correct. + +- Build new prerequisites (if any) on local, freebsd (install to /usr/local). + +Preparation +=========== + +- Copy new/updated prerequisites into build2-X.Y/ + +! Need to regenerate ODB files? + +Process +======= + +- Generate distribution (use -t for toolchain-only, without brep) + + etc/dist 2>&1 | tee dist.log + +- Stage packages to cppget1 host + + etc/stage + +- Determine the earliest supported toolchain (see requires: in manifests), + update ./test + +- Test + + etc/test 2>&1 | tee test.log + grep -i warning test.log + +- Upgrade brep on cppget1 (using pkg.cppget1), verify works + +- Publish to production (build2.org/cppget.org) + + etc/publish + +- Test production and save a copy of toolchain in etc1/install/X.Y.Z + + etc/install -i "etc1/install/`cat build2-toolchain/version`" \ + http://download.build2.org/0.1/build2-toolchain-0.1.0.tar.gz \ + http://pkg.cppget.org/1/alpha + +- Upgrade brep on cppget.org (using pkg.cppget.org), verify works + +- Tag + + etc/tag + ./push.sh + +- Commit and push cppget.org @@ -0,0 +1,11 @@ +#! /usr/bin/env bash + +# Stage build2 to cppget1 host. +# +# Usage: publish [<rsync-options>] +# +usage="$0 [<rsync-options>]" + +trap 'exit 1' ERR + +cppget.org/publish cppget.org/repository/1/ cppget1 $* @@ -0,0 +1,44 @@ +#! /usr/bin/env bash + +# Tag build2 distribution. +# +# Usage: tag [-t] +# +# -t +# Toolchain only. +# +usage="usage: $0 [-t]" + +owd=`pwd` +trap "{ cd $owd; exit 1; }" ERR + +function info () { echo "$*" 1>&2; } +function error () { info "$*"; exit 1; } + +toolchain="libbutl build2 libbpkg bpkg build2-toolchain" +extras="brep" + +while [ $# -gt 0 ]; do + case $1 in + -t) + extra= + shift + ;; + *) + error "unexpected $1" + ;; + esac +done + +tools="$toolchain $extras" + +for t in $tools; do + v=`cat $t/version` + if [ -z "$v" ]; then + error "unable to extract version from $t/version" + fi + git -C $t tag -a $v -M "Tag version $v" + info "tagged $t $v" +done + +info "remember to push" @@ -0,0 +1,84 @@ +#! /usr/bin/env bash + +# Test build2 distribution. +# +# Usage: test +# +usage="usage: $0" + +owd=`pwd` +trap "{ cd $owd; exit 1; }" ERR + +function info () { echo "$*" 1>&2; } +function error () { info "$*"; exit 1; } + +# Calculate versions. +# +tcv=`cat build2-toolchain/version` +v=`echo $tcv | sed -e 's/^\(.*\)\.\(.*\)\..*$/\1.\2/' -` + +if [ -z "$v" ]; then + error "unable to extract version from `cat build2-toolchain/version`" +fi + +src=build2-$v + + +# Update the development build. +# +info "making sure everythings is up to date..." +b build2/ bpkg/ + + +# Test repository with the earliest and latest (development build via +# /usr/local links) toolchains. +# +for t in etc1/install/0.1.0 /usr/local; do + cppget.org/test -t $t -n \ +-c cxx \ +-c config.cxx.coptions="-W -Wall -Wno-unknown-pragmas" \ +-c config.cxx.poptions="-I/usr/include/apache2 -I/usr/include/apr-1.0" \ +-c config.cxx.loptions=-L/usr/local/lib \ +cppget.org/repository/1/ +done + + +# Test the build2-toolchain INSTALL procedure (plus brep) with the earliest +# compiler versions we claim to support and the latest available. +# +# Note: Clang 3.4 and 3.7 are tested on FreeBSD below (3.4 cannot coexist +# with newer versions on Ubuntu). +# +for c in g++-4.9 g++-5; do + etc/install \ +--cxx $c \ +--cppflags "-I/usr/include/apache2 -I/usr/include/apr-1.0" \ +$src/build2-toolchain-$tcv.tar.gz \ +http://pkg.cppget1/1/alpha +done + +for c in clang-3.5 clang-3.6; do + etc/install \ +--cxx $c \ +--cppflags "-I/usr/include/apache2 -I/usr/include/apr-1.0" \ +--cxxflags --stdlib=libc++ \ +$src/build2-toolchain-$tcv.tar.gz \ +http://pkg.cppget1/1/alpha +done + +# Test installation requiring sudo. +# +etc/install -t -i /opt/build2 -s $src/build2-toolchain-$tcv.tar.gz \ +http://pkg.cppget1/1/alpha + + +# Test on FreeBSD with Clang 3.4 (default) and Clang 3.7. +# +scp etc/install $src/build2-toolchain-$tcv.tar.gz freebsd:/tmp/ + +for c in clang++ clang++37; do + ssh freebsd cd /tmp ';' ./install \ +--cxx $c \ +--cppflags '"-I/usr/local/include/apr-1 -I/usr/local/include/apache24"' \ +build2-toolchain-$tcv.tar.gz http://pkg.cppget1/1/alpha +done |