RPM Community Forums

Mailing List Message of <rpm-cvs>

[CVS] RPM: rpm/ VENDOR rpm/lib/ psm.c rpm/rpmdb/ rpmtag.h

From: Ralf S. Engelschall <rse@rpm5.org>
Date: Wed 30 Jan 2008 - 19:24:13 CET
Message-Id: <20080130182413.C68AD348471@rpm5.org>
  RPM Package Manager, CVS Repository
  http://rpm5.org/cvs/
  ____________________________________________________________________________

  Server: rpm5.org                         Name:   Ralf S. Engelschall
  Root:   /v/rpm/cvs                       Email:  rse@rpm5.org
  Module: rpm                              Date:   30-Jan-2008 19:24:13
  Branch: HEAD                             Handle: 2008013018241300

  Modified files:
    rpm                     VENDOR
    rpm/lib                 psm.c
    rpm/rpmdb               rpmtag.h

  Log:
    Still OpenPKG-specific until merged: support the tag "INSTALLTIME1ST"
    which is the first/initial "INSTALLTIME" of a package, even after
    multiple package updates. The background is: for multiple reasons
    (heuristical decisions by RPM frontends, etc) it is interesting to
    know when a particular package was installed the _first_ time, even
    if the current package version is already the N-th update and hence
    shows a later "install time". The formula used is: INSTALLTIME1ST_new =
    min([INSTALLTIME1ST_old], CURRENTTIME)

  Summary:
    Revision    Changes     Path
    2.37        +12 -0      rpm/VENDOR
    2.280       +39 -0      rpm/lib/psm.c
    1.36        +1  -0      rpm/rpmdb/rpmtag.h
  ____________________________________________________________________________

  patch -p0 <<'@@ .'
  Index: rpm/VENDOR
  ============================================================================
  $ cvs diff -u -r2.36 -r2.37 VENDOR
  --- rpm/VENDOR	29 Jan 2008 19:11:50 -0000	2.36
  +++ rpm/VENDOR	30 Jan 2008 18:24:13 -0000	2.37
  @@ -429,6 +429,18 @@
                        during built-time and hence one also needs to be able
                        to override this on the command line.
        ________________________________________________________________________
  +     
  +     Change:         additional-tag-installtime1st
  +     Purpose:        Support the tag "INSTALLTIME1ST" which shows the
  +                     first/initial "INSTALLTIME" of a package, even after
  +                     multiple package updates.
  +     Reason:         For multiple reasons (update frontends, etc) it is
  +                     interesting to know when a particular package was
  +                     installed the _first_ time, even if the current
  +                     package version is already the Nth update and hence
  +                     shows a later "install time". The formula used is:
  +                     INSTALLTIME1ST_new = min([INSTALLTIME1ST_old], CURRENTTIME)
  +     ________________________________________________________________________
   
     o  Name:           RPM4DARWIN
        Vendor:         RPM for Darwin (Mac OS X) <http://rpm4darwin.sourceforge.net/>
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/lib/psm.c
  ============================================================================
  $ cvs diff -u -r2.279 -r2.280 psm.c
  --- rpm/lib/psm.c	9 Jan 2008 00:36:02 -0000	2.279
  +++ rpm/lib/psm.c	30 Jan 2008 18:24:13 -0000	2.280
  @@ -1553,6 +1553,9 @@
       uint32_t installTime = (uint32_t) time(NULL);
       int fc = rpmfiFC(fi);
       int xx = 1;
  +#if defined(RPM_VENDOR_OPENPKG) /* additional-tag-installtime1st */
  +    HE_t he_te;
  +#endif
   
   assert(fi->h != NULL);
       if (fi->fstates != NULL && fc > 0) {
  @@ -1569,6 +1572,42 @@
       he->c = 1;
       xx = headerPut(fi->h, he, 0);
   
  +#if defined(RPM_VENDOR_OPENPKG) /* additional-tag-installtime1st */
  +    he_te = memset(alloca(sizeof(*he_te)), 0, sizeof(*he_te));
  +    he_te->tag = RPMTAG_NAME;
  +    if (headerGet(rpmteHeader(te), he_te, 0)) {
  +        const char *name = he_te->p.str;
  +        if (name != NULL) {
  +            rpmts ts;
  +            if ((ts = rpmtsCreate()) != NULL) {
  +                rpmdbMatchIterator mi;
  +                Header h_db;
  +                HE_t he_db;
  +                uint32_t installTime1st;
  +
  +                rpmtsOpenDB(ts, O_RDONLY);
  +                he_db = memset(alloca(sizeof(*he_db)), 0, sizeof(*he_db));
  +                mi = rpmtsInitIterator(ts, RPMTAG_PROVIDENAME, name, 0);
  +                installTime1st = installTime;
  +                while ((h_db = rpmdbNextIterator(mi)) != NULL) {
  +                    he_db->tag = RPMTAG_INSTALLTIME1ST;
  +                    if (headerGet(h_db, he_db, 0))
  +                        if (installTime1st > *(he_db->p.ui32p))
  +                            installTime1st = *(he_db->p.ui32p);
  +                }
  +                mi = rpmdbFreeIterator(mi);
  +                ts = rpmtsFree(ts);
  +
  +                he->tag = RPMTAG_INSTALLTIME1ST;
  +                he->t = RPM_UINT32_TYPE;
  +                he->p.ui32p = &installTime1st;
  +                he->c = 1;
  +                xx = headerPut(fi->h, he, 0);
  +            }
  +        }
  +    }
  +#endif
  +
       he->tag = RPMTAG_INSTALLCOLOR;
       he->t = RPM_UINT32_TYPE;
       he->p.ui32p = &tscolor;
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmdb/rpmtag.h
  ============================================================================
  $ cvs diff -u -r1.35 -r1.36 rpmtag.h
  --- rpm/rpmdb/rpmtag.h	26 Jan 2008 17:05:02 -0000	1.35
  +++ rpm/rpmdb/rpmtag.h	30 Jan 2008 18:24:13 -0000	1.36
  @@ -412,6 +412,7 @@
       RPMTAG_SANITYCHECKPROG	= 1206, /* s */
       RPMTAG_FILESTAT		= 1207, /* s[] stat(2) from metadata extension*/
       RPMTAG_STAT			= 1208, /* s[] stat(2) from disk extension */
  +    RPMTAG_INSTALLTIME1ST	= 1209,	/* i */
   
   /*@-enummemuse@*/
       RPMTAG_FIRSTFREE_TAG	/*!< internal */
  @@ .
Received on Wed Jan 30 19:24:13 2008
Driven by Jeff Johnson and the RPM project team.
Hosted by OpenPKG and Ralf S. Engelschall.
Powered by FreeBSD and OpenPKG.