#! /usr/bin/env bash # Stage (or queue) build2 packages and distributions. # # -t # Toolchain only, no brep. # -p # packages only, no baseutils/mingw. # -q # Put packages into the queue instead of staging (distributions still go to # staging). # usage="usage: etc/stage" rsync_ops="--progress" owd=`pwd` trap "{ cd $owd; exit 1; }" ERR set -o errtrace # Trap in functions. function info () { echo "$*" 1>&2; } function error () { info "$*"; exit 1; } v="$(cat build2-toolchain/version)" vf="$(echo $v | sed -e 's/^\(.*\)\.\(.*\)\.\([^-]*\).*$/\1.\2.\3/')" # Final. if [ -z "$v" -o -z "$vf" ]; then error "unable to extract version from `cat build2-toolchain/version`" fi toolchain="libbutl build2 libbpkg bpkg" extras="brep" base="y" repo_name="STAGE.BUILD2.ORG" repo_dir="staging/repository/1" repo_host1="stage.build2.org:/var/bpkg/1" repo_host2= while [ $# -gt 0 ]; do case $1 in -t) extras= shift ;; -p) base=n shift ;; -q) repo_name="CPPGET.ORG/QUEUE" repo_dir="cppget.org/repository/1/queue" repo_host1="cppget.org:/var/bpkg/1/queue" repo_host2="queue.cppget.org:/var/bpkg/1/queue" shift ;; *) error "unexpected $1" ;; esac done tools="$toolchain $extras" mkdir -p "staging/0/$v" # Generate baseutils if requested. # if [ "$base" = "y" ]; then cd private/baseutils echo "$v" >version ./pkdist -n baseutils -d "$vf" -p "$vf/list-i686" \ -c control -s ./pkpost \ -z "/tmp/build2-baseutils-$v-i686-windows" ./pkdist -n baseutils -d "$vf" -p "$vf/list-x86_64" \ -c control -s ./pkpost \ -z "/tmp/build2-baseutils-$v-x86_64-windows" ./pkdist -n mingw -d "mingw-$vf" -p "mingw-$vf/list-i686" \ -c ./control-mingw-i686 -s ./pkpost-mingw -u http://repo.msys2.org/mingw \ -x "/tmp/build2-mingw-$v-i686-windows" ./pkdist -n mingw -d "mingw-$vf" -p "mingw-$vf/list-x86_64" \ -c ./control-mingw-x86_64 -s ./pkpost-mingw -u http://repo.msys2.org/mingw \ -x "/tmp/build2-mingw-$v-x86_64-windows" cd ../.. mv "/tmp/build2-baseutils-$v-i686-windows.zip" "staging/0/$v/" mv "/tmp/build2-baseutils-$v-i686-windows.zip.sha256" "staging/0/$v/" mv "/tmp/build2-baseutils-$v-x86_64-windows.zip" "staging/0/$v/" mv "/tmp/build2-baseutils-$v-x86_64-windows.zip.sha256" "staging/0/$v/" mv "/tmp/build2-mingw-$v-i686-windows.tar.xz" "staging/0/$v/" mv "/tmp/build2-mingw-$v-i686-windows.tar.xz.sha256" "staging/0/$v/" mv "/tmp/build2-mingw-$v-x86_64-windows.tar.xz" "staging/0/$v/" mv "/tmp/build2-mingw-$v-x86_64-windows.tar.xz.sha256" "staging/0/$v/" fi # Dist build2-toolchain. # # @@ .sha256 sums: make sure they don't contain full paths! b "dist(build2-toolchain-default/)" \ "config.dist.archives=$owd/staging/0/$v/tar.xz $owd/staging/0/$v/tar.gz" cd "$owd/staging/0/$v/" sha256sum -b "build2-toolchain-$v.tar.gz" >"build2-toolchain-$v.tar.gz.sha256" sha256sum -b "build2-toolchain-$v.tar.xz" >"build2-toolchain-$v.tar.xz.sha256" cd "$owd" # Dist individual packages into the repository. # function dist() #