+4.3.1 -> 4.4:
+ - use package build time as EVR comparison tie breaker.
+
+4.3 -> 4.3.1:
+
4.2.2 -> 4.3:
- upgrade to zlib-1.2.beta7.
- fix: short option help missing string terminator.
{
const char * one, * two;
int_32 * epochOne, * epochTwo;
- int rc;
+ int_32 * btOne, * btTwo;
+ int rc = 0;
if (!headerGetEntry(first, RPMTAG_EPOCH, NULL, (void **) &epochOne, NULL))
epochOne = NULL;
epochTwo = NULL;
if (epochOne != NULL && epochTwo == NULL)
- return 1;
+ rc = 1;
else if (epochOne == NULL && epochTwo != NULL)
- return -1;
+ rc = -1;
else if (epochOne != NULL && epochTwo != NULL) {
/*@-boundsread@*/
if (*epochOne < *epochTwo)
- return -1;
+ rc = -1;
else if (*epochOne > *epochTwo)
- return 1;
+ rc = 1;
/*@=boundsread@*/
}
+ if (rc)
+ return rc;
rc = headerGetEntry(first, RPMTAG_VERSION, NULL, (void **) &one, NULL);
rc = headerGetEntry(second, RPMTAG_VERSION, NULL, (void **) &two, NULL);
rc = headerGetEntry(first, RPMTAG_RELEASE, NULL, (void **) &one, NULL);
rc = headerGetEntry(second, RPMTAG_RELEASE, NULL, (void **) &two, NULL);
- return rpmvercmp(one, two);
+ rc = rpmvercmp(one, two);
+ if (rc)
+ return rc;
+
+ if (!headerGetEntry(first, RPMTAG_BUILDTIME, NULL, (void **) &btOne, NULL))
+ btOne = NULL;
+ if (!headerGetEntry(second, RPMTAG_BUILDTIME, NULL, (void **) &btTwo, NULL))
+ btTwo = NULL;
+
+ if (btOne != NULL && btTwo != NULL && *btOne > 0 && *btTwo > 0) {
+/*@-boundsread@*/
+ rc = (*btOne < *btTwo ? -1 : (*btOne == *btTwo ? 0 : -1));
+/*@=boundsread@*/
+ }
+
+ return rc;
}
/**
{
HGE_t hge =
(scareMem ? (HGE_t) headerGetEntryMinMemory : (HGE_t) headerGetEntry);
+ rpmTag tagBT = RPMTAG_BUILDTIME;
+ int_32 BTt, * BTp;
rpmTag tagEVR, tagF;
rpmds ds = NULL;
const char * Type;
if (!scareMem && ds->Flags != NULL)
ds->Flags = memcpy(xmalloc(ds->Count * sizeof(*ds->Flags)),
ds->Flags, ds->Count * sizeof(*ds->Flags));
+ xx = hge(h, tagBT, &BTt, (void **) &BTp, NULL);
+ ds->BT = (xx && BTp != NULL && BTt == RPM_INT32_TYPE ? *BTp : 0);
/*@=boundsread@*/
ds->Color = xcalloc(Count, sizeof(*ds->Color));
ds->Refs = xcalloc(Count, sizeof(*ds->Refs));
ds->h = NULL;
ds->Type = Type;
ds->tagN = tagN;
+ { time_t now = time(NULL);
+ ds->BT = now;
+ }
ds->Count = 1;
/*@-assignexpose@*/
/*@-boundswrite@*/
return tagN;
}
+time_t rpmdsBT(const rpmds ds)
+{
+ time_t BT = 0;
+ if (ds != NULL && ds->BT > 0)
+ BT = ds->BT;
+ return BT;
+}
+
+time_t rpmdsSetBT(const rpmds ds, time_t BT)
+{
+ time_t oBT = 0;
+ if (ds != NULL) {
+ oBT = ds->BT;
+ ds->BT = BT;
+ }
+ return oBT;
+}
+
int rpmdsNoPromote(const rpmds ds)
{
int nopromote = 0;
sense = rpmvercmp(aV, bV);
if (sense == 0 && aR && *aR && bR && *bR) {
sense = rpmvercmp(aR, bR);
+ if (sense == 0 && A->BT > 0 && B->BT > 0)
+ sense = (A->BT < B->BT ? -1 : (A->BT == B->BT ? 0 : -1));
}
}
/*@=boundsread@*/
uint_32 * Color; /*!< Bit(s) calculated from file color(s). */
/*@only@*/ /*@null@*/
int_32 * Refs; /*!< No. of file refs. */
+ int_32 BT; /*!< Package build time tie breaker. */
rpmTag tagN; /*!< Header tag. */
rpmTagType Nt, EVRt, Ft; /*!< Tag data types. */
int_32 Count; /*!< No. of elements */
rpmTag rpmdsTagN(/*@null@*/ const rpmds ds)
/*@*/;
+/**
+ * Return dependency build time.
+ * @param ds dependency set
+ * @return dependency build time, 0 on invalid
+ */
+time_t rpmdsBT(/*@null@*/ const rpmds ds)
+ /*@*/;
+
+/**
+ * Set dependency build time.
+ * @param ds dependency set
+ * @return dependency build time, 0 on invalid
+ */
+time_t rpmdsSetBuildtime(/*@null@*/ const rpmds ds, time_t BT)
+ /*@modifies ds @*/;
+
/**
* Return current "Don't promote Epoch:" flag.
*
return Py_BuildValue("i", rpmdsFlags(s->ds));
}
+/*@null@*/
+static PyObject *
+rpmds_BT(rpmdsObject * s, PyObject * args)
+ /*@*/
+{
+ if (!PyArg_ParseTuple(args, ":BT")) return NULL;
+ return Py_BuildValue("i", (int) rpmdsBT(s->ds));
+}
+
/*@null@*/
static PyObject *
rpmds_TagN(rpmdsObject * s, PyObject * args)
"ds.EVR -> EVR - Return current EVR.\n" },
{"Flags", (PyCFunction)rpmds_Flags, METH_VARARGS,
"ds.Flags -> Flags - Return current Flags.\n" },
+ {"BT", (PyCFunction)rpmds_BT, METH_VARARGS,
+ "ds.BT -> BT - Return build time.\n" },
{"TagN", (PyCFunction)rpmds_TagN, METH_VARARGS,
"ds.TagN -> TagN - Return current TagN.\n" },
{"Color", (PyCFunction)rpmds_Color, METH_VARARGS,