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

DnfContext: make dnf_context_module_install like dnf module install #1207

Conversation

jlebon
Copy link
Contributor

@jlebon jlebon commented Apr 23, 2021

This significantly revamps dnf_context_module_install. It fixes some
issues noticed during review, but also aligns the logic closer to what
dnf module install does.

@jlebon
Copy link
Contributor Author

jlebon commented Apr 23, 2021

I can split this further into separate PRs if desired.

libdnf/dnf-context.cpp Outdated Show resolved Hide resolved
@jlebon
Copy link
Contributor Author

jlebon commented May 7, 2021

If the overall approach looks sane, I can work on adding tests.

@jlebon jlebon force-pushed the pr/module-install-follow-ups branch from fb28b70 to 27b34c9 Compare May 7, 2021 19:19
@jlebon jlebon changed the title DnfContext: various tweaks and improvements to modular functions DnfContext: make dnf_context_module_install like dnf module install May 7, 2021
@jlebon
Copy link
Contributor Author

jlebon commented May 10, 2021

Hmm, I'm trying to understand from the integration tests logs what part failed, but the output is quite large. In the tail of the output, I see:

2021-05-07T20:07:01.3167811Z 1 feature passed, 0 failed, 0 skipped
2021-05-07T20:07:01.3168378Z 32 scenarios passed, 0 failed, 0 skipped
2021-05-07T20:07:01.3168975Z 316 steps passed, 0 failed, 0 skipped, 0 undefined
2021-05-07T20:07:01.3169466Z Took 0m46.922s
2021-05-07T20:07:01.3179164Z ##[error]Process completed with exit code 1.

And quickly grepping the results from the other behave tests, they all say 0 failed.

@lukash
Copy link
Contributor

lukash commented May 10, 2021

@jlebon it's an occasional "infra" failure (of the overlay FS), you can search the logs for "OCI" to find it. Sorry about the inconvenience, it's hitting us quite often and I just can't seem to figure out what to do about it. I'll try to report to podman, but I don't have a reproducer outside of GitHub Actions. We could try to switch to docker...

Also @martinpitt would you have any idea?

I'll re-run the jobs for you (you can do it by clicking on the button in top right corner yourself), the failing action for future reference is here: https://github.com/rpm-software-management/libdnf/pull/1207/checks?check_run_id=2530538673

@martinpitt
Copy link

The re-run failed again with

 Error: executable file `behave` not found in $PATH: No such file or directory: OCI not found

I'm afraid I have no idea what behave is supposed to be. I see that you are already using options: --privileged, which ought to circumvent the faccessat() dealbreaker. You can still try --security-opt=seccomp=unconfined just in case that helps. Other than that, I'm afraid I have no idea 😢

@jlebon
Copy link
Contributor Author

jlebon commented May 10, 2021

Ahh yup, OK that error is a recent podman regression I think: containers/podman#10293 (I hit the same thing locally with my pet container after updating to https://bodhi.fedoraproject.org/updates/FEDORA-2021-fc15685f73).

@lukash
Copy link
Contributor

lukash commented May 11, 2021

@martinpitt behave is a test framework, in this context it's just an executable on the filesystem, I've seen the same error happen with chown and others. Thank you, I just thought I'd try to ask 🙂

@jlebon I'm quite sure it's not containers/podman#10293, apparently you can get the "OCI not found" error message in multiple various cases, I've observed this (almost) from the beginning of using GitHub Actions, but somehow the frequency seems to be increasing. It's non-deterministic, sometimes it works, sometimes it happens once in the hundreds of behave invocations, sometimes even more.

Re-running again, off to attempt a podman bug report.

@lukash
Copy link
Contributor

lukash commented May 12, 2021

Reported here: containers/podman#10321

@jlebon
Copy link
Contributor Author

jlebon commented May 13, 2021

Thanks @lukash, CI looks green now! :)

@j-mracek Could you have a look at this now? Happy to fix things up as necessary to drive this forward. Also open to have a higher-bandwidth conversation over video if you'd like.

Thanks!

@j-mracek
Copy link
Contributor

@jlebon I will take a look in next days.

libdnf/dnf-context.cpp Outdated Show resolved Hide resolved
libdnf/dnf-context.h Outdated Show resolved Hide resolved
libdnf/dnf-context.cpp Outdated Show resolved Hide resolved
@j-mracek
Copy link
Contributor

j-mracek commented Jun 1, 2021

I also suggest that module profile installed by C API will be impossible to remove by dnf module remove command because packages reason in C API is user, but expected is group.

jlebon added 3 commits June 3, 2021 16:17
A few things I wrote down to help find my way around the modularity
code.
As a library, we need to be able to report errors directly to the
application and not log it ourselves. Applications should take care of
displaying the errors to users.

Additionally, let's not log critical errors for things which are due to
user-input, such as a non-existent module name. In rpm-ostree for
example, we run enable `G_DEBUG=fatal-warnings` in some test scenarios
to ensure that we don't trigger any warnings. This then causes
rpm-ostree to crash if doing `rpm-ostree module install badname`.

This patch changes things so that instead of logging errors, we
concatenate them together and return them through the GError API.

= changelog =
msg: Improve error-reporting for modular functions
type: bugfix
@jlebon jlebon force-pushed the pr/module-install-follow-ups branch from 27b34c9 to 3ff36c8 Compare June 3, 2021 20:28
@jlebon
Copy link
Contributor Author

jlebon commented Jun 3, 2021

Updated! I squashed some of the commits together to make review easier. I didn't rebase it so you can use the inter-diff to see what changed.

I also suggest that module profile installed by C API will be impossible to remove by dnf module remove command because packages reason in C API is user, but expected is group.

Can you expand on this? I think I understand what you mean, but I couldn't find in the code what marks a module's install reason.

Worth noting that in rpm-ostree at least, we always re-assemble the rootfs from scratch, so there isn't a need to remove modules the same way: we just stop adding it in the new rootfs (we do support removing base packages, but to do that at the modular level would first require fixing #1207 (comment); until then, just removing the modular RPMs directly should work fine). Obviously, I do want this code to be leveraged by dnf module install too in the future though, so happy to fix up things as needed here to help with that!

@j-mracek
Copy link
Contributor

j-mracek commented Jun 9, 2021

@jlebon I suggest that the PR looks good to me. It enhance behaviour of dnf_context_module_install. I propose fix the problem with dnf module remove in next PR. Is there anything else what you want to include in this PR (tests?)?

I also suggest that module profile installed by C API will be impossible to remove by dnf module remove command because packages reason in C API is user, but expected is group.

Can you expand on this? I think I understand what you mean, but I couldn't find in the code what marks a module's install reason.

The difference is that dnf module install commands shares implementation with dnf group install. The difference is that after installation of packages installed from profiles (not their dependencies) they are marked with reason group. Normally they are installed as user.
Because the context part in libdnf does not support groups, there is not yet implemented the mechanism to mark installed packages with reason group.

To investigate stored reasons you can use dnf repoquery --installed --qf "%{name}.%{arch} %{reason}"

jlebon added 2 commits June 9, 2021 17:48
We were copying the map and modifying the copy rather than the original.
This caused issues in callers which assume that the argument passed was
modified so that only a single stream was retained.
This significantly revamps `dnf_context_module_install`. It fixes some
issues noticed during review, but also aligns the logic closer to what
`dnf module install` does.
@jlebon jlebon force-pushed the pr/module-install-follow-ups branch from 3ff36c8 to 6d9b1ad Compare June 9, 2021 21:49
@jlebon
Copy link
Contributor Author

jlebon commented Jun 9, 2021

@jlebon I suggest that the PR looks good to me. It enhance behaviour of dnf_context_module_install. I propose fix the problem with dnf module remove in next PR. Is there anything else what you want to include in this PR (tests?)?

Thanks, I've added some tests to this now so this is ready to go! And doing that uncovered a bug. 🎉 Split that out as a separate commit.

@j-mracek j-mracek merged commit 8e4d199 into rpm-software-management:dnf-4-master Jun 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants