Skip to content

Commit

Permalink
WIP: automatically do upgrade in rojig mode with install
Browse files Browse the repository at this point in the history
  • Loading branch information
cgwalters committed Oct 1, 2018
1 parent 16f48af commit fd082f6
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 8 deletions.
3 changes: 2 additions & 1 deletion src/app/rpmostree-pkg-builtins.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@ pkg_change (RpmOstreeCommandInvocation *invocation,
g_variant_dict_insert (&dict, "reboot", "b", opt_reboot);
g_variant_dict_insert (&dict, "cache-only", "b", opt_cache_only);
g_variant_dict_insert (&dict, "download-only", "b", opt_download_only);
g_variant_dict_insert (&dict, "no-pull-base", "b", TRUE);
/* For historical reasons */
g_variant_dict_insert (&dict, "no-pull-ostree-base", "b", TRUE);
g_variant_dict_insert (&dict, "dry-run", "b", opt_dry_run);
g_variant_dict_insert (&dict, "allow-inactive", "b", opt_allow_inactive);
g_variant_dict_insert (&dict, "no-layering", "b", opt_uninstall_all);
Expand Down
2 changes: 2 additions & 0 deletions src/daemon/org.projectatomic.rpmostree1.xml
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,8 @@
"no-pull-base" (type 'b')
Do not pull a base layer from the remote. Not valid if
either "set-refspec" or "set-revision" is specified.
"no-pull-ostree-base" (type 'b')
Like no-pull-base, but only applies if the base is via ostree://.
"dry-run" (type 'b')
Stop short of deploying the new tree. If layering packages,
the pkg diff is printed but packages are not downloaded or
Expand Down
4 changes: 3 additions & 1 deletion src/daemon/rpmostreed-os.c
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,8 @@ os_authorize_method (GDBusInterfaceSkeleton *interface,
G_VARIANT_TYPE("ah"));
gboolean no_pull_base =
vardict_lookup_bool (&options_dict, "no-pull-base", FALSE);
gboolean no_pull_ostree_base = no_pull_base ||
vardict_lookup_bool (&options_dict, "no-pull-ostree-base", FALSE);
gboolean no_overrides =
vardict_lookup_bool (&options_dict, "no-overrides", FALSE);
gboolean no_layering =
Expand All @@ -194,7 +196,7 @@ os_authorize_method (GDBusInterfaceSkeleton *interface,
g_ptr_array_add (actions, "org.projectatomic.rpmostree1.rebase");
else if (revision != NULL)
g_ptr_array_add (actions, "org.projectatomic.rpmostree1.deploy");
else if (!no_pull_base)
else if (!no_pull_base && !no_pull_ostree_base)
g_ptr_array_add (actions, "org.projectatomic.rpmostree1.upgrade");

if (install_pkgs != NULL || uninstall_pkgs != NULL || no_layering)
Expand Down
21 changes: 15 additions & 6 deletions src/daemon/rpmostreed-transaction-types.c
Original file line number Diff line number Diff line change
Expand Up @@ -793,6 +793,7 @@ deploy_transaction_execute (RpmostreedTransaction *transaction,
/* Mainly for the `install` and `override` commands */
const gboolean no_pull_base =
((self->flags & RPMOSTREE_TRANSACTION_DEPLOY_FLAG_NO_PULL_BASE) > 0);
const gboolean no_pull_ostree_base = deploy_has_bool_option (self, "no-pull-ostree-base");
/* Used to background check for updates; this essentially means downloading the minimum
* amount of metadata only to check if there's an upgrade */
const gboolean download_metadata_only =
Expand Down Expand Up @@ -881,7 +882,7 @@ deploy_transaction_execute (RpmostreedTransaction *transaction,
gboolean is_override = FALSE;

/* In practice today */
if (self->flags & RPMOSTREE_TRANSACTION_DEPLOY_FLAG_NO_PULL_BASE)
if (self->flags & RPMOSTREE_TRANSACTION_DEPLOY_FLAG_NO_PULL_BASE || no_pull_ostree_base)
{
/* this is a heuristic; by the end, once the proper switches are added, the two
* commands can look indistinguishable at the D-Bus level */
Expand Down Expand Up @@ -1128,8 +1129,20 @@ deploy_transaction_execute (RpmostreedTransaction *transaction,
rpmostree_transaction_set_title ((RPMOSTreeTransaction*)self, txn_title->str);

rpmostree_sysroot_upgrader_set_origin (upgrader, origin);
RpmOstreeRefspecType refspec_type;
rpmostree_origin_classify_refspec (origin, &refspec_type, NULL);
/* Now that we have the refspec type, find out if we should be pulling
* the base. The idea here is that rojig defaults to pulling even for
* rpm-ostree install (which now uses `no-pull-ostree-base`),
* since the contents come from the same place.
*
* Perhaps we should be doing this for ostree as well...but I want
* to be conservative there for now.
*/
const gboolean no_pull = no_pull_base ||
(no_pull_ostree_base && refspec_type == RPMOSTREE_REFSPEC_TYPE_OSTREE);

if (!no_pull_base)
if (!no_pull)
{
gboolean base_changed;

Expand Down Expand Up @@ -1208,10 +1221,6 @@ deploy_transaction_execute (RpmostreedTransaction *transaction,
changed = TRUE;
}

/* Past this point we've computed the origin */
RpmOstreeRefspecType refspec_type;
rpmostree_origin_classify_refspec (origin, &refspec_type, NULL);

if (download_metadata_only)
{
/* We have to short-circuit the usual path here; we already downloaded the ostree
Expand Down

0 comments on commit fd082f6

Please sign in to comment.