From 4eb0bf4df25e85d9ec274638a9cf20f2521659ed Mon Sep 17 00:00:00 2001 From: Jonathan Lebon Date: Tue, 26 Jan 2021 09:17:57 -0500 Subject: [PATCH] Backport https://github.com/coreos/rpm-ostree/pull/2490 for rawhide --- ...-back-to-usr-share-rpm-after-writing.patch | 44 +++++++++++++++++++ rpm-ostree.spec | 6 ++- 2 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 0001-core-Set-_dbpath-back-to-usr-share-rpm-after-writing.patch diff --git a/0001-core-Set-_dbpath-back-to-usr-share-rpm-after-writing.patch b/0001-core-Set-_dbpath-back-to-usr-share-rpm-after-writing.patch new file mode 100644 index 0000000..afce6ae --- /dev/null +++ b/0001-core-Set-_dbpath-back-to-usr-share-rpm-after-writing.patch @@ -0,0 +1,44 @@ +From bc5a7883668dd3e1c9bc36858ffc47b9bca2e7ca Mon Sep 17 00:00:00 2001 +From: Jonathan Lebon +Date: Mon, 25 Jan 2021 15:35:18 -0500 +Subject: [PATCH] core: Set _dbpath back to /usr/share/rpm after writing rpmdb + +We temporarily set the rpmdb path to be an absolute path pointing under +the tmprootfs when writing the rpmdb. This throws off libsolv 0.7.17, +which learned to give the `_dbpath` macro precedence on where the rpmdb +is located: + +https://github.com/openSUSE/libsolv/commit/04d4d036b275693a23eef75fba634e7cea2f1a6d + +So then the rpmdb sanity-check we do when exiting +`rpmostree_context_assemble()` breaks because it can't find the expected +packages. + +Because RPM macros are in global state, there's no elegant way of +setting it just for the rpmdb write operation (short of forking), so +just fix this by setting `_dbpath` back to the correct value after we're +done writing the rpmdb. + +Closes: https://github.com/coreos/fedora-coreos-tracker/issues/723 +--- + src/libpriv/rpmostree-core.cxx | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/src/libpriv/rpmostree-core.cxx b/src/libpriv/rpmostree-core.cxx +index 4931390f..59483d4e 100644 +--- a/src/libpriv/rpmostree-core.cxx ++++ b/src/libpriv/rpmostree-core.cxx +@@ -4668,6 +4668,10 @@ rpmostree_context_assemble (RpmOstreeContext *self, + + rpmostree_output_progress_end (&task); + ++ /* And finally revert the _dbpath setting because libsolv relies on it as well ++ * to find the rpmdb and RPM macros are global state. */ ++ set_rpm_macro_define ("_dbpath", "/" RPMOSTREE_RPMDB_LOCATION); ++ + /* And now also sanity check the rpmdb */ + if (!skip_sanity_check) + { +-- +2.29.2 + diff --git a/rpm-ostree.spec b/rpm-ostree.spec index 79f7833..42d62cf 100644 --- a/rpm-ostree.spec +++ b/rpm-ostree.spec @@ -4,12 +4,13 @@ Summary: Hybrid image/package system Name: rpm-ostree Version: 2021.1 -Release: 2%{?dist} +Release: 3%{?dist} License: LGPLv2+ URL: https://github.com/coreos/rpm-ostree # This tarball is generated via "cd packaging && make -f Makefile.dist-packaging dist-snapshot" # in the upstream git. It also contains vendored Rust sources. Source0: https://github.com/coreos/rpm-ostree/releases/download/v%{version}/rpm-ostree-%{version}.tar.xz +Patch0: 0001-core-Set-_dbpath-back-to-usr-share-rpm-after-writing.patch ExclusiveArch: %{rust_arches} @@ -202,6 +203,9 @@ $PYTHON autofiles.py > files.devel \ %files devel -f files.devel %changelog +* Tue Jan 26 2021 Jonathan Lebon - 2021.1-3 +- Backport https://github.com/coreos/rpm-ostree/pull/2490 for rawhide + * Tue Jan 19 15:08:59 UTC 2021 Colin Walters - 2021.1-2 - https://github.com/coreos/rpm-ostree/releases/tag/v2021.1