X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=build-aux%2Fgnupload;h=0832e16c95306b7e0a44a40744c49ad79bdbf8a4;hb=1276a2c5f24c0c932426aca9c899fa524d2443f2;hp=8320b58cf57ec102729f20e4be6e57f3d8f54370;hpb=cb75dc5b80c196fd934fd852bd3d39f1df1684dd;p=gnulib.git diff --git a/build-aux/gnupload b/build-aux/gnupload index 8320b58cf..0832e16c9 100755 --- a/build-aux/gnupload +++ b/build-aux/gnupload @@ -1,9 +1,9 @@ #!/bin/sh # Sign files and upload them. -scriptversion=2009-04-28.21; # UTC +scriptversion=2013-03-19.17; # UTC -# Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation +# Copyright (C) 2004-2014 Free Software Foundation, Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -19,6 +19,8 @@ scriptversion=2009-04-28.21; # UTC # along with this program. If not, see . # Originally written by Alexandre Duret-Lutz . +# The master copy of this file is maintained in the gnulib Git repository. +# Please send bug reports and feature requests to bug-gnulib@gnu.org. set -e @@ -26,16 +28,19 @@ GPG='gpg --batch --no-tty' conffile=.gnuploadrc to= dry_run=false +replace= symlink_files= delete_files= delete_symlinks= collect_var= dbg= +nl=' +' -usage="Usage: $0 [OPTIONS]... [COMMAND] FILES... [[COMMAND] FILES...] +usage="Usage: $0 [OPTION]... [CMD] FILE... [[CMD] FILE...] -Sign all FILES, and upload them to selected destinations, according to -. +Sign all FILES, and process them at the destinations specified with --to. +If CMD is not given, it defaults to uploading. See examples below. Commands: --delete delete FILES from destination @@ -44,17 +49,18 @@ Commands: -- treat the remaining arguments as files to upload Options: - --help print this help text and exit - --to DEST specify one destination for FILES + --to DEST specify a destination DEST for FILES (multiple --to options are allowed) --user NAME sign with key NAME + --replace allow replacements of existing files --symlink-regex[=EXPR] use sed script EXPR to compute symbolic link names --dry-run do nothing, show what would have been done + (including the constructed directive file) --version output version information and exit + --help print this help text and exit If --symlink-regex is given without EXPR, then the link target name -is created by replacing the version information with \`-latest', e.g.: - +is created by replacing the version information with '-latest', e.g.: foo-1.3.4.tar.gz -> foo-latest.tar.gz Recognized destinations are: @@ -72,43 +78,45 @@ in the current working directory, its contents are prepended to the actual command line options. Use this to keep your defaults. Comments (#) and empty lines in $conffile are allowed. + +gives some further background. + Examples: -1. Upload automake-1.8.2b.tar.gz and automake-1.8.2b.tar.bz2 to two sites: - gnupload --to sources.redhat.com:~ftp/pub/automake \\ - --to alpha.gnu.org:automake \\ - automake-1.8.2b.tar.gz automake-1.8.2b.tar.bz2 - -2. Same as above, but also create symbolic links to automake-latest.tar.*: - gnupload --to sources.redhat.com:~ftp/pub/automake \\ - --to alpha.gnu.org:automake \\ - --symlink-regex \\ - automake-1.8.2b.tar.gz automake-1.8.2b.tar.bz2 +1. Upload foobar-1.0.tar.gz to ftp.gnu.org: + gnupload --to ftp.gnu.org:foobar foobar-1.0.tar.gz -3. Symlink automake-1.8.2b.tar.gz to automake-latest.tar.gz and -automake-1.8.2b.tar.bz2 to automake-latest.tar.bz2 on both sites: +2. Upload foobar-1.0.tar.gz and foobar-1.0.tar.xz to ftp.gnu.org: + gnupload --to ftp.gnu.org:foobar foobar-1.0.tar.gz foobar-1.0.tar.xz - gnupload --to sources.redhat.com:~ftp/pub/automake \\ - --to alpha.gnu.org:automake \\ - --symlink automake-1.8.2b.tar.gz automake-latest.tar.gz \\ - automake-1.8.2b.tar.bz2 automake-latest.tar.bz2 +3. Same as above, and also create symbolic links to foobar-latest.tar.*: + gnupload --to ftp.gnu.org:foobar \\ + --symlink-regex \\ + foobar-1.0.tar.gz foobar-1.0.tar.xz -4. Delete automake-1.8.2a.tar.gz and .bz2, remove symlink -automake-latest.tar.gz and upload automake-1.8.2b.tar.gz: +4. Upload foobar-0.9.90.tar.gz to two sites: + gnupload --to alpha.gnu.org:foobar \\ + --to sources.redhat.com:~ftp/pub/foobar \\ + foobar-0.9.90.tar.gz - gnupload --to sources.redhat.com:~ftp/pub/automake \\ - --to alpha.gnu.org:automake \\ - --delete automake-1.8.2a.tar.gz automake-1.8.2a.tar.bz2 \\ - --rmsymlink automake-latest.tar.gz \\ - -- \\ - automake-1.8.2b.tar.gz automake-1.8.2b.tar.bz2 +5. Delete oopsbar-0.9.91.tar.gz and upload foobar-0.9.91.tar.gz + (the -- terminates the list of files to delete): + gnupload --to alpha.gnu.org:foobar \\ + --to sources.redhat.com:~ftp/pub/foobar \\ + --delete oopsbar-0.9.91.tar.gz \\ + -- foobar-0.9.91.tar.gz -Report bugs to . -Send patches to ." +gnupload executes a program ncftpput to do the transfers; if you don't +happen to have an ncftp package installed, the ncftpput-ftp script in +the build-aux/ directory of the gnulib package +(http://savannah.gnu.org/projects/gnulib) may serve as a replacement. + +Send patches and bug reports to ." # Read local configuration file if test -r "$conffile"; then echo "$0: Reading configuration file $conffile" - eval set x "`sed 's/#.*$//;/^$/d' \"$conffile\" | tr '\012\015' ' '` \"\$@\"" + conf=`sed 's/#.*$//;/^$/d' "$conffile" | tr "\015$nl" ' '` + eval set x "$conf \"\$@\"" shift fi @@ -125,6 +133,12 @@ while test -n "$1"; do if test -z "$2"; then echo "$0: Missing argument for --to" 1>&2 exit 1 + elif echo "$2" | grep 'ftp-upload\.gnu\.org' >/dev/null; then + echo "$0: Use ftp.gnu.org:PKGNAME or alpha.gnu.org:PKGNAME" >&2 + echo "$0: for the destination, not ftp-upload.gnu.org (which" >&2 + echo "$0: is used for direct ftp uploads, not with gnupload)." >&2 + echo "$0: See --help and its examples if need be." >&2 + exit 1 else to="$to $2" shift @@ -142,6 +156,9 @@ while test -n "$1"; do --delete) collect_var=delete_files ;; + --replace) + replace="replace: true" + ;; --rmsymlink) collect_var=delete_symlinks ;; @@ -166,7 +183,7 @@ while test -n "$1"; do break ;; -*) - echo "$0: Unknown option \`$1', try \`$0 --help'" 1>&2 + echo "$0: Unknown option '$1', try '$0 --help'" 1>&2 exit 1 ;; esac @@ -184,7 +201,7 @@ done dprint() { - echo "Running $*..." + echo "Running $* ..." } if $dry_run; then @@ -215,7 +232,7 @@ else for file do if test ! -f $file; then - echo "$0: Cannot find \`$file'" 1>&2 + echo "$0: Cannot find '$file'" 1>&2 exit 1 elif test -n "$symlink_expr"; then linkname=`echo $file | sed "$symlink_expr"` @@ -232,25 +249,30 @@ fi # Make sure passphrase is not exported in the environment. unset passphrase +unset passphrase_fd_0 +GNUPGHOME=${GNUPGHOME:-$HOME/.gnupg} # Reset PATH to be sure that echo is a built-in. We will later use -# `echo $passphrase' to output the passphrase, so it is important that -# it is a built-in (third-party programs tend to appear in `ps' +# 'echo $passphrase' to output the passphrase, so it is important that +# it is a built-in (third-party programs tend to appear in 'ps' # listings with their arguments...). -# Remember this script runs with `set -e', so if echo is not built-in +# Remember this script runs with 'set -e', so if echo is not built-in # it will exit now. -PATH=/empty echo -n "Enter GPG passphrase: " -stty -echo -read -r passphrase -stty echo -echo +if $dry_run || grep -q "^use-agent" $GNUPGHOME/gpg.conf; then :; else + PATH=/empty echo -n "Enter GPG passphrase: " + stty -echo + read -r passphrase + stty echo + echo + passphrase_fd_0="--passphrase-fd 0" +fi if test $# -ne 0; then for file do - echo "Signing $file..." + echo "Signing $file ..." rm -f $file.sig - echo "$passphrase" | $dbg $GPG --passphrase-fd 0 -ba -o $file.sig $file + echo "$passphrase" | $dbg $GPG $passphrase_fd_0 -ba -o $file.sig $file done fi @@ -266,7 +288,7 @@ filename: $3$stmt" fi cat >${2}.directive<