Skip to content

Commit

Permalink
libdnf: checks out a newer commit supporting network wait
Browse files Browse the repository at this point in the history
rpmostree-pkg-builtins.cxx: Adds a command line flag for --network-wait
rpmostree-sysroot-upgrader.cxx: Adds network_wait to struct SysrootUpgrader and support for setting it
rpmostree-transaction-types.cxx: Addresses a call to network wait by adding to struct sysroot_upgrader

For each configured ostree remote and each enabled yum repository, wait until we can reach those over the network.
This requires modifications in libdnf and librepo
  • Loading branch information
RishabhSaini committed Aug 31, 2022
1 parent 7fa5ab1 commit 460da67
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/app/rpmostree-pkg-builtins.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ static gboolean opt_uninstall_all;
static gboolean opt_unchanged_exit_77;
static gboolean opt_lock_finalization;
static gboolean opt_force_replacefiles;
static guint opt_network_wait;

static GOptionEntry option_entries[]
= { { "os", 0, 0, G_OPTION_ARG_STRING, &opt_osname, "Operate on provided OSNAME", "OSNAME" },
Expand Down Expand Up @@ -83,6 +84,8 @@ static GOptionEntry install_option_entry[]
"Apply changes to both pending deployment and running filesystem tree", NULL },
{ "force-replacefiles", 0, 0, G_OPTION_ARG_NONE, &opt_force_replacefiles,
"Allow package to replace files from other packages", NULL },
{ "network-wait", 'N', 0, G_OPTION_ARG_INT, &opt_network_wait,
"Wait to reach into remote repository till network setup", "seconds" },
{ NULL } };

static gboolean
Expand Down Expand Up @@ -125,6 +128,8 @@ pkg_change (RpmOstreeCommandInvocation *invocation, RPMOSTreeSysroot *sysroot_pr
g_variant_dict_insert (&dict, "lock-finalization", "b", opt_lock_finalization);
if (opt_apply_live)
g_variant_dict_insert (&dict, "apply-live", "b", opt_apply_live);
if (opt_network_wait)
g_variant_dict_insert (&dict, "network-wait", "u", opt_network_wait);
g_autoptr (GVariant) options = g_variant_ref_sink (g_variant_dict_end (&dict));

gboolean met_local_pkg = FALSE;
Expand Down
8 changes: 8 additions & 0 deletions src/daemon/rpmostree-sysroot-upgrader.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ struct RpmOstreeSysrootUpgrader
char *command_line;
char *agent;
char *sd_unit;
guint network_wait_timeout_secs;

OstreeDeployment *cfg_merge_deployment;
OstreeDeployment *origin_merge_deployment;
Expand Down Expand Up @@ -905,6 +906,11 @@ prepare_context_for_assembly (RpmOstreeSysrootUpgrader *self, const char *tmproo
return TRUE;
}

void
rpmostree_sysroot_upgrader_set_network_wait (RpmOstreeSysrootUpgrader *self, int network_wait_sec) {
self->network_wait_timeout_secs = network_wait_sec;
}

/* Initialize libdnf context from our configuration */
static gboolean
prep_local_assembly (RpmOstreeSysrootUpgrader *self, GCancellable *cancellable, GError **error)
Expand Down Expand Up @@ -942,6 +948,8 @@ prep_local_assembly (RpmOstreeSysrootUpgrader *self, GCancellable *cancellable,
error))
return FALSE;

dnf_context_set_network_timeout_seconds(rpmostree_context_get_dnf(self->ctx), self->network_wait_timeout_secs);

if (rpmostree_origin_has_any_packages (self->computed_origin))
{
if (!rpmostree_context_prepare (self->ctx, cancellable, error))
Expand Down
2 changes: 2 additions & 0 deletions src/daemon/rpmostree-sysroot-upgrader.h
Original file line number Diff line number Diff line change
Expand Up @@ -121,4 +121,6 @@ gboolean rpmostree_sysroot_upgrader_deploy (RpmOstreeSysrootUpgrader *self,
GCancellable *cancellable, GError **error);

void rpmostree_sysroot_upgrader_set_kargs (RpmOstreeSysrootUpgrader *self, char **kernel_args);

void rpmostree_sysroot_upgrader_set_network_wait (RpmOstreeSysrootUpgrader *self, int network_wait_sec);
G_END_DECLS
6 changes: 6 additions & 0 deletions src/daemon/rpmostreed-transaction-types.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -1557,6 +1557,12 @@ deploy_transaction_execute (RpmostreedTransaction *transaction, GCancellable *ca
return TRUE;
}

int network_wait_sec;
if(g_variant_dict_lookup(self->options, "network-wait", "u", &network_wait_sec))
{
rpmostree_sysroot_upgrader_set_network_wait(upgrader, network_wait_sec);
}

RpmOstreeSysrootUpgraderLayeringType layering_type;
gboolean layering_changed = FALSE;
if (!rpmostree_sysroot_upgrader_prep_layering (upgrader, &layering_type, &layering_changed,
Expand Down

0 comments on commit 460da67

Please sign in to comment.