1961 Commits

Author SHA1 Message Date
Bevan Kay
5f79980938
cask/url headers parameter type fix 2023-11-09 10:23:13 +11:00
Mike McQuaid
ff404fe5ab
Merge pull request #16184 from dduugg/rm-try
Remove use of ActiveSupport try
2023-11-06 13:11:01 +00:00
Mike McQuaid
d4bf3b0685
Merge pull request #16183 from dduugg/sorbet-updates
Sorbet updates for compatibility with recent releases
2023-11-06 13:10:12 +00:00
Razvan Azamfirei
df2aee4553
audit: add extract artifcats method 2023-11-05 17:18:32 -05:00
Razvan Azamfirei
e60523766e
audit: code review changes 2023-11-05 17:18:32 -05:00
Razvan Azamfirei
c90e6e7b4b
cask/audit: add audit_min_os 2023-11-05 17:18:31 -05:00
Douglas Eichelberger
75179e9239 brew style --fix 2023-11-05 12:18:31 -08:00
Douglas Eichelberger
00ba09d73d Remove use of ActiveSupport try 2023-11-05 09:28:19 -08:00
Douglas Eichelberger
0191af7899 resolve typecheck errors 2023-11-05 08:55:58 -08:00
Mike McQuaid
54012f14ce
cask: add installed_time to JSON output.
This is provided for formulae in `installed.time` and is useful to have
for casks as well as formulae so let's output it here too.
2023-11-03 11:37:01 +00:00
Edward
f21af1e3eb
fix: xattr check in download quarantine 2023-10-25 21:22:06 +08:00
Edward
25ab4a2733
Revert "fix: ignore quarantine for linux cask download"
This reverts commit d2c15d04a1603c0a20fcedd0070d7c144cba28d8.
2023-10-25 21:21:28 +08:00
Edward
d2c15d04a1
fix: ignore quarantine for linux cask download 2023-10-25 19:25:29 +08:00
Mike McQuaid
eb1355e624
Add HOMEBREW_SUDO_THROUGH_SUDO_USER
This environment variable allows telling Homebrew to use the `SUDO_USER`
variable to `sudo` through that user when Homebrew (Cask) attempts to
run `sudo`.

While we're here, clarify in some messaging that we're running `sudo`
and that that's the password we're asking for; the specific password is
configuration dependent and not the specific password for the user.

Similarly, remove the `Package installers may write to any location`
output; it's kinda spammy and doesn't feel like the right place.
2023-09-29 18:49:44 +01:00
Bo Anderson
af7d744af0
Fixes for Ruby 3 2023-09-29 05:25:48 +01: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
Mike McQuaid
9b7b283805
Merge pull request #15977 from apainintheneck/improve-cask-audit
Improve cask audit
2023-09-08 00:46:34 -04: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
Mike McQuaid
d5d74788b2
Merge pull request #15968 from MikeMcQuaid/cask_upgrade_sudo_test_fix
cask/quarantine: don't try to sudo during tests.
2023-09-06 10:17:37 -04:00
Mike McQuaid
58df7885e6
cask/quarantine: sudo correctly during tests.
Use `NeverSudoSystemCommand` and pass it through to
`Quarantine.copy_xattrs` so `brew tests` doesn't try to `sudo`.

Fixes #15958

Co-authored-by: Bo Anderson <mail@boanderson.me>
Co-authored-by: Kevin <apainintheneck@gmail.com>
2023-09-06 10:03:45 -04:00
Mike McQuaid
9ce19fc002
cask/url: full scope curl_output call. 2023-09-06 09:55:17 -04:00
Ruoyu Zhong
05ffff09ed
cask/audit: fix Utils::Curl usage
Needed after #15940.
2023-09-06 00:12:57 +08:00
Mike McQuaid
1a91157590
Fix more missing Utils::Curl references.
e.g. https://github.com/Homebrew/brew/pull/15940#issuecomment-1706486816
2023-09-05 08:27:02 -04:00
Mike McQuaid
b7114651ac
utils/curl: include or use explicitly.
Include or use `Utils::Curl` explicitly everywhere it is used.
2023-09-04 22:17:57 -04:00
Gibson Fahnestock
b4feaf27d9
cask/url: accept Class for using in Cask::URL#initialize
https://github.com/Homebrew/brew/pull/15754 fixed
`Cask::URL::DSL#initialize`, but we also need to fix
`Cask::URL#initialize` as that takes the same parameters.

Error:

```
Error: Cask 'mycask' definition is invalid: 'url' stanza failed
  with: Parameter 'using': Expected type T.nilable(Symbol), got type Class
  with value MyCustomDownloadStrategy
Caller:
  /opt/homebrew/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/sorbet-runtime-0.5.10461/lib/types/private/methods/call_validation.rb:113
```

Refs: https://github.com/Homebrew/brew/issues/15750
2023-09-04 08:46:22 +01:00
Mike McQuaid
db1267bdff
Merge pull request #15943 from apainintheneck/handle-nil-urls-in-cask-installer
Handle nil cask urls caused by unsupported macOS version
2023-09-03 09:23:08 -04:00
Mike McQuaid
daa175e760
cask/installer: remove outdated comment. 2023-09-03 09:09:14 -04:00
apainintheneck
8c2f101138 cmd/fetch: handle nil cask urls
These urls can be nil if there is an unsatisfied macos version
requirement. We check for false here because either the macos
requirement can be satisfied and return true or can not be
specified and return nil. If it's not specified, it means it
can run on any macos version.

The change in Cask::Download should provide better error messages
in Downloadable but honestly we're better off just checking for
the missing url higher up the call stack which is why I made
the changes in the fetch command. Either way it seemed like
a good idea while I'm here.
2023-09-02 20:56:55 -07:00
apainintheneck
51387287f7 Handle nil urls in cask installer and API cask loader
The goal here is to handle the case where a cask might have a nil
url stanza because that cask is not available on the current version
of macOS or the given architecture. This just moves those checks
from the end of the `Cask::Installer#fetch` method to the beginning
so that we don't try and download casks that are missing urls.

This will now provide a helpful error message like so:
```
Error: This software does not run on macOS versions older than Big Sur.
```

Beyond that it no longer tries to run the url stanza with a nil value
when loading casks from the API.
2023-09-02 20:56:36 -07:00
Eric Knibbe
686638b683
cask/audit: format-check block URLs only if online 2023-08-29 17:10:40 -04:00
Douglas Eichelberger
d01cda2815 Turn up the types 2023-08-12 22:01:22 -07:00
Mike McQuaid
22553cd34a
Fix cask sharding issues
- Fix cask info output being incorrect
- Improve some code referring to casks as formulae
- Move livecheck cask fixtures to not shadow existing names
- Adjust the cask tap symlinking logic to make handling outdated
  shadowed casks significantly easier
- Fix various flaky tests caused by casks sharding logic
- Prefer longer paths when there's multiple formulae or casks in a tap
  with the same name rather than always using the first
2023-08-10 16:08:47 +01:00
Razvan Azamfirei
72df964b33
change path 2023-08-09 15:27:36 -04:00
Razvan Azamfirei
a916d6184b
Update Library/Homebrew/cask/audit.rb
Co-authored-by: Mike McQuaid <mike@mikemcquaid.com>
2023-08-09 15:26:47 -04:00
Razvan Azamfirei
ef9e0bc8a6
cask/audit: audit for appropriate sharding directory 2023-08-09 14:52:30 -04:00
Douglas Eichelberger
efd02b956d Revert "Revert "Make inreplace a purely static method""
This reverts commit 8656caa67ce2dd9ec6484969b183c1fd7805451e.
2023-08-04 16:20:38 -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
Alexander Bayandin
8656caa67c
Revert "Make inreplace a purely static method" 2023-08-03 16:16:19 +01:00
Douglas Eichelberger
2ad87f87d5 Make inreplace a purely static method 2023-08-02 09:44:18 -07:00
Eric Knibbe
b3ecd91f97
dev-cmd/edit: suggest tapping core repositories 2023-08-01 13:39:28 -04:00
Mike McQuaid
471e733641
Merge pull request #15754 from MikeMcQuaid/cask_url_class
cask/url: accept `Class` for `using`.
2023-07-25 16:04:48 +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
Mike McQuaid
7d153d34e9
cask/url: accept Class for using.
Fixes #15750.
2023-07-25 15:50:49 +01:00
apainintheneck
c9dea04bd4 cmd/install: upgrade already installed casks
Previously, the behavior was to warn users that a cask was already
installed and then skip modifying the installed version. This is
different to how we handled things with formulas. For them we would
upgrade any already installed formulas. This just brings casks in line
with what we already do with formulas.

Changes:
- cmd/install: Upgrade already installed casks if HOMEBREW_NO_INSTALL_UPGRADE
  is not set
- env_config: Update wording of HOMEBREW_NO_INSTALL_UPGRADE to include casks
- remove error that was only used to alert about already installed casks

Note:
- The upgrade command for casks defaults to --greedy when you pass named casks
  to the command which means that this will always default to that behavior
  since you must specify the name of the cask when installing.
2023-07-23 18:50:39 -07:00
Razvan Azamfirei
c64c834d05
bump-cask-pr: add arch-specific version support 2023-07-21 11:45:34 -04:00
Bo Anderson
67ecc2452a
Merge pull request #15602 from donaldducky/cask-support-multiple-headers
Cask support multiple headers
2023-07-20 21:19:55 +01:00
Douglas Eichelberger
368dd4d949 Fix other to_json override while we're here 2023-07-18 11:30:46 -07:00
Mike McQuaid
c940e15a5c
Use HOMEBREW_CELLAR_PLACEHOLDER
Similarly to HOMEBREW_PREFIX_PLACEHOLDER, this allows the substitution
of HOMEBREW_CELLAR in JSON output when using the API.

Fixes #15668.
2023-07-18 10:59:27 +01:00
Bo Anderson
ba02c669e1
Introduce CoreCaskTap class 2023-07-13 20:33:26 +01:00
Mike McQuaid
cb6178596b
Merge pull request #15632 from MikeMcQuaid/deprecate_disable_delete
Deprecate/disable/delete code.
2023-07-07 07:57:50 +01:00