From 185ce5454e4afd11b1f90d7fe487b0ec3cb840c7 Mon Sep 17 00:00:00 2001 From: Judd Vinet Date: Mon, 17 Mar 2003 19:36:48 +0000 Subject: [PATCH] Imported from pacman-2.3.2.tar.gz --- ChangeLog | 5 ++++ Makefile.in | 2 +- TODO | 1 - etc/makepkg.conf | 6 +++++ etc/pacman.conf | 13 +++++++--- libftp/ftplib.c | 18 ++++++++++++- libftp/ftplib.h | 1 + scripts/gensync | 2 +- scripts/makepkg | 50 +++++++++++++++++++++++------------- scripts/makeworld | 2 +- src/.pacman.c.swp | Bin 0 -> 24576 bytes src/pacman.c | 10 +++++++- src/pacman.h | 2 +- src/pacsync.c | 63 +++++++++++++++++++++++++--------------------- src/util.c | 13 ++++++++++ 15 files changed, 133 insertions(+), 55 deletions(-) create mode 100644 src/.pacman.c.swp diff --git a/ChangeLog b/ChangeLog index d9469ea1..707826b1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ VERSION DESCRIPTION ------------------------------------------------------------------ +2.3.2 - Added patches from Aurelien Foret: + - FTP resume feature + - IgnorePkg option in pacman.conf + - FTPAGENT setting in makepkg.conf + - Added --cleancache option to makepkg 2.3.1 - Fixed the progress bar overflow - Pacman does not ask "Are you sure" when you use --downloadonly - Switched up a couple makepkg options to be more consistent diff --git a/Makefile.in b/Makefile.in index b5479d6d..c5f89922 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.3.1 +PACVER = 2.3.2 LIBTAR_VERSION = 1.2.5 TOPDIR = @srcdir@ diff --git a/TODO b/TODO index 7b1d6f07..add6b4be 100644 --- a/TODO +++ b/TODO @@ -2,7 +2,6 @@ - add some logging mechanism (/var/log/pacman.log) - handle version comparators in makepkg dep resolution (eg, glibc>=2.2.5) - have "group" designations -- IgnorePkg option/switch in pacman.conf to ignore updates from the sync repo - record md5sums of all files in a package - add a way to clean /var/cache/pacman/src - duplicate dep checks occur with sync (one in sync, one in add) diff --git a/etc/makepkg.conf b/etc/makepkg.conf index c73d9889..b2d8a893 100644 --- a/etc/makepkg.conf +++ b/etc/makepkg.conf @@ -5,6 +5,11 @@ # the top-level directory of all your PKGBUILDs export ABSROOT="/usr/abs" +# The FTP/HTTP download utility that makepkg should use to acquire sources +export FTPAGENT="/usr/bin/wget --continue --passive-ftp --tries=3 --waitretry=3" +#export FTPAGENT="/usr/bin/snarf" +#export FTPAGENT="/usr/bin/lftpget -c" + # Pentium Pro/Pentium II/Pentium III+/Pentium 4/Athlon optimized (but binaries # will run on any x86 system) #export CHOST="i686-pc-linux-gnu" @@ -22,3 +27,4 @@ export CXXFLAGS="-march=i686 -O2 -pipe" # if you want your name to show up in the packages you build, set this. #export PACKAGER="John Doe " + diff --git a/etc/pacman.conf b/etc/pacman.conf index ad77cfec..8262aad3 100644 --- a/etc/pacman.conf +++ b/etc/pacman.conf @@ -2,14 +2,21 @@ # /etc/pacman.conf # -# Currently the only option directive is NoUpgrade. Use this with a -# space-delimited list of files that should never be touched by pacman -# during an install/upgrade. (note: do not include the leading slash) +# GENERAL OPTIONS +# NoUpgrade: a space-delimited list of files that should never +# be touched by pacman during an install/upgrade. +# (note: do not include the leading slash) +# IgnorePkg: a space-delimited list of packages that pacman should NOT +# upgrade when doing a --sysupgrade [options] NoUpgrade = etc/passwd etc/group etc/shadow NoUpgrade = etc/fstab etc/rc.conf etc/rc.local NoUpgrade = etc/lilo.conf etc/raidtab +#IgnorePkg = lilo gcc +# +# REPOSITORIES +# [current] Server = ftp://ftp.archlinux.org/current Server = ftp://ftp.ibiblio.org/pub/linux/distributions/archlinux/current diff --git a/libftp/ftplib.c b/libftp/ftplib.c index 9089a5b3..d8c25f58 100644 --- a/libftp/ftplib.c +++ b/libftp/ftplib.c @@ -1104,7 +1104,7 @@ static int FtpXfer(const char *localfile, const char *path, if (localfile != NULL) { - char ac[4] = "w"; + char ac[4] = "a"; if (typ == FTPLIB_FILE_WRITE) ac[0] = 'r'; if (mode == FTPLIB_IMAGE) @@ -1199,6 +1199,22 @@ GLOBALDEF int FtpSize(const char *path, int *size, char mode, netbuf *nControl) return rv; } +/* + * FtpRestart - issue a REST command + * + * return 1 if successful, 0 otherwise + */ +GLOBALDEF int FtpRestart(int offset, netbuf *nControl) +{ + char cmd[256]; + int rv=1; + + sprintf(cmd,"REST %d",offset); + if (!FtpSendCmd(cmd,'3',nControl)) + rv = 0; + return rv; +} + /* * FtpModDate - determine the modification date of a remote file * diff --git a/libftp/ftplib.h b/libftp/ftplib.h index c281b723..05bdf9e1 100644 --- a/libftp/ftplib.h +++ b/libftp/ftplib.h @@ -109,6 +109,7 @@ GLOBALREF int FtpPwd(char *path, int max, netbuf *nControl); GLOBALREF int FtpNlst(const char *output, const char *path, netbuf *nControl); GLOBALREF int FtpDir(const char *output, const char *path, netbuf *nControl); GLOBALREF int FtpSize(const char *path, int *size, char mode, netbuf *nControl); +GLOBALREF int FtpRestart(int offset, netbuf *nControl); GLOBALREF int FtpModDate(const char *path, char *dt, int max, netbuf *nControl); GLOBALREF int FtpGet(const char *output, const char *path, char mode, netbuf *nControl); diff --git a/scripts/gensync b/scripts/gensync index cc825f3b..e73ba3c1 100755 --- a/scripts/gensync +++ b/scripts/gensync @@ -1,6 +1,6 @@ #!/bin/bash -myver='2.3.1' +myver='2.3.2' usage() { echo "gensync $myver" diff --git a/scripts/makepkg b/scripts/makepkg index 5f39a832..890ec22f 100755 --- a/scripts/makepkg +++ b/scripts/makepkg @@ -1,6 +1,6 @@ #!/bin/bash -myver='2.3.1' +myver='2.3.2' startdir=`pwd` [ -f /etc/makepkg.conf ] && source /etc/makepkg.conf @@ -52,6 +52,7 @@ if [ "$1" = "--help" -o "$1" = "-h" ]; then echo "usage: $0 [options] [build_script]" echo "options:" echo " -c, --clean Clean up work files after build" + echo " -C, --cleancache Clean up source files from the cache" echo " -s, --syncdeps Install missing dependencies with pacman" echo " -b, --builddeps Build missing dependencies from source" echo " -d, --nodeps Skip all dependency checks" @@ -67,6 +68,7 @@ fi # Options CLEANUP=0 +CLEANCACHE=0 INSTALL=0 DEP_BIN=0 DEP_SRC=0 @@ -79,6 +81,9 @@ for arg in $*; do -c|--clean) CLEANUP=1 ;; + -C|--cleancache) + CLEANCACHE=1 + ;; -s|--syncdeps) DEP_BIN=1 ;; @@ -100,22 +105,16 @@ for arg in $*; do esac done +if [ "$CLEANCACHE" = "1" ]; then + msg "==> Cleaning up source files from the cache" + rm -rf /var/cache/pacman/src/* + exit 0 +fi + unset pkgname pkgver pkgrel pkgdesc unset depends conflicts backup source install build umask 0022 -# check for a download utility -if [ -x /usr/bin/wget ]; then - ftpagent="/usr/bin/wget --passive-ftp --tries=3 --waitretry=3" -elif [ -x /usr/bin/snarf ]; then - ftpagent="/usr/bin/snarf" -elif [ -x /usr/bin/lftpget -a "$proto" = "ftp" ]; then - ftpagent="/usr/bin/lftpget" -else - msg "==> ERROR: You need an ftp client installed (snarf/lftp/wget) in /usr/bin" - exit 1 -fi - if [ ! -f $BUILDSCRIPT ]; then msg "==> ERROR: $BUILDSCRIPT does not exist." exit 1 @@ -151,7 +150,7 @@ if [ `type -p pacman` -a "$NODEPS" = "0" ]; then msg "==> ERROR: Failed to install missing dependencies." exit 1 fi - # TODO: check deps again to make sure they were resolved + # TODO: check deps again to make sure they were resolved elif [ "$DEP_SRC" = "1" ]; then # install missing deps by building them from source. # we look for each package name in $ABSROOT and build it. @@ -183,7 +182,7 @@ if [ `type -p pacman` -a "$NODEPS" = "0" ]; then exit 1 fi done - # TODO: check deps again to make sure they were resolved + # TODO: check deps again to make sure they were resolved else exit 1 fi @@ -211,6 +210,18 @@ for netfile in ${source[@]}; do msg "==> Using local copy of $file" cp /var/cache/pacman/src/$file . else + # check for a download utility + if [ -z "$FTPAGENT" ]; then + msg "==> 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 + msg "==> ERROR: ftpclient `basename $ftpclient` is not installed." + msg "==> Aborting..." + exit 1 + fi proto=`echo $netfile | sed 's|://.*||'` if [ "$proto" != "ftp" -a "$proto" != "http" ]; then msg "==> ERROR: $netfile was not found in the build directory and is not a proper URL." @@ -218,7 +229,7 @@ for netfile in ${source[@]}; do exit 1 fi msg "==> Downloading $file" - $ftpagent $netfile 2>&1 + $FTPAGENT $netfile 2>&1 if [ ! -f $file ]; then msg "==> ERROR: Failed to download $file" msg "==> Aborting..." @@ -242,6 +253,11 @@ for netfile in ${source[@]}; do if [ "$cmd" != "" ]; then msg "==> $cmd" $cmd + if [ $? -ne 0 ]; then + msg "==> ERROR: Failed to extract $file" + msg "==> Aborting..." + exit 1 + fi fi done @@ -348,7 +364,7 @@ fi cd $startdir if [ "$CLEANUP" = "1" ]; then msg "==> Cleaning up" - rm -rf src pkg + rm -rf src pkg filelist fi d=`date` diff --git a/scripts/makeworld b/scripts/makeworld index 3c523f9c..9b5e46cd 100755 --- a/scripts/makeworld +++ b/scripts/makeworld @@ -1,7 +1,7 @@ #!/bin/bash toplevel=`pwd` -version="2.3.1" +version="2.3.2" usage() { echo "makeworld version $version" diff --git a/src/.pacman.c.swp b/src/.pacman.c.swp new file mode 100644 index 0000000000000000000000000000000000000000..e318408d20185b12cc3ecb90fd9893f155768e7f GIT binary patch literal 24576 zcmeI4du(LYdBBGP4U+)PLllWXIhc?goAGNG2y3rRjdyl&eYi3Hw+1g5ua z?(I3Z?Hu)&g?~*{$oCxoNV>WyO-}7*z4gZSt*AjlohJQ);j|m^8Afi$)6F$Q4 zla4pxmk2KrzSf5SoA4pRzqH{O3FDGTg%l+3zd-mC{C?Voe?jx8Uiqz5>Unq;?uI*|1ZTnbPbCa@z&xA>Po0uV-351o3+?d3lT)dG zhDYHa;9KxD_#FHJRA4XcfGuz~yaRsz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@8^9GFvhW#Wlr1j;}ZWdYAe!1?y;Tsz}7#-gP+-iTyhw_x9#ToG%m;mD!$8d^@h z@9D2~*716hc)T=LjCEG?H?fp!A8)Ig7T?L!W2(N$G|lgoiVekYs4X=dlPh(l*4^1m z3<9x|5jLp4?-WD3n#;g z@G7?b%kZD@1^6Uf2m7HLB(Iy`LHIkk9wuN26#Toj{qN!TSK$*-hL6Am^g{-o!N&hQ zh#x@g|5M@n*!2&next) { int cmp, found = 0; pkginfo_t *local = (pkginfo_t*)i->data; @@ -400,6 +402,12 @@ int pacman_sync(pacdb_t *db, PMList *targets) /*fprintf(stderr, "%s: not found in sync db. skipping.", local->name);*/ continue; } + /* check if package should be ignored */ + if(is_in((char*)i->data, pmo_ignorepkg)) { + fprintf(stderr, ":: %s: ignoring package upgrade\n", (char*)i->data); + ignore = 1; + continue; + } /* compare versions and see if we need to upgrade */ cmp = rpmvercmp(local->version, sync->pkg->version); if(cmp > 0) { @@ -438,7 +446,7 @@ int pacman_sync(pacdb_t *db, PMList *targets) } } } - if(newer && allgood) { + if((newer || ignore) && allgood) { fprintf(stderr, ":: Above packages will be skipped. To manually upgrade use 'pacman -S '\n"); } } else { diff --git a/src/pacman.h b/src/pacman.h index 2c9b19a4..e248a8bf 100644 --- a/src/pacman.h +++ b/src/pacman.h @@ -22,7 +22,7 @@ #define _PAC_PACMAN_H #ifndef PACVER -#define PACVER "2.3.1" +#define PACVER "2.3.2" #endif #ifndef PKGDIR diff --git a/src/pacsync.c b/src/pacsync.c index f61a61e0..72b0a0d4 100644 --- a/src/pacsync.c +++ b/src/pacsync.c @@ -38,6 +38,7 @@ static int log_progress(netbuf *ctl, int xfered, void *arg); static char sync_fnm[25]; +static int offset; /* pacman options */ extern char *pmo_root; @@ -104,7 +105,6 @@ int downloadfiles(PMList *servers, char *localpath, PMList *files) int done = 0; PMList *complete = NULL; PMList *i; - extern char* workfile; if(files == NULL) { return(0); @@ -136,12 +136,13 @@ int downloadfiles(PMList *servers, char *localpath, PMList *files) char output[PATH_MAX]; int j; char *fn = (char*)lp->data; + struct stat st; if(is_in(fn, complete)) { continue; } - snprintf(output, PATH_MAX, "%s/%s", localpath, fn); + snprintf(output, PATH_MAX, "%s/%s.part", localpath, fn); strncpy(sync_fnm, lp->data, 24); for(j = strlen(sync_fnm); j < 24; j++) { sync_fnm[j] = ' '; @@ -157,30 +158,36 @@ int downloadfiles(PMList *servers, char *localpath, PMList *files) 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); + } + } /* 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); - /* declare our working file so it can be removed it on interrupt */ - /* by the cleanup() function */ - if(workfile) { - FREE(workfile); - } - MALLOC(workfile, PATH_MAX); - strcpy(workfile, output); - if(!FtpGet(output, lp->data, FTPLIB_IMAGE, control)) { fprintf(stderr, "\nfailed downloading %s from %s: %s\n", fn, server->server, FtpLastResponse(control)); - /* unlink the file */ - unlink(output); + /* we leave the partially downloaded file in place so it can be resumed later */ } else { - log_progress(control, fsz, &fsz); + 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); } - FREE(workfile); printf("\n"); fflush(stdout); } else { @@ -220,20 +227,20 @@ int downloadfiles(PMList *servers, char *localpath, PMList *files) static int log_progress(netbuf *ctl, int xfered, void *arg) { - int fsz = *(int*)arg; - int pct = ((float)xfered / fsz) * 100; - int i; - - printf("%s [", sync_fnm); - for(i = 0; i < (int)(pct/3); i++) { - printf("#"); - } - for(i = (int)(pct/3); i < (int)(100/3); i++) { - printf(" "); - } - printf("] %3d%% | %6dK\r", pct, (xfered/1024)); - fflush(stdout); - return(1); + int fsz = *(int*)arg; + int pct = ((float)(xfered+offset) / fsz) * 100; + int i; + + printf("%s [", sync_fnm); + for(i = 0; i < (int)(pct/3); i++) { + printf("#"); + } + for(i = (int)(pct/3); i < (int)(100/3); i++) { + printf(" "); + } + printf("] %3d%% | %6dK\r ", pct, ((xfered+offset)/1024)); + fflush(stdout); + return(1); } /* vim: set ts=2 sw=2 noet: */ diff --git a/src/util.c b/src/util.c index cba4a050..96a91371 100644 --- a/src/util.c +++ b/src/util.c @@ -59,6 +59,7 @@ extern unsigned short pmo_s_clean; extern unsigned short pmo_s_upgrade; extern unsigned short pmo_s_downloadonly; extern PMList *pmo_noupgrade; +extern PMList *pmo_ignorepkg; extern PMList *pmc_syncs; extern PMList *pm_targets; @@ -305,6 +306,18 @@ int parseconfig(char *configfile) } pmo_noupgrade = list_add(pmo_noupgrade, strdup(p)); vprint("config: noupgrade: %s\n", p); + } else if(!strcmp(key, "IGNOREPKG")) { + char *p = ptr; + char *q; + while((q = strchr(p, ' '))) { + *q = '\0'; + pmo_ignorepkg = list_add(pmo_ignorepkg, strdup(p)); + vprint("config: ignorepkg: %s\n", p); + p = q; + p++; + } + pmo_ignorepkg = list_add(pmo_ignorepkg, strdup(p)); + vprint("config: ignorepkg: %s\n", p); } else { fprintf(stderr, "config: line %d: syntax error\n", linenum); return(1);