Eliminate ancient dependency loop whiteout mechanism
authorPanu Matilainen <pmatilai@redhat.com>
Wed, 15 Dec 2010 09:34:50 +0000 (11:34 +0200)
committerPanu Matilainen <pmatilai@redhat.com>
Wed, 15 Dec 2010 09:34:50 +0000 (11:34 +0200)
- 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.

lib/order.c
macros.in

index d7a91e7..9cda649 100644 (file)
@@ -4,13 +4,10 @@
 
 #include "system.h"
 
-#include <popt.h>
-
 #include <rpm/rpmtag.h>
-#include <rpm/rpmmacro.h>       /* XXX rpmExpand("%{_dependency_whiteout */
+#include <rpm/rpmmacro.h>
 #include <rpm/rpmlog.h>
 #include <rpm/rpmds.h>
-#include <rpm/rpmfi.h>
 
 #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);
     }
index 8894efd..afa98f8 100644 (file)
--- 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
 #