compose: Add --download-only option
With jigdo this is a very useful as one needs the ability to bind together the RPMs and commits. And for the compose tests this is a more reliable way to do caching anyways. Closes: #1122 Approved by: jlebon
This commit is contained in:
parent
7056e6b726
commit
7f5082deef
@ -46,6 +46,7 @@
|
||||
static char *opt_workdir;
|
||||
static gboolean opt_workdir_tmpfs;
|
||||
static char *opt_cachedir;
|
||||
static gboolean opt_download_only;
|
||||
static gboolean opt_force_nocache;
|
||||
static gboolean opt_cache_only;
|
||||
static gboolean opt_ex_unified_core;
|
||||
@ -69,6 +70,7 @@ static GOptionEntry install_option_entries[] = {
|
||||
{ "force-nocache", 0, 0, G_OPTION_ARG_NONE, &opt_force_nocache, "Always create a new OSTree commit, even if nothing appears to have changed", NULL },
|
||||
{ "cache-only", 0, 0, G_OPTION_ARG_NONE, &opt_cache_only, "Assume cache is present, do not attempt to update it", NULL },
|
||||
{ "cachedir", 0, 0, G_OPTION_ARG_STRING, &opt_cachedir, "Cached state", "CACHEDIR" },
|
||||
{ "download-only", 0, 0, G_OPTION_ARG_NONE, &opt_download_only, "Like --dry-run, but download RPMs as well; requires --cachedir", NULL },
|
||||
{ "ex-unified-core", 0, 0, G_OPTION_ARG_NONE, &opt_ex_unified_core, "Use new \"unified core\" codepath", NULL },
|
||||
{ "proxy", 0, 0, G_OPTION_ARG_STRING, &opt_proxy, "HTTP proxy", "PROXY" },
|
||||
{ "dry-run", 0, 0, G_OPTION_ARG_NONE, &opt_dry_run, "Just print the transaction and exit", NULL },
|
||||
@ -356,6 +358,11 @@ install_packages_in_root (RpmOstreeTreeComposeContext *self,
|
||||
dnf_context_set_cache_age (dnfctx, 0);
|
||||
else
|
||||
dnf_context_set_cache_age (dnfctx, G_MAXUINT);
|
||||
/* Without specifying --cachedir we'd just toss the data we download, so let's
|
||||
* catch that.
|
||||
*/
|
||||
if (opt_download_only && !opt_ex_unified_core && !opt_cachedir)
|
||||
return glnx_throw (error, "--download-only can only be used with --cachedir");
|
||||
|
||||
g_autoptr(GKeyFile) treespec = g_key_file_new ();
|
||||
g_key_file_set_string (treespec, "tree", "ref", self->ref);
|
||||
@ -491,6 +498,9 @@ install_packages_in_root (RpmOstreeTreeComposeContext *self,
|
||||
if (!rpmostree_context_download (self->corectx, cancellable, error))
|
||||
return FALSE;
|
||||
|
||||
if (opt_download_only)
|
||||
return TRUE; /* 🔚 Early return */
|
||||
|
||||
/* Before we install packages, inject /etc/{passwd,group} if configured. */
|
||||
g_autoptr(GFile) treefile_dirpath = g_file_get_parent (self->treefile_path);
|
||||
gboolean generate_from_previous = TRUE;
|
||||
@ -1006,7 +1016,7 @@ impl_install_tree (RpmOstreeTreeComposeContext *self,
|
||||
/* Note early return */
|
||||
return TRUE;
|
||||
}
|
||||
else if (opt_dry_run)
|
||||
else if (opt_dry_run || opt_download_only)
|
||||
{
|
||||
g_print ("--dry-run complete");
|
||||
if (opt_touch_if_changed)
|
||||
|
Loading…
Reference in New Issue
Block a user