Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mktree tweaks, volume II #2618

Merged
merged 9 commits into from
Aug 17, 2023

Conversation

dmnks
Copy link
Contributor

@dmnks dmnks commented Aug 16, 2023

Mostly quality of life fixes and improvements to make env and a few other small bug fixes.

Use /root instead of / (in runroot) or $PWD (in atlocal).  We already do
this in "make shell" so that the root user's dotfiles (e.g. ~/.bashrc)
are loaded from the base image, this commit extends that to "make env"
and fixes the following:

  - Calling "runroot rpm -qa" interactively now works as expected since
    the rpmdb from the base image built by mktree.fedora (which
    overrides %_dbpath in /root/.rpmmacros) is used

  - The user's native prompt is now used, instead of the shell's default

This commit has no effect on the tests themselves since we initialize an
empty rpmdb before use anyway.

There was no technical reason for HOME being set to /, really, other
than it being a historical artifact from the fakechroot era.
This just mirrors what mktree.fedora does already, and is only relevant
in "make shell" when using the mktree.podman backend, no other
functional change here.
When managing the test tree with DNF, it's actually desirable to use the
same options that were used during the tree construction (especially the
cachedir), so just do that.
Networking is currently enabled in test containers (we don't use
--unshare-net) but for domain names to be resolvable, we need an
/etc/resolv.conf, too, so add it from the host, similar to how e.g.
Podman does it.

We don't need network access in the test-suite but it can be handy for
interactive testing in "make shell", e.g. to allow gdb to fetch
debuginfo data through debuginfod automatically.
This is more flexible as we can now add more commands to the trap, see
the next commit.

No functional changes.
With OverlayFS and unshare(1) being used in the test-suite, some of the
directories in the test tree, sandbox and rpmtests.dir/ end up missing
read/write or execute (for directories) permissions which means removing
them requires excessive force in the form of "unshare -r rm -rf".

CMake is clever enough to adjust the permissions behind the scenes on
"make clean" but manual removal should just work too, so fix that with
chmod(1) in the clean_up() trap.
Newer versions of Bubblewrap emit a warning for some select options
(--chdir included) about only the last occurrence having effect, which
is what happens in "make check" due to the --chdir override.

Instead, just cd to the /srv directory in a shell and then run rpmtests
from there, sigh.  It's not the prettiest but it's better than always
printing the spurious warning.
@dmnks dmnks marked this pull request as ready for review August 17, 2023 16:13
@dmnks dmnks merged commit 5e9c712 into rpm-software-management:master Aug 17, 2023
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant