diff options
author | Luke Shumaker <lukeshu@lukeshu.com> | 2017-05-24 13:21:35 -0400 |
---|---|---|
committer | Luke Shumaker <lukeshu@lukeshu.com> | 2017-05-24 13:21:35 -0400 |
commit | 944c4a6e8dae50541cea20aaea8843de3e46dfe3 (patch) | |
tree | 965add000ab1b4db6f3f220b7ab850b27a243595 | |
parent | f6dc0c43604395dfbdeec69bf7302f441a5dd829 (diff) |
Include the 1863 port number in config variables
-rwxr-xr-x | src/abslibre-tools/librerelease | 53 | ||||
-rw-r--r-- | src/libretools.conf | 7 |
2 files changed, 51 insertions, 9 deletions
diff --git a/src/abslibre-tools/librerelease b/src/abslibre-tools/librerelease index 643bfb8..51cf6de 100755 --- a/src/abslibre-tools/librerelease +++ b/src/abslibre-tools/librerelease @@ -51,7 +51,6 @@ readonly rsync_flags=( --partial --human-readable --progress - -e ssh ) # Functions #################################################################### @@ -181,7 +180,50 @@ main() { return 6 fi - REPODEST+='/staging/' + local re_url='^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$' + local re_authority='^(([^@]*)@)?([^][@:]*|\[[^]]*\])(:([0-9]*))?$' + local REPODEST_ok=false + if [[ "$REPODEST" =~ $re_url ]]; then + REPODEST_ok=true + + REPODEST_scheme=${BASH_REMATCH[2]} + REPODEST_authority=${BASH_REMATCH[4]} + REPODEST_path=${BASH_REMATCH[5]} + REPODEST_query=${BASH_REMATCH[7]} + REPODEST_fragment=${BASH_REMATCH[9]} + + if [[ "$REPODEST_authority" =~ $re_authority ]]; then + REPODEST_userinfo=${BASH_REMATCH[2]} + REPODEST_host=${BASH_REMATCH[3]} + REPODEST_port=${BASH_REMATCH[5]} + else + REPODEST_ok=false + fi + + [[ $REPODEST_scheme == ssh ]] || REPODEST_ok=false + [[ -n $REPODEST_authority ]] || REPODEST_ok=false + [[ -n $REPODEST_path ]] || REPODEST_ok=false + [[ -n $REPODEST_userhost ]] || REPODEST_ok=false + + fi + if ! $REPODEST_ok; then + error 'The format of libretools.conf:REPODEST has changed.' + plain 'Merge the /etc/libretools.conf.pacnew file!' + return 6 + fi + if [[ "$REPODEST_path" = '/~'* ]]; then + if [[ "$REPODEST_path" = '/~/'* ]]; then + REPODEST_path=${REPODEST_path#'/~/'} + else + error 'Unfortunately, `~user` home-directory expansion is not (yet?) supported in libretools.conf:REPODEST' + return 6 + fi + fi + if [[ "$REPODEST_host" = '['*']' ]]; then + REPODEST_host=${REPODEST_HOST#'['} + REPODEST_host=${REPODEST_HOST#']'} + fi + REPODEST_userhost="${REPODEST_userinfo:+${REPODEST_userinfo%%:*}@}${REPODEST_host}" "$mode" } @@ -237,11 +279,12 @@ release_packages() { msg "%s to upload" "$(cd "${WORKDIR}/staging" && du -hc --files0-from="$file_list" | sed -n '$s/\t.*//p')" msg "Uploading packages..." - xargs -0r -a "$file_list" dirname -z | ssh "${REPODEST%%:*}" "$(printf 'mkdir -p -- %q && cd %q && xargs -0r mkdir -pv --' "${REPODEST#*:}"{,})" + xargs -0r -a "$file_list" dirname -z | ssh ${REPODEST_port:+-p "$REPODEST_port"} "${REPODEST_userhost}" "$(printf 'mkdir -p -- %q && cd %q && xargs -0r mkdir -pv --' "${REPODEST_path}"{,})" if ! rsync ${dryrun} "${rsync_flags[@]}" \ + -e "ssh ${REPODEST_port:+-p $REPODEST_port}" \ -0 --files-from="$file_list" \ "${WORKDIR}/staging" \ - "${REPODEST}/" + "$REPODEST_userhost:$REPODEST_path/" then error "Sync failed, try again" return 1 @@ -254,7 +297,7 @@ release_packages() { fi msg "Running db-update on repos" - ssh "${REPODEST%%:*}" "$(printf 'STAGING=%q db-update' "${REPODEST#*:}")" + ssh ${REPODEST_port:+-p "$REPODEST_port"} "${REPODEST_userhost}" "$(printf 'STAGING=%q db-update' "$REPODEST_path")" if [[ -n $HOOKPOSTRELEASE ]]; then msg "Running HOOKPOSTRELEASE..." diff --git a/src/libretools.conf b/src/libretools.conf index f909c36..3ba13bf 100644 --- a/src/libretools.conf +++ b/src/libretools.conf @@ -19,7 +19,7 @@ DIFFPROG=$(which $([ -z "${DISPLAY:-}" ]||echo kdiff3 meld gvimdiff) vimdiff col ## ABSLibre ## Used by xbs-abslibre ABSLIBRERECV=git://git.parabola.nu/abslibre/abslibre.git -ABSLIBRESEND=ssh://git@git.parabola.nu/srv/git/abslibre/abslibre.git +ABSLIBRESEND=ssh://git@git.parabola.nu:1863/~git/abslibre/abslibre.git ABSLIBREDEST="$WORKDIR/staging/abslibre" ## ARCHES is the list of ARCHES to look for under ABSLIBREDEST ARCHES=($(printf '%s\n' /usr/share/pacman/defaults/pacman.conf.*|sed 's|.*\.||')) @@ -29,11 +29,10 @@ ARCHES=($(printf '%s\n' /usr/share/pacman/defaults/pacman.conf.*|sed 's|.*\.||') ################################################################################ ## Where to upload packages to -# '/staging/' is appended; this is for compatibility with previous versions. -REPODEST=repo@repo.parabola.nu:staging/$LIBREUSER +REPODEST=ssh://repo@repo.parabola.nu:1863/~/staging/$LIBREUSER/staging/ ## These are run before and after uploading packages -HOOKPRERELEASE="ssh -fN ${REPODEST%%:*}" +HOOKPRERELEASE="ssh -fN $(sed -r -e 's,^ssh://,,' -e 's,[/#?].*$,,' -e 's/^(.*)(:([0-9]+))$/-p \3 \1/' -e 's/[][]//g' <<<"$REPODEST")" HOOKPOSTRELEASE="sudo librechroot clean-repo" ################################################################################ |