RPM Package Manager, CVS Repository
  http://rpm5.org/cvs/
  ____________________________________________________________________________

  Server: rpm5.org                         Name:   Jeff Johnson
  Root:   /v/rpm/cvs                       Email:  j...@rpm5.org
  Module: rpm                              Date:   11-Apr-2017 19:36:59
  Branch: rpm-5_4                          Handle: 2017041117365801

  Modified files:           (Branch: rpm-5_4)
    rpm                     CHANGES
    rpm/build               names.c
    rpm/lib                 rpmts.c rpmts.h transaction.c

  Log:
    - install: use clock_gettime/gettimeofday/time for *.rpm timestamps.

  Summary:
    Revision    Changes     Path
    1.3501.2.531+1  -0      rpm/CHANGES
    1.40.6.3    +2  -2      rpm/build/names.c
    2.188.2.18  +38 -3      rpm/lib/rpmts.c
    2.134.2.9   +3  -0      rpm/lib/rpmts.h
    1.429.2.18  +16 -2      rpm/lib/transaction.c
  ____________________________________________________________________________

  patch -p0 <<'@@ .'
  Index: rpm/CHANGES
  ============================================================================
  $ cvs diff -u -r1.3501.2.530 -r1.3501.2.531 CHANGES
  --- rpm/CHANGES       11 Apr 2017 17:04:51 -0000      1.3501.2.530
  +++ rpm/CHANGES       11 Apr 2017 17:36:58 -0000      1.3501.2.531
  @@ -1,4 +1,5 @@
   5.4.17 -> 5.4.18:
  +    - jbj: install: use clock_gettime/gettimeofday/time for *.rpm timestamps.
       - jbj: build: add usecs to RPMTAG_BUILDTIME/RPMTAG_COOKIE.
       - jbj: header: minor optimization for headerGet().
       - jbj: header: fix: accomodate rpm.org unsorted signature header bug.
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/build/names.c
  ============================================================================
  $ cvs diff -u -r1.40.6.2 -r1.40.6.3 names.c
  --- rpm/build/names.c 11 Apr 2017 17:04:52 -0000      1.40.6.2
  +++ rpm/build/names.c 11 Apr 2017 17:36:59 -0000      1.40.6.3
  @@ -218,8 +218,8 @@
       }
     
       /* XXX avoid "legacy incompatbility" for now.*/
  -    buildTime[0] = (rpm_time_t) tv.tv_sec;
  -    buildTime[1] = (rpm_time_t) tv.tv_usec;
  +    buildTime[0] = (rpmuint32_t) tv.tv_sec;
  +    buildTime[1] = (rpmuint32_t) tv.tv_usec;
   
   exit:
       return buildTime;
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/lib/rpmts.c
  ============================================================================
  $ cvs diff -u -r2.188.2.17 -r2.188.2.18 rpmts.c
  --- rpm/lib/rpmts.c   27 Jun 2016 03:10:04 -0000      2.188.2.17
  +++ rpm/lib/rpmts.c   11 Apr 2017 17:36:59 -0000      2.188.2.18
  @@ -1046,6 +1046,16 @@
       return tid;
   }
   
  +rpmuint32_t * rpmtsGetTid2(rpmts ts)
  +{
  +    static rpmuint32_t _tid[2] = { -1, 0 };
  +    rpmuint32_t * tidp = _tid;
  +    if (ts != NULL) {
  +     tidp = ts->tid;
  +    }
  +    return tidp;
  +}
  +
   rpmuint32_t rpmtsSetTid(rpmts ts, rpmuint32_t tid)
   {
       rpmuint32_t otid = 0;    /* XXX -1 is time(2) error return. */
  @@ -1057,6 +1067,19 @@
       return otid;
   }
   
  +rpmuint32_t * rpmtsSetTid2(rpmts ts, rpmuint32_t tid0, rpmuint32_t tid1)
  +{
  +    static rpmuint32_t _tid[2] = { -1, 0 };
  +    rpmuint32_t * otidp = _tid;
  +    if (ts != NULL) {
  +       _tid[0] = ts->tid[0];
  +       _tid[1] = ts->tid[1];
  +       ts->tid[0] = tid0;
  +       ts->tid[1] = tid1;
  +    }
  +    return otidp;
  +}
  +
   rpmPRCO rpmtsPRCO(rpmts ts)
   {
       rpmPRCO PRCO = NULL;
  @@ -1508,7 +1531,6 @@
   rpmts rpmtsCreate(void)
   {
       rpmts ts = rpmtsGetPool(_rpmtsPool);
  -    int xx;
   
       memset(&ts->ops, 0, sizeof(ts->ops));
       (void) rpmswEnter(rpmtsOp(ts, RPMTS_OP_TOTAL), -1);
  @@ -1532,8 +1554,21 @@
       ts->txn = NULL;
   
       ts->scriptFd = NULL;
  -    {        struct timeval tv;
  -     xx = gettimeofday(&tv, NULL);
  +    {        struct timespec tspec = { 0, 0 };
  +     struct timeval tv = { 0, 0 };
  +     if (!clock_gettime(CLOCK_REALTIME, &tspec)) {
  +         tv.tv_sec = tspec.tv_sec;
  +         tv.tv_usec = tspec.tv_nsec/1000;
  +     } else
  +     if (!gettimeofday(&tv, NULL)) {
  +         tspec.tv_sec = tv.tv_sec;
  +         tspec.tv_nsec = tv.tv_usec * 1000;
  +     } else
  +     {
  +         tspec.tv_sec = tv.tv_sec = time(NULL);
  +         tspec.tv_nsec = tv.tv_usec = 0;
  +     }
  +     /* XXX avoid "legacy incompatbility" for now.*/
        ts->tid[0] = (rpmuint32_t) tv.tv_sec;
        ts->tid[1] = (rpmuint32_t) tv.tv_usec;
       }
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/lib/rpmts.h
  ============================================================================
  $ cvs diff -u -r2.134.2.8 -r2.134.2.9 rpmts.h
  --- rpm/lib/rpmts.h   25 Jun 2016 09:49:39 -0000      2.134.2.8
  +++ rpm/lib/rpmts.h   11 Apr 2017 17:36:59 -0000      2.134.2.9
  @@ -673,6 +673,8 @@
    */
   rpmuint32_t rpmtsGetTid(rpmts ts)
        RPM_GNUC_PURE;
  +rpmuint32_t * rpmtsGetTid2(rpmts ts)
  +     RPM_GNUC_PURE;
   
   /** \ingroup rpmts
    * Set transaction id, i.e. transaction time stamp.
  @@ -681,6 +683,7 @@
    * @return           previous transaction id
    */
   rpmuint32_t rpmtsSetTid(rpmts ts, rpmuint32_t tid);
  +rpmuint32_t * rpmtsSetTid2(rpmts ts, rpmuint32_t tid0, rpmuint32_t tid1);
   
   /** \ingroup rpmts
    * Get OpenPGP packet parameters, i.e. signature/pubkey constants.
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/lib/transaction.c
  ============================================================================
  $ cvs diff -u -r1.429.2.17 -r1.429.2.18 transaction.c
  --- rpm/lib/transaction.c     27 Feb 2016 21:03:41 -0000      1.429.2.17
  +++ rpm/lib/transaction.c     11 Apr 2017 17:36:59 -0000      1.429.2.18
  @@ -1517,8 +1517,22 @@
       (void) rpmtsSetChrootDone(ts, 0);
   
       /* XXX rpmtsCreate() sets the transaction id, but apps may not honor. */
  -    {        rpmuint32_t tid = (rpmuint32_t) time(NULL);
  -     (void) rpmtsSetTid(ts, tid);
  +    {        struct timespec tspec = { 0, 0 };
  +     struct timeval tv = { 0, 0 };
  +     if (!clock_gettime(CLOCK_REALTIME, &tspec)) {
  +         tv.tv_sec = tspec.tv_sec;
  +         tv.tv_usec = tspec.tv_nsec/1000;
  +     } else
  +     if (!gettimeofday(&tv, NULL)) {
  +         tspec.tv_sec = tv.tv_sec;
  +         tspec.tv_nsec = tv.tv_usec * 1000;
  +     } else
  +     {
  +         tspec.tv_sec = tv.tv_sec = time(NULL);
  +         tspec.tv_nsec = tv.tv_usec = 0;
  +     }
  +     /* XXX avoid "legacy incompatbility" for now.*/
  +     (void) rpmtsSetTid2(ts, tv.tv_sec, tv.tv_usec);
       }
   
       /* Get available space on mounted file systems. */
  @@ .
______________________________________________________________________
RPM Package Manager                                    http://rpm5.org
CVS Sources Repository                                rpm-cvs@rpm5.org

Reply via email to