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
This commit is contained in:
Jonathan Lebon 2018-06-22 10:03:46 -04:00 committed by Atomic Bot
parent 14b104d9f1
commit b302aa45bc
3 changed files with 15 additions and 16 deletions

View File

@ -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--;

View File

@ -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);
}

View File

@ -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 <pkg>"