[pacman-dev] [patch] FS#4404 - rsync protocol support for makepkg.
A set of patches to add support for downloading from rsync in makepkg. Andrew
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
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
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
On 3/29/07, Andrew Fyfe <andrew@neptune-one.net> wrote:
A set of patches to add support for downloading from rsync in makepkg.
Andrew
Can you submit these as individual email patches? This goes for any patchset- git makes it really easy to apply email patches as long as they are in individual emails. You even get your name in as the author of the commit! Haha. Setting up git-send-email is not too tough and it works great for this. I set it up with msmtp (sendemail.smtpserver=/usr/bin/msmtp in my git config). -Dan
participants (2)
-
Andrew Fyfe
-
Dan McGee