[pacman-dev] FS#4404 - rsync protocol support for makepkg.
Rediffed post gettext changes. Andrew
Signed-off-by: Andrew Fyfe <andrew@neptune-one.net> diff --git a/scripts/makepkg.in b/scripts/makepkg.in index 17a500b..5f9adbd 100755 --- a/scripts/makepkg.in +++ b/scripts/makepkg.in @@ -184,6 +184,26 @@ in_array() { return 1 } +getDownloadClient () { + # $1 = Config variable name. + + local agent=$(eval echo \$$1) + if [ -z "$agent" ]; then + error "$(gettext_eval "\$1 is not configured. Check the /etc/makepkg.conf file.")" + error "$(gettext "Aborting...")" + exit 1 # $E_CONFIG_ERROR # TODO: error code + fi + + local program="$(echo $agent | awk '{print $1 }')" + if [ ! -x "$program" ]; then + error "$(gettext_eval "The download program \$(basename \$program) is not installed.")" + error "$(gettext "Aborting...")" + exit 1 # $E_MISSING_PROGRAM # TODO: error code + fi + + echo $agent +} + checkdeps() { [ $# -gt 0 ] || return @@ -669,59 +689,54 @@ fi cd "$startdir" -# retrieve sources -msg "$(gettext "Retrieving Sources...")" mkdir -p src cd "$startdir/src" + +msg "$(gettext "Retrieving Sources...")" for netfile in ${source[@]}; do file=$(strip_url "$netfile") if [ -f "../$file" ]; then msg2 "$(eval_gettext "Found \$file in build dir")" cp "../$file" . + continue elif [ -f "$SRCDEST/$file" ]; then msg2 "$(eval_gettext "Using cached copy of \$file")" cp "$SRCDEST/$file" . - else - # check for a download utility - if [ -z "$FTPAGENT" ]; then - error "$(gettext "FTPAGENT is not configured. Check the /etc/makepkg.conf file.")" - msg "$(gettext "Aborting...")" - exit 1 - fi - ftpclient=$(echo $FTPAGENT | awk {'print $1'}) - if [ ! -x "$ftpclient" ]; then - local clientname=$(basename $ftpclient) - error "$(eval_gettext "ftpclient \$clientname is not installed.")" - msg "$(gettext "Aborting...")" - exit 1 - fi - proto=$(echo "$netfile" | sed 's|://.*||') - if [ "$proto" != "ftp" -a "$proto" != "http" -a "$proto" != "https" ]; then + continue + fi + + proto=$(echo $netfile | sed 's|://.*||') + case "$proto" in + ftp|http|https) + dlclient=$(getDownloadClient FTPAGENT) || exit $?;; + *) error "$(eval_gettext "\$netfile was not found in the build directory and is not a proper URL.")" msg "$(gettext "Aborting...")" - exit 1 - fi - msg2 "$(eval_gettext "Downloading \$file")" - $FTPAGENT "$netfile" - # fix flyspray bug #3289 - ftpret=$? - if [ $ftpret -gt 0 ]; then - error "$(eval_gettext "Failure while downloading \$file")" - msg "$(gettext "Aborting...")" - #rm "$file" - exit 1 - fi - if [ -n "$SRCDEST" ]; then - mkdir -p $SRCDEST && cp "$file" $SRCDEST - if [ $? -ne 0 ]; then - warning "$(eval_gettext "You do not have correct permissions to cache source in \$SRCDEST")" - cp "$file" .. - fi - else + exit 1 # $E_BAD_PKGBUILD # TODO: error code + ;; + esac + + msg2 "$(gettext_eval "Downloading \$file")" + # fix flyspray bug #3289 + ret=0 + $dlclient "$netfile" || ret=$? + if [ $ret -gt 0 ]; then + error "$(gettext "Failure while downloading $file")" + msg "$(gettext "Aborting...")" + exit 1 + fi + + if [ -n "$SRCDEST" ]; then + mkdir -p "$SRCDEST" && cp "$file" "$SRCDEST" || ret=$? + if [ $ret -gt 0 ]; then + warning "$(gettext_eval "You do not have correct permissions to cache source in \$SRCDEST")" cp "$file" .. fi + else + cp "$file" .. fi done +unset netfile file dlclient proto ret if [ "$NOEXTRACT" = "1" -o "$REPKG" = "1" ]; then warning "$(gettext "Skipping source integrity checks -- using existing src/ tree")" -- 1.5.0.6
Added support for rsync to getDoownloadClient(). Signed-off-by: Andrew Fyfe <andrew@neptune-one.net> diff --git a/scripts/makepkg.in b/scripts/makepkg.in index 5f9adbd..f8ec869 100755 --- a/scripts/makepkg.in +++ b/scripts/makepkg.in @@ -709,6 +709,8 @@ for netfile in ${source[@]}; do case "$proto" in ftp|http|https) dlclient=$(getDownloadClient FTPAGENT) || exit $?;; + rsync) + dlclient=$(getDownloadClient RSYNCAGENT) || exit $?;; *) error "$(eval_gettext "\$netfile was not found in the build directory and is not a proper URL.")" msg "$(gettext "Aborting...")" -- 1.5.0.6
Signed-off-by: Andrew Fyfe <andrew@neptune-one.net> diff --git a/etc/makepkg.conf.in b/etc/makepkg.conf.in index 9ac0ef2..3c0fdf8 100644 --- a/etc/makepkg.conf.in +++ b/etc/makepkg.conf.in @@ -10,6 +10,8 @@ FTPAGENT="/usr/bin/wget --continue --passive-ftp --tries=3 --waitretry=3 --no-check-certificate" #FTPAGENT="/usr/bin/snarf" #FTPAGENT="/usr/bin/lftpget -c" +#-- The rsync program that makepkg should use to acquire sources +RSYNCAGENT="/usr/bin/rsync" ######################################################################### # ARCHITECTURE, COMPILE FLAGS -- 1.5.0.6
participants (1)
-
Andrew Fyfe