From c4f0f3245d7b48b204bfb9165d8a42a822f25ec8 Mon Sep 17 00:00:00 2001 From: Alexander Larsson Date: Mon, 16 Jan 2017 11:51:14 +0100 Subject: [PATCH] Fix update of standalone bundle We regressed on being able to install a bundle twice to update it. This fixes https://github.com/flatpak/flatpak/issues/462 --- app/flatpak-transaction.c | 2 +- tests/test-bundle.sh | 18 +++++++++++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/app/flatpak-transaction.c b/app/flatpak-transaction.c index 46547b923..7c569247c 100644 --- a/app/flatpak-transaction.c +++ b/app/flatpak-transaction.c @@ -467,7 +467,7 @@ flatpak_transaction_add_ref (FlatpakTransaction *self, } remote = origin; } - else + else if (kind == FLATPAK_TRANSACTION_OP_KIND_INSTALL) { g_assert (remote != NULL); if (dir_ref_is_installed (self->dir, ref, NULL)) diff --git a/tests/test-bundle.sh b/tests/test-bundle.sh index 5898b2b66..581d88194 100755 --- a/tests/test-bundle.sh +++ b/tests/test-bundle.sh @@ -24,7 +24,7 @@ set -euo pipefail skip_without_bwrap skip_without_user_xattrs -echo "1..6" +echo "1..7" mkdir bundles @@ -147,3 +147,19 @@ run org.test.Hello > hello_out assert_file_has_content hello_out '^Hello world, from a sandboxUPDATED$' echo "ok update" + +make_updated_app UPDATED2 + +${FLATPAK} build-bundle repos/test --repo-url=file://`pwd`/repos/test --gpg-keys=${FL_GPG_HOMEDIR}/pubring.gpg bundles/hello2.flatpak org.test.Hello +assert_has_file bundles/hello2.flatpak + +${FLATPAK} install ${U} -y --bundle bundles/hello2.flatpak + +NEW2_COMMIT=`${FLATPAK} ${U} info --show-commit org.test.Hello` + +assert_not_streq "$NEW_COMMIT" "$NEW2_COMMIT" + +run org.test.Hello > hello_out +assert_file_has_content hello_out '^Hello world, from a sandboxUPDATED2$' + +echo "ok update as bundle"