diff options
Diffstat (limited to 'stage')
-rwxr-xr-x | stage | 167 |
1 files changed, 80 insertions, 87 deletions
@@ -2,11 +2,13 @@ # Stage or queue build2 packages and distributions. # -# -p -# Packages only, no baseutils/mingw. +# -b +# Packages baseutils/mingw. # -q -# Put packages into the queue instead of staging (distributions still go to -# staging). +# Put packages 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. # usage="usage: etc/stage" @@ -19,31 +21,34 @@ set -o errtrace # Trap in functions. function info () { echo "$*" 1>&2; } function error () { info "$*"; exit 1; } -v="$(cat build2-toolchain/version)" +v="$(sed -n -re 's/^version: ([^.]+\.[^.]+\.[^-]+(-[ab]\.[^.+]+)?).*$/\1/p' build2-toolchain/manifest)" vf="$(echo $v | sed -re 's/^([^.]*)\.([^.]*)\.([^-]*).*$/\1.\2.\3/')" # Final. if [ -z "$v" -o -z "$vf" ]; then error "unable to extract version from build2-toolchain/version" fi -base="y" - -repo_name="STAGE.BUILD2.ORG" -repo_dir="staging/repository/1" -repo_host1="stage.build2.org:/var/bpkg/1" -repo_host2= +mode= +base= +dist_src=staging/0 +dist_dst=stage.build2.org:/var/www/stage.build2.org/public/0 while [ $# -gt 0 ]; do case $1 in - -p) - base=n + -b) + base=true 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" + mode=-q + dist_src=cppget.org/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 shift ;; *) @@ -52,11 +57,11 @@ while [ $# -gt 0 ]; do esac done -mkdir -p "staging/0/$v" +mkdir -p "$dist_src/$v" # Generate baseutils if requested. # -if [ "$base" = "y" ]; then +if [ -n "$base" ]; then cd private/baseutils echo "$v" >version @@ -79,17 +84,17 @@ if [ "$base" = "y" ]; then 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-i686-windows.zip" "$dist_src/$v/" + mv "/tmp/build2-baseutils-$v-i686-windows.zip.sha256" "$dist_src/$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-baseutils-$v-x86_64-windows.zip" "$dist_src/$v/" + mv "/tmp/build2-baseutils-$v-x86_64-windows.zip.sha256" "$dist_src/$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-i686-windows.tar.xz" "$dist_src/$v/" + mv "/tmp/build2-mingw-$v-i686-windows.tar.xz.sha256" "$dist_src/$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/" + 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/" fi mkdir -p /tmp/dist @@ -98,12 +103,20 @@ mkdir -p /tmp/dist # # @@ .sha256 sums: make sure they don't contain full paths! +# Cleanup old stuff. +# +rm -f "$owd/$dist_src/$v"/build2-toolchain-* + b "dist(build2-toolchain-default/)" \ - "config.dist.archives=$owd/staging/0/$v/tar.xz $owd/staging/0/$v/tar.gz" + "config.dist.archives=$owd/$dist_src/$v/tar.xz $owd/$dist_src/$v/tar.gz" + +cd "$owd/$dist_src/$v/" + +tv="$(echo build2-toolchain-*.tar.gz | sed -re 's/build2-toolchain-(.+).tar.gz/\1/')" + +sha256sum -b "build2-toolchain-$tv.tar.gz" >"build2-toolchain-$tv.tar.gz.sha256" +sha256sum -b "build2-toolchain-$tv.tar.xz" >"build2-toolchain-$tv.tar.xz.sha256" -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" # Prepare the toolchain.sha256 checksums file. @@ -111,72 +124,52 @@ cd "$owd" function checksum_line () # <file> { local s - s="$(sed -n -re 's/^([^ ]+) .+$/\1/p' "staging/0/$v/$1.sha256")" - echo "$s *$v/$1" >>"staging/0/toolchain.sha256" + s="$(sed -n -re 's/^([^ ]+) .+$/\1/p' "$dist_src/$v/$1.sha256")" + echo "$s *$v/$1" >>"$dist_src/toolchain.sha256" } -echo "# $v" >"staging/0/toolchain.sha256" -checksum_line "build2-toolchain-$v.tar.xz" # Must be first. +echo "# $tv" >"$dist_src/toolchain.sha256" +checksum_line "build2-toolchain-$tv.tar.xz" # Must be first. checksum_line "build2-baseutils-$v-x86_64-windows.zip" -#checksum_line "build2-mingw-$v-x86_64-windows.tar.xz" +checksum_line "build2-mingw-$v-x86_64-windows.tar.xz" #checksum_line "build2-baseutils-$v-i686-windows.zip" #checksum_line "build2-mingw-$v-i686-windows.tar.xz" -# Dist individual packages into the repository. -# -function dist() # <dir> <category> -{ - local b="$(basename $1)" - local o="$repo_dir/$2" - - # Clean up old packages. - # - mkdir -p "$o" - rm -f "$o/$b"-* - - b "dist($1-default/)" "config.dist.archives=$owd/$o/tar.gz" -} - -dist packaging/apr/libapr1 apr -dist packaging/postgresql/libpq postgresql - -dist packaging/sqlite/libsqlite3 sqlite -dist packaging/sqlite/sqlite3 sqlite - -dist ../studxml/libstudxml studxml - -dist ../odb/builds/default/libodb odb -dist ../odb/builds/default/libodb-sqlite odb -dist ../odb/builds/default/libodb-pgsql odb - -dist libbutl build2 -dist build2 build2 -dist libbpkg build2 -dist bpkg build2 -dist brep build2 - -dist libbbot build2 -dist bbot build2 - -# Regenerate the repository. -# -info "Insert $repo_name signing key and press Enter" -read -etc/rep-update "$repo_dir/" \ - --openssl-option -engine --openssl-option pkcs11 \ - --openssl-option -keyform --openssl-option engine \ - --key "label_SIGN key" +if [ "$mode" = "-p" ]; then + exit 0 +fi -# Sync repository and distribution. +# 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 staging/0/ stage.build2.org:/var/www/stage.build2.org/public/0/ + $rsync_ops "$dist_src/" "$dist_dst/" -etc/rep-publish "$repo_dir/" "$repo_host1/" $rsync_ops - -if [ -n "$repo_host2" ]; then - etc/rep-publish "$repo_dir/" "$repo_host2/" $rsync_ops -fi +# Distribute packages, regenerate and sync the repository. +# +etc/stage-pkg -c $mode -d apr packaging/apr/libapr1 +etc/stage-pkg -c $mode -d postgresql packaging/postgresql/libpq + +etc/stage-pkg $mode -d sqlite \ + packaging/sqlite/libsqlite3 \ + packaging/sqlite/sqlite3 + +etc/stage-pkg $mode -d studxml ../studxml/libstudxml + +etc/stage-pkg $mode -d odb \ + ../odb/builds/default/libodb \ + ../odb/builds/default/libodb-sqlite \ + ../odb/builds/default/libodb-pgsql + +etc/stage-pkg -c $mode build2 \ + libbutl \ + build2 \ + libbpkg \ + bpkg \ + libbbot \ + brep \ + bbot |