Record header instance in dependency sets + add API for retrieving
authorPanu Matilainen <pmatilai@redhat.com>
Fri, 26 Mar 2010 12:56:14 +0000 (14:56 +0200)
committerPanu Matilainen <pmatilai@redhat.com>
Fri, 26 Mar 2010 12:56:14 +0000 (14:56 +0200)
lib/rpmds.c
lib/rpmds.h

index 669b735..9952e0f 100644 (file)
@@ -29,6 +29,7 @@ struct rpmds_s {
     time_t BT;                 /*!< Package build time tie breaker. */
     rpmTag tagN;               /*!< Header tag. */
     int32_t Count;             /*!< No. of elements */
+    unsigned int instance;     /*!< From rpmdb instance? */
     int i;                     /*!< Element index. */
     unsigned l;                        /*!< Low element (bsearch). */
     unsigned u;                        /*!< High element (bsearch). */
@@ -140,6 +141,7 @@ rpmds rpmdsNew(Header h, rpmTag tagN, int flags)
        ds->N = names.data;
        ds->Count = rpmtdCount(&names);
        ds->nopromote = _rpmds_nopromote;
+       ds->instance = headerGetInstance(h);
 
        headerGet(h, tagEVR, &evr, hgflags);
        ds->EVR = evr.data;
@@ -212,6 +214,7 @@ rpmds rpmdsThis(Header h, rpmTag tagN, rpmsenseFlags Flags)
 {
     char *evr = headerGetAsString(h, RPMTAG_EVR);
     rpmds ds = rpmdsSingle(tagN, headerGetString(h, RPMTAG_NAME), evr, Flags);
+    if (ds) ds->instance = headerGetInstance(h);
     free(evr);
     return ds;
 }
@@ -340,6 +343,11 @@ time_t rpmdsSetBT(const rpmds ds, time_t BT)
     return oBT;
 }
 
+unsigned int rpmdsInstance(rpmds ds)
+{
+    return (ds != NULL) ? ds->instance : 0;
+}
+
 int rpmdsNoPromote(const rpmds ds)
 {
     int nopromote = 0;
index 72c09d7..714d266 100644 (file)
@@ -201,6 +201,14 @@ rpmsenseFlags rpmdsFlags(const rpmds ds);
 rpmTag rpmdsTagN(const rpmds ds);
 
 /** \ingroup rpmds
+ * Return dependency header instance, ie whether the dependency comes from 
+ * an installed header or not.
+ * @param ds           dependency set
+ * @return             header instance of dependency (0 for not installed)
+ */
+unsigned int rpmdsInstance(rpmds ds);
+
+/** \ingroup rpmds
  * Return dependency build time.
  * @param ds           dependency set
  * @return             dependency build time, 0 on invalid