Imported from pacman-2.9.5.tar.gz

This commit is contained in:
Judd Vinet 2005-01-11 23:14:16 +00:00
parent ad39cd7bd6
commit d48cc3bf5d
19 changed files with 131 additions and 67 deletions

View file

@ -1,5 +1,11 @@
VERSION DESCRIPTION VERSION DESCRIPTION
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
2.9.5 - bugfix: missing files after re-ordering packages wrt
deps with --upgrade
- added "Repository" line to -Si output
- patch from Tommi Rantala to fix trim() behaviour with
empty or whitespace-only strings
- fixed removal order when using -Rc or -Rs
2.9.4 - fixed a bug that was introduced from another bugfix :-/ 2.9.4 - fixed a bug that was introduced from another bugfix :-/
2.9.3 - fixed a couple manpage typos 2.9.3 - fixed a couple manpage typos
- added --ignore to -S operations, works just like IgnorePkg - added --ignore to -S operations, works just like IgnorePkg

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

View file

@ -1,7 +1,7 @@
/* /*
* convertdb.c * convertdb.c
* *
* Copyright (c) 2002-2004 by Judd Vinet <jvinet@zeroflux.org> * Copyright (c) 2002-2005 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-2004 by Judd Vinet <jvinet@zeroflux.org> * Copyright (c) 2002-2005 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
@ -768,7 +768,7 @@ PMList* db_find_conflicts(pacdb_t *db, PMList *targets, char *root)
for(k = dbpkg->files; k; k = k->next) { for(k = dbpkg->files; k; k = k->next) {
snprintf(str, PATH_MAX, "%s%s", root, (char*)k->data); snprintf(str, PATH_MAX, "%s%s", root, (char*)k->data);
stat(str, &buf2); stat(str, &buf2);
if(buf.st_ino == buf2.st_ino) { if(buf.st_ino == buf2.st_ino && buf.st_dev == buf2.st_dev) {
ok = 1; ok = 1;
} }
} }

View file

@ -1,7 +1,7 @@
/* /*
* db.h * db.h
* *
* Copyright (c) 2002-2004 by Judd Vinet <jvinet@zeroflux.org> * Copyright (c) 2002-2005 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-2004 by Judd Vinet <jvinet@zeroflux.org> * Copyright (c) 2002-2005 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
@ -26,27 +26,28 @@
#include <assert.h> #include <assert.h>
#include "list.h" #include "list.h"
/* 1: List seems to be OK. /* Check PMList sanity
*
* 1: List seems to be OK.
* 0: We're in deep ... * 0: We're in deep ...
*/ */
int check_list(PMList* list)
int CheckList(PMList* list)
{ {
PMList* it = NULL; PMList* it = NULL;
if (list == NULL) if(list == NULL) {
return 1; return(1);
}
if(list->last == NULL) {
return(0);
}
if (list->last == NULL) for(it = list; it && it->next; it = it->next);
return 0; if(it != list->last) {
return(0);
}
for (it = list; it && it->next; it = it->next) return(1);
;
if (it != list->last)
return 0;
return 1;
} }
PMList* list_new() PMList* list_new()
@ -119,7 +120,7 @@ PMList* list_add(PMList *list, void *data)
PMList* list_remove(PMList* list, PMList* item) PMList* list_remove(PMList* list, PMList* item)
{ {
assert(CheckList(list)); assert(check_list(list));
if (list == NULL || item == NULL) if (list == NULL || item == NULL)
return NULL; return NULL;
@ -157,7 +158,7 @@ PMList* list_remove(PMList* list, PMList* item)
item->prev = item->next = NULL; item->prev = item->next = NULL;
list_free(item); list_free(item);
assert(CheckList(list)); assert(check_list(list));
return list; return list;
} }
@ -272,6 +273,24 @@ PMList *list_sort(PMList *list)
return(lp); return(lp);
} }
/* Reverse the order of a list
*
* The caller is responsible for freeing the old list
*/
PMList* list_reverse(PMList *list)
{
/* simple but functional -- we just build a new list, starting
* with the old list's tail
*/
PMList *newlist = NULL;
PMList *lp;
for(lp = list->last; lp; lp = lp->prev) {
newlist = list_add(newlist, lp->data);
}
return(newlist);
}
void list_display(const char *title, PMList *list) void list_display(const char *title, PMList *list)
{ {
PMList *lp; PMList *lp;
@ -349,7 +368,7 @@ PMList* list_add_sorted(PMList *list, void *data, cmp_fn sortfunc)
} }
if(prev != NULL) { if(prev != NULL) {
prev->next = add; /* In middle. */ prev->next = add; /* In middle. */
} else { } else {
if (list == NULL) { if (list == NULL) {
add->last = add; add->last = add;
@ -357,7 +376,7 @@ PMList* list_add_sorted(PMList *list, void *data, cmp_fn sortfunc)
add->last = list->last; add->last = list->last;
list->last = NULL; list->last = NULL;
} }
list = add; /* Start or empty, new list head. */ list = add; /* Start or empty, new list head. */
} }
return(list); return(list);

View file

@ -1,7 +1,7 @@
/* /*
* list.h * list.h
* *
* Copyright (c) 2002-2004 by Judd Vinet <jvinet@zeroflux.org> * Copyright (c) 2002-2005 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
@ -47,6 +47,7 @@ PMList* list_merge(PMList *one, PMList *two);
PMList* list_last(PMList* list); PMList* list_last(PMList* list);
int list_strcmp(const void *s1, const void *s2); int list_strcmp(const void *s1, const void *s2);
PMList *list_sort(PMList *list); PMList *list_sort(PMList *list);
PMList *list_reverse(PMList *list);
void list_display(const char *title, PMList *list); void list_display(const char *title, PMList *list);
int strlist_cmp(const void *s1, const void *s2); int strlist_cmp(const void *s1, const void *s2);

View file

@ -1,7 +1,7 @@
/* /*
* pacconf.h * pacconf.h
* *
* Copyright (c) 2002-2004 by Judd Vinet <jvinet@zeroflux.org> * Copyright (c) 2002-2005 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_PACCONF_H #define _PAC_PACCONF_H
#ifndef PACVER #ifndef PACVER
#define PACVER "2.9.4" #define PACVER "2.9.5"
#endif #endif
#ifndef PACDBDIR #ifndef PACDBDIR

View file

@ -1,7 +1,7 @@
/* /*
* package.c * package.c
* *
* Copyright (c) 2002-2004 by Judd Vinet <jvinet@zeroflux.org> * Copyright (c) 2002-2005 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
@ -144,6 +144,8 @@ pkginfo_t* load_pkg(char *pkgfile)
return(NULL); return(NULL);
} }
info->filename = strdup(pkgfile);
return(info); return(info);
} }
@ -260,6 +262,7 @@ pkginfo_t* newpkg()
pkg->groups = NULL; pkg->groups = NULL;
pkg->provides = NULL; pkg->provides = NULL;
pkg->replaces = NULL; pkg->replaces = NULL;
pkg->filename = NULL;
return(pkg); return(pkg);
} }
@ -278,6 +281,7 @@ void freepkg(pkginfo_t *pkg)
FREELIST(pkg->groups); FREELIST(pkg->groups);
FREELIST(pkg->provides); FREELIST(pkg->provides);
FREELIST(pkg->replaces); FREELIST(pkg->replaces);
FREE(pkg->filename);
FREE(pkg); FREE(pkg);
return; return;
} }
@ -367,7 +371,7 @@ void dump_pkg_full(pkginfo_t *info)
/* Display the content of a sync package /* Display the content of a sync package
*/ */
void dump_pkg_sync(pkginfo_t *info) void dump_pkg_sync(pkginfo_t *info, char *treename)
{ {
PMList *pm; PMList *pm;
@ -375,6 +379,7 @@ void dump_pkg_sync(pkginfo_t *info)
return; return;
} }
printf("Repository : %s\n", treename);
printf("Name : %s\n", info->name); printf("Name : %s\n", info->name);
printf("Version : %s\n", info->version); printf("Version : %s\n", info->version);
pm = list_sort(info->groups); pm = list_sort(info->groups);

View file

@ -1,7 +1,7 @@
/* /*
* package.h * package.h
* *
* Copyright (c) 2002-2004 by Judd Vinet <jvinet@zeroflux.org> * Copyright (c) 2002-2005 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
@ -68,6 +68,10 @@ typedef struct __pkginfo_t {
PMList *requiredby; PMList *requiredby;
PMList *conflicts; PMList *conflicts;
PMList *provides; PMList *provides;
/* if the package has an associated filename on the local system
* (eg, filename.pkg.tar.gz) then it will be stored here, otherwise NULL
*/
char *filename;
} pkginfo_t; } pkginfo_t;
typedef struct __depend_t { typedef struct __depend_t {
@ -89,7 +93,7 @@ void freepkg(pkginfo_t *pkg);
int pkgcmp(const void *p1, const void *p2); int pkgcmp(const void *p1, const void *p2);
int is_pkgin(pkginfo_t *needle, PMList *haystack); int is_pkgin(pkginfo_t *needle, PMList *haystack);
void dump_pkg_full(pkginfo_t *info); void dump_pkg_full(pkginfo_t *info);
void dump_pkg_sync(pkginfo_t *info); void dump_pkg_sync(pkginfo_t *info, char *treename);
int split_pkgname(char *pkgfile, char *name, char *version); int split_pkgname(char *pkgfile, char *name, char *version);
#endif #endif

View file

@ -1,7 +1,7 @@
/* /*
* pacman.c * pacman.c
* *
* Copyright (c) 2002-2004 by Judd Vinet <jvinet@zeroflux.org> * Copyright (c) 2002-2005 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
@ -75,13 +75,14 @@ unsigned short pmo_q_search = 0;
unsigned short pmo_r_cascade = 0; unsigned short pmo_r_cascade = 0;
unsigned short pmo_r_dbonly = 0; unsigned short pmo_r_dbonly = 0;
unsigned short pmo_r_recurse = 0; unsigned short pmo_r_recurse = 0;
unsigned short pmo_s_upgrade = 0;
unsigned short pmo_s_downloadonly = 0;
unsigned short pmo_s_printuris = 0;
unsigned short pmo_s_sync = 0;
unsigned short pmo_s_search = 0;
unsigned short pmo_s_clean = 0; unsigned short pmo_s_clean = 0;
unsigned short pmo_s_downloadonly = 0;
PMList *pmo_s_ignore = NULL; PMList *pmo_s_ignore = NULL;
unsigned short pmo_s_info = 0;
unsigned short pmo_s_printuris = 0;
unsigned short pmo_s_search = 0;
unsigned short pmo_s_sync = 0;
unsigned short pmo_s_upgrade = 0;
unsigned short pmo_group = 0; unsigned short pmo_group = 0;
/* configuration file options */ /* configuration file options */
char *pmo_dbpath = NULL; char *pmo_dbpath = NULL;
@ -535,7 +536,7 @@ int pacman_sync(pacdb_t *db, PMList *targets)
FREELIST(pkg); FREELIST(pkg);
} }
FREELIST(groups); FREELIST(groups);
} else if(pmo_q_info) { } else if(pmo_s_info) {
PMList *pkgs = NULL; PMList *pkgs = NULL;
int found; int found;
if(targets) { if(targets) {
@ -563,7 +564,7 @@ int pacman_sync(pacdb_t *db, PMList *targets)
/* wtf */ /* wtf */
continue; continue;
} }
dump_pkg_sync(p); dump_pkg_sync(p, dbs->sync->treename);
printf("\n"); printf("\n");
freepkg(p); freepkg(p);
found = 1; found = 1;
@ -1445,9 +1446,8 @@ int pacman_add(pacdb_t *db, PMList *targets, PMList *dependonly)
char pm_install[PATH_MAX]; char pm_install[PATH_MAX];
pkginfo_t *info = NULL; pkginfo_t *info = NULL;
struct stat buf; struct stat buf;
PMList *targ, *file, *lp, *j, *k; PMList *targ, *lp, *j, *k;
PMList *alltargs = NULL; PMList *alltargs = NULL;
PMList *filenames = NULL;
unsigned short real_pmo_upgrade; unsigned short real_pmo_upgrade;
tartype_t gztype = { tartype_t gztype = {
(openfunc_t) gzopen_frontend, (openfunc_t) gzopen_frontend,
@ -1545,21 +1545,18 @@ int pacman_add(pacdb_t *db, PMList *targets, PMList *dependonly)
} }
/* check if an older version of said package is already in alltargs. /* check if an older version of said package is already in alltargs.
* if so, replace it in the list */ * if so, replace it in the list */
for(j = alltargs, k = filenames; j && j->data && k; j = j->next, k = k->next) { for(j = alltargs; j && j->data; j = j->next) {
pkginfo_t *pkg = (pkginfo_t*)j->data; pkginfo_t *pkg = (pkginfo_t*)j->data;
if(!strcmp(pkg->name, info->name)) { if(!strcmp(pkg->name, info->name)) {
if(rpmvercmp(pkg->version, info->version) < 0) { if(rpmvercmp(pkg->version, info->version) < 0) {
vprint("replacing older version in target list. "); vprint("replacing older version in target list. ");
FREEPKG(j->data); FREEPKG(j->data);
j->data = info; j->data = info;
FREE(k->data);
k->data = strdup(targ->data);
} }
} }
} }
vprint("done\n"); vprint("done\n");
alltargs = list_add(alltargs, info); alltargs = list_add(alltargs, info);
filenames = list_add(filenames, strdup(targ->data));
} }
printf("done.\n"); printf("done.\n");
@ -1670,7 +1667,7 @@ int pacman_add(pacdb_t *db, PMList *targets, PMList *dependonly)
/* re-order w.r.t. dependencies */ /* re-order w.r.t. dependencies */
vprint("sorting by dependencies\n"); vprint("sorting by dependencies\n");
lp = sortbydeps(alltargs); lp = sortbydeps(alltargs, PM_ADD);
/* free the old alltargs */ /* free the old alltargs */
for(j = alltargs; j; j = j->next) { for(j = alltargs; j; j = j->next) {
j->data = NULL; j->data = NULL;
@ -1708,7 +1705,7 @@ int pacman_add(pacdb_t *db, PMList *targets, PMList *dependonly)
* Install packages * Install packages
* *
*/ */
for(targ = alltargs, file = filenames; targ && file; targ = targ->next, file = file->next) { for(targ = alltargs; targ; targ = targ->next) {
pkginfo_t* oldpkg = NULL; pkginfo_t* oldpkg = NULL;
info = (pkginfo_t*)targ->data; info = (pkginfo_t*)targ->data;
errors = 0; errors = 0;
@ -1733,7 +1730,7 @@ int pacman_add(pacdb_t *db, PMList *targets, PMList *dependonly)
/* pre_upgrade scriptlet */ /* pre_upgrade scriptlet */
if(info->scriptlet) { if(info->scriptlet) {
runscriptlet(file->data, "pre_upgrade", info->version, oldpkg ? oldpkg->version : NULL); runscriptlet(info->filename, "pre_upgrade", info->version, oldpkg ? oldpkg->version : NULL);
} }
if(oldpkg) { if(oldpkg) {
@ -1764,13 +1761,13 @@ int pacman_add(pacdb_t *db, PMList *targets, PMList *dependonly)
neednl = 1; neednl = 1;
/* pre_install scriptlet */ /* pre_install scriptlet */
if(info->scriptlet) { if(info->scriptlet) {
runscriptlet(file->data, "pre_install", info->version, NULL); runscriptlet(info->filename, "pre_install", info->version, NULL);
} }
} }
fflush(stdout); fflush(stdout);
/* open the .tar.gz package */ /* open the .tar.gz package */
if(tar_open(&tar, (char*)file->data, &gztype, O_RDONLY, 0, TAR_GNU) == -1) { if(tar_open(&tar, info->filename, &gztype, O_RDONLY, 0, TAR_GNU) == -1) {
perror("could not open package"); perror("could not open package");
return(1); return(1);
} }
@ -1990,7 +1987,7 @@ int pacman_add(pacdb_t *db, PMList *targets, PMList *dependonly)
* or installed as a dependency for another package * or installed as a dependency for another package
*/ */
info->reason = REASON_EXPLICIT; info->reason = REASON_EXPLICIT;
if(is_in(file->data, dependonly) || pmo_d_resolve) { if(is_in(info->filename, dependonly) || pmo_d_resolve) {
info->reason = REASON_DEPEND; info->reason = REASON_DEPEND;
} }
/* make an install date (in UTC) */ /* make an install date (in UTC) */
@ -2053,7 +2050,6 @@ int pacman_add(pacdb_t *db, PMList *targets, PMList *dependonly)
FREEPKG(lp->data); FREEPKG(lp->data);
} }
FREELIST(alltargs); FREELIST(alltargs);
FREELIST(filenames);
/* run ldconfig if it exists */ /* run ldconfig if it exists */
snprintf(expath, PATH_MAX, "%setc/ld.so.conf", pmo_root); snprintf(expath, PATH_MAX, "%setc/ld.so.conf", pmo_root);
@ -2165,6 +2161,16 @@ int pacman_remove(pacdb_t *db, PMList *targets)
alltargs = removedeps(db, alltargs); alltargs = removedeps(db, alltargs);
} }
/* re-order w.r.t. dependencies */
vprint("sorting by dependencies\n");
lp = sortbydeps(alltargs, PM_REMOVE);
/* free the old alltargs */
for(j = alltargs; j; j = j->next) {
j->data = NULL;
}
FREELIST(alltargs);
alltargs = lp;
if(pmo_r_recurse || pmo_r_cascade) { if(pmo_r_recurse || pmo_r_cascade) {
/* list targets */ /* list targets */
list_display("\nTargets:", alltargs); list_display("\nTargets:", alltargs);
@ -2542,17 +2548,20 @@ int pacman_upgrade(pacdb_t *db, PMList *targets, PMList *dependonly)
/* Re-order a list of target packages with respect to their dependencies. /* Re-order a list of target packages with respect to their dependencies.
* *
* Example: * Example (PM_ADD):
* A depends on C * A depends on C
* B depends on A * B depends on A
* Target order is A,B,C,D * Target order is A,B,C,D
* *
* Should be re-ordered to C,A,B,D * Should be re-ordered to C,A,B,D
* *
* mode should be either PM_ADD or PM_REMOVE. This affects the dependency
* order sortbydeps() will use.
*
* This function returns the new PMList* target list. * This function returns the new PMList* target list.
* *
*/ */
PMList* sortbydeps(PMList *targets) PMList* sortbydeps(PMList *targets, int mode)
{ {
PMList *newtargs = NULL; PMList *newtargs = NULL;
PMList *i, *j, *k; PMList *i, *j, *k;
@ -2607,11 +2616,21 @@ PMList* sortbydeps(PMList *targets)
for(i = targets; i; i = i->next) { for(i = targets; i; i = i->next) {
i->data = NULL; i->data = NULL;
} }
list_free(targets); FREELIST(targets);
} }
targets = newtargs; targets = newtargs;
clean = 1; clean = 1;
} }
if(mode == PM_REMOVE) {
/* we're removing packages, so reverse the order */
newtargs = list_reverse(targets);
/* free the old one */
for(i = targets; i; i = i->next) {
i->data = NULL;
}
FREELIST(targets);
targets = newtargs;
}
return(targets); return(targets);
} }
@ -3400,7 +3419,7 @@ int parseargs(int op, int argc, char **argv)
case 'e': pmo_q_orphans = 1; break; case 'e': pmo_q_orphans = 1; break;
case 'f': pmo_force = 1; break; case 'f': pmo_force = 1; break;
case 'g': pmo_group = 1; break; case 'g': pmo_group = 1; break;
case 'i': pmo_q_info++; break; case 'i': pmo_q_info++; pmo_s_info++; break;
case 'k': pmo_r_dbonly = 1; break; case 'k': pmo_r_dbonly = 1; break;
case 'l': pmo_q_list = 1; break; case 'l': pmo_q_list = 1; break;
case 'n': pmo_nosave = 1; break; case 'n': pmo_nosave = 1; break;
@ -3759,7 +3778,7 @@ void version(void)
{ {
printf("\n"); printf("\n");
printf(" .--. Pacman v%s\n", PACVER); printf(" .--. Pacman v%s\n", PACVER);
printf("/ _.-' .-. .-. .-. Copyright (C) 2002-2004 Judd Vinet <jvinet@zeroflux.org>\n"); printf("/ _.-' .-. .-. .-. Copyright (C) 2002-2005 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-2004 by Judd Vinet <jvinet@zeroflux.org> * Copyright (c) 2002-2005 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
@ -39,7 +39,7 @@ int pacman_query(pacdb_t *db, PMList *targets);
int pacman_sync(pacdb_t *db, PMList *targets); int pacman_sync(pacdb_t *db, PMList *targets);
int pacman_deptest(pacdb_t *db, PMList *targets); int pacman_deptest(pacdb_t *db, PMList *targets);
PMList* sortbydeps(PMList *targets); PMList* sortbydeps(PMList *targets, int mode);
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); 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);

View file

@ -1,7 +1,7 @@
/* /*
* pacsync.c * pacsync.c
* *
* Copyright (c) 2002-2004 by Judd Vinet <jvinet@zeroflux.org> * Copyright (c) 2002-2005 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 @@
/* /*
* pacsync.h * pacsync.h
* *
* Copyright (c) 2002-2004 by Judd Vinet <jvinet@zeroflux.org> * Copyright (c) 2002-2005 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-2004 by Judd Vinet <jvinet@zeroflux.org> * Copyright (c) 2002-2005 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-2004 by Judd Vinet <jvinet@zeroflux.org> * Copyright (c) 2002-2005 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-2004 by Judd Vinet <jvinet@zeroflux.org> * Copyright (c) 2002-2005 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
@ -281,12 +281,22 @@ char* strtoupper(char *str)
char* trim(char *str) char* trim(char *str)
{ {
char *pch = str; char *pch = str;
if(*str == '\0')
/* string is empty, so we're done. */
return(str);
while(isspace(*pch)) { while(isspace(*pch)) {
pch++; pch++;
} }
if(pch != str) { if(pch != str) {
memmove(str, pch, (strlen(pch) + 1)); memmove(str, pch, (strlen(pch) + 1));
} }
/* check if there wasn't anything but whitespace in the string. */
if(*str == '\0') {
return(str);
}
pch = (char*)(str + (strlen(str) - 1)); pch = (char*)(str + (strlen(str) - 1));
while(isspace(*pch)) { while(isspace(*pch)) {
@ -294,7 +304,7 @@ char* trim(char *str)
} }
*++pch = '\0'; *++pch = '\0';
return str; return(str);
} }
/* A cheap grep for text files, returns 1 if a substring /* A cheap grep for text files, returns 1 if a substring

View file

@ -1,7 +1,7 @@
/* /*
* util.h * util.h
* *
* Copyright (c) 2002-2004 by Judd Vinet <jvinet@zeroflux.org> * Copyright (c) 2002-2005 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-2004 by Judd Vinet <jvinet@zeroflux.org> * Copyright (c) 2002-2005 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