bstinson / rpms / rpm-ostree

Forked from rpms/rpm-ostree 5 years ago
Clone
Blob Blame History Raw
From da27b94b2903ce10a3b0063da62fea8f90a93675 Mon Sep 17 00:00:00 2001
From: Colin Walters <walters@verbum.org>
Date: Mon, 23 Jul 2018 16:37:43 +0000
Subject: [PATCH] core: Use new `rpmtsSetVfyLevel()` API for writing rpmdb

Newer librpm defaults to doing a full payload checksum, which we can't
do at this point (writing the db) because we imported the RPMs into
ostree commits, saving just the header in metadata - we don't have the
exact original content to provide again.

Ref: https://bugzilla.redhat.com/show_bug.cgi?id=1607223

Closes: #1469
Approved by: jlebon
---
 configure.ac                 | 4 ++++
 src/libpriv/rpmostree-core.c | 9 +++++++++
 2 files changed, 13 insertions(+)

diff --git a/configure.ac b/configure.ac
index e1e771ac..f1aa0751 100644
--- a/configure.ac
+++ b/configure.ac
@@ -110,6 +110,10 @@ AS_IF([pkg-config --atleast-version=4.13.0.1 rpm], [
   AC_DEFINE([BUILDOPT_HAVE_RPM_FILETRIGGERS], 1, [Set to 1 if we have file triggers])
   AC_DEFINE([BUILDOPT_HAVE_RPMFILES], 1, [Set to 1 if we have rpmfiles API])
 ], [have_modern_rpm=false])
+dnl See usage
+AS_IF([pkg-config --atleast-version=4.14.2-rc1 rpm], [
+  AC_DEFINE([BUILDOPT_HAVE_NEW_RPM_VERIFY], 1, [Set to 1 if we have rpmtsSetVfyLevel])
+])
 
 AC_PATH_PROG([XSLTPROC], [xsltproc])
 
diff --git a/src/libpriv/rpmostree-core.c b/src/libpriv/rpmostree-core.c
index 68ac8871..d38303fa 100644
--- a/src/libpriv/rpmostree-core.c
+++ b/src/libpriv/rpmostree-core.c
@@ -4010,6 +4010,15 @@ rpmostree_context_assemble (RpmOstreeContext      *self,
 
   g_auto(rpmts) rpmdb_ts = rpmtsCreate ();
   rpmtsSetVSFlags (rpmdb_ts, _RPMVSF_NOSIGNATURES | _RPMVSF_NODIGESTS);
+  /* https://bugzilla.redhat.com/show_bug.cgi?id=1607223
+   * Newer librpm defaults to doing a full payload checksum, which we can't
+   * do at this point because we imported the RPMs into ostree commits, saving
+   * just the header in metadata - we don't have the exact original content to
+   * provide again.
+   */
+#ifdef BUILDOPT_HAVE_NEW_RPM_VERIFY
+  rpmtsSetVfyLevel (rpmdb_ts, 0);
+#endif
   rpmtsSetFlags (rpmdb_ts, RPMTRANS_FLAG_JUSTDB);
 
   tdata.ctx = self;
-- 
2.17.1