3098 Commits

Author SHA1 Message Date
Anatoli Babenia
2445b687c6 Use any? to check for warning message and fix brew style 2023-09-26 10:10:47 +03:00
Anatoli Babenia
d16e7e1f32 Rename refinement 2023-09-25 18:50:38 +03:00
Anatoli Babenia
6c7f3eb233 Move condition in interpolated part into variable 2023-09-25 18:11:27 +03:00
Anatoli Babenia
e3c0dafbc4
Update Library/Homebrew/dev-cmd/edit.rb
Co-authored-by: Mike McQuaid <mike@mikemcquaid.com>
2023-09-25 18:03:57 +03:00
Anatoli Babenia
cbee941502 Add proper sig for fail_with_message 2023-09-25 17:34:10 +03:00
Anatoli Babenia
7e835bcd97 Skip backticks when printing env var name 2023-09-25 17:22:18 +03:00
Anatoli Babenia
96ca1c561a Move helper Pathname methods into Refinement
https://docs.ruby-lang.org/en/2.4.0/syntax/refinements_rdoc.html
2023-09-25 17:21:21 +03:00
Anatoli Babenia
466055a1be Use regexp interpolation instead of string concat 2023-09-25 16:13:16 +03:00
Anatoli Babenia
63c60d2859 Rename fail to more descriptive fail_with_message 2023-09-25 15:58:52 +03:00
Anatoli Babenia
a78da3ecf0 Check paths exist before brew install warning 2023-09-25 15:56:41 +03:00
Anatoli Babenia
8f072dc05c Move error reporting logic for absent path to separate method 2023-09-25 15:56:41 +03:00
Anatoli Babenia
eae95670ef Separate logic that shows warning from path detection 2023-09-25 15:56:41 +03:00
Anatoli Babenia
1cbf5ce093 dev-cmd/edit: Move path specific functions to Pathname 2023-09-25 15:56:41 +03:00
Anatoli Babenia
84ce25d370
Make warning message fit 80 char limit
The longest line below limit is 59 chars this way.

Warning: `brew install` ignores locally edited formulae if
`HOMEBREW_NO_INSTALL_FROM_API` is not set.
2023-09-25 06:48:18 +03:00
Anatoli Babenia
a0a4fa4ed9
dev-cmd/edit: ignore linefeed in the message 2023-09-23 13:01:43 +03:00
Anatoli Babenia
4d625d03fc
dev-cmd/edit: make the warning easier to read 2023-09-23 12:56:26 +03:00
apainintheneck
85bd4c7e1f utils/backtrace: scrub sorbet-runtime from backtrace
Ever since we started using this at runtime it's been polluting
the backtrace output. This makes it harder to debug errors and
increases the amount of info users have to paste into the box
when filing an issue.

This is a very direct approach. Essentially, we strip out
everything related to the `sorbet-runtime` gem whenever the top
line in the backtrace is unrelated to sorbet-runtime.

The hope is that this will allow errors related to sorbet to
be diagnosed easily while also reducing the backtrace size
for all other types of errors.

Sometimes it is useful to see the full backtrace though.
For those cases, we include the full backtrace when
`--verbose` is passed in and print a warning that the
Sorbet lines have been removed from the backtrace the
first time they are removed.

Note: This requires gems to be set up so that the call to
`Gem.paths.home` works correctly. For that reason, it must
be included after `utils/gems` which is included in
`standalone/load_path` already.
2023-09-21 21:07:22 -07:00
Eric Knibbe
7c707216a2
dev-cmd/bump: skip head-only & disabled formulae 2023-09-13 18:02:12 -04:00
Eric Knibbe
6235a7f1af
dev-cmd/bump: omit PR lines with --no-pull-requests 2023-09-13 17:59:11 -04:00
Bo Anderson
9cf0d34ee0
Move gem group setting to separate, cacheable file 2023-09-13 14:04:13 +01:00
Mike McQuaid
86acd120b8
Merge pull request #15983 from razvanazamfirei/deprecate-online-flag
bump-cask-pr: deprecate online flag
2023-09-11 14:27:01 +01:00
Razvan Azamfirei
705c466bbd
bump-cask-pr: comment out odeprecated 2023-09-11 09:13:43 -04:00
Mike McQuaid
4e0ec2555e
Merge pull request #15986 from EricFromCanada/docs-assorted-improvements
Docs: assorted refinements for output
2023-09-11 13:06:52 +01:00
Eric Knibbe
c493b5e680
cmd+dev-cmd: fixes for output formatting 2023-09-11 02:29:57 -04:00
Eric Knibbe
4662678b3b
cmd+dev-cmd: adjust description line breaks
Use to distinguish additional notes from initial explanation and usage info
2023-09-11 02:29:21 -04:00
Eric Knibbe
2f79bdd257
global: add HOMEBREW_API_WWW 2023-09-11 02:26:37 -04:00
Eric Knibbe
931f762598
docs+rubydoc: various grammar/wording fixes 2023-09-11 02:26:37 -04:00
apainintheneck
d63e8cde80 cmd/audit: only flush formulary cache when needed
The cache here needs to be cleared when we are auditing multiple
os/arch combinations but not when we are running the audit only
for the current os/arch combination. This gives a 2x speed boost
to `brew audit --skip-style --except-version --tap=homebrew/core` locally.

In theory we could clear the cache less often by running all audits for
one os/arch combination at a time when auditing multiple os/arch combinations.
This would make the output a bit harder to follow and we don't seem to
run those checks on CI so I'm skipping that for now.
2023-09-09 18:47:29 -07:00
apainintheneck
1dc9274f62 Improve cask audit
- check for cask.url in audit steps
- check for cask.version in audit steps
- check for cask.sha256 in fetch command
- stop omitting casks based on nil url in audit command

It would be nice to be able to omit casks from the audit
if the os is not supported but there is not easy way to
do that without updating the SimulateSystem code or
refactoring how MacOSRequirement's are defined in the DSL.
2023-09-07 20:38:17 -07:00
apainintheneck
f4b15e95ac cmd/fetch & cmd/audit: handle unsupported os/arch combos
It's possible for casks to only run on certain os/arch
combinations but we don't check for them in the fetch and
audit commands.

At first, I tried to check if the macos version was satisfied
in a previous PR but that doesn't work correctly because
MacOSRequirement and ArchRequirement don't respect SimulateSystem.

Instead I'm just checking to see if the url stanza is defined
for each os/arch combination and skipping those casks where
it ends up being nil. This is kind of brute forcing it but
should work.
2023-09-04 15:00:31 -07:00
hyuraku
adc2a2fea1 remove ARGV from Formula#all 2023-09-02 19:35:22 +09:00
Mike McQuaid
d357607b2c
dev-cmd/contributions: usability/performance improvements.
- more sensible/performant defaults: default to primary repositories
  only for the last year rather than all repositories forever
- allow specifying more than one user at a time
- output the breakdown of contributions without needing `--csv`
- add a space before the `--csv` output
- consolidate some code
- avoid counting authored commits twice, to improve performance
- retry failed GitHub API calls (this happens often when querying all
  maintainers)
- stop counting after we find 1000 commits for a given user to avoid
  excessive API queries/pagination
2023-08-30 15:08:50 +01:00
Bo Anderson
fe8f6dfc8d
dev-cmd/prof: bleed less of the environment from gem installs 2023-08-21 14:22:47 +01:00
Mike McQuaid
e7dc14c015
dev-cmd/bottle: install gnu-tar before keg lock.
This allows the correct bottling of `gnu-tar` dependencies (and
`gnu-tar` itself). It also installs `gnu-tar` at a more appropriate
time in the `brew bottle` command.
2023-08-18 11:03:22 +01:00
Mike McQuaid
597f0840a3
dev-cmd/tests: add --fail-fast.
This is useful when testing very slow test files with many tests.
2023-08-10 16:27:37 +01:00
apainintheneck
0979f7c35f cmd/bump: add --installed flag
This allows users to only try to bump formulae and casks they
currently have installed. It copies this behavior from the
livecheck command.
2023-08-05 10:01:11 -07:00
apainintheneck
474656ffaa dev-cmd/bump : stop using API to load formulae/casks
Even though the command already sets without_api that only
affects how named args are loaded. In this command, we used to load
many formulae and casks all at once using the API according to
user settings. Now we just mandate that all loading must skip the API.
2023-08-04 19:08:22 -07:00
Mike McQuaid
b3c33d34ab
Various sharding fixes
- Load paths with no API when needed (e.g. for `brew edit`)
- Use no API mode for `brew log` as it's needed there
- Define sharding format for homebrew-cask and homebrew-core inside
  `Tap` methods
- Create new formulae/casks in location defined by these `Tap` methods
- Fix a bug in Formulary that made sharded formulae lookup less
  efficient (and possibly broke it for core and some API usage)
- Fix various other hardcoded Formula/Cask directory assumptions

Co-authored-by: Bo Anderson <mail@boanderson.me>
2023-08-04 16:43:13 +01:00
Mike McQuaid
71888db8ba
bottle: reproducibility fixes.
I noticed from
https://github.com/Homebrew/homebrew-core/actions/runs/5751070010 that
we're no longer creating reproducible bottles between macOS and Linux.

All macOS checksums have changed but Linux ones have not. The main
difference between the two platforms is the `gtar` version used so let's
always just use the formula on both platforms.

While we're here, clear up the ordering and comments a little on the
reproducible `tar` arguments so that it's easier to compare with the
reproducible builds archives documentation.
2023-08-04 10:02:44 +01:00
Razvan Azamfirei
3949138d5b
format bump block 2023-08-03 09:58:59 -04:00
Razvan Azamfirei
2d330bcd32
bump: add arch-specific support 2023-08-03 09:41:01 -04:00
Eric Knibbe
b3ecd91f97
dev-cmd/edit: suggest tapping core repositories 2023-08-01 13:39:28 -04:00
Mike McQuaid
375a7ee8dc
Allow configuring Homebrew with .env files
For a long time people have requested some sort of configuration files
for Homebrew. Now: here's the first version of that.

Similarly to how you can configure Git for a system, a repository or
a user: you can configure Homebrew for a system, a prefix or a user.

The system-wide configuration file is `/etc/homebrew/brew.env`, the
prefix-specific configuration file is
`$HOMEBREW_PREFIX/etc/homebrew/brew.env`
and the user-specific configuration file is `~/.homebrew/brew.env`.

As we need to read these files from Bash in `bin/brew` (so they can)
influence functionality ASAP: they are in a simple format that Bash
can read. It may be that we have more complex array or hash data in
future that's configured through JSON or YAML (most likely JSON as we
use it more) and stored in a `brew.json`/`brew.yaml` file in the same
directory.

As this is relying on `eval` in Bash which is fairly dangerous: we
filter the lines with a regex to ensure we're only permitting setting
`HOMEBREW_*` variables and nothing more.

To give a bit of power to system administrators, the
`HOMEBREW_SYSTEM_ENV_TAKES_PRIORITY` variable can be set in
`/etc/homebrew/brew.env` to ensure that the system-wide configuration
file is loaded last and overrides any prefix or user settings.

Now that we have an actual location for configuration files, let's also
change the `brew livecheck` watchlist configuration file to be in this
directory and deprecate the existing location. As this is a developer
command and the mitigation is to just move the file: we don't need to
follow the normal deprecation process here.
2023-07-28 17:17:14 +01:00
Mike McQuaid
4b9c031e1b
Merge pull request #15725 from razvanazamfirei/bump-cask-pr-arch
`bump-cask-pr`: add arch-specific version support
2023-07-25 15:52:36 +01:00
Razvan Azamfirei
33375ae938
rename class and reorganize files 2023-07-25 06:41:38 -04:00
Douglas Eichelberger
08e46c18cd Add type to Formula attrs 2023-07-24 14:12:36 -07:00
Bo Anderson
9235024131
dev-cmd/pr-pull: fix branch warning conditions 2023-07-22 22:41:51 +01:00
Razvan Azamfirei
c64c834d05
bump-cask-pr: add arch-specific version support 2023-07-21 11:45:34 -04:00
Carlo Cabrera
45171dde8d
dev-cmd/pr-pull: fix typechecking error
Fixes

    Error: uninitialized constant Formulary::Formula

https://github.com/Homebrew/homebrew-core/actions/runs/5622415532/job/15237499429#step:8:132
2023-07-21 22:18:00 +08:00
Douglas Eichelberger
33d9dc63b0 Fix type errors when HOMEBREW_SORBET_RUNTIME=1 2023-07-18 10:22:51 -07:00