summaryrefslogtreecommitdiff
path: root/stage
diff options
context:
space:
mode:
Diffstat (limited to 'stage')
-rwxr-xr-xstage125
1 files changed, 91 insertions, 34 deletions
diff --git a/stage b/stage
index 4c3bc6b..19944f5 100755
--- a/stage
+++ b/stage
@@ -1,6 +1,6 @@
#! /usr/bin/env bash
-# Stage or queue build2 packages and distributions.
+# Stage or queue build2 packages and the toolchain distribution.
#
# -b
# Packages baseutils/mingw.
@@ -9,11 +9,11 @@
# -s
# Only prepare the install scripts and regenerate toolchain.sha256.
# -q
-# Put packages into the queue instead of staging. Used to update for
-# queue.
+# Put packages and the distribution into the queue instead of staging.
# -p
-# Regenerate build2-toolchain into queue's 0/ and update the checksums file
-# but don't do anything else. Used to update for public.
+# Regenerate and publish distribution. Specifically, move baseutils from
+# queue, regenerate build2-toolchain, install scripts, and the checksum
+# file, and upload everything to public. Also disable the queue toolchain.
#
usage="usage: etc/stage"
@@ -26,6 +26,12 @@ set -o errtrace # Trap in functions.
function info () { echo "$*" 1>&2; }
function error () { info "$*"; exit 1; }
+# Make sure the build2 tools are runnable.
+#
+b --version >/dev/null
+bpkg --version >/dev/null
+bdep --version >/dev/null
+
v="$(sed -n -re 's/^version: ([^.]+\.[^.]+\.[^-]+(-[ab]\.[^.+]+)?).*$/\1/p' build2-toolchain/manifest)"
vf="$(echo $v | sed -re 's/^([^.]*)\.([^.]*)\.([^-]*).*$/\1.\2.\3/')" # Final.
@@ -41,6 +47,8 @@ script_only=
dist_src=staging/0
dist_dst=stage.build2.org:/var/www/stage.build2.org/public/0
+rsync_del="--delete-after"
+
while [ $# -gt 0 ]; do
case $1 in
-b)
@@ -48,6 +56,7 @@ while [ $# -gt 0 ]; do
shift
;;
-o)
+ base=true
base_only=true
shift
;;
@@ -55,16 +64,22 @@ while [ $# -gt 0 ]; do
script_only=true
shift
;;
- -q)
- mode=-q
- dist_src=cppget.org/0
+ -q | -p)
+ mode="$1"
+ dist_src=cppget.org/queue/0
dist_dst=build2.org:/var/www/download.build2.org/public/queue
- shift
- ;;
- -p)
- mode=-p
- dist_src=cppget.org/0
- dist_dst=example.org/not-used
+
+ if [ "$mode" = "-p" ]; then
+
+ queue_dist_src="$dist_src"
+ queue_dist_dst="$dist_dst"
+
+ dist_src=cppget.org/public/0
+ dist_dst=build2.org:/var/www/download.build2.org/public
+
+ rsync_del= # Do not delete anything existing.
+ fi
+
shift
;;
*)
@@ -113,24 +128,42 @@ if [ "$base" = true ]; then
--min-s ./pkpost-mingw-mingw
cd ../..
+fi
+
+# Copy baseutils if requested.
+#
+if [ "$base" = true -o "$mode" = "-p" ]; then
+
+ if [ "$base" = true ]; then
+ d=/tmp
+ else
+ d="$queue_dist_src/$v"
+ fi
- mv "/tmp/build2-baseutils-$v-i686-windows.zip" "$dist_src/$v/"
- mv "/tmp/build2-baseutils-$v-i686-windows.zip.sha256" "$dist_src/$v/"
+ mv "$d/build2-baseutils-$v-i686-windows.zip" "$dist_src/$v/"
+ mv "$d/build2-baseutils-$v-i686-windows.zip.sha256" "$dist_src/$v/"
- mv "/tmp/build2-baseutils-$v-x86_64-windows.zip" "$dist_src/$v/"
- mv "/tmp/build2-baseutils-$v-x86_64-windows.zip.sha256" "$dist_src/$v/"
+ mv "$d/build2-baseutils-$v-x86_64-windows.zip" "$dist_src/$v/"
+ mv "$d/build2-baseutils-$v-x86_64-windows.zip.sha256" "$dist_src/$v/"
- mv "/tmp/build2-mingw-$v-i686-windows.tar.xz" "$dist_src/$v/"
- mv "/tmp/build2-mingw-$v-i686-windows.tar.xz.sha256" "$dist_src/$v/"
+ mv "$d/build2-mingw-$v-i686-windows.tar.xz" "$dist_src/$v/"
+ mv "$d/build2-mingw-$v-i686-windows.tar.xz.sha256" "$dist_src/$v/"
- mv "/tmp/build2-mingw-$v-x86_64-windows.tar.xz" "$dist_src/$v/"
- mv "/tmp/build2-mingw-$v-x86_64-windows.tar.xz.sha256" "$dist_src/$v/"
+ mv "$d/build2-mingw-$v-x86_64-windows.tar.xz" "$dist_src/$v/"
+ mv "$d/build2-mingw-$v-x86_64-windows.tar.xz.sha256" "$dist_src/$v/"
fi
if [ "$base_only" = true ]; then
exit 0
fi
+# Clean and disable queue toolchain.
+#
+if [ "$mode" = "-p" ]; then
+ rm -rf "$queue_dist_src/$v"
+ echo 'disabled' >"$queue_dist_src/toolchain.sha256"
+fi
+
##
##if false; then
@@ -183,19 +216,32 @@ for f in "${scripts[@]}"; do
checksum_line "$f"
done
-if [ "$mode" = "-p" ]; then
- exit 0
-fi
-
# Sync the distribution.
#
# Note that we do the distribution first so that the toolchain changes are
# visible before package changes. This is relied upon by the Build OS monitor.
#
-info "Press Enter to start distribution upload"
-read
-rsync -v -rlpt -c --copy-unsafe-links --prune-empty-dirs --delete-after \
- $rsync_ops "$dist_src/" "$dist_dst/"
+function sync_dist () # <dist-src> <dist-dst> [<rsync-options>]
+{
+ local s="$1"
+ local d="$2"
+
+ shift
+ shift
+
+ info "Press Enter to start distribution upload to $d"
+ read
+ rsync -v -rlpt -c --copy-unsafe-links --prune-empty-dirs \
+ $rsync_ops "$@" "$s/" "$d/"
+}
+
+sync_dist "$dist_src" "$dist_dst" $rsync_del
+
+# Also sync (disable) queue.
+#
+if [ "$mode" = "-p" ]; then
+ sync_dist "$queue_dist_src" "$queue_dist_dst" --delete-after
+fi
##fi
##
@@ -204,12 +250,16 @@ if [ "$script_only" = true ]; then
exit 0
fi
+if [ "$mode" = "-p" ]; then
+ exit 0
+fi
+
# Distribute packages, regenerate and sync the repository.
#
# These are just for testing (though libodb-mysql needs libmysqlclient).
#
-etc/stage-pkg -c $mode -d vcpkg packaging/vcpkg/vcpkg
+#etc/stage-pkg -c $mode -d vcpkg packaging/vcpkg/vcpkg
etc/stage-pkg -c $mode -d mariadb packaging/mariadb/libmariadb
etc/stage-pkg -c $mode -d mysql packaging/mysql/libmysqlclient
@@ -233,7 +283,7 @@ etc/stage-pkg -c $mode -d libstudxml ../studxml/libstudxml
etc/stage-pkg -c $mode -d hello hello/libhello-1.0
-# For now we also stage libodb-mysql.
+# For testing we also stage other libodb-*.
#
etc/stage-pkg -c $mode -d odb \
../odb/odb \
@@ -242,7 +292,10 @@ etc/stage-pkg -c $mode -d odb \
../odb/builds/default/libodb-pgsql \
../odb/builds/default/libodb-mysql \
../odb/builds/default/libodb-oracle \
- ../odb/builds/default/libodb-mssql
+ ../odb/builds/default/libodb-mssql \
+ ../odb/builds/default/libodb-boost \
+ ../odb/builds/default/libodb-qt
+
etc/stage-pkg -c $mode build2 \
libbutl \
@@ -250,8 +303,12 @@ etc/stage-pkg -c $mode build2 \
build2 \
libbpkg \
bpkg \
+ bpkg-rep \
bdep \
libbbot \
brep \
bbot \
- libstd-modules
+ openssl-agent
+
+# msvc-linux
+# libstd-modules