Imported from pacman-2.7.5.tar.gz

This commit is contained in:
Judd Vinet 2004-03-02 04:49:15 +00:00
parent a11fb0b581
commit 88c73d4d65
23 changed files with 146 additions and 42 deletions

View file

@ -1,5 +1,10 @@
VERSION DESCRIPTION VERSION DESCRIPTION
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
2.7.5 - "replaces" packages were ignoring IgnorePkg in pacman.conf
- fixed another bug in conflict handling
- found an out-dated reference to /usr/abs, fixed
- added a --recursive option for package removal, which removes
all deps of a target that aren't required by other packages
2.7.4 - fixed a bug in conflict handling, where installing a 2.7.4 - fixed a bug in conflict handling, where installing a
conflicting package would fail even if the new package conflicting package would fail even if the new package
"provided" it "provided" it

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.7.4 PACVER = 2.7.5
TOPDIR = @srcdir@ TOPDIR = @srcdir@
SRCDIR = $(TOPDIR)/src/ SRCDIR = $(TOPDIR)/src/

View file

@ -87,6 +87,12 @@ which is "owned" by another system. By using this option you not only
specify where the software should be installed, but you also specify where the software should be installed, but you also
specify which package database to use. specify which package database to use.
.TP .TP
.B "\-s, \-\-recursive"
(only used with \fB--remove\fP)
For each target specified, remove it and all its dependencies, provided
they are not required by other packages. This option is analagous to
a backwards --sync operation.
.TP
.B "\-v, \-\-verbose" .B "\-v, \-\-verbose"
Output more status and error messages. Output more status and error messages.
.SH SYNC OPTIONS .SH SYNC OPTIONS
@ -240,16 +246,16 @@ want to use a local directory, you can specify the full path with a 'file://' pr
shown above. shown above.
.SH USING YOUR OWN REPOSITORY .SH USING YOUR OWN REPOSITORY
Let's say you have a bunch of custom packages in \fI/home/pkgs\fP and their respective PKGBUILD Let's say you have a bunch of custom packages in \fI/home/pkgs\fP and their respective PKGBUILD
files are all in \fI/usr/abs/local\fP. All you need to do is generate a compressed package database files are all in \fI/var/abs/local\fP. All you need to do is generate a compressed package database
in the \fI/home/pkgs\fP directory so pacman can find it when run with --refresh. in the \fI/home/pkgs\fP directory so pacman can find it when run with --refresh.
.RS .RS
.nf .nf
# gensync /usr/abs/local /home/pkgs/custom.db.tar.gz # gensync /var/abs/local /home/pkgs/custom.db.tar.gz
.fi .fi
.RE .RE
The above command will read all PKGBUILD files in /usr/abs/local and generate a compressed The above command will read all PKGBUILD files in /var/abs/local and generate a compressed
database called /home/pkgs/custom.db.tar.gz. Note that the database must be of the form database called /home/pkgs/custom.db.tar.gz. Note that the database must be of the form
\fI{treename}.db.tar.gz\fP, where {treename} is the name of the section defined in the \fI{treename}.db.tar.gz\fP, where {treename} is the name of the section defined in the
configuration file. configuration file.

View file

@ -23,7 +23,6 @@ NoUpgrade = etc/fstab etc/raidtab
NoUpgrade = etc/rc.conf etc/rc.local NoUpgrade = etc/rc.conf etc/rc.local
NoUpgrade = etc/modprobe.conf etc/modules.conf NoUpgrade = etc/modprobe.conf etc/modules.conf
NoUpgrade = etc/lilo.conf boot/grub/menu.lst NoUpgrade = etc/lilo.conf boot/grub/menu.lst
#IgnorePkg = lilo kernel
# #
# REPOSITORIES # REPOSITORIES

View file

@ -20,7 +20,7 @@
# USA. # USA.
# #
myver='2.7.4' myver='2.7.5'
usage() { usage() {
echo "gensync $myver" echo "gensync $myver"

View file

@ -20,7 +20,7 @@
# USA. # USA.
# #
myver='2.7.4' myver='2.7.5'
startdir=`pwd` startdir=`pwd`
USE_COLOR="n" USE_COLOR="n"

View file

@ -21,7 +21,7 @@
# #
toplevel=`pwd` toplevel=`pwd`
version="2.7.4" version="2.7.5"
usage() { usage() {
echo "makeworld version $version" echo "makeworld version $version"

View file

@ -1,7 +1,7 @@
/* /*
* convertdb.c * convertdb.c
* *
* Copyright (c) 2002 by Judd Vinet <jvinet@zeroflux.org> * Copyright (c) 2002-2004 by Judd Vinet <jvinet@zeroflux.org>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

View file

@ -1,7 +1,7 @@
/* /*
* db.c * db.c
* *
* Copyright (c) 2002 by Judd Vinet <jvinet@zeroflux.org> * Copyright (c) 2002-2004 by Judd Vinet <jvinet@zeroflux.org>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

View file

@ -1,7 +1,7 @@
/* /*
* db.h * db.h
* *
* Copyright (c) 2002 by Judd Vinet <jvinet@zeroflux.org> * Copyright (c) 2002-2004 by Judd Vinet <jvinet@zeroflux.org>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

View file

@ -1,7 +1,7 @@
/* /*
* list.c * list.c
* *
* Copyright (c) 2002 by Judd Vinet <jvinet@zeroflux.org> * Copyright (c) 2002-2004 by Judd Vinet <jvinet@zeroflux.org>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

View file

@ -1,7 +1,7 @@
/* /*
* list.h * list.h
* *
* Copyright (c) 2002 by Judd Vinet <jvinet@zeroflux.org> * Copyright (c) 2002-2004 by Judd Vinet <jvinet@zeroflux.org>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

View file

@ -1,7 +1,7 @@
/* /*
* package.c * package.c
* *
* Copyright (c) 2002-2003 by Judd Vinet <jvinet@zeroflux.org> * Copyright (c) 2002-2004 by Judd Vinet <jvinet@zeroflux.org>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -289,6 +289,9 @@ int is_pkgin(pkginfo_t *needle, PMList *haystack)
{ {
PMList *lp; PMList *lp;
pkginfo_t *info; pkginfo_t *info;
if(needle == NULL || haystack == NULL) {
return(0);
}
for(lp = haystack; lp; lp = lp->next) { for(lp = haystack; lp; lp = lp->next) {
info = (pkginfo_t*)lp->data; info = (pkginfo_t*)lp->data;

View file

@ -1,7 +1,7 @@
/* /*
* package.h * package.h
* *
* Copyright (c) 2002 by Judd Vinet <jvinet@zeroflux.org> * Copyright (c) 2002-2004 by Judd Vinet <jvinet@zeroflux.org>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

View file

@ -69,6 +69,7 @@ unsigned short pmo_q_list = 0;
unsigned short pmo_q_orphans = 0; unsigned short pmo_q_orphans = 0;
unsigned short pmo_q_owns = 0; unsigned short pmo_q_owns = 0;
unsigned short pmo_r_cascade = 0; unsigned short pmo_r_cascade = 0;
unsigned short pmo_r_recurse = 0;
unsigned short pmo_s_upgrade = 0; unsigned short pmo_s_upgrade = 0;
unsigned short pmo_s_downloadonly = 0; unsigned short pmo_s_downloadonly = 0;
unsigned short pmo_s_sync = 0; unsigned short pmo_s_sync = 0;
@ -549,10 +550,14 @@ int pacman_sync(pacdb_t *db, PMList *targets)
for(m = pm_packages; m; m = m->next) { for(m = pm_packages; m; m = m->next) {
pkginfo_t *p = (pkginfo_t*)m->data; pkginfo_t *p = (pkginfo_t*)m->data;
if(!strcmp(k->data, p->name)) { if(!strcmp(k->data, p->name)) {
if(is_in(p->name, pmo_ignorepkg)) {
fprintf(stderr, ":: %s-%s: ignoring package upgrade (to be replaced by %s-%s)\n",
p->name, p->version, pkg->name, pkg->version);
ignore = 1;
} else if(yesno(":: Replace %s with %s from \"%s\"? [Y/n] ", p->name, pkg->name, dbs->db->treename)) {
/* if confirmed, add this to the 'final' list, designating 'p' as /* if confirmed, add this to the 'final' list, designating 'p' as
* the package to replace. * the package to replace.
*/ */
if(yesno(":: Replace %s with %s from \"%s\"? [Y/n] ", p->name, pkg->name, dbs->db->treename)) {
syncpkg_t *sync = NULL; syncpkg_t *sync = NULL;
/* we save the dependency info so we can move p's requiredby stuff /* we save the dependency info so we can move p's requiredby stuff
* over to the replacing package * over to the replacing package
@ -909,6 +914,15 @@ int pacman_sync(pacdb_t *db, PMList *targets)
/* any packages in rmtargs need to be removed from final. */ /* any packages in rmtargs need to be removed from final. */
/* rather than ripping out nodes from final, we just copy over */ /* rather than ripping out nodes from final, we just copy over */
/* our "good" nodes to a new list and reassign. */ /* our "good" nodes to a new list and reassign. */
/* XXX: this fails for cases where a requested package wants
* a dependency that conflicts with an older version of
* the package. It will be removed from final, and the user
* has to re-request it to get it installed properly.
*
* Not gonna happen very often, but should be dealt with...
*
*/
k = NULL; k = NULL;
for(i = final; i; i = i->next) { for(i = final; i; i = i->next) {
syncpkg_t *s = (syncpkg_t*)i->data; syncpkg_t *s = (syncpkg_t*)i->data;
@ -1114,11 +1128,36 @@ int pacman_sync(pacdb_t *db, PMList *targets)
} }
} }
if(allgood) {
/* Check dependencies of packages in rmtargs and make sure
* we won't be breaking anything by removing them.
* If a broken dep is detected, make sure it's not from a
* package that's in our final (upgrade) list.
*/
vprint("checking dependencies...\n");
i = checkdeps(db, PM_REMOVE, rmtargs);
for(j = i; j; j = j->next) {
depmissing_t* miss = (depmissing_t*)j->data;
syncpkg_t *s = find_pkginsync(miss->depend.name, final);
if(s == NULL) {
if(allgood) {
fprintf(stderr, "error: this will break the following dependencies:\n");
allgood = 0;
}
printf(" %s: is required by %s\n", miss->target, miss->depend.name);
}
}
FREELIST(i);
}
if(!pmo_s_downloadonly && allgood) { if(!pmo_s_downloadonly && allgood) {
/* remove any conflicting packages (WITH dep checks) */ /* remove any conflicting packages (WITHOUT dep checks) */
if(rmtargs) { if(rmtargs) {
int retcode; int retcode;
int oldupg = pmo_upgrade;
pmo_upgrade = 1;
retcode = pacman_remove(db, rmtargs); retcode = pacman_remove(db, rmtargs);
pmo_upgrade = oldupg;
FREELIST(rmtargs); FREELIST(rmtargs);
if(retcode == 1) { if(retcode == 1) {
fprintf(stderr, "\nupgrade aborted.\n"); fprintf(stderr, "\nupgrade aborted.\n");
@ -1820,20 +1859,12 @@ int pacman_remove(pacdb_t *db, PMList *targets)
depmissing_t* miss = (depmissing_t*)j->data; depmissing_t* miss = (depmissing_t*)j->data;
info = db_scan(db, miss->depend.name, INFRQ_ALL); info = db_scan(db, miss->depend.name, INFRQ_ALL);
if(!is_pkgin(info, alltargs)) { if(!is_pkgin(info, alltargs)) {
list_add(alltargs, info); alltargs = list_add(alltargs, info);
} }
} }
list_free(lp); list_free(lp);
lp = checkdeps(db, PM_REMOVE, alltargs); lp = checkdeps(db, PM_REMOVE, alltargs);
} }
/* list targets */
list_display("\nTargets:", alltargs);
/* get confirmation */
if(yesno("\nDo you want to remove these packages? [Y/n] ") == 0) {
list_free(alltargs);
list_free(lp);
return(1);
}
} else { } else {
fprintf(stderr, "error: this will break the following dependencies:\n"); fprintf(stderr, "error: this will break the following dependencies:\n");
for(j = lp; j; j = j->next) { for(j = lp; j; j = j->next) {
@ -1845,7 +1876,21 @@ int pacman_remove(pacdb_t *db, PMList *targets)
return(1); return(1);
} }
} }
list_free(lp);
if(pmo_r_recurse) {
vprint("finding removable dependencies...\n");
alltargs = removedeps(db, alltargs);
}
if(pmo_r_recurse || pmo_r_cascade) {
/* list targets */
list_display("\nTargets:", alltargs);
/* get confirmation */
if(yesno("\nDo you want to remove these packages? [Y/n] ") == 0) {
list_free(alltargs);
return(1);
}
}
} }
for(targ = alltargs; targ; targ = targ->next) { for(targ = alltargs; targ; targ = targ->next) {
@ -2289,6 +2334,49 @@ PMList* sortbydeps(PMList *targets)
return(targets); return(targets);
} }
/* return a new PMList target list containing all packages in the original
* target list, as well as all their un-needed dependencies. By un-needed,
* I mean dependencies that are *only* required for packages in the target
* list, so they can be safely removed. This function is recursive.
*/
PMList* removedeps(pacdb_t *db, PMList *targs)
{
PMList *i, *j, *k;
PMList *newtargs = targs;
for(i = targs; i; i = i->next) {
pkginfo_t *pkg = (pkginfo_t*)i->data;
for(j = pkg->depends; j; j = j->next) {
depend_t depend;
pkginfo_t *dep;
int needed = 0;
if(splitdep(j->data, &depend)) {
continue;
}
dep = db_scan(db, depend.name, INFRQ_DESC | INFRQ_DEPENDS);
if(is_pkgin(dep, targs)) {
continue;
}
/* see if other packages need it */
for(k = dep->requiredby; k && !needed; k = k->next) {
pkginfo_t *dummy = db_scan(db, k->data, INFRQ_DESC);
if(!is_pkgin(dummy, targs)) {
needed = 1;
}
}
if(!needed) {
/* add it to the target list */
freepkg(dep);
dep = db_scan(db, depend.name, INFRQ_ALL);
newtargs = list_add(newtargs, dep);
newtargs = removedeps(db, newtargs);
}
}
}
return(newtargs);
}
/* populates *list with packages that need to be installed to satisfy all /* populates *list with packages that need to be installed to satisfy all
* dependencies (recursive) for *syncpkg->pkg * dependencies (recursive) for *syncpkg->pkg
* *
@ -2814,6 +2902,7 @@ int parseargs(int op, int argc, char **argv)
{"downloadonly", no_argument, 0, 'w'}, {"downloadonly", no_argument, 0, 'w'},
{"refresh", no_argument, 0, 'y'}, {"refresh", no_argument, 0, 'y'},
{"cascade", no_argument, 0, 'c'}, {"cascade", no_argument, 0, 'c'},
{"recursive", no_argument, 0, 's'},
{"groups", no_argument, 0, 'g'}, {"groups", no_argument, 0, 'g'},
{0, 0, 0, 0} {0, 0, 0, 0}
}; };
@ -2850,7 +2939,7 @@ int parseargs(int op, int argc, char **argv)
perror("bad root path"); perror("bad root path");
return(1); return(1);
} break; } break;
case 's': pmo_s_search = 1; break; case 's': pmo_s_search = 1; pmo_r_recurse = 1; break;
case 'u': pmo_s_upgrade = 1; break; case 'u': pmo_s_upgrade = 1; break;
case 'v': pmo_verbose = 1; break; case 'v': pmo_verbose = 1; break;
case 'w': pmo_s_downloadonly = 1; break; case 'w': pmo_s_downloadonly = 1; break;
@ -3113,6 +3202,7 @@ void usage(int op, char *myname)
printf(" -c, --cascade remove packages and all packages that depend on them\n"); printf(" -c, --cascade remove packages and all packages that depend on them\n");
printf(" -d, --nodeps skip dependency checks\n"); printf(" -d, --nodeps skip dependency checks\n");
printf(" -n, --nosave remove configuration files as well\n"); printf(" -n, --nosave remove configuration files as well\n");
printf(" -s, --recursive remove dependencies also (that won't break packages)\n");
} else if(op == PM_UPGRADE) { } else if(op == PM_UPGRADE) {
if(pmo_freshen) { if(pmo_freshen) {
printf("usage: %s {-F --freshen} [options] <file>\n", myname); printf("usage: %s {-F --freshen} [options] <file>\n", myname);
@ -3157,7 +3247,7 @@ void version(void)
{ {
printf("\n"); printf("\n");
printf(" .--. Pacman v%s\n", PACVER); printf(" .--. Pacman v%s\n", PACVER);
printf("/ _.-' .-. .-. .-. Copyright (C) 2002-2003 Judd Vinet <jvinet@zeroflux.org>\n"); printf("/ _.-' .-. .-. .-. Copyright (C) 2002-2004 Judd Vinet <jvinet@zeroflux.org>\n");
printf("\\ '-. '-' '-' '-' \n"); printf("\\ '-. '-' '-' '-' \n");
printf(" '--' This program may be freely redistributed under\n"); printf(" '--' This program may be freely redistributed under\n");
printf(" the terms of the GNU General Public License\n\n"); printf(" the terms of the GNU General Public License\n\n");

View file

@ -1,7 +1,7 @@
/* /*
* pacman.h * pacman.h
* *
* Copyright (c) 2002 by Judd Vinet <jvinet@zeroflux.org> * Copyright (c) 2002-2004 by Judd Vinet <jvinet@zeroflux.org>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -22,7 +22,7 @@
#define _PAC_PACMAN_H #define _PAC_PACMAN_H
#ifndef PACVER #ifndef PACVER
#define PACVER "2.7.4" #define PACVER "2.7.5"
#endif #endif
#ifndef PKGDIR #ifndef PKGDIR
@ -53,6 +53,7 @@ int pacman_deptest(pacdb_t *db, PMList *targets);
PMList* sortbydeps(PMList *targets); PMList* sortbydeps(PMList *targets);
PMList* checkdeps(pacdb_t *db, unsigned short op, PMList *targets); PMList* checkdeps(pacdb_t *db, unsigned short op, PMList *targets);
PMList* removedeps(pacdb_t *db, PMList *targs);
int resolvedeps(pacdb_t *local, PMList *databases, syncpkg_t *sync, PMList *list, PMList *trail); int resolvedeps(pacdb_t *local, PMList *databases, syncpkg_t *sync, PMList *list, PMList *trail);
int splitdep(char *depstr, depend_t *depend); int splitdep(char *depstr, depend_t *depend);

View file

@ -1,7 +1,7 @@
/* /*
* pacsync.c * pacsync.c
* *
* Copyright (c) 2002 by Judd Vinet <jvinet@zeroflux.org> * Copyright (c) 2002-2004 by Judd Vinet <jvinet@zeroflux.org>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -346,7 +346,7 @@ static int log_progress(netbuf *ctl, int xfered, void *arg)
syncpkg_t* find_pkginsync(char *needle, PMList *haystack) syncpkg_t* find_pkginsync(char *needle, PMList *haystack)
{ {
PMList *i; PMList *i;
syncpkg_t *sync; syncpkg_t *sync = NULL;
int found = 0; int found = 0;
for(i = haystack; i && !found; i = i->next) { for(i = haystack; i && !found; i = i->next) {

View file

@ -1,7 +1,7 @@
/* /*
* pacsync.h * pacsync.h
* *
* Copyright (c) 2002 by Judd Vinet <jvinet@zeroflux.org> * Copyright (c) 2002-2004 by Judd Vinet <jvinet@zeroflux.org>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

View file

@ -1,7 +1,7 @@
/* /*
* rpmvercmp.c * rpmvercmp.c
* *
* Copyright (c) 2002 by Judd Vinet <jvinet@zeroflux.org> * Copyright (c) 2002-2004 by Judd Vinet <jvinet@zeroflux.org>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

View file

@ -1,7 +1,7 @@
/* /*
* rpmvercmp.h * rpmvercmp.h
* *
* Copyright (c) 2002 by Judd Vinet <jvinet@zeroflux.org> * Copyright (c) 2002-2004 by Judd Vinet <jvinet@zeroflux.org>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

View file

@ -1,7 +1,7 @@
/* /*
* util.c * util.c
* *
* Copyright (c) 2002 by Judd Vinet <jvinet@zeroflux.org> * Copyright (c) 2002-2004 by Judd Vinet <jvinet@zeroflux.org>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

View file

@ -1,7 +1,7 @@
/* /*
* util.h * util.h
* *
* Copyright (c) 2002 by Judd Vinet <jvinet@zeroflux.org> * Copyright (c) 2002-2004 by Judd Vinet <jvinet@zeroflux.org>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

View file

@ -1,7 +1,7 @@
/* /*
* vercmp.c * vercmp.c
* *
* Copyright (c) 2002 by Judd Vinet <jvinet@zeroflux.org> * Copyright (c) 2002-2004 by Judd Vinet <jvinet@zeroflux.org>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by