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

install-qa-check.d: migrate xdg-utils checks over from preinst/postinst to ${D} #1362

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

eli-schwartz
Copy link
Member

It's practically criminal to run these at merge time instead of src_install time. It disproportionately affects binpkg consumers, because it applies to the entirety of ROOT. We actually don't want to do... basically any of this. It's not even accurate because we are heavily reliant on mtime of installed files to check whether the commands were actually run.

What we actually want to do is significantly simpler: every package that installs specific files to ${D} has to also inherit an eclass and run a function in pkg_postinst. We can check for inherits quite trivially, and warn about those. We can also slightly less efficiently check the contents of pkg_* functions to see if they make certain calls; bash can print the function contents and we can grep for that.

It doesn't catch cases where a custom eclass runs the xdg functions, but we manually include those in our matching.

…st to ${D}

It's practically criminal to run these at merge time instead of src_install
time. It disproportionately affects binpkg consumers, because it applies
to the entirety of ROOT. We actually don't want to do... basically any
of this. It's not even accurate because we are heavily reliant on mtime
of installed files to check whether the commands were actually run.

What we actually want to do is significantly simpler: every package that
installs specific files to ${D} has to also inherit an eclass and run a
function in pkg_postinst. We can check for inherits quite trivially, and
warn about those. We can also slightly less efficiently check the
contents of pkg_* functions to see if they make certain calls; bash can
print the function contents and we can grep for that.

It doesn't catch cases where a custom eclass runs the xdg functions, but
we manually include those in our matching.

Signed-off-by: Eli Schwartz <[email protected]>
@mgorny
Copy link
Member

mgorny commented Aug 3, 2024

NAK. There's no real gain from this, and it's extremely fragile.

@thesamesam
Copy link
Member

thesamesam commented Aug 3, 2024

NAK. There's no real gain from this, and it's extremely fragile.

The gain is not running tonnes of slow code on merging every single binpkg. Checking mtime is also fragile. We even had a user give specific measurements at https://bugs.gentoo.org/937150#c3 of how slow the existing check is.

One particularly bad part about the current setup is, if one package is missing the xdg hooks, you get reminded about that by every other package.

@mgorny
Copy link
Member

mgorny commented Aug 3, 2024

How can you handle ebuilds that call these functions via a separate function (e.g. because they don't want to repeat the same thing in postinst and postrm)?

@thesamesam
Copy link
Member

thesamesam commented Aug 3, 2024

We could fallback to the worse (mtime) check if xdg or xdg-utils is inherited but we don't see the call in pkg_*, maybe?

I think that's kind of a hack, but I also think that needing xdg at all is a hack around the fact we don't have triggers (because really, we only want to run it once per full PM run anyway).

@mgorny
Copy link
Member

mgorny commented Aug 3, 2024

I don't know. This sounds like a lot of extra complexity, and extra complexity means even higher risk of false positives. But I suppose it could work.

@thesamesam
Copy link
Member

I wonder if we're better off doing something like:

  • Having some checks be dev-only (opt-in), and
  • Having a fake xdg-whatever in PATH which records when it got run so we don't have to run on real merges

I'm going to sleep on it and have a think. I'm not really married to this PR, but I do think the status quo is undesirably slow :(

@mgorny
Copy link
Member

mgorny commented Aug 3, 2024

Yeah, I don't think this kind of QA check needs to run for end users at all.

@eli-schwartz
Copy link
Member Author

A false positive that you can solve in the ebuild itself is better than a false positive that can only be solved by fixing a different ebuild.

Tests that actually test what they claim to test instead of testing the side effects of something totally unrelated are better than really slow tests that don't test what you want to test.

And no, the answer is NOT that the checks simply should run for developers and not for end users. I don't want to be heavily penalized in merge speed just because I'm a developer and the check is badly written. Is it better for developers to simply opt out of QA checks?

...

Somewhat tangential but also kind of related: https://bugs.gentoo.org/516014

I am skeptical of the value of running all phase functions for all eclasses as a general concept, but it does feel like eclasses such as xdg would work better as an incremental effect, precisely because pkg_* phases tend to be cumulative via hardcoding instead. Maybe a phase-hooks.eclass which runs each function in PHASE_HOOKS_PKG_POSTINST=()

@thesamesam
Copy link
Member

thesamesam commented Aug 4, 2024

A false positive that you can solve in the ebuild itself is better than a false positive that can only be solved by fixing a different ebuild.

Yeah, we can (and should) really have QA_* exception vars for all QA checks. I think it should work to just have people set those if they insist on the indirection. It's pretty rare anyway?

In general, I agree as well that we shouldn't pessimise everybody based on what one ebuild might be doing wrong, and also inflict warnings where: a) it was caused by another ebuild; b) you may not even be able to do anything about it.

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.

3 participants