From 9d9b0e8d2655f5430bf917452221400fc219a2d8 Mon Sep 17 00:00:00 2001 From: Judd Vinet Date: Wed, 11 Dec 2002 21:56:52 +0000 Subject: Imported from pacman-2.2.tar.gz --- ChangeLog | 17 +++++++++----- Makefile.in | 2 +- README | 5 +++++ TODO | 21 +++++++++-------- doc/makepkg.8.in | 2 +- doc/pacman.8.in | 5 ++++- etc/pacman.conf | 21 ++++++++--------- scripts/abs | 2 +- scripts/gensync | 2 +- scripts/makepkg | 9 +++++--- scripts/makeworld | 2 +- src/package.c | 16 ++++++++----- src/pacman.c | 67 ++++++++++++++++++++++++++++++++++++++++--------------- src/pacman.h | 2 +- src/util.c | 18 +++++++++------ 15 files changed, 125 insertions(+), 66 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5715d16d..7837894e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,14 +1,19 @@ VERSION DESCRIPTION ------------------------------------------------------------------ +2.2 - More bugfixes + - Added --downloadonly switch to --sync +2.1 - Lots of bugfixes + - Added support for multiple respositories + - Improved the config file layout - Improved dependency resolution and sorting 2.0 - Added dependency functionality - Completely new database format, similar to FreeBSD - - Better internal data structures - - Merged pacsync functionality into pacman - - Now uses libftp for all file retrieval (currently only ftp) - - Automatic dependency resolution, a la apt-get - - Moved config stuff from /etc/pacsync.conf to /etc/pacman.conf - - Much better backup file handling, now uses md5 hashes a la rpm + - Better internal data structures + - Merged pacsync functionality into pacman + - Now uses libftp for all file retrieval (currently only ftp) + - Automatic dependency resolution, a la apt-get + - Moved config stuff from /etc/pacsync.conf to /etc/pacman.conf + - Much better backup file handling, now uses md5 hashes a la rpm 1.23 - Added install/upgrade/remove scripting control 1.22 - Some manpage typo fixes - Added --root switch to pacsync diff --git a/Makefile.in b/Makefile.in index 07e5d802..18a44543 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.1 +PACVER = 2.2 LIBTAR_VERSION = 1.2.5 TOPDIR = @srcdir@ diff --git a/README b/README index cb4b27de..df24ed93 100644 --- a/README +++ b/README @@ -55,3 +55,8 @@ licensed through the GNU General Public License (see COPYING). pacman uses "libtar", a library for reading/writing tar-files. This library is Copyright (c) 1998-2001 Mark D. Roth (see libtar-X.X.X/COPYRIGHT for further details). + +pacman uses "ftplib", a library for sending/receiving files via FTP. This +library is copyright (c) 1996-2000 Thomas Pfau, pfau@cnj.digex.net (see +libftp/ftplib.c for furthur details). + diff --git a/TODO b/TODO index 2e4c64e6..e6b69f68 100644 --- a/TODO +++ b/TODO @@ -1,27 +1,30 @@ +- add a way to clean /var/cache/pacman/src +- add other options to config file: db location, overwrite behaviour, etc. +- don't skip the db update when a package fails to upgrade - we lose the entry - have "group" designations -- use 'set -e' in makepkg? -- if a package fails, ask before aborting the full operation -- ask, then remove conflicting packages with --sync -- use a provides tag (instead of an OR operator in depends) +? use 'set -e' in makepkg? +x if a package fails, ask before aborting the full operation + - can't -- further dependent packages may fail b/c of the first failure +? ask, then remove conflicting packages with --sync +? use a provides tag (instead of an OR operator in depends) - add a freshen operation - add a 'cascade' option to --remove that will remove a package and all requiredby packages under it - check $PACCONF env var - ftp transfer progress bar breaks after ~42000 K -- use a 'trust pacman' config option for downgrading? +? use a 'trust pacman' config option for downgrading? - instead of 'conflicts' use a ! operator in depends - add a --pretend option - add a consistency/sanity check operation - add a --dbpath option -- build-time (source) dependencies in makepkg +? build-time (source) dependencies in makepkg - auto-resolve dependencies in makepkg - use package caches more for performance -+ add an "ignore package" option in either pacman.conf or in each package - record. this will prevent it from being upgraded from the sync set +- IgnorePkg option in pacman.conf to ignore updates from the sync repo - if a package is removed with --nodeps and re-installed, the requiredby fields of it's required packages are not updated - duplicate dep checks occur with sync (one in sync, one in add) - clean up output a bit (message queue?) -- run ldd on every executable in a newly built package to find required so's +? run ldd on every executable in a newly built package to find required so's - use a files.cache gdbm (or whatever) for --owns and db_find_conflicts diff --git a/doc/makepkg.8.in b/doc/makepkg.8.in index e21fec1c..bb2b313e 100644 --- a/doc/makepkg.8.in +++ b/doc/makepkg.8.in @@ -1,4 +1,4 @@ -.TH makepkg 8 "July 18, 2002" "makepkg #VERSION#" "" +.TH makepkg 8 "November 7, 2002" "makepkg #VERSION#" "" .SH NAME makepkg \- package build utility .SH SYNOPSIS diff --git a/doc/pacman.8.in b/doc/pacman.8.in index d8bb26b7..db72e5ff 100644 --- a/doc/pacman.8.in +++ b/doc/pacman.8.in @@ -1,4 +1,4 @@ -.TH pacman 8 "August 18, 2002" "pacman #VERSION#" "" +.TH pacman 8 "November 7, 2002" "pacman #VERSION#" "" .SH NAME pacman \- package manager utility .SH SYNOPSIS @@ -99,6 +99,9 @@ installed/upgraded if necessary. This will search each package in the package list for names or descriptions that contains . .TP +.B "\-w, \-\-downloadonly" +Retrieve all packages from the server, but do not install/upgrade anything. +.TP .B "\-c, \-\-clean" Remove packages from the cache. When pacman downloads packages, it saves them in \fI/var/cache/pacman/pkg\fP. If you need to free up diff --git a/etc/pacman.conf b/etc/pacman.conf index c0b833b6..491520b2 100644 --- a/etc/pacman.conf +++ b/etc/pacman.conf @@ -7,42 +7,43 @@ # during an install/upgrade. (note: do not include the leading slash) [options] NoUpgrade = etc/passwd etc/group etc/shadow -NoUpgrade = etc/fstab +NoUpgrade = etc/fstab etc/rc.conf etc/rc.local +NoUpgrade = etc/lilo.conf [current] Server = ftp://ftp.ibiblio.org/pub/linux/distributions/archlinux/current +Server = ftp://ftp.webtrek.com/pub/mirrors/archlinux/current Server = ftp://ftp.mpi-sb.mpg.de/pub/linux/mirror/ftp.ibiblio.org/pub/Linux/distributions/archlinux/current Server = ftp://ftp.oit.unc.edu/pub/Linux/distributions/archlinux/current Server = ftp://ftp.tu-chemnitz.de/pub/linux/sunsite.unc-mirror/distributions/archlinux/current -Server = ftp://gd.tuwien.ac.at/opsys/linux/archlinux/current -Server = ftp://ftp2.archlinux.org/current -Server = ftp://ftp3.archlinux.org/current Server = ftp://ftp.archlinux.org/current +Server = ftp://gd.tuwien.ac.at/opsys/linux/archlinux/current +Server = ftp://saule.mintis.lt/pub/linux/current # Uncomment this block to access the 'unofficial' package set # #[unofficial] #Server = ftp://ftp.ibiblio.org/pub/linux/distributions/archlinux/unofficial +#Server = ftp://ftp.webtrek.com/pub/mirrors/archlinux/unofficial #Server = ftp://ftp.mpi-sb.mpg.de/pub/linux/mirror/ftp.ibiblio.org/pub/Linux/distributions/archlinux/unofficial #Server = ftp://ftp.oit.unc.edu/pub/Linux/distributions/archlinux/unofficial #Server = ftp://ftp.tu-chemnitz.de/pub/linux/sunsite.unc-mirror/distributions/archlinux/unofficial -#Server = ftp://gd.tuwien.ac.at/opsys/linux/archlinux/unofficial -#Server = ftp://ftp2.archlinux.org/unofficial -#Server = ftp://ftp3.archlinux.org/unofficial #Server = ftp://ftp.archlinux.org/unofficial +#Server = ftp://gd.tuwien.ac.at/opsys/linux/archlinux/unofficial +#Server = ftp://saule.mintis.lt/pub/linux/unofficial # If you use the 'stable' tree, you should disable the 'current' # tree to avoid conflicts # #[stable] #Server = ftp://ftp.ibiblio.org/pub/linux/distributions/archlinux/stable +#Server = ftp://ftp.webtrek.com/pub/mirrors/archlinux/stable #Server = ftp://ftp.mpi-sb.mpg.de/pub/linux/mirror/ftp.ibiblio.org/pub/Linux/distributions/archlinux/stable #Server = ftp://ftp.oit.unc.edu/pub/Linux/distributions/archlinux/stable #Server = ftp://ftp.tu-chemnitz.de/pub/linux/sunsite.unc-mirror/distributions/archlinux/stable #Server = ftp://ftp.archlinux.org/stable -#Server = ftp://ftp.oit.unc.edu/pub/Linux/distributions/archlinux/stable -#Server = ftp://ftp2.archlinux.org/stable -#Server = ftp://ftp3.archlinux.org/stable +#Server = ftp://gd.tuwien.ac.at/opsys/linux/archlinux/stable +#Server = ftp://saule.mintis.lt/pub/linux/stable # This is a typical setup for a local package repository. To have pacman # resolve dependencies and install your custom packages with the --sync diff --git a/scripts/abs b/scripts/abs index 10e9b9c4..37e39be8 100755 --- a/scripts/abs +++ b/scripts/abs @@ -1,6 +1,6 @@ #!/bin/bash -myver='2.1' +myver='2.2' ABS_ROOT=/usr/abs usage() { diff --git a/scripts/gensync b/scripts/gensync index 4b0f882d..841fae8d 100755 --- a/scripts/gensync +++ b/scripts/gensync @@ -1,6 +1,6 @@ #!/bin/bash -myver='2.1' +myver='2.2' usage() { echo "gensync $myver" diff --git a/scripts/makepkg b/scripts/makepkg index 35e7dac9..7304987d 100755 --- a/scripts/makepkg +++ b/scripts/makepkg @@ -1,6 +1,6 @@ #!/bin/bash -myver='2.1' +myver='2.2' startdir=`pwd` [ -f /etc/makepkg.conf ] && source /etc/makepkg.conf @@ -138,6 +138,7 @@ for netfile in ${source[@]}; do fi mkdir -p /var/cache/pacman/src && cp $file /var/cache/pacman/src fi + unset cmd case $file in *.tar.gz|*.tar.Z|*.tgz) cmd="tar --use-compress-program=gzip -xf $file" ;; @@ -150,8 +151,10 @@ for netfile in ${source[@]}; do *.gz) cmd="gunzip $file" ;; esac - msg "==> $cmd" - $cmd + if [ "$cmd" != "" ]; then + msg "==> $cmd" + $cmd + fi done # check for existing pkg directory diff --git a/scripts/makeworld b/scripts/makeworld index 448dbc49..7cf04a76 100755 --- a/scripts/makeworld +++ b/scripts/makeworld @@ -1,7 +1,7 @@ #!/bin/bash toplevel=`pwd` -version="2.1" +version="2.2" usage() { echo "makeworld version $version" diff --git a/src/package.c b/src/package.c index 95913b14..1fd12c7a 100644 --- a/src/package.c +++ b/src/package.c @@ -62,11 +62,11 @@ pkginfo_t* load_pkg(char *pkgfile, unsigned short output) /* parse the info file */ parse_descfile(descfile, info, &backup, output); if(!strlen(info->name)) { - fprintf(stderr, "error: missing package name in description file.\n"); + fprintf(stderr, "load_pkg: missing package name in %s.\n", pkgfile); return(NULL); } if(!strlen(info->version)) { - fprintf(stderr, "error: missing package version in description file.\n"); + fprintf(stderr, "load_pkg: missing package version in %s.\n", pkgfile); return(NULL); } for(lp = backup; lp; lp = lp->next) { @@ -85,7 +85,9 @@ pkginfo_t* load_pkg(char *pkgfile, unsigned short output) } if(TH_ISREG(tar) && tar_skip_regfile(tar)) { - perror("bad package file"); + char errorstr[255]; + snprintf(errorstr, 255, "bad package file in %s", pkgfile); + perror(errorstr); return(NULL); } expath = NULL; @@ -94,7 +96,7 @@ pkginfo_t* load_pkg(char *pkgfile, unsigned short output) FREE(descfile); if(!strlen(info->name) || !strlen(info->version)) { - fprintf(stderr, "Error: Missing .PKGINFO file in %s\n", pkgfile); + fprintf(stderr, "load_pkg: missing package info file in %s\n", pkgfile); return(NULL); } @@ -136,7 +138,8 @@ int parse_descfile(char *descfile, pkginfo_t *info, PMList **backup, int output) ptr = line; key = strsep(&ptr, "="); if(key == NULL || ptr == NULL) { - fprintf(stderr, "Syntax error in description file line %d\n", linenum); + fprintf(stderr, "%s: syntax error in description file line %d\n", + info->name[0] != '\0' ? info->name : "error", linenum); } else { trim(key); key = strtoupper(key); @@ -167,7 +170,8 @@ int parse_descfile(char *descfile, pkginfo_t *info, PMList **backup, int output) char *s = strdup(ptr); bak = list_add(bak, s); } else { - fprintf(stderr, "Syntax error in description file line %d\n", linenum); + fprintf(stderr, "%s: syntax error in description file line %d\n", + info->name[0] != '\0' ? info->name : "error", linenum); } } line[0] = '\0'; diff --git a/src/pacman.c b/src/pacman.c index 053c5081..4d2cbb4b 100644 --- a/src/pacman.c +++ b/src/pacman.c @@ -69,6 +69,7 @@ unsigned short pmo_q_info = 0; unsigned short pmo_q_list = 0; unsigned short pmo_q_owns = 0; unsigned short pmo_s_upgrade = 0; +unsigned short pmo_s_downloadonly = 0; unsigned short pmo_s_sync = 0; unsigned short pmo_s_search = 0; unsigned short pmo_s_clean = 0; @@ -382,13 +383,27 @@ int pacman_sync(pacdb_t *db, PMList *targets) /* versions are identical */ continue; } else { + PMList *lp = NULL; + int found = 0; /* re-fetch the package record with dependency info */ sync->pkg = db_scan(sync->dbs->db, sync->pkg->name, INFRQ_DESC | INFRQ_DEPENDS); /* add to the targets list */ - if(!list_isin(final, sync)) { + for(found = 0, lp = final; lp && !found; lp = lp->next) { + syncpkg_t *s = (syncpkg_t*)lp->data; + if(s && !strcmp(s->pkg->name, sync->pkg->name)) { + found = 1; + } + } + if(!found) { allgood = !resolvedeps(db, databases, sync, final, trail); /* check again, as resolvedeps could have added our target for us */ - if(!list_isin(final, sync)) { + for(found = 0, lp = final; lp && !found; lp = lp->next) { + syncpkg_t *s = (syncpkg_t*)lp->data; + if(s && !strcmp(s->pkg->name, sync->pkg->name)) { + found = 1; + } + } + if(!found) { final = list_add(final, sync); } } @@ -407,7 +422,6 @@ int pacman_sync(pacdb_t *db, PMList *targets) MALLOC(sync, sizeof(syncpkg_t)); local = db_scan(db, (char*)i->data, INFRQ_DESC); - //sync = db_scan(db_sync, (char*)i->data, INFRQ_DESC | INFRQ_DEPENDS); for(j = databases; !found && j; j = j->next) { dbsync_t *dbs = (dbsync_t*)j->data; for(k = dbs->pkgcache; !found && k; k = k->next) { @@ -479,6 +493,7 @@ int pacman_sync(pacdb_t *db, PMList *targets) list = list_add(list, s->pkg); } } + deps = checkdeps(db, PM_UPGRADE, list); if(deps) { fprintf(stderr, "error: unresolvable conflicts/dependencies:\n"); @@ -538,7 +553,11 @@ int pacman_sync(pacdb_t *db, PMList *targets) /* get confirmation */ confirm = 0; if(allgood && final && final->data) { - confirm = yesno("\nDo you want to install/upgrade these packages? [Y/n] "); + if(pmo_s_downloadonly) { + confirm = yesno("\nDo you want to download these packages? [Y/n] "); + } else { + confirm = yesno("\nDo you want to install/upgrade these packages? [Y/n] "); + } } } @@ -625,21 +644,24 @@ int pacman_sync(pacdb_t *db, PMList *targets) list_free(files); files = NULL; } - /* install targets */ - for(i = final; allgood && i; i = i->next) { - char *str; - syncpkg_t *sync = (syncpkg_t*)i->data; - if(sync->pkg) { - MALLOC(str, PATH_MAX); - snprintf(str, PATH_MAX, "%s/%s-%s.pkg.tar.gz", ldir, sync->pkg->name, sync->pkg->version); - files = list_add(files, str); + + if(!pmo_s_downloadonly) { + /* install targets */ + for(i = final; allgood && i; i = i->next) { + char *str; + syncpkg_t *sync = (syncpkg_t*)i->data; + if(sync->pkg) { + MALLOC(str, PATH_MAX); + snprintf(str, PATH_MAX, "%s/%s-%s.pkg.tar.gz", ldir, sync->pkg->name, sync->pkg->version); + files = list_add(files, str); + } + } + if(allgood) { + pacman_upgrade(db, files); } - } - if(allgood) { - pacman_upgrade(db, files); } - if(!varcache) { + if(!varcache && !pmo_s_downloadonly) { /* delete packages */ for(i = files; i; i = i->next) { unlink(i->data); @@ -688,7 +710,8 @@ int pacman_add(pacdb_t *db, PMList *targets) return(0); } - vprint("Loading all target data...\n"); + printf("loading package data... "); + fflush(stdout); for(targ = targets; targ; targ = targ->next) { /* Populate the package struct */ vprint(" %s\n", (char*)targ->data); @@ -699,9 +722,10 @@ int pacman_add(pacdb_t *db, PMList *targets) alltargs = list_add(alltargs, info); filenames = list_add(filenames, strdup(targ->data)); } + printf("done.\n"); if(!pmo_nodeps) { - vprint("Checking dependencies...\n"); + vprint("checking dependencies...\n"); lp = checkdeps(db, (pmo_upgrade ? PM_UPGRADE : PM_ADD), alltargs); if(lp) { fprintf(stderr, "error: unsatisfied dependencies:\n"); @@ -1516,9 +1540,15 @@ PMList* checkdeps(pacdb_t *db, unsigned short op, PMList *targets) pkginfo_t *p; found = 0; if((p = db_scan(db, j->data, INFRQ_DESC | INFRQ_DEPENDS)) == NULL) { + /* hmmm... package isn't installed.. */ + continue; + } + if(is_pkgin(p, targets)) { + /* this package is also in the upgrade list, so don't worry about it */ continue; } for(k = p->depends; k && !found; k = k->next) { + /* find the dependency info in p->depends */ if(splitdep(k->data, &depend)) { continue; } @@ -1527,6 +1557,7 @@ PMList* checkdeps(pacdb_t *db, unsigned short op, PMList *targets) } } if(found == 0) { + /* not found */ continue; } found = 0; diff --git a/src/pacman.h b/src/pacman.h index 37b86853..c9794737 100644 --- a/src/pacman.h +++ b/src/pacman.h @@ -22,7 +22,7 @@ #define _PAC_PACMAN_H #ifndef PACVER -#define PACVER "2.1" +#define PACVER "2.2" #endif #ifndef PKGDIR diff --git a/src/util.c b/src/util.c index b5930bcf..6d4c1bc7 100644 --- a/src/util.c +++ b/src/util.c @@ -55,6 +55,7 @@ extern unsigned short pmo_s_sync; extern unsigned short pmo_s_search; extern unsigned short pmo_s_clean; extern unsigned short pmo_s_upgrade; +extern unsigned short pmo_s_downloadonly; extern PMList *pmo_noupgrade; extern PMList *pmc_syncs; @@ -156,11 +157,12 @@ int parseargs(int op, int argc, char **argv) {"file", no_argument, 0, 'p'}, {"info", no_argument, 0, 'i'}, {"sysupgrade", no_argument, 0, 'u'}, + {"downloadonly", no_argument, 0, 'w'}, {"refresh", no_argument, 0, 'y'}, {0, 0, 0, 0} }; - while((opt = getopt_long(argc, argv, "ARUQSTYr:vhscVfnoldpiuy", opts, &option_index))) { + while((opt = getopt_long(argc, argv, "ARUQSTYr:vhscVfnoldpiuwy", opts, &option_index))) { if(opt < 0) { break; } @@ -184,6 +186,7 @@ int parseargs(int op, int argc, char **argv) case 'i': pmo_q_info = 1; break; case 'o': pmo_q_owns = 1; break; case 'u': pmo_s_upgrade = 1; break; + case 'w': pmo_s_downloadonly = 1; break; case 'y': pmo_s_sync = 1; break; case 's': pmo_s_search = 1; break; case 'c': pmo_s_clean = 1; break; @@ -510,12 +513,13 @@ void usage(int op, char *myname) } else if(op == PM_SYNC) { printf("usage: %s {-S --sync} [options] [package]\n", myname); printf("options:\n"); - printf(" -s, --search search sync database for matching strings\n"); - printf(" -f, --force force install, overwrite conflicting files\n"); - printf(" -d, --nodeps skip dependency checks\n"); - printf(" -y, --refresh download a fresh package sync database from the server\n"); - printf(" -u, --sysupgrade upgrade all packages that are out of date\n"); - printf(" -c, --clean remove packages from cache directory to free up diskspace\n"); + printf(" -s, --search search sync database for matching strings\n"); + printf(" -f, --force force install, overwrite conflicting files\n"); + printf(" -d, --nodeps skip dependency checks\n"); + printf(" -y, --refresh download a fresh package sync database from the server\n"); + printf(" -u, --sysupgrade upgrade all packages that are out of date\n"); + printf(" -w, --downloadonly download packages, but do not install/upgrade anything\n"); + printf(" -c, --clean remove packages from cache directory to free up diskspace\n"); } printf(" -v, --verbose be verbose\n"); printf(" -r, --root set an alternate installation root\n"); -- cgit v1.2.3-24-g4f1b