From c5fcb8bbf8ec50068313ae0a1fe508f648799658 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Fri, 15 Oct 2021 13:34:25 +0200 Subject: Staging scripts updates for queue.stage --- stage-pkg | 93 ++++++++++++++++++++++++++++++++++++++++----------------------- 1 file changed, 59 insertions(+), 34 deletions(-) (limited to 'stage-pkg') diff --git a/stage-pkg b/stage-pkg index 5814d21..fe876c6 100755 --- a/stage-pkg +++ b/stage-pkg @@ -10,6 +10,7 @@ # # -g # Distribute and regenerate only without publishing the repository. +# In this mode of no packages is specified, then just regenerate. # # -p # Publish only without distributing and regenerating the repository. @@ -17,6 +18,13 @@ # -q # Put packages into the queue instead of staging. Implies -d. # +# -Q +# Put packages into staging queue instead of staging. +# +# --min-bpkg-version +# +# Pass --min-bpkg-version to bpkg-rep-create. +# usage="usage: etc/stage-pkg [] ..." rsync_ops="--progress" @@ -45,6 +53,7 @@ gen_only= pub_only= group= dirs=() +rep_create_ops=() while [ $# -gt 0 ]; do case $1 in @@ -72,6 +81,17 @@ while [ $# -gt 0 ]; do dist_only=true shift ;; + -Q) + repo_name="QUEUE.STAGE.BUILD2.ORG" + repo_dir="staging/queue/1" + repo_host1="stage.build2.org:/var/bpkg/queue/1" + shift + ;; + --min-bpkg-version) + shift + rep_create_ops+=(--min-bpkg-version "$1") + shift + ;; *) if [ -z "$group" ]; then group="$1" @@ -85,45 +105,50 @@ done if [ -z "$pub_only" ]; then - if [ -z "$group" -o "${#dirs[@]}" -eq 0 ]; then - error "$usage" - fi + # In the -g mode skip distributing if no packages are specified. + # + if [ -z "$gen_only" -o -n "$group" ]; then - mkdir -p /tmp/dist + if [ -z "$group" -o "${#dirs[@]}" -eq 0 ]; then + error "$usage" + fi - # 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). + mkdir -p /tmp/dist + + # 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 + fi if [ -n "$dist_only" ]; then exit 0 @@ -133,10 +158,10 @@ if [ -z "$pub_only" ]; then # 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" + etc/rep-update "$repo_dir/" "${rep_create_ops[@]}" \ + --openssl-option -engine --openssl-option pkcs11 \ + --openssl-option -keyform --openssl-option engine \ + --key "label_SIGN key" if [ -n "$gen_only" ]; then exit 0 -- cgit v1.1