Patch attached (this is a fix for FS#12059), and can be found in my
working tree:
http://repo.or.cz/w/pacman-ng.git?a=shortlog;h=refs/heads/working
Bye
------------------------------------------------------
SZTE Egyetemi Konyvtar - http://www.bibl.u-szeged.hu
This message was sent using IMP: http://horde.org/imp/
>From 962ccd09c7afc59a19045e353b4fbd4711414720 Mon Sep 17 00:00:00 2001
From: Nagy Gabor <[EMAIL PROTECTED]>
Date: Sun, 9 Nov 2008 17:34:49 +0100
Subject: [PATCH] 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 <[EMAIL PROTECTED]>
---
lib/libalpm/alpm.h | 1 +
lib/libalpm/deps.c | 12 ++++++++++--
lib/libalpm/error.c | 2 ++
lib/libalpm/sync.c | 3 ++-
src/pacman/sync.c | 7 ++++---
5 files changed, 19 insertions(+), 6 deletions(-)
diff --git a/lib/libalpm/alpm.h b/lib/libalpm/alpm.h
index 7b7ca4e..d52ee96 100644
--- a/lib/libalpm/alpm.h
+++ b/lib/libalpm/alpm.h
@@ -494,6 +494,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,
diff --git a/lib/libalpm/deps.c b/lib/libalpm/deps.c
index 940f12c..c550873 100644
--- a/lib/libalpm/deps.c
+++ b/lib/libalpm/deps.c
@@ -504,10 +504,11 @@ void _alpm_recursedeps(pmdb_t *db, alpm_list_t *targs, int include_explicit)
}
}
-/* helper function for resolvedeps: search for dep satisfier in dbs */
+/* helper function for resolvedeps and sync_addtarget: search for dep satisfier in dbs */
pmpkg_t *_alpm_resolvedep(pmdepend_t *dep, alpm_list_t *dbs, alpm_list_t *excluding, pmpkg_t *tpkg)
{
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);
@@ -517,6 +518,7 @@ pmpkg_t *_alpm_resolvedep(pmdepend_t *dep, alpm_list_t *dbs, alpm_list_t *exclud
QUESTION(handle->trans, PM_TRANS_CONV_INSTALL_IGNOREPKG, pkg,
tpkg, NULL, &install);
if(!install) {
+ ignored = 1;
continue;
}
}
@@ -534,6 +536,7 @@ pmpkg_t *_alpm_resolvedep(pmdepend_t *dep, alpm_list_t *dbs, alpm_list_t *exclud
QUESTION(handle->trans, PM_TRANS_CONV_INSTALL_IGNOREPKG, pkg,
tpkg, NULL, &install);
if(!install) {
+ ignored = 1;
continue;
}
}
@@ -543,6 +546,11 @@ pmpkg_t *_alpm_resolvedep(pmdepend_t *dep, alpm_list_t *dbs, alpm_list_t *exclud
}
}
}
+ if(ignored) { /* resolvedeps will override these */
+ pm_errno = PM_ERR_PKG_IGNORED;
+ } else {
+ pm_errno = PM_ERR_PKG_NOT_FOUND;
+ }
return(NULL);
}
@@ -595,7 +603,7 @@ int _alpm_resolvedeps(pmdb_t *local, alpm_list_t *dbs_sync, alpm_list_t *list,
alpm_list_free_inner(deps, (alpm_list_fn_free)_alpm_depmiss_free);
alpm_list_free(deps);
return(-1);
- } else {
+ } else {
_alpm_log(PM_LOG_DEBUG, "pulling dependency %s (needed by %s)\n",
alpm_pkg_get_name(spkg), alpm_pkg_get_name(tpkg));
list = alpm_list_add(list, spkg);
diff --git a/lib/libalpm/error.c b/lib/libalpm/error.c
index 1ccec53..807075b 100644
--- a/lib/libalpm/error.c
+++ b/lib/libalpm/error.c
@@ -109,6 +109,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:
diff --git a/lib/libalpm/sync.c b/lib/libalpm/sync.c
index b458874..607057c 100644
--- a/lib/libalpm/sync.c
+++ b/lib/libalpm/sync.c
@@ -296,7 +296,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))) {
diff --git a/src/pacman/sync.c b/src/pacman/sync.c
index aacdb51..21bc257 100644
--- a/src/pacman/sync.c
+++ b/src/pacman/sync.c
@@ -573,11 +573,12 @@ static int sync_trans(alpm_list_t *targets)
char *targ = alpm_list_getdata(i);
if(alpm_trans_addtarget(targ) == -1) {
pmgrp_t *grp = NULL;
- int found=0;
+ 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) {
--
1.6.0.3
_______________________________________________
pacman-dev mailing list
pacman-dev@archlinux.org
http://archlinux.org/mailman/listinfo/pacman-dev