A set of patches to add support for downloading from rsync in makepkg. Andrew
From 5248d7bfd1e37b1c332c77537d08cb1a1d58f628 Mon Sep 17 00:00:00 2001 From: Andrew Fyfe <andrew@neptune-one.net> Date: Thu, 29 Mar 2007 10:58:16 +0100 Subject: [PATCH 1/3] Moved check for download client into getDownloadClient().
Signed-off-by: Andrew Fyfe <andrew@neptune-one.net> --- scripts/makepkg | 91 +++++++++++++++++++++++++++++++++---------------------- 1 files changed, 55 insertions(+), 36 deletions(-) diff --git a/scripts/makepkg b/scripts/makepkg index 5afb285..0e5c5ec 100755 --- a/scripts/makepkg +++ b/scripts/makepkg @@ -190,6 +190,26 @@ checkdeps() { fi } +getDownloadClient () { + # $1 = Config variable name. + + local agent=$(eval echo \$$1) + if [ -z "$agent" ]; then + error "$1 is not configured. Check the /etc/makepkg.conf file." + error "Aborting..." + exit 1 # $E_CONFIG_ERROR # TODO: error code + fi + + local program="$(echo $agent | awk '{print $1 }')" + if [ ! -x "$program" ]; then + error "The download program $(basename $program) is not installed." + error "Aborting..." + exit 1 # $E_MISSING_PROGRAM # TODO: error code + fi + + echo $agent +} + handledeps() { local missingdeps=0 local deplist="$*" @@ -659,58 +679,57 @@ fi cd "$startdir" -# retrieve sources -msg "Retrieving Sources..." mkdir -p src cd "$startdir/src" + + +msg "Retrieving Sources..." for netfile in ${source[@]}; do file=$(strip_url "$netfile") if [ -f "../$file" ]; then msg2 "Found $file in build dir" cp "../$file" . + continue elif [ -f "$SRCDEST/$file" ]; then msg2 "Using cached copy of $file" cp "$SRCDEST/$file" . - else - # check for a download utility - if [ -z "$FTPAGENT" ]; then - error "FTPAGENT is not configured. Check the /etc/makepkg.conf file." - msg "Aborting..." - exit 1 - fi - ftpclient=$(echo $FTPAGENT | awk {'print $1'}) - if [ ! -x "$ftpclient" ]; then - error "ftpclient $(basename $ftpclient) is not installed." - msg "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) + FTPAGENT_PROGRAM=$FTPAGENT_PROGRAM # HACK ALERT! + dlclient=$(getDownloadClient FTPAGENT) || exit $?;; + + *) error "$netfile was not found in the build directory and is not a proper URL." msg "Aborting..." - exit 1 - fi - msg2 "Downloading $file" - $FTPAGENT "$netfile" - # fix flyspray bug #3289 - ftpret=$? - if [ $ftpret -gt 0 ]; then - error "Failure while downloading $file" - msg "Aborting..." - #rm "$file" - exit 1 - fi - if [ -n "$SRCDEST" ]; then - mkdir -p $SRCDEST && cp "$file" $SRCDEST - if [ $? -ne 0 ]; then - warning "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 "Downloading $file" + # fix flyspray bug #3289 + ret=0 + $dlclient "$netfile" || ret=$? + if [ $ret -gt 0 ]; then + error "Failure while downloading $file" + msg "Aborting..." + exit 1 + fi + + if [ -n "$SRCDEST" ]; then + mkdir -p "$SRCDEST" && cp "$file" "$SRCDEST" || ret=$? + if [ $ret -gt 0 ]; then + warning "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 "Skipping source integrity checks -- using existing src/ tree" -- 1.5.0.5
From 46cf6179ae0c0f4afb7c0382be82cf777cd0b6ff Mon Sep 17 00:00:00 2001 From: Andrew Fyfe <andrew@neptune-one.net> Date: Thu, 29 Mar 2007 11:02:09 +0100 Subject: [PATCH 2/3] Fixed FS#4404 - rsync protocol support for makepkg.
Added support for rsync to getDownloadClient(). Signed-off-by: Andrew Fyfe <andrew@neptune-one.net> --- scripts/makepkg | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/scripts/makepkg b/scripts/makepkg index 0e5c5ec..87fd384 100755 --- a/scripts/makepkg +++ b/scripts/makepkg @@ -702,6 +702,9 @@ for netfile in ${source[@]}; do FTPAGENT_PROGRAM=$FTPAGENT_PROGRAM # HACK ALERT! dlclient=$(getDownloadClient FTPAGENT) || exit $?;; + rsync) + dlclient=$(getDownloadClient RSYNCAGENT);; + *) error "$netfile was not found in the build directory and is not a proper URL." msg "Aborting..." -- 1.5.0.5
From 8c4c9ee8b2678fb8a63b2c1b4fa61d41bb83c686 Mon Sep 17 00:00:00 2001 From: Andrew Fyfe <andrew@neptune-one.net> Date: Thu, 29 Mar 2007 11:03:11 +0100 Subject: [PATCH 3/3] Added RSYNCAGENT to makepkg.conf.in
Signed-off-by: Andrew Fyfe <andrew@neptune-one.net> --- etc/makepkg.conf.in | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) 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.5