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

cmd/deps: add --os and --arch #17122

Merged
merged 1 commit into from
Apr 22, 2024
Merged

Conversation

cho-m
Copy link
Member

@cho-m cho-m commented Apr 21, 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?

Personal use-case is viewing Linux dependency tree for a formula. These extra args provide a simpler way of accessing info rather than using Linux container/VM.

@cho-m cho-m force-pushed the deps-simulated-os-and-arch branch from 85eaa26 to 77a16c2 Compare April 21, 2024 21:57
@dduugg
Copy link
Member

dduugg commented Apr 21, 2024

Is there any particular reason we can't add tests for this?

Copy link
Contributor

@apainintheneck apainintheneck left a comment

Choose a reason for hiding this comment

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

LGTM!

Comment on lines +69 to +72
flag "--os=",
description: "Show dependencies for the given operating system."
flag "--arch=",
description: "Show dependencies for the given CPU architecture."
Copy link
Contributor

Choose a reason for hiding this comment

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

Tangential: Do we list supported operating systems and architectures in the docs anywhere? If not, that might be a good thing to add at some point since this pattern is showing up in a few commands.

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't think it is documented. Closest may be on_* docs - https://docs.brew.sh/Formula-Cookbook#handling-different-system-configurations

Supported architectures at least show up if unsupported one is passed in, e.g.

Error: New arch must be :arm or :intel

raise UsageError, "`brew deps --os=all` is not supported" if args.os == "all"
raise UsageError, "`brew deps --arch=all` is not supported" if args.arch == "all"

os, arch = T.must(args.os_arch_combinations.first)
all = args.eval_all?

Formulary.enable_factory_cache!
Copy link
Contributor

Choose a reason for hiding this comment

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

I double-checked to make sure that the caching strategy supports multiple platforms.

@apainintheneck
Copy link
Contributor

Is there any particular reason we can't add tests for this?

@dduugg My guess is that tests weren't added because they'd need to be integration tests or things would need to be refactored more. The change itself seems pretty straightforward if you look at the whitespace-insensitive diff.

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.

Makes sense, thanks @cho-m!

@MikeMcQuaid MikeMcQuaid merged commit af2d356 into master Apr 22, 2024
25 checks passed
@MikeMcQuaid MikeMcQuaid deleted the deps-simulated-os-and-arch branch April 22, 2024 12:37
@github-actions github-actions bot added the outdated PR was locked due to age label May 23, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 23, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated PR was locked due to age
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants