From ffe1d50cff3e1df8834f371e1b7a40fa2c703e9b Mon Sep 17 00:00:00 2001 From: Judd Vinet Date: Sat, 12 Jul 2003 00:06:30 +0000 Subject: Imported from pacman-2.5.1.tar.gz --- ChangeLog | 3 +++ Makefile.in | 2 +- scripts/gensync | 2 +- scripts/makepkg | 2 +- scripts/makeworld | 14 +++++------ src/pacman.c | 2 +- src/pacman.h | 2 +- src/pacsync.c | 70 ++++++++++++++++++++++++++++++------------------------- 8 files changed, 53 insertions(+), 44 deletions(-) diff --git a/ChangeLog b/ChangeLog index b56da5b5..7765bfda 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ VERSION DESCRIPTION ------------------------------------------------------------------ +2.5.1 - Added retries to the downloader to get around some + transient network errors. (this will likely be an option + in pacman.conf for later versions) 2.5 - Added an URL tag to package info - Sped up package load times by about 500% by introducing a .FILELIST into the package diff --git a/Makefile.in b/Makefile.in index 9036f1a2..c4d66c31 100644 --- a/Makefile.in +++ b/Makefile.in @@ -34,7 +34,7 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS) INSTALL_DATA = @INSTALL_DATA@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ -PACVER = 2.5 +PACVER = 2.5.1 TOPDIR = @srcdir@ SRCDIR = $(TOPDIR)/src/ diff --git a/scripts/gensync b/scripts/gensync index 769972a6..ef528543 100755 --- a/scripts/gensync +++ b/scripts/gensync @@ -1,6 +1,6 @@ #!/bin/bash -myver='2.5' +myver='2.5.1' usage() { echo "gensync $myver" diff --git a/scripts/makepkg b/scripts/makepkg index 08cddb38..89e9ee22 100755 --- a/scripts/makepkg +++ b/scripts/makepkg @@ -1,6 +1,6 @@ #!/bin/bash -myver='2.5' +myver='2.5.1' startdir=`pwd` [ -f /etc/makepkg.conf ] && source /etc/makepkg.conf diff --git a/scripts/makeworld b/scripts/makeworld index fdeb23a3..94a522e2 100755 --- a/scripts/makeworld +++ b/scripts/makeworld @@ -1,7 +1,7 @@ #!/bin/bash toplevel=`pwd` -version="2.5" +version="2.5.1" usage() { echo "makeworld version $version" @@ -42,12 +42,12 @@ for arg in $*; do -*) while getopts "cisbdf-" opt; do case $opt in - c) MAKEPKGS_OPTS="$MAKEPKGS_OPTS -c" ;; - i) MAKEPKGS_OPTS="$MAKEPKGS_OPTS -i" ;; - s) MAKEPKGS_OPTS="$MAKEPKGS_OPTS -s" ;; - b) MAKEPKGS_OPTS="$MAKEPKGS_OPTS -b" ;; - d) MAKEPKGS_OPTS="$MAKEPKGS_OPTS -d" ;; - f) MAKEPKGS_OPTS="$MAKEPKGS_OPTS -f" ;; + c) MAKEPKG_OPTS="$MAKEPKG_OPTS -c" ;; + i) MAKEPKG_OPTS="$MAKEPKG_OPTS -i" ;; + s) MAKEPKG_OPTS="$MAKEPKG_OPTS -s" ;; + b) MAKEPKG_OPTS="$MAKEPKG_OPTS -b" ;; + d) MAKEPKG_OPTS="$MAKEPKG_OPTS -d" ;; + f) MAKEPKG_OPTS="$MAKEPKG_OPTS -f" ;; -) OPTIND=0 break diff --git a/src/pacman.c b/src/pacman.c index 79f2f996..35421ff5 100644 --- a/src/pacman.c +++ b/src/pacman.c @@ -1226,7 +1226,7 @@ int pacman_remove(pacdb_t *db, PMList *targets) snprintf(pm_install, PATH_MAX, "%s%s/%s/%s-%s/install", pmo_root, PKGDIR, db->treename, info->name, info->version); if(!stat(pm_install, &buf)) { vprint("Executing pre-remove script...\n"); - snprintf(pm_install, PATH_MAX, "%s%s/%s/%s-%s/install", pmo_root, PKGDIR, db->treename, info->name, info->version); + snprintf(pm_install, PATH_MAX, "%s/%s/%s-%s/install", PKGDIR, db->treename, info->name, info->version); snprintf(line, PATH_MAX, "chroot %s /bin/sh %s pre_remove %s", pmo_root, pm_install, info->version); system(line); diff --git a/src/pacman.h b/src/pacman.h index 5c1a94dd..3d749886 100644 --- a/src/pacman.h +++ b/src/pacman.h @@ -22,7 +22,7 @@ #define _PAC_PACMAN_H #ifndef PACVER -#define PACVER "2.5" +#define PACVER "2.5.1" #endif #ifndef PKGDIR diff --git a/src/pacsync.c b/src/pacsync.c index da2f1a9a..91e62117 100644 --- a/src/pacsync.c +++ b/src/pacsync.c @@ -155,41 +155,47 @@ int downloadfiles(PMList *servers, char *localpath, PMList *files) sync_fnm[24] = '\0'; if(!server->islocal) { - if(!FtpSize(fn, &fsz, FTPLIB_IMAGE, control)) { - fprintf(stderr, "warning: failed to get filesize for %s\n", fn); - } - offset = 0; - if(!stat(output, &st)) { - offset = (int)st.st_size; - } - if(offset) { - if(!FtpRestart(offset, control)) { - fprintf(stderr, "warning: failed to resume download -- restarting\n"); - /* can't resume: */ - /* unlink the file in order to restart download from scratch */ - unlink(output); + int tries = 2; + while(tries) { + if(!FtpSize(fn, &fsz, FTPLIB_IMAGE, control)) { + fprintf(stderr, "warning: failed to get filesize for %s\n", fn); } - } - /* set up our progress bar's callback */ - FtpOptions(FTPLIB_CALLBACK, (long)log_progress, control); - FtpOptions(FTPLIB_IDLETIME, (long)1000, control); - FtpOptions(FTPLIB_CALLBACKARG, (long)&fsz, control); - FtpOptions(FTPLIB_CALLBACKBYTES, (10*1024), control); + offset = 0; + if(!stat(output, &st)) { + offset = (int)st.st_size; + } + if(offset) { + if(!FtpRestart(offset, control)) { + fprintf(stderr, "warning: failed to resume download -- restarting\n"); + /* can't resume: */ + /* unlink the file in order to restart download from scratch */ + unlink(output); + } + } + /* set up our progress bar's callback */ + FtpOptions(FTPLIB_CALLBACK, (long)log_progress, control); + FtpOptions(FTPLIB_IDLETIME, (long)1000, control); + FtpOptions(FTPLIB_CALLBACKARG, (long)&fsz, control); + FtpOptions(FTPLIB_CALLBACKBYTES, (10*1024), control); - if(!FtpGet(output, lp->data, FTPLIB_IMAGE, control)) { - fprintf(stderr, "\nfailed downloading %s from %s: %s\n", - fn, server->server, FtpLastResponse(control)); - /* we leave the partially downloaded file in place so it can be resumed later */ - } else { - char completefile[PATH_MAX]; - log_progress(control, fsz-offset, &fsz); - complete = list_add(complete, fn); - /* rename "output.part" file to "output" file */ - snprintf(completefile, PATH_MAX, "%s/%s", localpath, fn); - rename(output, completefile); + if(!FtpGet(output, lp->data, FTPLIB_IMAGE, control)) { + fprintf(stderr, "\nfailed downloading %s from %s: %s\n", + fn, server->server, FtpLastResponse(control)); + /* we leave the partially downloaded file in place so it can be resumed later */ + /* try each file twice in case it was just one of those transient network errors */ + tries--; + } else { + char completefile[PATH_MAX]; + log_progress(control, fsz-offset, &fsz); + complete = list_add(complete, fn); + tries = 0; + /* rename "output.part" file to "output" file */ + snprintf(completefile, PATH_MAX, "%s/%s", localpath, fn); + rename(output, completefile); + } + printf("\n"); + fflush(stdout); } - printf("\n"); - fflush(stdout); } else { /* local repository, just copy the file */ char src[PATH_MAX], dest[PATH_MAX]; -- cgit v1.2.3-24-g4f1b