From: Panu Matilainen Date: Wed, 15 Dec 2010 09:34:50 +0000 (+0200) Subject: Eliminate ancient dependency loop whiteout mechanism X-Git-Tag: tznext/4.11.0.1.tizen20130304~1369 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=69187d6bb04d36934a7f9f276d90164e842ef54c;p=tools%2Flibrpm-tizen.git Eliminate ancient dependency loop whiteout mechanism - Nobody has been relying on this for ages, and with the new ordering code since rpm 4.8.x loops are handled much more gracefully than before. RIP. --- diff --git a/lib/order.c b/lib/order.c index d7a91e7..9cda649 100644 --- a/lib/order.c +++ b/lib/order.c @@ -4,13 +4,10 @@ #include "system.h" -#include - #include -#include /* XXX rpmExpand("%{_dependency_whiteout */ +#include #include #include -#include #include "lib/rpmte_internal.h" /* XXX tsortInfo_s */ #include "lib/rpmts_internal.h" @@ -51,83 +48,6 @@ struct tsortInfo_s { int tsi_SccLowlink; // used for SCC detection }; -struct badDeps_s { - char * pname; - const char * qname; -}; - -static int badDepsInitialized = 0; -static struct badDeps_s * badDeps = NULL; - -/** - */ -static void freeBadDeps(void) -{ - if (badDeps) { - struct badDeps_s * bdp; - /* bdp->qname is a pointer to pname so doesn't need freeing */ - for (bdp = badDeps; bdp->pname != NULL && bdp->qname != NULL; bdp++) - bdp->pname = _free(bdp->pname); - badDeps = _free(badDeps); - } - badDepsInitialized = 0; -} - -/** - * Check for dependency relations to be ignored. - * - * @param ts transaction set - * @param p successor element (i.e. with Requires: ) - * @param q predecessor element (i.e. with Provides: ) - * @return 1 if dependency is to be ignored. - */ -static int ignoreDep(const rpmts ts, const rpmte p, const rpmte q) -{ - struct badDeps_s * bdp; - - if (!badDepsInitialized) { - char * s = rpmExpand("%{?_dependency_whiteout}", NULL); - const char ** av = NULL; - int msglvl = (rpmtsFlags(ts) & RPMTRANS_FLAG_DEPLOOPS) - ? RPMLOG_WARNING : RPMLOG_DEBUG; - int ac = 0; - int i; - - if (s != NULL && *s != '\0' - && !(i = poptParseArgvString(s, &ac, (const char ***)&av)) - && ac > 0 && av != NULL) - { - bdp = badDeps = xcalloc(ac+1, sizeof(*badDeps)); - for (i = 0; i < ac; i++, bdp++) { - char * pname, * qname; - - if (av[i] == NULL) - break; - pname = xstrdup(av[i]); - if ((qname = strchr(pname, '>')) != NULL) - *qname++ = '\0'; - bdp->pname = pname; - bdp->qname = qname; - rpmlog(msglvl, - _("ignore package name relation(s) [%d]\t%s -> %s\n"), - i, bdp->pname, (bdp->qname ? bdp->qname : "???")); - } - bdp->pname = NULL; - bdp->qname = NULL; - } - av = _free(av); - s = _free(s); - badDepsInitialized++; - } - - if (badDeps != NULL) - for (bdp = badDeps; bdp->pname != NULL && bdp->qname != NULL; bdp++) { - if (rstreq(rpmteN(p), bdp->pname) && rstreq(rpmteN(q), bdp->qname)) - return 1; - } - return 0; -} - static void rpmTSIFree(tsortInfo tsi) { relation rel; @@ -238,10 +158,6 @@ static inline int addRelation(rpmts ts, if (q == NULL || q == p) return 0; - /* Avoid certain dependency relations. */ - if (ignoreDep(ts, p, q)) - return 0; - addSingleRelation(p, q, dsflags); return 0; @@ -719,8 +635,6 @@ int rpmtsOrder(rpmts ts) tsmem->orderAlloced = tsmem->orderCount; rc = 0; - freeBadDeps(); - for (int i = 2; SCCs[i].members != NULL; i++) { free(SCCs[i].members); } diff --git a/macros.in b/macros.in index 8894efd..afa98f8 100644 --- a/macros.in +++ b/macros.in @@ -625,19 +625,6 @@ print (t)\ %_vsflags_rebuilddb %{__vsflags} %_vsflags_verify %{__vsflags} -# Relations between package names that cause dependency loops -# with legacy packages that cannot be fixed. Relations are -# specified as -# p>q -# where package p has a Requires: on something that package q Provides: -# -# XXX Note: that there cannot be any whitespace within the string "p>q", -# and that both p and q are package names (i.e. no version/release). -# - -%_dependency_whiteout \ - %{nil} - # # Default output format string for rpm -qa #