From eaff094c5756a15c5e4c70fcfacf63251b9f7691 Mon Sep 17 00:00:00 2001 From: Panu Matilainen Date: Fri, 26 Mar 2010 14:56:14 +0200 Subject: [PATCH] Record header instance in dependency sets + add API for retrieving --- lib/rpmds.c | 8 ++++++++ lib/rpmds.h | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/lib/rpmds.c b/lib/rpmds.c index 669b735..9952e0f 100644 --- a/lib/rpmds.c +++ b/lib/rpmds.c @@ -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; diff --git a/lib/rpmds.h b/lib/rpmds.h index 72c09d7..714d266 100644 --- a/lib/rpmds.h +++ b/lib/rpmds.h @@ -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 -- 2.7.4