From a59a1edc34c8139419adf8029c725de604f92470 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 15 Apr 2021 12:59:53 +0200 Subject: Redo stage script to first prepare everything and then upload --- stage | 37 ++++++++++++++-------- stage-pkg | 104 +++++++++++++++++++++++++++++++++++--------------------------- 2 files changed, 82 insertions(+), 59 deletions(-) diff --git a/stage b/stage index ab2722b..bd4cbc0 100755 --- a/stage +++ b/stage @@ -204,6 +204,9 @@ for f in "${scripts[@]}"; do checksum_line "$f" done +##fi +## + # Sync the distribution. # # Note that we do the distribution first so that the toolchain changes are @@ -226,27 +229,27 @@ function sync_dist () # [] --prune-empty-dirs $rsync_ops "$@" "$s/" "$d/" } -sync_dist "$dist_src" "$dist_dst" $rsync_del - -# Also sync (disable) queue. +# If we are not preparing packages, publish the distribution now. Otherwise, +# wait until we have prepared all the packages (which can take a considerable +# time). # -if [ "$mode" = "-p" ]; then - sync_dist "$queue_dist_src" "$queue_dist_dst" --delete-after -fi +if [ "$script_only" -o "$mode" = "-p" ]; then -##fi -## + sync_dist "$dist_src" "$dist_dst" $rsync_del -if [ "$script_only" = true ]; then - exit 0 -fi + # Also sync (disable) queue. + # + if [ "$mode" = "-p" ]; then + sync_dist "$queue_dist_src" "$queue_dist_dst" --delete-after + fi -if [ "$mode" = "-p" ]; then exit 0 fi # Distribute packages, regenerate and sync the repository. # +# Note: $mode is either empty or -q (which implies -d). +# # These are just for testing (though libodb-mysql needs libmysqlclient). # @@ -319,7 +322,9 @@ etc/stage-pkg -c $mode -d odb \ ../odb/builds/default/libodb-boost \ ../odb/builds/default/libodb-qt -etc/stage-pkg -c $mode build2 \ +# Regenerate the repository (unless $mode is -q) but do not publish. +# +etc/stage-pkg -c $mode -g build2 \ libbutl \ libbutl.bash \ build2 \ @@ -337,3 +342,9 @@ etc/stage-pkg -c $mode build2 \ libbuild2-kconfig/kconfig-hello \ libbuild2-kconfig/libbuild2-kconfig \ libbuild2-kconfig/libbuild2-kconfig-tests + +sync_dist "$dist_src" "$dist_dst" $rsync_del + +if [ "$mode" != "-q" ]; then + etc/stage-pkg -p +fi diff --git a/stage-pkg b/stage-pkg index 6930fd9..5814d21 100755 --- a/stage-pkg +++ b/stage-pkg @@ -9,10 +9,13 @@ # Distribute only without regenerating or publishing the repository. # # -g -# Distribute and regenerating only without publishing the repository. +# Distribute and regenerate only without publishing the repository. +# +# -p +# Publish only without distributing and regenerating the repository. # # -q -# Publish packages into the queue instead of staging. Implies -d. +# Put packages into the queue instead of staging. Implies -d. # usage="usage: etc/stage-pkg [] ..." @@ -39,6 +42,7 @@ repo_host2= clean= dist_only= gen_only= +pub_only= group= dirs=() @@ -56,6 +60,10 @@ while [ $# -gt 0 ]; do gen_only=true shift ;; + -p) + pub_only=true + shift + ;; -q) #repo_name="CPPGET.ORG/QUEUE" repo_dir="cppget.org/queue/1/alpha" @@ -75,62 +83,66 @@ while [ $# -gt 0 ]; do esac done -if [ -z "$group" -o "${#dirs[@]}" -eq 0 ]; then - error "$usage" -fi +if [ -z "$pub_only" ]; then + + if [ -z "$group" -o "${#dirs[@]}" -eq 0 ]; then + error "$usage" + fi -mkdir -p /tmp/dist + mkdir -p /tmp/dist -# Dist individual packages into the repository. -# -function dist() # -{ - local o="$repo_dir/$1" - local b="$(basename $2)" - local d="$2-default" - - # If *-default/ exists, use that (old style out of tree configuration). - # Otherwise, use the source directory itself (new style forwarded - # configuration). + # Dist individual packages into the repository. # - if ! test -d "$d"; then - d="$2" + function dist() # + { + local o="$repo_dir/$1" + local b="$(basename $2)" + local d="$2-default" + + # If *-default/ exists, use that (old style out of tree configuration). + # Otherwise, use the source directory itself (new style forwarded + # configuration). + # if ! test -d "$d"; then - error "neither $2-default nor $2 exist" + d="$2" + if ! test -d "$d"; then + error "neither $2-default nor $2 exist" + fi fi - fi - mkdir -p "$o" + mkdir -p "$o" - # Clean up old packages. - # - if [ -n "$clean" ]; then - rm -f "$o/$b"-* - fi + # Clean up old packages. + # + if [ -n "$clean" ]; then + rm -f "$o/$b"-* + fi - b "dist($d/)" config.dist.root=/tmp/dist "config.dist.archives=$owd/$o/tar.gz" -} + b "dist($d/)" config.dist.root=/tmp/dist "config.dist.archives=$owd/$o/tar.gz" + } -for d in "${dirs[@]}"; do - dist "$group" "$d" -done + for d in "${dirs[@]}"; do + dist "$group" "$d" + done -if [ -n "$dist_only" ]; then - exit 0 -fi + if [ -n "$dist_only" ]; then + exit 0 + fi -# 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" + # 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 [ -n "$gen_only" ]; then + exit 0 + fi -if [ -n "$gen_only" ]; then - exit 0 -fi +fi # !pub_only # Sync repository. # -- cgit v1.1