From 8e20523b9d7ad373ded0810cede0ce0e99a5cede Mon Sep 17 00:00:00 2001 From: Panu Matilainen Date: Thu, 25 Feb 2010 12:32:57 +0200 Subject: [PATCH] Count the number of failures for transaction elements - this lets us track whether the package itself failed or if it was cancelled due to parent failure --- lib/rpmte.c | 7 +++---- lib/rpmte.h | 6 ++++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/lib/rpmte.c b/lib/rpmte.c index a570876..f45781c 100644 --- a/lib/rpmte.c +++ b/lib/rpmte.c @@ -688,18 +688,17 @@ FD_t rpmtePayload(rpmte te) int rpmteMarkFailed(rpmte te, rpmts ts) { rpmtsi pi = rpmtsiInit(ts); - int rc = 0; rpmte p; - te->failed = 1; + te->failed++; /* XXX we can do a much better here than this... */ while ((p = rpmtsiNext(pi, TR_REMOVED))) { if (rpmteDependsOn(p) == te) { - p->failed = 1; + p->failed++; } } rpmtsiFree(pi); - return rc; + return te->failed; } int rpmteFailed(rpmte te) diff --git a/lib/rpmte.h b/lib/rpmte.h index 33af0cd..c3b221e 100644 --- a/lib/rpmte.h +++ b/lib/rpmte.h @@ -226,9 +226,11 @@ const char * rpmteNEVRA(rpmte te); fnpyKey rpmteKey(rpmte te); /** \ingroup rpmte - * Return failed status of transaction element. + * Return failure status of transaction element. + * If the element itself failed, this is 1, larger count means one of + * it's parents failed. * @param te transaction element - * @return 1 if transaction element (or its parents) failed + * @return number of failures for this transaction element */ int rpmteFailed(rpmte te); -- 2.7.4