Skip to content

Commit

Permalink
core: Use source root for repos if set
Browse files Browse the repository at this point in the history
The goal here is to have the new (more container-native) flow
for `experimental compose rootfs` to always operate on a "repos container"
that we've mounted.

I noticed that `rpmostree_find_and_download_packages()` has
similar behavior, but that's apparently only used in override
flows?

Signed-off-by: Colin Walters <[email protected]>
  • Loading branch information
cgwalters committed Feb 7, 2025
1 parent 3ac642e commit 8f82c3b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
8 changes: 8 additions & 0 deletions src/libpriv/rpmostree-core.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -668,6 +668,14 @@ rpmostree_context_setup (RpmOstreeContext *self, const char *install_root, const

dnf_context_set_install_root (self->dnfctx, install_root);
dnf_context_set_source_root (self->dnfctx, source_root);
if (source_root)
{
// Override what rpmostree_context_set_cache_root() did.
// TODO disentangle these things so that we only call set_repo_dir if
// we didn't have a source root.
g_autofree char *source_repos = g_build_filename (source_root, "etc/yum.repos.d", NULL);
dnf_context_set_repo_dir (self->dnfctx, source_repos);
}

/* Hackaround libdnf logic, ensuring that `/etc/dnf/vars` gets sourced
* from the host environment instead of the install_root:
Expand Down
6 changes: 0 additions & 6 deletions tests/compose-rootfs/Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,6 @@ COPY . /src
WORKDIR /src
RUN --mount=type=bind,from=repos,src=/,dst=/repos <<EORUN
set -xeuo pipefail
# Synchronize the dnf/rpm configs from the repos container.
for x in etc/dnf etc/yum.repos.d etc/pki/rpm-gpg; do
rm -rf /"$x" && cp -a /repos/${x} /$x
done
# And copy to the workdir; TODO fix this in rpm-ostree
cp /etc/yum.repos.d/*.repo .
exec rpm-ostree experimental compose rootfs --source-root=/repos manifest.yaml /target-rootfs
EORUN

Expand Down

0 comments on commit 8f82c3b

Please sign in to comment.