bstinson / rpms / rpm-ostree

Forked from rpms/rpm-ostree 5 years ago
Clone

Blame SOURCES/0001-core-Use-new-rpmtsSetVfyLevel-API-for-writing-rpmdb.patch

491aaa
From da27b94b2903ce10a3b0063da62fea8f90a93675 Mon Sep 17 00:00:00 2001
491aaa
From: Colin Walters <walters@verbum.org>
491aaa
Date: Mon, 23 Jul 2018 16:37:43 +0000
491aaa
Subject: [PATCH] core: Use new `rpmtsSetVfyLevel()` API for writing rpmdb
491aaa
491aaa
Newer librpm defaults to doing a full payload checksum, which we can't
491aaa
do at this point (writing the db) because we imported the RPMs into
491aaa
ostree commits, saving just the header in metadata - we don't have the
491aaa
exact original content to provide again.
491aaa
491aaa
Ref: https://bugzilla.redhat.com/show_bug.cgi?id=1607223
491aaa
491aaa
Closes: #1469
491aaa
Approved by: jlebon
491aaa
---
491aaa
 configure.ac                 | 4 ++++
491aaa
 src/libpriv/rpmostree-core.c | 9 +++++++++
491aaa
 2 files changed, 13 insertions(+)
491aaa
491aaa
diff --git a/configure.ac b/configure.ac
491aaa
index e1e771ac..f1aa0751 100644
491aaa
--- a/configure.ac
491aaa
+++ b/configure.ac
491aaa
@@ -110,6 +110,10 @@ AS_IF([pkg-config --atleast-version=4.13.0.1 rpm], [
491aaa
   AC_DEFINE([BUILDOPT_HAVE_RPM_FILETRIGGERS], 1, [Set to 1 if we have file triggers])
491aaa
   AC_DEFINE([BUILDOPT_HAVE_RPMFILES], 1, [Set to 1 if we have rpmfiles API])
491aaa
 ], [have_modern_rpm=false])
491aaa
+dnl See usage
491aaa
+AS_IF([pkg-config --atleast-version=4.14.2-rc1 rpm], [
491aaa
+  AC_DEFINE([BUILDOPT_HAVE_NEW_RPM_VERIFY], 1, [Set to 1 if we have rpmtsSetVfyLevel])
491aaa
+])
491aaa
 
491aaa
 AC_PATH_PROG([XSLTPROC], [xsltproc])
491aaa
 
491aaa
diff --git a/src/libpriv/rpmostree-core.c b/src/libpriv/rpmostree-core.c
491aaa
index 68ac8871..d38303fa 100644
491aaa
--- a/src/libpriv/rpmostree-core.c
491aaa
+++ b/src/libpriv/rpmostree-core.c
491aaa
@@ -4010,6 +4010,15 @@ rpmostree_context_assemble (RpmOstreeContext      *self,
491aaa
 
491aaa
   g_auto(rpmts) rpmdb_ts = rpmtsCreate ();
491aaa
   rpmtsSetVSFlags (rpmdb_ts, _RPMVSF_NOSIGNATURES | _RPMVSF_NODIGESTS);
491aaa
+  /* https://bugzilla.redhat.com/show_bug.cgi?id=1607223
491aaa
+   * Newer librpm defaults to doing a full payload checksum, which we can't
491aaa
+   * do at this point because we imported the RPMs into ostree commits, saving
491aaa
+   * just the header in metadata - we don't have the exact original content to
491aaa
+   * provide again.
491aaa
+   */
491aaa
+#ifdef BUILDOPT_HAVE_NEW_RPM_VERIFY
491aaa
+  rpmtsSetVfyLevel (rpmdb_ts, 0);
491aaa
+#endif
491aaa
   rpmtsSetFlags (rpmdb_ts, RPMTRANS_FLAG_JUSTDB);
491aaa
 
491aaa
   tdata.ctx = self;
491aaa
-- 
491aaa
2.17.1
491aaa