diff options
author | ewt <devnull@localhost> | 1996-02-14 20:56:22 +0000 |
---|---|---|
committer | ewt <devnull@localhost> | 1996-02-14 20:56:22 +0000 |
commit | 6b7dcf1cd43381685f58ddb561150a0d9111d409 (patch) | |
tree | c1478f139e2c25b3b71d14b3551eaf9370773fbf /install.c | |
parent | 865692e3c2c7e2833797c70732a47c8e818d4a5c (diff) | |
download | librpm-tizen-6b7dcf1cd43381685f58ddb561150a0d9111d409.tar.gz librpm-tizen-6b7dcf1cd43381685f58ddb561150a0d9111d409.tar.bz2 librpm-tizen-6b7dcf1cd43381685f58ddb561150a0d9111d409.zip |
accepts package specifications like name-version, name-version-release
CVS patchset: 272
CVS date: 1996/02/14 20:56:22
Diffstat (limited to 'install.c')
-rw-r--r-- | install.c | 23 |
1 files changed, 19 insertions, 4 deletions
@@ -6,6 +6,7 @@ #include "install.h" #include "lib/rpmlib.h" #include "messages.h" +#include "query.h" static int hashesPrinted = 0; @@ -100,6 +101,8 @@ void doUninstall(char * prefix, char * arg, int test, int uninstallFlags) { dbIndexSet matches; int i; int mode; + int rc; + int count; if (test) mode = O_RDONLY; @@ -111,15 +114,27 @@ void doUninstall(char * prefix, char * arg, int test, int uninstallFlags) { exit(1); } - if (rpmdbFindPackage(db, arg, &matches)) { + rc = findPackageByLabel(db, arg, &matches); + if (rc == 1) fprintf(stderr, "package %s is not installed\n", arg); - } else { - if (matches.count > 1) { + else if (rc == 2) + fprintf(stderr, "error searching for package %s\n", arg); + else { + count = 0; + for (i = 0; i < matches.count; i++) + if (matches.recs[i].recOffset) count++; + + if (count > 1) { fprintf(stderr, "\"%s\" specifies multiple packages\n", arg); } else { for (i = 0; i < matches.count; i++) { - rpmRemovePackage(prefix, db, matches.recs[i].recOffset, test); + if (matches.recs[i].recOffset) { + message(MESS_DEBUG, "uninstalling record number %d\n", + matches.recs[i].recOffset); + rpmRemovePackage(prefix, db, matches.recs[i].recOffset, + test); + } } } |