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

cleaner: rewrite pkg-config file Cellar paths and keg-only #18229

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

Conversation

cho-m
Copy link
Member

@cho-m cho-m commented Sep 2, 2024

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same change?
  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes? Here's an example.
  • Have you successfully run brew style with your changes locally?
  • Have you successfully run brew typecheck with your changes locally?
  • Have you successfully run brew tests with your changes locally?

Concept idea based on manual work in Homebrew/core, e.g.

Library/Homebrew/cleaner.rb Outdated Show resolved Hide resolved
keg_only_pc_files = @formula.deps
.reject { |d| d.build? || d.test? }
.map(&:to_formula)
.select(&:keg_only?)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps controversial idea: I think this could be usefully done for all formulae, not just keg-only. We've debated for a while about whether we should try to support formulae when brew unlinked and, generally, I think we should.

Copy link

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

@github-actions github-actions bot added the stale No recent activity label Sep 24, 2024
@cho-m cho-m removed the stale No recent activity label Sep 24, 2024
@carlocab
Copy link
Member

Would be nice to get this in in some form at some point.

@cho-m cho-m added the in progress Maintainers are working on this label Oct 4, 2024
@cho-m cho-m self-assigned this Oct 4, 2024
.filter_map { |dep| dep.to_formula if !dep.build? && !dep.test? }
.select(&:keg_only?)
.flat_map { |f| f.opt_prefix.glob("{lib,share}/pkgconfig/*.pc") }
.to_h { |pc_file| [pc_file.basename(".pc").to_s.downcase, pc_file.to_s] }
Copy link
Member Author

@cho-m cho-m Oct 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to figure out if there is a way to deal with whitespaces in HOMEBREW_PREFIX as this will break pkgconfig file. If I can't figure out a way, can just skip the modification if we detect whitespaces.

There is also an odd case of pkgconfig file backslash handling, e.g.

Cflags: -I/this/\
is/a/single/path

results in:

PKG_CONFIG_PATH=. pkg-config test --cflags
-I/this/is/a/single/path

May just ignore this for now until we find a scenario that needs it.


EDIT: This is actually more annoying due to possibility of installing relocatable bottle on system with whitespace in HOMEBREW_PREFIX.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in progress Maintainers are working on this
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants