Hang rpmlib() dependency set onto transaction set
authorPanu Matilainen <pmatilai@redhat.com>
Thu, 13 Sep 2012 08:45:29 +0000 (11:45 +0300)
committerPanu Matilainen <pmatilai@redhat.com>
Thu, 13 Sep 2012 08:45:29 +0000 (11:45 +0300)
- Eliminates the cumbersome static rpmlib ds instance which can never
  be freed, as a member of the transaction set it simply gets cleaned
  out along with other transaction (dependency) data.

lib/depends.c
lib/rpmts.c
lib/rpmts_internal.h

index 04e64f5..f9d21c3 100644 (file)
@@ -25,9 +25,6 @@ const char * const rpmEVR = VERSION;
 
 const int rpmFLAGS = RPMSENSE_EQUAL;
 
-/* rpmlib provides */
-static rpmds rpmlibP = NULL;
-
 #undef HASHTYPE
 #undef HTKEYTYPE
 #undef HTDATATYPE
@@ -534,11 +531,10 @@ retry:
      * Check those dependencies now.
      */
     if (dsflags & RPMSENSE_RPMLIB) {
-       static int oneshot = -1;
-       if (oneshot) 
-           oneshot = rpmdsRpmlib(&rpmlibP, NULL);
+       if (tsmem->rpmlib == NULL)
+           rpmdsRpmlib(&(tsmem->rpmlib), NULL);
        
-       if (rpmlibP != NULL && rpmdsSearch(rpmlibP, dep) >= 0) {
+       if (tsmem->rpmlib != NULL && rpmdsSearch(tsmem->rpmlib, dep) >= 0) {
            rpmdsNotify(dep, "(rpmlib provides)", rc);
            goto exit;
        }
index c8ecb9c..7653844 100644 (file)
@@ -555,6 +555,7 @@ void rpmtsClean(rpmts ts)
     rpmtsiFree(pi);
 
     tsmem->addedPackages = rpmalFree(tsmem->addedPackages);
+    tsmem->rpmlib = rpmdsFree(tsmem->rpmlib);
 
     rpmtsCleanProblems(ts);
 }
index a942910..a1e786f 100644 (file)
@@ -16,6 +16,7 @@ typedef struct tsMembers_s {
     removedHash removedPackages;       /*!< Set of packages being removed. */
     rpmal addedPackages;       /*!< Set of packages being installed. */
 
+    rpmds rpmlib;              /*!< rpmlib() dependency set. */
     rpmte * order;             /*!< Packages sorted by dependencies. */
     int orderCount;            /*!< No. of transaction elements. */
     int orderAlloced;          /*!< No. of allocated transaction elements. */