1
0
mirror of https://github.com/moparisthebest/pacman synced 2024-12-22 15:58:50 -05:00

New error type: PM_ERR_PKG_IGNORED

This patch fixes FS#12059.
Now sync_addtarget can return with PM_ERR_PKG_IGNORED, which indicates that
although the requested package was found it is in ignorepkg, so alpm could
not add it to the transaction. So the front-end can decide what to do.

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
Nagy Gabor 2008-11-09 17:34:49 +01:00 committed by Dan McGee
parent 93ca155b48
commit 77efd51216
5 changed files with 18 additions and 5 deletions

View File

@ -493,6 +493,7 @@ enum _pmerrno_t {
PM_ERR_TRANS_DOWNLOADING,
/* Packages */
PM_ERR_PKG_NOT_FOUND,
PM_ERR_PKG_IGNORED,
PM_ERR_PKG_INVALID,
PM_ERR_PKG_OPEN,
PM_ERR_PKG_LOAD,

View File

@ -520,6 +520,7 @@ pmpkg_t *_alpm_resolvedep(pmdepend_t *dep, alpm_list_t *dbs,
alpm_list_t *excluding, int prompt)
{
alpm_list_t *i, *j;
int ignored = 0;
/* 1. literals */
for(i = dbs; i; i = i->next) {
pmpkg_t *pkg = _alpm_db_get_pkgfromcache(i->data, dep->name);
@ -531,6 +532,7 @@ pmpkg_t *_alpm_resolvedep(pmdepend_t *dep, alpm_list_t *dbs,
NULL, NULL, &install);
}
if(!install) {
ignored = 1;
continue;
}
}
@ -550,6 +552,7 @@ pmpkg_t *_alpm_resolvedep(pmdepend_t *dep, alpm_list_t *dbs,
pkg, NULL, NULL, &install);
}
if(!install) {
ignored = 1;
continue;
}
}
@ -559,6 +562,11 @@ pmpkg_t *_alpm_resolvedep(pmdepend_t *dep, alpm_list_t *dbs,
}
}
}
if(ignored) { /* resolvedeps will override these */
pm_errno = PM_ERR_PKG_IGNORED;
} else {
pm_errno = PM_ERR_PKG_NOT_FOUND;
}
return(NULL);
}

View File

@ -106,6 +106,8 @@ const char SYMEXPORT *alpm_strerror(int err)
/* Packages */
case PM_ERR_PKG_NOT_FOUND:
return _("could not find or read package");
case PM_ERR_PKG_IGNORED:
return _("operation cancelled due to ignorepkg");
case PM_ERR_PKG_INVALID:
return _("invalid or corrupted package");
case PM_ERR_PKG_OPEN:

View File

@ -297,7 +297,8 @@ int _alpm_sync_addtarget(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t *dbs_sy
FREE(targline);
if(spkg == NULL) {
RET_ERR(PM_ERR_PKG_NOT_FOUND, -1);
/* pm_errno is set by _alpm_resolvedep */
return(-1);
}
if(_alpm_sync_find(trans->packages, alpm_pkg_get_name(spkg))) {

View File

@ -577,8 +577,9 @@ static int sync_trans(alpm_list_t *targets)
int found = 0;
alpm_list_t *j;
if(pm_errno == PM_ERR_TRANS_DUP_TARGET) {
/* just ignore duplicate targets */
if(pm_errno == PM_ERR_TRANS_DUP_TARGET || pm_errno == PM_ERR_PKG_IGNORED) {
/* just skip duplicate or ignored targets */
pm_printf(PM_LOG_WARNING, _("skipping target: %s\n"), targ);
continue;
}
if(pm_errno != PM_ERR_PKG_NOT_FOUND) {