From 0aea7e6b98a730101a75579866d5b52d057ae3b2 Mon Sep 17 00:00:00 2001 From: Jonathan Lebon Date: Fri, 22 Jan 2021 15:43:25 -0500 Subject: [PATCH] Revert "core: Allow overriding downloaded RPMs target dir" This reverts commit 6a3e3d807d671a3c437fb60dc4f04ccd90e4adc6. This isn't as useful in the implementation of a `rpm-ostree compose extensions` because it doesn't account for locally cached repos where no downloading happens. Instead, just let libdnf download the packages to the default location if it's a remote package and we'll just copy it over to the output dir. --- src/app/rpmostree-compose-builtin-rojig.cxx | 2 +- src/app/rpmostree-compose-builtin-tree.cxx | 2 +- src/daemon/rpmostree-sysroot-upgrader.cxx | 2 +- src/libpriv/rpmostree-core.cxx | 12 ++++-------- src/libpriv/rpmostree-core.h | 1 - src/libpriv/rpmostree-rojig-client.cxx | 4 ++-- 6 files changed, 9 insertions(+), 14 deletions(-) diff --git a/src/app/rpmostree-compose-builtin-rojig.cxx b/src/app/rpmostree-compose-builtin-rojig.cxx index a6021261f5..8cb90412e8 100644 --- a/src/app/rpmostree-compose-builtin-rojig.cxx +++ b/src/app/rpmostree-compose-builtin-rojig.cxx @@ -191,7 +191,7 @@ install_packages (RpmOstreeRojigCompose *self, return FALSE; /* --- Downloading packages --- */ - if (!rpmostree_context_download (self->corectx, NULL, cancellable, error)) + if (!rpmostree_context_download (self->corectx, cancellable, error)) return FALSE; if (!rpmostree_context_import (self->corectx, cancellable, error)) return FALSE; diff --git a/src/app/rpmostree-compose-builtin-tree.cxx b/src/app/rpmostree-compose-builtin-tree.cxx index a8846910a7..57ccb5b0cd 100644 --- a/src/app/rpmostree-compose-builtin-tree.cxx +++ b/src/app/rpmostree-compose-builtin-tree.cxx @@ -413,7 +413,7 @@ install_packages (RpmOstreeTreeComposeContext *self, return FALSE; /* --- Downloading packages --- */ - if (!rpmostree_context_download (self->corectx, NULL, cancellable, error)) + if (!rpmostree_context_download (self->corectx, cancellable, error)) return FALSE; if (opt_download_only || opt_download_only_rpms) diff --git a/src/daemon/rpmostree-sysroot-upgrader.cxx b/src/daemon/rpmostree-sysroot-upgrader.cxx index 84b2eb0d62..b68a2a2eca 100644 --- a/src/daemon/rpmostree-sysroot-upgrader.cxx +++ b/src/daemon/rpmostree-sysroot-upgrader.cxx @@ -1288,7 +1288,7 @@ rpmostree_sysroot_upgrader_import_pkgs (RpmOstreeSysrootUpgrader *self, if (self->layering_type == RPMOSTREE_SYSROOT_UPGRADER_LAYERING_RPMMD_REPOS) { - if (!rpmostree_context_download (self->ctx, NULL, cancellable, error)) + if (!rpmostree_context_download (self->ctx, cancellable, error)) return FALSE; if (!rpmostree_context_import (self->ctx, cancellable, error)) return FALSE; diff --git a/src/libpriv/rpmostree-core.cxx b/src/libpriv/rpmostree-core.cxx index 86d0ebc7f6..4931390fee 100644 --- a/src/libpriv/rpmostree-core.cxx +++ b/src/libpriv/rpmostree-core.cxx @@ -2457,7 +2457,6 @@ gather_source_to_packages (RpmOstreeContext *self) gboolean rpmostree_context_download (RpmOstreeContext *self, - const char *target_dir, GCancellable *cancellable, GError **error) { @@ -2477,9 +2476,7 @@ rpmostree_context_download (RpmOstreeContext *self, g_autoptr(GHashTable) source_to_packages = gather_source_to_packages (self); GLNX_HASH_TABLE_FOREACH_KV (source_to_packages, DnfRepo*, src, GPtrArray*, src_packages) { - const char *final_target_dir = target_dir; - g_autofree char *final_target_dir_owned = NULL; - + g_autofree char *target_dir = NULL; glnx_unref_object DnfState *hifstate = dnf_state_new (); progress_sigid = g_signal_connect (hifstate, "percentage-changed", @@ -2489,12 +2486,11 @@ rpmostree_context_download (RpmOstreeContext *self, rpmostree_output_progress_percent_begin (&progress, "Downloading from '%s'", dnf_repo_get_id (src)); - if (!final_target_dir) - final_target_dir = final_target_dir_owned = g_build_filename (dnf_repo_get_location (src), "/packages/", NULL); - if (!glnx_shutil_mkdir_p_at (AT_FDCWD, final_target_dir, 0755, cancellable, error)) + target_dir = g_build_filename (dnf_repo_get_location (src), "/packages/", NULL); + if (!glnx_shutil_mkdir_p_at (AT_FDCWD, target_dir, 0755, cancellable, error)) return FALSE; - if (!dnf_repo_download_packages (src, src_packages, final_target_dir, + if (!dnf_repo_download_packages (src, src_packages, target_dir, hifstate, error)) return FALSE; diff --git a/src/libpriv/rpmostree-core.h b/src/libpriv/rpmostree-core.h index 6ff4b3d9da..54e431a58f 100644 --- a/src/libpriv/rpmostree-core.h +++ b/src/libpriv/rpmostree-core.h @@ -187,7 +187,6 @@ rpmostree_context_set_vlockmap (RpmOstreeContext *self, gboolean strict); gboolean rpmostree_context_download (RpmOstreeContext *self, - const char *target_dir, GCancellable *cancellable, GError **error); diff --git a/src/libpriv/rpmostree-rojig-client.cxx b/src/libpriv/rpmostree-rojig-client.cxx index 7194ac89f5..d095e02ee9 100644 --- a/src/libpriv/rpmostree-rojig-client.cxx +++ b/src/libpriv/rpmostree-rojig-client.cxx @@ -206,7 +206,7 @@ rpmostree_context_execute_rojig (RpmOstreeContext *self, return FALSE; } - if (!rpmostree_context_download (self, NULL, cancellable, error)) + if (!rpmostree_context_download (self, cancellable, error)) return FALSE; glnx_fd_close int oirpm_fd = -1; @@ -301,7 +301,7 @@ rpmostree_context_execute_rojig (RpmOstreeContext *self, } /* Start the download and import, using the xattr data from the rojigRPM */ - if (!rpmostree_context_download (self, NULL, cancellable, error)) + if (!rpmostree_context_download (self, cancellable, error)) return FALSE; g_autoptr(GVariant) xattr_table = rpmostree_rojig_assembler_get_xattr_table (rojig); if (!rpmostree_context_import_rojig (self, xattr_table, pkg_to_xattrs,