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

Build failure due to deleted etc files from built dependencies #805

Open
cho-m opened this issue May 28, 2022 · 1 comment
Open

Build failure due to deleted etc files from built dependencies #805

cho-m opened this issue May 28, 2022 · 1 comment

Comments

@cho-m
Copy link
Member

cho-m commented May 28, 2022

I was debugging ocaml bump failure (Homebrew/homebrew-core#102436) and noticed that newly built ocaml-findlib was causing failures for subsequent formulae that depended on it due to missing etc/findlib.conf.

I think the issue is due to the etc files getting cleaned up and not being restored for dependents that are also being bottled:

ensure
cleanup_bottle_etc_var(formula) if args.cleanup?

Was able to test that modifying etc to pkgshare/"etc" avoided issue, but that loses the advantage of preserving user-modifications via etc directory.

@MikeMcQuaid
Copy link
Member

Good catch @cho-m. This will need a bug fix to test-bot.

carlocab added a commit to carlocab/homebrew-test-bot that referenced this issue Sep 26, 2022
1. Doing `brew install --only-dependencies` and `brew postinstall` can
   be quite expensive. Let's defer this to when we're sure we have
   dependents to test.
2. Calling `brew uses` is slow, because this requires traversing the
   dependency tree. [*] Let's avoid doing this unless we know we really
   need to. Here, we test for "needing to" by checking if another `.rb`
   file in the tap that might be a formula contains a `depends_on` line
   declaring a dependency on the formula being tested.
3. Restrict the second `brew uses` call to when we are building
   dependents from source, since that is the only instance where we are
   interested in the build dependents.

While we're here, make sure to call `brew postinstall` on all
dependencies that were rebuilt, and not just the one being tested
currently. This may address Homebrew#805.

Locally, this results in the following speed up for a formula with no
dependents:

Before

    ( brew test-bot --only-formulae-dependents --testing-formulae=hello --dry-run)  28.95s user 6.70s system 76% cpu 46.875 total

After

    ( brew test-bot --only-formulae-dependents --testing-formulae=hello --dry-run)  0.91s user 1.02s system 51% cpu 3.738 total

This makes testing formulae with dependents slightly slower. However,
the vast majority of formulae in Homebrew/core have no dependents (on
macOS, at least), so this is likely a net win for the average workflow.

[*] Potential future optimisation: calling `Dependency.expand` directly
    might give us better opportunities to exploit caching.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants