diff options
author | Dan McGee <dan@archlinux.org> | 2009-06-06 19:05:55 +0200 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2009-07-01 08:42:35 +0200 |
commit | be7266155fb726bbb62b6c86857273465209b586 (patch) | |
tree | eadf6ccdca3e5ca16fae463afc29d1f04237d76c /lib | |
parent | a21d1f99b874ebdee58b283119dd447771af0958 (diff) | |
download | pacman-be7266155fb726bbb62b6c86857273465209b586.tar.gz pacman-be7266155fb726bbb62b6c86857273465209b586.tar.xz |
Allow remove to accept 'local/' prefix
See FS#14642- this allows -Qs output to be fed back into pacman without
problems or having to strip off the 'local/' prefix manually.
Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libalpm/remove.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/lib/libalpm/remove.c b/lib/libalpm/remove.c index 9dfff9c3..62fd3964 100644 --- a/lib/libalpm/remove.c +++ b/lib/libalpm/remove.c @@ -49,6 +49,7 @@ int _alpm_remove_loadtarget(pmtrans_t *trans, pmdb_t *db, char *name) { pmpkg_t *info; + const char *targ; ALPM_LOG_FUNC; @@ -56,12 +57,19 @@ int _alpm_remove_loadtarget(pmtrans_t *trans, pmdb_t *db, char *name) ASSERT(trans != NULL, RET_ERR(PM_ERR_TRANS_NULL, -1)); ASSERT(name != NULL, RET_ERR(PM_ERR_WRONG_ARGS, -1)); - if(_alpm_pkg_find(trans->packages, name)) { + targ = strchr(name, '/'); + if(targ && strncmp(name, "local", 5) == 0) { + targ++; + } else { + targ = name; + } + + if(_alpm_pkg_find(trans->packages, targ)) { RET_ERR(PM_ERR_TRANS_DUP_TARGET, -1); } - if((info = _alpm_db_get_pkgfromcache(db, name)) == NULL) { - _alpm_log(PM_LOG_DEBUG, "could not find %s in database\n", name); + if((info = _alpm_db_get_pkgfromcache(db, targ)) == NULL) { + _alpm_log(PM_LOG_DEBUG, "could not find %s in database\n", targ); RET_ERR(PM_ERR_PKG_NOT_FOUND, -1); } |