Skip to content

Commit 460da67

Browse files
committed
libdnf: checks out a newer commit supporting network wait
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
1 parent 7fa5ab1 commit 460da67

5 files changed

+22
-1
lines changed

src/app/rpmostree-pkg-builtins.cxx

+5
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ static gboolean opt_uninstall_all;
4646
static gboolean opt_unchanged_exit_77;
4747
static gboolean opt_lock_finalization;
4848
static gboolean opt_force_replacefiles;
49+
static guint opt_network_wait;
4950

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

8891
static gboolean
@@ -125,6 +128,8 @@ pkg_change (RpmOstreeCommandInvocation *invocation, RPMOSTreeSysroot *sysroot_pr
125128
g_variant_dict_insert (&dict, "lock-finalization", "b", opt_lock_finalization);
126129
if (opt_apply_live)
127130
g_variant_dict_insert (&dict, "apply-live", "b", opt_apply_live);
131+
if (opt_network_wait)
132+
g_variant_dict_insert (&dict, "network-wait", "u", opt_network_wait);
128133
g_autoptr (GVariant) options = g_variant_ref_sink (g_variant_dict_end (&dict));
129134

130135
gboolean met_local_pkg = FALSE;

src/daemon/rpmostree-sysroot-upgrader.cxx

+8
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ struct RpmOstreeSysrootUpgrader
9090
char *command_line;
9191
char *agent;
9292
char *sd_unit;
93+
guint network_wait_timeout_secs;
9394

9495
OstreeDeployment *cfg_merge_deployment;
9596
OstreeDeployment *origin_merge_deployment;
@@ -905,6 +906,11 @@ prepare_context_for_assembly (RpmOstreeSysrootUpgrader *self, const char *tmproo
905906
return TRUE;
906907
}
907908

909+
void
910+
rpmostree_sysroot_upgrader_set_network_wait (RpmOstreeSysrootUpgrader *self, int network_wait_sec) {
911+
self->network_wait_timeout_secs = network_wait_sec;
912+
}
913+
908914
/* Initialize libdnf context from our configuration */
909915
static gboolean
910916
prep_local_assembly (RpmOstreeSysrootUpgrader *self, GCancellable *cancellable, GError **error)
@@ -942,6 +948,8 @@ prep_local_assembly (RpmOstreeSysrootUpgrader *self, GCancellable *cancellable,
942948
error))
943949
return FALSE;
944950

951+
dnf_context_set_network_timeout_seconds(rpmostree_context_get_dnf(self->ctx), self->network_wait_timeout_secs);
952+
945953
if (rpmostree_origin_has_any_packages (self->computed_origin))
946954
{
947955
if (!rpmostree_context_prepare (self->ctx, cancellable, error))

src/daemon/rpmostree-sysroot-upgrader.h

+2
Original file line numberDiff line numberDiff line change
@@ -121,4 +121,6 @@ gboolean rpmostree_sysroot_upgrader_deploy (RpmOstreeSysrootUpgrader *self,
121121
GCancellable *cancellable, GError **error);
122122

123123
void rpmostree_sysroot_upgrader_set_kargs (RpmOstreeSysrootUpgrader *self, char **kernel_args);
124+
125+
void rpmostree_sysroot_upgrader_set_network_wait (RpmOstreeSysrootUpgrader *self, int network_wait_sec);
124126
G_END_DECLS

src/daemon/rpmostreed-transaction-types.cxx

+6
Original file line numberDiff line numberDiff line change
@@ -1557,6 +1557,12 @@ deploy_transaction_execute (RpmostreedTransaction *transaction, GCancellable *ca
15571557
return TRUE;
15581558
}
15591559

1560+
int network_wait_sec;
1561+
if(g_variant_dict_lookup(self->options, "network-wait", "u", &network_wait_sec))
1562+
{
1563+
rpmostree_sysroot_upgrader_set_network_wait(upgrader, network_wait_sec);
1564+
}
1565+
15601566
RpmOstreeSysrootUpgraderLayeringType layering_type;
15611567
gboolean layering_changed = FALSE;
15621568
if (!rpmostree_sysroot_upgrader_prep_layering (upgrader, &layering_type, &layering_changed,

0 commit comments

Comments
 (0)