From 3f3348f63104320202f2813989bacfe92bd543cd Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Mon, 7 Jun 2021 16:14:33 -0400 Subject: [PATCH] =?UTF-8?q?origin:=20Switch=20baserefspec=20=E2=86=92=20re?= =?UTF-8?q?fspec=20when=20de-layering?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The idea originally was that we'd switch to `baserefspec` when performing changes such that `ostree admin upgrade` would no longer work. But that has long since been buggy since the introduction of things like `rpm-ostree initramfs --enable` etc. The only goal of this PR is to avoid "leaking state" across origin switches, so that the work to map origin ⇔ treefile can also (correctly) be stateless. --- src/libpriv/rpmostree-origin.cxx | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/src/libpriv/rpmostree-origin.cxx b/src/libpriv/rpmostree-origin.cxx index 53ba5a2ddc..af91690a48 100644 --- a/src/libpriv/rpmostree-origin.cxx +++ b/src/libpriv/rpmostree-origin.cxx @@ -566,17 +566,15 @@ update_keyfile_pkgs_from_cache (RpmOstreeOrigin *origin, if (g_hash_table_size (pkgs) > 0) { - switch (origin->refspec_type) - { - case RPMOSTREE_REFSPEC_TYPE_OSTREE: - case RPMOSTREE_REFSPEC_TYPE_CHECKSUM: - { - g_key_file_set_value (origin->kf, "origin", "baserefspec", - origin->cached_refspec); - g_key_file_remove_key (origin->kf, "origin", "refspec", NULL); - break; - } - } + g_key_file_set_value (origin->kf, "origin", "baserefspec", + origin->cached_refspec); + g_key_file_remove_key (origin->kf, "origin", "refspec", NULL); + } + else + { + g_key_file_set_value (origin->kf, "origin", "refspec", + origin->cached_refspec); + g_key_file_remove_key (origin->kf, "origin", "baserefspec", NULL); } }