Poifect! That also keeps TID's opaque in case something
other than a time stamp ever has to be substituted: any
monotonically increasing integer would do for a transaction id.
Would you like to try for higher precision? RPM_UINT64_TYPE
is available several years now, and gettimeofday(2) could
be layered into a uint64_t for usec precision time stamps.
The legacy issues with using RPM_UINT64_TYPE needs to be explored.
I *think* that an added UINT64 tag has legacy compatibility for
new tags that are not queried. At worst, there's a case that needs
adding in a handful of places in older versions of rpm.
I'm also quite prepared for UINT128 to accomodate UUID's whenever.
BTW, its likely time to also substitute RPMTAG_INSTALLTID instead
of RPMTAG_INSTALLTIME in --info spew. That likely pleases
the greatest number of people's expectations.
Sound like a plan?
73 de Jeff
On Jan 31, 2008, at 5:12 PM, Ralf S. Engelschall wrote:
> Jeff, I finally understood your points about the difference between
> INSTALLTID and INSTALLTIME. Actually, until now I was not even aware
> that INSTALLTID is actually the unique transaction startup time.
>
> I discussed the issue "to what value should ORIGINTIME be initialized:
> INSTALLTIME or INSTALLTID" offline with Thomas Lotterer now and we
> came to only one obvious solution which also makes a lot of sense for
> both consistency and practical usefulness reasons: we need companion
> ORIGINTIME _AND_ ORIGINTID and the initial value for ORIGINTIME is
> INSTALLTIME and the initial value for ORIGINTID is INSTALLTID!
>
> Find a proposed patch appended which implements this
> and perhaps finally should make _both_ you _and_ me happy ;-)
>
> Ralf S. Engelschall
> rse@engelschall.com
> www.engelschall.com
>
> Index: lib/depends.c
> ===================================================================
> RCS file: /v/rpm/cvs/rpm/lib/depends.c,v
> retrieving revision 1.386
> diff -u -d -u -d -r1.386 depends.c
> --- lib/depends.c 31 Jan 2008 18:46:28 -0000 1.386
> +++ lib/depends.c 31 Jan 2008 21:32:07 -0000
> @@ -419,6 +419,13 @@
> continue;
>
> /* Snarf the original install time from older package(s). */
> + he->tag = RPMTAG_ORIGINTID;
> + xx = headerGet(oh, he, 0);
> + if (xx && he->p.ui32p != NULL) {
> + if (p->originTid == 0 || p->originTid > he->p.ui32p[0])
> + p->originTid = he->p.ui32p[0];
> + he->p.ptr = _free(he->p.ptr);
> + }
> he->tag = RPMTAG_ORIGINTIME;
> xx = headerGet(oh, he, 0);
> if (xx && he->p.ui32p != NULL) {
> Index: lib/psm.c
> ===================================================================
> RCS file: /v/rpm/cvs/rpm/lib/psm.c,v
> retrieving revision 2.282
> diff -u -d -u -d -r2.282 psm.c
> --- lib/psm.c 31 Jan 2008 07:26:12 -0000 2.282
> +++ lib/psm.c 31 Jan 2008 21:32:07 -0000
> @@ -1551,6 +1551,7 @@
> uint32_t tscolor = rpmtsColor(ts);
> uint32_t tecolor = rpmteColor(te);
> uint32_t installTime = (uint32_t) time(NULL);
> + uint32_t originTid = rpmteOriginTid(te);
> uint32_t originTime = rpmteOriginTime(te);
> int fc = rpmfiFC(fi);
> int xx = 1;
> @@ -1571,8 +1572,15 @@
> xx = headerPut(fi->h, he, 0);
>
> /* Propagate the time that the package was first installed. */
> + if (originTid == 0)
> + originTid = rpmtsGetTid(ts);
> + he->tag = RPMTAG_ORIGINTID;
> + he->t = RPM_UINT32_TYPE;
> + he->p.ui32p = &originTid;
> + he->c = 1;
> + xx = headerPut(fi->h, he, 0);
> if (originTime == 0)
> - originTime = rpmtsGetTid(ts);
> + originTime = installTime;
> he->tag = RPMTAG_ORIGINTIME;
> he->t = RPM_UINT32_TYPE;
> he->p.ui32p = &originTime;
> Index: lib/rpmte.c
> ===================================================================
> RCS file: /v/rpm/cvs/rpm/lib/rpmte.c,v
> retrieving revision 2.74
> diff -u -d -u -d -r2.74 rpmte.c
> --- lib/rpmte.c 30 Jan 2008 21:39:30 -0000 2.74
> +++ lib/rpmte.c 31 Jan 2008 21:32:07 -0000
> @@ -181,6 +181,7 @@
> p->replaced = NULL;
>
> p->pkgFileSize = 0;
> + p->originTid = 0;
> p->originTime = 0;
>
> p->PRCO = rpmdsNewPRCO(h);
> @@ -328,6 +329,11 @@
> return (te != NULL ? te->pkgFileSize : 0);
> }
>
> +uint32_t rpmteOriginTid(rpmte te)
> +{
> + return (te != NULL ? te->originTid : 0);
> +}
> +
> uint32_t rpmteOriginTime(rpmte te)
> {
> return (te != NULL ? te->originTime : 0);
> Index: lib/rpmte.h
> ===================================================================
> RCS file: /v/rpm/cvs/rpm/lib/rpmte.h,v
> retrieving revision 2.43
> diff -u -d -u -d -r2.43 rpmte.h
> --- lib/rpmte.h 30 Jan 2008 21:39:30 -0000 2.43
> +++ lib/rpmte.h 31 Jan 2008 21:32:07 -0000
> @@ -343,6 +343,14 @@
> /*@*/;
>
> /** \ingroup rpmte
> + * Retrieve transaction start time that package was first installed.
> + * @param te transaction element
> + * @return origin time
> + */
> +uint32_t rpmteOriginTid(rpmte te)
> + /*@*/;
> +
> +/** \ingroup rpmte
> * Retrieve time that package was first installed.
> * @param te transaction element
> * @return origin time
> Index: rpmdb/rpmtag.h
> ===================================================================
> RCS file: /v/rpm/cvs/rpm/rpmdb/rpmtag.h,v
> retrieving revision 1.37
> diff -u -d -u -d -r1.37 rpmtag.h
> --- rpmdb/rpmtag.h 31 Jan 2008 07:26:12 -0000 1.37
> +++ rpmdb/rpmtag.h 31 Jan 2008 21:32:08 -0000
> @@ -412,7 +412,8 @@
> RPMTAG_SANITYCHECKPROG = 1206, /* s */
> RPMTAG_FILESTAT = 1207, /* s[] stat(2) from metadata extension*/
> RPMTAG_STAT = 1208, /* s[] stat(2) from disk extension */
> - RPMTAG_ORIGINTIME = 1209, /* i */
> + RPMTAG_ORIGINTID = 1209, /* i */
> + RPMTAG_ORIGINTIME = 1210, /* i */
>
> /*@-enummemuse@*/
> RPMTAG_FIRSTFREE_TAG /*!< internal */
>
> ______________________________________________________________________
> RPM Package Manager http://rpm5.org
> Developer Communication List rpm-devel@rpm5.org
Received on Thu Jan 31 23:50:07 2008