RPM Community Forums

Mailing List Message of <rpm-cvs>

[CVS] RPM: rpm/ CHANGES rpm/lib/ depends.c psm.c rpmte.c rpmte.h rpmts...

From: Jeff Johnson <jbj@rpm5.org>
Date: Fri 01 Feb 2008 - 20:45:55 CET
Message-Id: <20080201194555.60F63348494@rpm5.org>
  RPM Package Manager, CVS Repository
  http://rpm5.org/cvs/
  ____________________________________________________________________________

  Server: rpm5.org                         Name:   Jeff Johnson
  Root:   /v/rpm/cvs                       Email:  jbj@rpm5.org
  Module: rpm                              Date:   01-Feb-2008 20:45:55
  Branch: HEAD                             Handle: 2008020119455202

  Modified files:
    rpm                     CHANGES
    rpm/lib                 depends.c psm.c rpmte.c rpmte.h rpmts.c rpmts.h
    rpm/rpmdb               rpmdb.c rpmtag.h

  Log:
    - use struct timeval timestamp for INSTALL{TID,TIME} and ORIGIN{TID,TIME}.
            Note: TID.usec field is always 0 atm.

  Summary:
    Revision    Changes     Path
    1.2123      +2  -0      rpm/CHANGES
    1.388       +13 -5      rpm/lib/depends.c
    2.285       +27 -16     rpm/lib/psm.c
    2.76        +6  -6      rpm/lib/rpmte.c
    2.45        +4  -4      rpm/lib/rpmte.h
    2.137       +9  -4      rpm/lib/rpmts.c
    2.95        +2  -2      rpm/lib/rpmts.h
    1.235       +10 -6      rpm/rpmdb/rpmdb.c
    1.39        +5  -5      rpm/rpmdb/rpmtag.h
  ____________________________________________________________________________

  patch -p0 <<'@@ .'
  Index: rpm/CHANGES
  ============================================================================
  $ cvs diff -u -r1.2122 -r1.2123 CHANGES
  --- rpm/CHANGES	1 Feb 2008 13:51:23 -0000	1.2122
  +++ rpm/CHANGES	1 Feb 2008 19:45:52 -0000	1.2123
  @@ -1,4 +1,6 @@
   5.0.0 -> 5.1a1:
  +    - jbj: use struct timeval timestamp for INSTALL{TID,TIME} and ORIGIN{TID,TIME}.
  +	Note: TID.usec field is always 0 atm.
       - rse: add new RPM macro "%{uuid:[<version>[, <ns>, <data>]]}" for generating UUIDs of version 1, 3, 4 or 5
       - rse: add new C API function rpmuuidMake() for generating UUIDs of version 1, 3, 4 or 5
       - rse: provide both ORIGINTIME (based on INSTALLTIME) and ORIGINTID (based on INSTALLTID)
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/lib/depends.c
  ============================================================================
  $ cvs diff -u -r1.387 -r1.388 depends.c
  --- rpm/lib/depends.c	1 Feb 2008 07:32:31 -0000	1.387
  +++ rpm/lib/depends.c	1 Feb 2008 19:45:53 -0000	1.388
  @@ -418,19 +418,27 @@
   	if (tscolor && hcolor && ohcolor && !(hcolor & ohcolor))
   	    continue;
   
  -	/* Snarf the original install time from older package(s). */
  +	/* Snarf the original install tid & 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];
  +	    if (p->originTid[0] == 0 || p->originTid[0] > he->p.ui32p[0]
  +	     || (he->c > 1 && p->originTid[0] == he->p.ui32p[0] && p->originTid[1] > he->p.ui32p[1]))
  +	    {
  +		p->originTid[0] = he->p.ui32p[0];
  +		p->originTid[1] = (he->c > 1 ? he->p.ui32p[1] : 0);
  +	    }
   	    he->p.ptr = _free(he->p.ptr);
   	}
   	he->tag = RPMTAG_ORIGINTIME;
   	xx = headerGet(oh, he, 0);
   	if (xx && he->p.ui32p != NULL) {
  -	    if (p->originTime == 0 || p->originTime > he->p.ui32p[0])
  -		p->originTime = he->p.ui32p[0];
  +	    if (p->originTime[0] == 0 || p->originTime[0] > he->p.ui32p[0]
  +	     || (he->c > 1 && p->originTime[0] == he->p.ui32p[0] && p->originTime[1] > he->p.ui32p[1]))
  +	    {
  +		p->originTime[0] = he->p.ui32p[0];
  +		p->originTime[1] = (he->c > 1 ? he->p.ui32p[1] : 0);
  +	    }
   	    he->p.ptr = _free(he->p.ptr);
   	}
   
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/lib/psm.c
  ============================================================================
  $ cvs diff -u -r2.284 -r2.285 psm.c
  --- rpm/lib/psm.c	1 Feb 2008 07:32:31 -0000	2.284
  +++ rpm/lib/psm.c	1 Feb 2008 19:45:53 -0000	2.285
  @@ -1550,33 +1550,44 @@
       HE_t he = memset(alloca(sizeof(*he)), 0, sizeof(*he));
       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);
  +    uint32_t * uip;
  +    uint32_t installTime[2];
  +    uint32_t originTime[2];
  +    uint32_t originTid[2];
       int xx = 1;
   
   assert(fi->h != NULL);
   
  +    {	struct timeval tv;
  +	xx = gettimeofday(&tv, NULL);
  +	installTime[0] = (uint32_t) tv.tv_sec;
  +	installTime[1] = (uint32_t) tv.tv_usec;
  +    }
       he->tag = RPMTAG_INSTALLTIME;
       he->t = RPM_UINT32_TYPE;
  -    he->p.ui32p = &installTime;
  -    he->c = 1;
  +    he->p.ui32p = &installTime[0];
  +    he->c = 2;
       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;
  +    /* Propagate the tid & time that the package was first installed. */
  +    if ((uip = rpmteOriginTime(te)) != NULL)
  +	memcpy(originTime, uip, sizeof(originTime));
  +    if (originTime[0] == 0)
  +	memcpy(originTime, installTime, sizeof(originTime));
  +    he->tag = RPMTAG_ORIGINTIME;
       he->t = RPM_UINT32_TYPE;
  -    he->p.ui32p = &originTid;
  -    he->c = 1;
  +    he->p.ui32p = originTime;
  +    he->c = 2;
       xx = headerPut(fi->h, he, 0);
  -    if (originTime == 0)
  -	originTime = installTime;
  -    he->tag = RPMTAG_ORIGINTIME;
  +
  +    if ((uip = rpmteOriginTid(te)) != NULL)
  +	memcpy(originTid, uip, sizeof(originTid));
  +    if (originTid[0] == 0)
  +	memcpy(originTid, ts->tid, sizeof(originTid));
  +    he->tag = RPMTAG_ORIGINTID;
       he->t = RPM_UINT32_TYPE;
  -    he->p.ui32p = &originTime;
  -    he->c = 1;
  +    he->p.ui32p = originTid;
  +    he->c = 2;
       xx = headerPut(fi->h, he, 0);
   
       he->tag = RPMTAG_INSTALLCOLOR;
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/lib/rpmte.c
  ============================================================================
  $ cvs diff -u -r2.75 -r2.76 rpmte.c
  --- rpm/lib/rpmte.c	1 Feb 2008 07:32:31 -0000	2.75
  +++ rpm/lib/rpmte.c	1 Feb 2008 19:45:53 -0000	2.76
  @@ -181,8 +181,8 @@
       p->replaced = NULL;
   
       p->pkgFileSize = 0;
  -    p->originTid = 0;
  -    p->originTime = 0;
  +    memset(p->originTid, 0, sizeof(p->originTid));
  +    memset(p->originTime, 0, sizeof(p->originTime));
   
       p->PRCO = rpmdsNewPRCO(h);
   
  @@ -329,14 +329,14 @@
       return (te != NULL ? te->pkgFileSize : 0);
   }
   
  -uint32_t rpmteOriginTid(rpmte te)
  +uint32_t * rpmteOriginTid(rpmte te)
   {
  -    return (te != NULL ? te->originTid : 0);
  +    return te->originTid;
   }
   
  -uint32_t rpmteOriginTime(rpmte te)
  +uint32_t * rpmteOriginTime(rpmte te)
   {
  -    return (te != NULL ? te->originTime : 0);
  +    return te->originTime;
   }
   
   int rpmteDepth(rpmte te)
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/lib/rpmte.h
  ============================================================================
  $ cvs diff -u -r2.44 -r2.45 rpmte.h
  --- rpm/lib/rpmte.h	1 Feb 2008 07:32:31 -0000	2.44
  +++ rpm/lib/rpmte.h	1 Feb 2008 19:45:53 -0000	2.45
  @@ -148,8 +148,8 @@
       struct rpmChainLink_s flink;/*!< Forward link info to installed element. */
       int linkFailed;		/*!< Did the linked element upgrade succeed? */
       int done;			/*!< Has the element been installed/erased? */
  -    uint32_t originTid;		/*!< Time of transaction that package was first installed. */
  -    uint32_t originTime;	/*!< Time that package was first installed. */
  +    uint32_t originTid[2];	/*!< Transaction id of first install. */
  +    uint32_t originTime[2];	/*!< Time that package was first installed. */
   
       int installed;		/*!< Was the header installed? */
       int downgrade;		/*!< Adjust package count on downgrades. */
  @@ -348,7 +348,7 @@
    * @param te		transaction element
    * @return		origin time
    */
  -uint32_t rpmteOriginTid(rpmte te)
  +uint32_t * rpmteOriginTid(rpmte te)
   	/*@*/;
   
   /** \ingroup rpmte
  @@ -356,7 +356,7 @@
    * @param te		transaction element
    * @return		origin time
    */
  -uint32_t rpmteOriginTime(rpmte te)
  +uint32_t * rpmteOriginTime(rpmte te)
   	/*@*/;
   
   /** \ingroup rpmte
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/lib/rpmts.c
  ============================================================================
  $ cvs diff -u -r2.136 -r2.137 rpmts.c
  --- rpm/lib/rpmts.c	18 Jan 2008 17:41:28 -0000	2.136
  +++ rpm/lib/rpmts.c	1 Feb 2008 19:45:53 -0000	2.137
  @@ -886,7 +886,7 @@
   {
       uint32_t tid = 0;	/* XXX -1 is time(2) error return. */
       if (ts != NULL) {
  -	tid = ts->tid;
  +	tid = ts->tid[0];
       }
       return tid;
   }
  @@ -895,8 +895,9 @@
   {
       uint32_t otid = 0;	/* XXX -1 is time(2) error return. */
       if (ts != NULL) {
  -	otid = ts->tid;
  -	ts->tid = tid;
  +	otid = ts->tid[0];
  +	ts->tid[0] = tid;
  +	ts->tid[1] = 0;
       }
       return otid;
   }
  @@ -1309,7 +1310,11 @@
       ts->dbmode = O_RDONLY;
   
       ts->scriptFd = NULL;
  -    ts->tid = (uint32_t) time(NULL);
  +    {   struct timeval tv;
  +	xx = gettimeofday(&tv, NULL);
  +	ts->tid[0] = (uint32_t) tv.tv_sec;
  +        ts->tid[1] = (uint32_t) tv.tv_usec;
  +    }
       ts->delta = 5;
   
       ts->color = rpmExpandNumeric("%{?_transaction_color}");
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/lib/rpmts.h
  ============================================================================
  $ cvs diff -u -r2.94 -r2.95 rpmts.h
  --- rpm/lib/rpmts.h	29 Jan 2008 13:37:06 -0000	2.94
  +++ rpm/lib/rpmts.h	1 Feb 2008 19:45:53 -0000	2.95
  @@ -290,7 +290,7 @@
   /*@null@*/
       FD_t scriptFd;		/*!< Scriptlet stdout/stderr. */
       int delta;			/*!< Delta for reallocation. */
  -    uint32_t tid;			/*!< Transaction id. */
  +    uint32_t tid[2];			/*!< Transaction id. */
   
       uint32_t color;		/*!< Transaction color bits. */
       uint32_t prefcolor;		/*!< Preferred file color. */
  @@ -1117,7 +1117,7 @@
   	/*@globals fileSystem @*/
   	/*@modifies ts, *fp, fileSystem @*/
   {
  -    int tid = rpmtsGetTid(ts);
  +    uint32_t tid = rpmtsGetTid(ts);
       time_t ttid = tid;
       rpmtsi tsi;
       rpmte te;
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmdb/rpmdb.c
  ============================================================================
  $ cvs diff -u -r1.234 -r1.235 rpmdb.c
  --- rpm/rpmdb/rpmdb.c	28 Jan 2008 20:29:16 -0000	1.234
  +++ rpm/rpmdb/rpmdb.c	1 Feb 2008 19:45:54 -0000	1.235
  @@ -2830,11 +2830,13 @@
   #ifdef	DYING
       /* Add remove transaction id to header. */
       if (rid != 0 && rid != -1) {
  -	uint32_t tid = rid;
  +	uint32_t tid[2];
  +	tid[0] = rid;
  +	tid[1] = 0;
   	he->tag = RPMTAG_REMOVETID;
   	he->t = RPM_UINT32_TYPE;
  -	he->p.ui32p = &tid;
  -	he->c = 1;
  +	he->p.ui32p = tid;
  +	he->c = 2;
   	xx = headerPut(h, he, 0);
       }
   #endif
  @@ -3142,11 +3144,13 @@
       xx = headerDel(h, he, 0);
   #endif
       if (iid != 0 && iid != -1) {
  -	uint32_t tid = iid;
  +	uint32_t tid[2];
  +	tid[0] = iid;
  +	tid[1] = 0;
   	he->tag = RPMTAG_INSTALLTID;
   	he->t = RPM_UINT32_TYPE;
  -	he->p.ui32p = &tid;
  -	he->c = 1;
  +	he->p.ui32p = tid;
  +	he->c = 2;
   	if (!headerIsEntry(h, he->tag))
   /*@-compmempass@*/
   	   xx = headerPut(h, he, 0);
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmdb/rpmtag.h
  ============================================================================
  $ cvs diff -u -r1.38 -r1.39 rpmtag.h
  --- rpm/rpmdb/rpmtag.h	1 Feb 2008 07:32:32 -0000	1.38
  +++ rpm/rpmdb/rpmtag.h	1 Feb 2008 19:45:54 -0000	1.39
  @@ -193,7 +193,7 @@
       RPMTAG_DESCRIPTION		= 1005,	/* s{} */
       RPMTAG_BUILDTIME		= 1006,	/* i */
       RPMTAG_BUILDHOST		= 1007,	/* s */
  -    RPMTAG_INSTALLTIME		= 1008,	/* i */
  +    RPMTAG_INSTALLTIME		= 1008,	/* i[] */
       RPMTAG_SIZE			= 1009,	/* i */
       RPMTAG_DISTRIBUTION		= 1010,	/* s */
       RPMTAG_VENDOR		= 1011,	/* s */
  @@ -326,8 +326,8 @@
       RPMTAG_PAYLOADCOMPRESSOR	= 1125,	/* s */
       RPMTAG_PAYLOADFLAGS		= 1126,	/* s */
       RPMTAG_INSTALLCOLOR		= 1127, /* i transaction color when installed */
  -    RPMTAG_INSTALLTID		= 1128,	/* i */
  -    RPMTAG_REMOVETID		= 1129,	/* i */
  +    RPMTAG_INSTALLTID		= 1128,	/* i[] */
  +    RPMTAG_REMOVETID		= 1129,	/* i[] */
   /*@-enummemuse@*/
       RPMTAG_SHA1RHN		= 1130, /* internal - obsolete */
   /*@=enummemuse@*/
  @@ -412,8 +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_ORIGINTID		= 1209,	/* i */
  -    RPMTAG_ORIGINTIME		= 1210,	/* i */
  +    RPMTAG_ORIGINTID		= 1209,	/* i[] */
  +    RPMTAG_ORIGINTIME		= 1210,	/* i[] */
   
   /*@-enummemuse@*/
       RPMTAG_FIRSTFREE_TAG	/*!< internal */
  @@ .
Received on Fri Feb 1 20:45:55 2008
Driven by Jeff Johnson and the RPM project team.
Hosted by OpenPKG and Ralf S. Engelschall.
Powered by FreeBSD and OpenPKG.