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: 30-Jan-2008 22:39:30
Branch: HEAD Handle: 2008013021392901
Modified files:
rpm CHANGES
rpm/lib depends.c psm.c rpmte.c rpmte.h
Log:
- propagate the time a package was first installed through upgrades.
Summary:
Revision Changes Path
1.2110 +1 -0 rpm/CHANGES
1.383 +9 -0 rpm/lib/depends.c
2.281 +10 -0 rpm/lib/psm.c
2.74 +6 -0 rpm/lib/rpmte.c
2.43 +9 -0 rpm/lib/rpmte.h
____________________________________________________________________________
patch -p0 <<'@@ .'
Index: rpm/CHANGES
============================================================================
$ cvs diff -u -r1.2109 -r1.2110 CHANGES
--- rpm/CHANGES 29 Jan 2008 14:40:18 -0000 1.2109
+++ rpm/CHANGES 30 Jan 2008 21:39:29 -0000 1.2110
@@ -1,4 +1,5 @@
5.0.0 -> 5.1a1:
+ - jbj: propagate the time a package was first installed through upgrades.
- jbj: replace sr.po from translation project.
- jbj: fix: rpmtsCheck() needs to return 1 when problems exist.
- rse: (again) replace u_int32_t with uint32_t to be consistent across the code base
@@ .
patch -p0 <<'@@ .'
Index: rpm/lib/depends.c
============================================================================
$ cvs diff -u -r1.382 -r1.383 depends.c
--- rpm/lib/depends.c 29 Jan 2008 13:37:06 -0000 1.382
+++ rpm/lib/depends.c 30 Jan 2008 21:39:30 -0000 1.383
@@ -431,6 +431,15 @@
/* Chain through upgrade flink. */
xx = rpmteChain(p, q, oh, "Upgrades");
+ /* Snarf the original install time from older package(s). */
+ he->tag = tagValue("Installtime1st");
+ xx = headerGet(h, he, 0);
+ if (xx && he->p.ui32p != NULL) {
+ if (p->originTime == 0 || p->originTime > he->p.ui32p[0])
+ p->originTime = he->p.ui32p[0];
+ he->p.ptr = _free(he->p.ptr);
+ }
+
/*@-nullptrarith@*/
rpmlog(RPMLOG_DEBUG, D_(" upgrade erases %s\n"), rpmteNEVRA(q));
/*@=nullptrarith@*/
@@ .
patch -p0 <<'@@ .'
Index: rpm/lib/psm.c
============================================================================
$ cvs diff -u -r2.280 -r2.281 psm.c
--- rpm/lib/psm.c 30 Jan 2008 18:24:13 -0000 2.280
+++ rpm/lib/psm.c 30 Jan 2008 21:39:30 -0000 2.281
@@ -1551,6 +1551,7 @@
uint32_t tscolor = rpmtsColor(ts);
uint32_t tecolor = rpmteColor(te);
uint32_t installTime = (uint32_t) time(NULL);
+ uint32_t originTime = rpmteOriginTime(te);
int fc = rpmfiFC(fi);
int xx = 1;
#if defined(RPM_VENDOR_OPENPKG) /* additional-tag-installtime1st */
@@ -1572,6 +1573,15 @@
he->c = 1;
xx = headerPut(fi->h, he, 0);
+ /* Propagate the time that the package was first installed. */
+ if (originTime == 0)
+ originTime = rpmtsGetTid(ts);
+ he->tag = tagValue("Installtime1st");
+ he->t = RPM_UINT32_TYPE;
+ he->p.ui32p = &originTime;
+ 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;
@@ .
patch -p0 <<'@@ .'
Index: rpm/lib/rpmte.c
============================================================================
$ cvs diff -u -r2.73 -r2.74 rpmte.c
--- rpm/lib/rpmte.c 26 Nov 2007 05:16:50 -0000 2.73
+++ rpm/lib/rpmte.c 30 Jan 2008 21:39:30 -0000 2.74
@@ -181,6 +181,7 @@
p->replaced = NULL;
p->pkgFileSize = 0;
+ p->originTime = 0;
p->PRCO = rpmdsNewPRCO(h);
@@ -327,6 +328,11 @@
return (te != NULL ? te->pkgFileSize : 0);
}
+uint32_t rpmteOriginTime(rpmte te)
+{
+ return (te != NULL ? te->originTime : 0);
+}
+
int rpmteDepth(rpmte te)
{
return (te != NULL ? te->depth : 0);
@@ .
patch -p0 <<'@@ .'
Index: rpm/lib/rpmte.h
============================================================================
$ cvs diff -u -r2.42 -r2.43 rpmte.h
--- rpm/lib/rpmte.h 17 Dec 2007 07:07:42 -0000 2.42
+++ rpm/lib/rpmte.h 30 Jan 2008 21:39:30 -0000 2.43
@@ -148,6 +148,7 @@
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 originTime; /*!< Time that package was first installed. */
int installed; /*!< Was the header installed? */
int downgrade; /*!< Adjust package count on downgrades. */
@@ -342,6 +343,14 @@
/*@*/;
/** \ingroup rpmte
+ * Retrieve time that package was first installed.
+ * @param te transaction element
+ * @return origin time
+ */
+uint32_t rpmteOriginTime(rpmte te)
+ /*@*/;
+
+/** \ingroup rpmte
* Retrieve dependency tree depth of transaction element.
* @param te transaction element
* @return depth
@@ .
Received on Wed Jan 30 22:39:30 2008