From b302aa45bc4598ee6bef98a039f54b39e966d304 Mon Sep 17 00:00:00 2001 From: Jonathan Lebon Date: Fri, 22 Jun 2018 10:03:46 -0400 Subject: [PATCH] daemon/deploy: Allow layering with no-layering option We added the `no-layering` option, but made it conflicting with `--install`. This loosens that requirement so that one can do e.g. rpm-ostree uninstall --all -install foobar to essentially remove all layered packages and then add back `foobar`. Prep for `reset` command. Closes: #1424 Approved by: cgwalters --- src/app/rpmostree-pkg-builtins.c | 7 ------- src/daemon/rpmostreed-transaction-types.c | 9 --------- tests/vmcheck/test-layering-basic-2.sh | 15 +++++++++++++++ 3 files changed, 15 insertions(+), 16 deletions(-) diff --git a/src/app/rpmostree-pkg-builtins.c b/src/app/rpmostree-pkg-builtins.c index 388d8d66..20ae737a 100644 --- a/src/app/rpmostree-pkg-builtins.c +++ b/src/app/rpmostree-pkg-builtins.c @@ -211,13 +211,6 @@ rpmostree_builtin_uninstall (int argc, return FALSE; } - if (opt_install && opt_uninstall_all) - { - g_set_error (error, G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT, - "Cannot specify both --install and --all"); - return FALSE; - } - /* shift to first pkgspec and ensure it's a proper strv (previous parsing * might have moved args around) */ argv++; argc--; diff --git a/src/daemon/rpmostreed-transaction-types.c b/src/daemon/rpmostreed-transaction-types.c index 87121ee8..692b9b17 100644 --- a/src/daemon/rpmostreed-transaction-types.c +++ b/src/daemon/rpmostreed-transaction-types.c @@ -788,12 +788,6 @@ deploy_transaction_execute (RpmostreedTransaction *transaction, upgrader_flags |= RPMOSTREE_SYSROOT_UPGRADER_FLAGS_PKGCACHE_ONLY; } - /* these should have been checked already */ - if (no_layering) - { - g_assert (self->install_pkgs == NULL); - g_assert (self->install_local_pkgs == NULL); - } if (no_overrides) { g_assert (self->override_replace_pkgs == NULL); @@ -1544,9 +1538,6 @@ rpmostreed_transaction_new_deploy (GDBusMethodInvocation *invocation, self->override_replace_pkgs || override_replace_local_pkgs_idxs)) return glnx_null_throw (error, "Can't specify no-overrides if setting " "override modifiers"); - if (vardict_lookup_bool (self->options, "no-layering", FALSE) && - (self->install_pkgs || self->install_local_pkgs)) - return glnx_null_throw (error, "Can't specify no-layering if also layering packages"); return (RpmostreedTransaction *) g_steal_pointer (&self); } diff --git a/tests/vmcheck/test-layering-basic-2.sh b/tests/vmcheck/test-layering-basic-2.sh index b17c39b3..27805c8d 100755 --- a/tests/vmcheck/test-layering-basic-2.sh +++ b/tests/vmcheck/test-layering-basic-2.sh @@ -104,6 +104,7 @@ vm_rpmostree uninstall --all |& tee out.txt assert_file_has_content out.txt "No change." vm_build_rpm test-uninstall-all-pkg1 vm_build_rpm test-uninstall-all-pkg2 +vm_build_rpm test-uninstall-all-pkg3 # do one from repo and one local for funsies vm_rpmostree install test-uninstall-all-pkg1 \ /tmp/vmcheck/yumrepo/packages/x86_64/test-uninstall-all-pkg2-1.0-1.x86_64.rpm @@ -119,3 +120,17 @@ vm_assert_status_jq \ '.deployments[0]["requested-local-packages"]|length == 0' vm_rpmostree cleanup -p echo "ok uninstall --all" + +vm_rpmostree install test-uninstall-all-pkg1 +vm_assert_status_jq \ + '.deployments[0]["packages"]|length == 1' \ + '.deployments[0]["packages"]|index("test-uninstall-all-pkg1") >= 0' \ + '.deployments[0]["requested-packages"]|length == 1' \ + '.deployments[0]["requested-local-packages"]|length == 0' +vm_rpmostree uninstall --all --install test-uninstall-all-pkg3 +vm_assert_status_jq \ + '.deployments[0]["packages"]|length == 1' \ + '.deployments[0]["packages"]|index("test-uninstall-all-pkg3") >= 0' \ + '.deployments[0]["requested-packages"]|length == 1' \ + '.deployments[0]["requested-local-packages"]|length == 0' +echo "ok uninstall --all --install "