Imported from pacman-2.3.2.tar.gz

This commit is contained in:
Judd Vinet 2003-03-17 19:36:48 +00:00
parent 0207fad046
commit 185ce5454e
15 changed files with 133 additions and 55 deletions

View file

@ -1,5 +1,10 @@
VERSION DESCRIPTION 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 2.3.1 - Fixed the progress bar overflow
- Pacman does not ask "Are you sure" when you use --downloadonly - Pacman does not ask "Are you sure" when you use --downloadonly
- Switched up a couple makepkg options to be more consistent - Switched up a couple makepkg options to be more consistent

View file

@ -34,7 +34,7 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS)
INSTALL_DATA = @INSTALL_DATA@ INSTALL_DATA = @INSTALL_DATA@
INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_SCRIPT = @INSTALL_SCRIPT@
PACVER = 2.3.1 PACVER = 2.3.2
LIBTAR_VERSION = 1.2.5 LIBTAR_VERSION = 1.2.5
TOPDIR = @srcdir@ TOPDIR = @srcdir@

1
TODO
View file

@ -2,7 +2,6 @@
- add some logging mechanism (/var/log/pacman.log) - add some logging mechanism (/var/log/pacman.log)
- handle version comparators in makepkg dep resolution (eg, glibc>=2.2.5) - handle version comparators in makepkg dep resolution (eg, glibc>=2.2.5)
- have "group" designations - have "group" designations
- IgnorePkg option/switch in pacman.conf to ignore updates from the sync repo
- record md5sums of all files in a package - record md5sums of all files in a package
- add a way to clean /var/cache/pacman/src - add a way to clean /var/cache/pacman/src
- duplicate dep checks occur with sync (one in sync, one in add) - duplicate dep checks occur with sync (one in sync, one in add)

View file

@ -5,6 +5,11 @@
# the top-level directory of all your PKGBUILDs # the top-level directory of all your PKGBUILDs
export ABSROOT="/usr/abs" 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 # Pentium Pro/Pentium II/Pentium III+/Pentium 4/Athlon optimized (but binaries
# will run on any x86 system) # will run on any x86 system)
#export CHOST="i686-pc-linux-gnu" #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. # if you want your name to show up in the packages you build, set this.
#export PACKAGER="John Doe <john@doe.com>" #export PACKAGER="John Doe <john@doe.com>"

View file

@ -2,14 +2,21 @@
# /etc/pacman.conf # /etc/pacman.conf
# #
# Currently the only option directive is NoUpgrade. Use this with a # GENERAL OPTIONS
# space-delimited list of files that should never be touched by pacman # NoUpgrade: a space-delimited list of files that should never
# during an install/upgrade. (note: do not include the leading slash) # 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] [options]
NoUpgrade = etc/passwd etc/group etc/shadow NoUpgrade = etc/passwd etc/group etc/shadow
NoUpgrade = etc/fstab etc/rc.conf etc/rc.local NoUpgrade = etc/fstab etc/rc.conf etc/rc.local
NoUpgrade = etc/lilo.conf etc/raidtab NoUpgrade = etc/lilo.conf etc/raidtab
#IgnorePkg = lilo gcc
#
# REPOSITORIES
#
[current] [current]
Server = ftp://ftp.archlinux.org/current Server = ftp://ftp.archlinux.org/current
Server = ftp://ftp.ibiblio.org/pub/linux/distributions/archlinux/current Server = ftp://ftp.ibiblio.org/pub/linux/distributions/archlinux/current

View file

@ -1104,7 +1104,7 @@ static int FtpXfer(const char *localfile, const char *path,
if (localfile != NULL) if (localfile != NULL)
{ {
char ac[4] = "w"; char ac[4] = "a";
if (typ == FTPLIB_FILE_WRITE) if (typ == FTPLIB_FILE_WRITE)
ac[0] = 'r'; ac[0] = 'r';
if (mode == FTPLIB_IMAGE) if (mode == FTPLIB_IMAGE)
@ -1199,6 +1199,22 @@ GLOBALDEF int FtpSize(const char *path, int *size, char mode, netbuf *nControl)
return rv; 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 * FtpModDate - determine the modification date of a remote file
* *

View file

@ -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 FtpNlst(const char *output, const char *path, netbuf *nControl);
GLOBALREF int FtpDir(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 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 FtpModDate(const char *path, char *dt, int max, netbuf *nControl);
GLOBALREF int FtpGet(const char *output, const char *path, char mode, GLOBALREF int FtpGet(const char *output, const char *path, char mode,
netbuf *nControl); netbuf *nControl);

View file

@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
myver='2.3.1' myver='2.3.2'
usage() { usage() {
echo "gensync $myver" echo "gensync $myver"

View file

@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
myver='2.3.1' myver='2.3.2'
startdir=`pwd` startdir=`pwd`
[ -f /etc/makepkg.conf ] && source /etc/makepkg.conf [ -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 "usage: $0 [options] [build_script]"
echo "options:" echo "options:"
echo " -c, --clean Clean up work files after build" 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 " -s, --syncdeps Install missing dependencies with pacman"
echo " -b, --builddeps Build missing dependencies from source" echo " -b, --builddeps Build missing dependencies from source"
echo " -d, --nodeps Skip all dependency checks" echo " -d, --nodeps Skip all dependency checks"
@ -67,6 +68,7 @@ fi
# Options # Options
CLEANUP=0 CLEANUP=0
CLEANCACHE=0
INSTALL=0 INSTALL=0
DEP_BIN=0 DEP_BIN=0
DEP_SRC=0 DEP_SRC=0
@ -79,6 +81,9 @@ for arg in $*; do
-c|--clean) -c|--clean)
CLEANUP=1 CLEANUP=1
;; ;;
-C|--cleancache)
CLEANCACHE=1
;;
-s|--syncdeps) -s|--syncdeps)
DEP_BIN=1 DEP_BIN=1
;; ;;
@ -100,22 +105,16 @@ for arg in $*; do
esac esac
done 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 pkgname pkgver pkgrel pkgdesc
unset depends conflicts backup source install build unset depends conflicts backup source install build
umask 0022 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 if [ ! -f $BUILDSCRIPT ]; then
msg "==> ERROR: $BUILDSCRIPT does not exist." msg "==> ERROR: $BUILDSCRIPT does not exist."
exit 1 exit 1
@ -151,7 +150,7 @@ if [ `type -p pacman` -a "$NODEPS" = "0" ]; then
msg "==> ERROR: Failed to install missing dependencies." msg "==> ERROR: Failed to install missing dependencies."
exit 1 exit 1
fi 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 elif [ "$DEP_SRC" = "1" ]; then
# install missing deps by building them from source. # install missing deps by building them from source.
# we look for each package name in $ABSROOT and build it. # 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 exit 1
fi fi
done done
# TODO: check deps again to make sure they were resolved # TODO: check deps again to make sure they were resolved
else else
exit 1 exit 1
fi fi
@ -211,6 +210,18 @@ for netfile in ${source[@]}; do
msg "==> Using local copy of $file" msg "==> Using local copy of $file"
cp /var/cache/pacman/src/$file . cp /var/cache/pacman/src/$file .
else 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|://.*||'` proto=`echo $netfile | sed 's|://.*||'`
if [ "$proto" != "ftp" -a "$proto" != "http" ]; then if [ "$proto" != "ftp" -a "$proto" != "http" ]; then
msg "==> ERROR: $netfile was not found in the build directory and is not a proper URL." 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 exit 1
fi fi
msg "==> Downloading $file" msg "==> Downloading $file"
$ftpagent $netfile 2>&1 $FTPAGENT $netfile 2>&1
if [ ! -f $file ]; then if [ ! -f $file ]; then
msg "==> ERROR: Failed to download $file" msg "==> ERROR: Failed to download $file"
msg "==> Aborting..." msg "==> Aborting..."
@ -242,6 +253,11 @@ for netfile in ${source[@]}; do
if [ "$cmd" != "" ]; then if [ "$cmd" != "" ]; then
msg "==> $cmd" msg "==> $cmd"
$cmd $cmd
if [ $? -ne 0 ]; then
msg "==> ERROR: Failed to extract $file"
msg "==> Aborting..."
exit 1
fi
fi fi
done done
@ -348,7 +364,7 @@ fi
cd $startdir cd $startdir
if [ "$CLEANUP" = "1" ]; then if [ "$CLEANUP" = "1" ]; then
msg "==> Cleaning up" msg "==> Cleaning up"
rm -rf src pkg rm -rf src pkg filelist
fi fi
d=`date` d=`date`

View file

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
toplevel=`pwd` toplevel=`pwd`
version="2.3.1" version="2.3.2"
usage() { usage() {
echo "makeworld version $version" echo "makeworld version $version"

BIN
src/.pacman.c.swp Normal file

Binary file not shown.

View file

@ -76,6 +76,7 @@ unsigned short pmo_s_sync = 0;
unsigned short pmo_s_search = 0; unsigned short pmo_s_search = 0;
unsigned short pmo_s_clean = 0; unsigned short pmo_s_clean = 0;
PMList *pmo_noupgrade = NULL; PMList *pmo_noupgrade = NULL;
PMList *pmo_ignorepkg = NULL;
/* list of sync_t structs for sync locations */ /* list of sync_t structs for sync locations */
@ -379,6 +380,7 @@ int pacman_sync(pacdb_t *db, PMList *targets)
} }
} else if(pmo_s_upgrade) { } else if(pmo_s_upgrade) {
int newer = 0; int newer = 0;
int ignore = 0;
for(i = pm_packages; i && allgood; i = i->next) { for(i = pm_packages; i && allgood; i = i->next) {
int cmp, found = 0; int cmp, found = 0;
pkginfo_t *local = (pkginfo_t*)i->data; 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);*/ /*fprintf(stderr, "%s: not found in sync db. skipping.", local->name);*/
continue; 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 */ /* compare versions and see if we need to upgrade */
cmp = rpmvercmp(local->version, sync->pkg->version); cmp = rpmvercmp(local->version, sync->pkg->version);
if(cmp > 0) { 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 <pkg>'\n"); fprintf(stderr, ":: Above packages will be skipped. To manually upgrade use 'pacman -S <pkg>'\n");
} }
} else { } else {

View file

@ -22,7 +22,7 @@
#define _PAC_PACMAN_H #define _PAC_PACMAN_H
#ifndef PACVER #ifndef PACVER
#define PACVER "2.3.1" #define PACVER "2.3.2"
#endif #endif
#ifndef PKGDIR #ifndef PKGDIR

View file

@ -38,6 +38,7 @@
static int log_progress(netbuf *ctl, int xfered, void *arg); static int log_progress(netbuf *ctl, int xfered, void *arg);
static char sync_fnm[25]; static char sync_fnm[25];
static int offset;
/* pacman options */ /* pacman options */
extern char *pmo_root; extern char *pmo_root;
@ -104,7 +105,6 @@ int downloadfiles(PMList *servers, char *localpath, PMList *files)
int done = 0; int done = 0;
PMList *complete = NULL; PMList *complete = NULL;
PMList *i; PMList *i;
extern char* workfile;
if(files == NULL) { if(files == NULL) {
return(0); return(0);
@ -136,12 +136,13 @@ int downloadfiles(PMList *servers, char *localpath, PMList *files)
char output[PATH_MAX]; char output[PATH_MAX];
int j; int j;
char *fn = (char*)lp->data; char *fn = (char*)lp->data;
struct stat st;
if(is_in(fn, complete)) { if(is_in(fn, complete)) {
continue; continue;
} }
snprintf(output, PATH_MAX, "%s/%s", localpath, fn); snprintf(output, PATH_MAX, "%s/%s.part", localpath, fn);
strncpy(sync_fnm, lp->data, 24); strncpy(sync_fnm, lp->data, 24);
for(j = strlen(sync_fnm); j < 24; j++) { for(j = strlen(sync_fnm); j < 24; j++) {
sync_fnm[j] = ' '; sync_fnm[j] = ' ';
@ -157,30 +158,36 @@ int downloadfiles(PMList *servers, char *localpath, PMList *files)
if(!FtpSize(fn, &fsz, FTPLIB_IMAGE, control)) { if(!FtpSize(fn, &fsz, FTPLIB_IMAGE, control)) {
fprintf(stderr, "warning: failed to get filesize for %s\n", fn); 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 */ /* set up our progress bar's callback */
FtpOptions(FTPLIB_CALLBACK, (long)log_progress, control); FtpOptions(FTPLIB_CALLBACK, (long)log_progress, control);
FtpOptions(FTPLIB_IDLETIME, (long)1000, control); FtpOptions(FTPLIB_IDLETIME, (long)1000, control);
FtpOptions(FTPLIB_CALLBACKARG, (long)&fsz, control); FtpOptions(FTPLIB_CALLBACKARG, (long)&fsz, control);
FtpOptions(FTPLIB_CALLBACKBYTES, (10*1024), 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)) { if(!FtpGet(output, lp->data, FTPLIB_IMAGE, control)) {
fprintf(stderr, "\nfailed downloading %s from %s: %s\n", fprintf(stderr, "\nfailed downloading %s from %s: %s\n",
fn, server->server, FtpLastResponse(control)); fn, server->server, FtpLastResponse(control));
/* unlink the file */ /* we leave the partially downloaded file in place so it can be resumed later */
unlink(output);
} else { } else {
log_progress(control, fsz, &fsz); char completefile[PATH_MAX];
log_progress(control, fsz-offset, &fsz);
complete = list_add(complete, fn); 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"); printf("\n");
fflush(stdout); fflush(stdout);
} else { } else {
@ -220,20 +227,20 @@ int downloadfiles(PMList *servers, char *localpath, PMList *files)
static int log_progress(netbuf *ctl, int xfered, void *arg) static int log_progress(netbuf *ctl, int xfered, void *arg)
{ {
int fsz = *(int*)arg; int fsz = *(int*)arg;
int pct = ((float)xfered / fsz) * 100; int pct = ((float)(xfered+offset) / fsz) * 100;
int i; int i;
printf("%s [", sync_fnm); printf("%s [", sync_fnm);
for(i = 0; i < (int)(pct/3); i++) { for(i = 0; i < (int)(pct/3); i++) {
printf("#"); printf("#");
} }
for(i = (int)(pct/3); i < (int)(100/3); i++) { for(i = (int)(pct/3); i < (int)(100/3); i++) {
printf(" "); printf(" ");
} }
printf("] %3d%% | %6dK\r", pct, (xfered/1024)); printf("] %3d%% | %6dK\r ", pct, ((xfered+offset)/1024));
fflush(stdout); fflush(stdout);
return(1); return(1);
} }
/* vim: set ts=2 sw=2 noet: */ /* vim: set ts=2 sw=2 noet: */

View file

@ -59,6 +59,7 @@ extern unsigned short pmo_s_clean;
extern unsigned short pmo_s_upgrade; extern unsigned short pmo_s_upgrade;
extern unsigned short pmo_s_downloadonly; extern unsigned short pmo_s_downloadonly;
extern PMList *pmo_noupgrade; extern PMList *pmo_noupgrade;
extern PMList *pmo_ignorepkg;
extern PMList *pmc_syncs; extern PMList *pmc_syncs;
extern PMList *pm_targets; extern PMList *pm_targets;
@ -305,6 +306,18 @@ int parseconfig(char *configfile)
} }
pmo_noupgrade = list_add(pmo_noupgrade, strdup(p)); pmo_noupgrade = list_add(pmo_noupgrade, strdup(p));
vprint("config: noupgrade: %s\n", 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 { } else {
fprintf(stderr, "config: line %d: syntax error\n", linenum); fprintf(stderr, "config: line %d: syntax error\n", linenum);
return(1); return(1);