Skip to content

Commit

Permalink
Revert "core: Allow overriding downloaded RPMs target dir"
Browse files Browse the repository at this point in the history
This reverts commit 6a3e3d8.

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.
  • Loading branch information
jlebon committed Jan 22, 2021
1 parent 9bcff4f commit 0aea7e6
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/app/rpmostree-compose-builtin-rojig.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/app/rpmostree-compose-builtin-tree.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/daemon/rpmostree-sysroot-upgrader.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
12 changes: 4 additions & 8 deletions src/libpriv/rpmostree-core.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -2457,7 +2457,6 @@ gather_source_to_packages (RpmOstreeContext *self)

gboolean
rpmostree_context_download (RpmOstreeContext *self,
const char *target_dir,
GCancellable *cancellable,
GError **error)
{
Expand All @@ -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",
Expand All @@ -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;

Expand Down
1 change: 0 additions & 1 deletion src/libpriv/rpmostree-core.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
4 changes: 2 additions & 2 deletions src/libpriv/rpmostree-rojig-client.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 0aea7e6

Please sign in to comment.