--- rpm-5.4.4/lib/order.c.ordering~ 2011-01-14 15:06:08.000000000 +0100 +++ rpm-5.4.4/lib/order.c 2011-11-16 11:31:23.529577558 +0100 @@ -332,7 +332,7 @@ static inline /*@observer@*/ const char /*@-mustmod@*/ /* FIX: hack modifies, but -type disables */ static /*@owned@*/ /*@null@*/ const char * zapRelation(rpmte q, rpmte p, - int zap, /*@in@*/ /*@out@*/ int * nzaps, int msglvl) + int zap, /*@in@*/ /*@out@*/ int * nzaps, int msglvl, rpmuint32_t skipFlags) /*@globals rpmGlobalMacroContext, h_errno, internalState @*/ /*@modifies q, p, *nzaps, rpmGlobalMacroContext, internalState @*/ { @@ -364,6 +364,18 @@ zapRelation(rpmte q, rpmte p, dp = rpmdsNewDNEVR( identifyDepend(Flags), requires); + if(Flags & skipFlags) { + if(zap) { + rpmlog(msglvl, + _("not removing %s \"%s\" from tsort relations.\n"), + (rpmteNEVRA(p) ? rpmteNEVRA(p) : "???"), dp); + if (nzaps) + (*nzaps)++; + } + dp = _free(dp); + continue; + } + /* * Attempt to unravel a dependency loop by eliminating Requires's. */ @@ -1812,6 +1824,18 @@ int _rpmtsOrder(rpmts ts) int depth; int breadth; int qlen; + static const evrFlags orderPriority[] = { + RPMSENSE_MISSINGOK, + RPMSENSE_SCRIPT_VERIFY, + RPMSENSE_PACKAGE, + RPMSENSE_FIND_REQUIRES, + _ERASE_ONLY_MASK, + _INSTALL_ONLY_MASK, + _ALL_REQUIRES_MASK + }; /* dependency to zap in order to try resolve dependency loops */ + rpmuint32_t skipFlags = _ALL_REQUIRES_MASK; + unsigned sfi = 0; + #endif /* REFERENCE */ if (_rpmts_debug) @@ -2007,6 +2031,9 @@ fprintf(stderr, "--> %s(%p) tsFlags 0x%x rescan: if (pi != NULL) pi = rpmtsiFree(pi); #endif + if (sfi < sizeof(orderPriority)) + skipFlags &= ~orderPriority[sfi++]; + q = r = NULL; qlen = 0; pi = rpmtsiInit(ts); @@ -2168,10 +2195,14 @@ rescan: const char * nevra; #endif const char * dp; + /* + * TODO: use RPMLOG_DEBUG for when loops can be resolved + * without zapping all dependencies in it + */ rpmlogLvl msglvl = (anaconda || (rpmtsDFlags(ts) & RPMDEPS_FLAG_DEPLOOPS)) ? RPMLOG_WARNING : RPMLOG_ERR; #if defined(RPM_VENDOR_MANDRIVA) /* loop-detection-optional-loglevel */ - // Report loops as debug-level message by default (7 = RPMLOG_DEBUG), overridable + /* Report loops as debug-level message by default (7 = RPMLOG_DEBUG), overridable */ msglvl = rpmExpandNumeric("%{?_loop_detection_loglevel}%{?!_loop_detection_loglevel:7}"); #endif @@ -2184,7 +2215,7 @@ rescan: } /* Find (and destroy if co-requisite) "q <- p" relation. */ - dp = zapRelation(q, p, 1, &nzaps, msglvl); + dp = zapRelation(q, p, 1, &nzaps, msglvl, skipFlags); #if 0 /* Print next member of loop. */