[Rpm-maint] [rpm-software-management/rpm] Allow the transaction ID and installation time to be overridden (PR #1803)

Colin Walters notifications at github.com
Mon Oct 25 13:53:51 UTC 2021


@cgwalters commented on this pull request.

Thank you so much for working on this!

> @@ -1296,3 +1296,30 @@ rpmtxn rpmtxnEnd(rpmtxn txn)
     }
     return NULL;
 }
+
+#define FAKE_CLOCK_INITIALIZED (1<<0)
+#define FAKE_CLOCK_ACTIVE      (1<<1)
+
+static int _fakeClockState = 0;
+static time_t _fakeClock = -1;

(Not an rpm maintainer myself but)

The term "fake" has negative connotations, but this is actually going to (IMO) be quite a normal thing to do.  Alternative terms: "synthetic", "external", "override" or so?



> @@ -1296,3 +1296,30 @@ rpmtxn rpmtxnEnd(rpmtxn txn)
     }
     return NULL;
 }
+
+#define FAKE_CLOCK_INITIALIZED (1<<0)
+#define FAKE_CLOCK_ACTIVE      (1<<1)
+
+static int _fakeClockState = 0;
+static time_t _fakeClock = -1;
+
+rpm_time_t rpmtsGetTime(time_t step)

It would seem cleaner to me to have `rpmtsInitTime()` and `rpmtNextTime()` or so, which correspond to `rpmtsGetTime(0)` and `rpmtsGetTime(1)`.

> @@ -1296,3 +1296,30 @@ rpmtxn rpmtxnEnd(rpmtxn txn)
     }
     return NULL;
 }
+
+#define FAKE_CLOCK_INITIALIZED (1<<0)
+#define FAKE_CLOCK_ACTIVE      (1<<1)
+
+static int _fakeClockState = 0;

It'd be nice to avoid more global mutable state in RPM.  Can we actually hook this clock state inside the `ts` structure?

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/1803#pullrequestreview-788150043
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rpm.org/pipermail/rpm-maint/attachments/20211025/daed49e3/attachment.html>


More information about the Rpm-maint mailing list