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

dev-cmd/extract: trim version to only digits/decimals for class & file names #17537

Merged
merged 1 commit into from
Jun 20, 2024

Conversation

EricFromCanada
Copy link
Member

  • 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?

When generating a class name for a formula, remove any non-digit characters following the @ if present. Allows a command like brew extract --version to handle versions that don't start with digits. Fixes #16881.

brew(main):001> Formulary.class_s("[email protected]")
=> "MinioAT20240305t044844z"

@Bo98
Copy link
Member

Bo98 commented Jun 19, 2024

[email protected]

Should brew extract be outputting these names at all? There's a few places that assume numerical @ versions:

name_prefix = name.gsub(/(@[\d.]+)?$/, "")
T.must(tap).prefix_to_versioned_formulae_names.fetch(name_prefix, [])
elsif path.exist?
Pathname.glob(path.to_s.gsub(/(@[\d.]+)?\.rb$/, "@*.rb"))

@EricFromCanada
Copy link
Member Author

EricFromCanada commented Jun 20, 2024

Good point. I've updated this to have extract convert versions to just digits with decimals.

Now, RELEASE.2024-03-05T04-48-44Z becomes [email protected] with class name MinioAT20240305044844.

@EricFromCanada EricFromCanada changed the title formulary: trim non-digits after @ for class names dev-cmd/extract: trim version to only digits/decimals for class & file names Jun 20, 2024
Copy link
Member

@Bo98 Bo98 left a comment

Choose a reason for hiding this comment

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

Thanks!

Copy link
Member

@MikeMcQuaid MikeMcQuaid left a comment

Choose a reason for hiding this comment

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

Looks good with suggestions applied, thanks @EricFromCanada!

Library/Homebrew/dev-cmd/extract.rb Outdated Show resolved Hide resolved
Library/Homebrew/dev-cmd/extract.rb Outdated Show resolved Hide resolved
Library/Homebrew/dev-cmd/extract.rb Outdated Show resolved Hide resolved
@MikeMcQuaid MikeMcQuaid merged commit 14d452f into master Jun 20, 2024
25 checks passed
@MikeMcQuaid MikeMcQuaid deleted the formulary-trim-version branch June 20, 2024 13:16
@MikeMcQuaid
Copy link
Member

Thanks @EricFromCanada!

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.

brew extract creates a class name with @ symbol instead of AT
3 participants