48 Commits

Author SHA1 Message Date
apainintheneck
b61d74f176 api: require base64
This was required previously by the `plist` gem and we were requiring
it indirectly. It got removed in v1.7.1 of that gem because it will
no longer be included in the standard library as of Ruby 3.4.

Since we're not currently running on Ruby 3.3 and 3.4 is not out yet,
we can punt on this for now but we'll need to figure out a better
alternative before upgrading to Ruby 3.4.

Related:
- https://github.com/patsplat/plist/pull/63
2023-12-27 20:04:15 -08:00
Eric Knibbe
8646b2cf1f
api: ignore HTTPS errors if minimum curl version isn't installed 2023-10-04 22:24:57 -04:00
Mike McQuaid
8ba389817f
api: retry manually without curl_args defaults.
Co-authored-by: Kevin <apainintheneck@gmail.com>
2023-09-03 09:10:25 -04:00
Mike McQuaid
d5a1f3e02c
api: use Utils::Curl.curl_args
This sets user-agent nicely and avoids some duplication.
2023-09-02 21:31:01 -04:00
Eric Knibbe
70e676c176
api: ignore HTTPS errors if required certs aren't installed 2023-08-22 17:41:46 -04:00
Mike McQuaid
27dda52a5d
Download tap_migrations.json files from the API
Download the previously stored tap migrations files for homebrew/core
and homebrew/cask from the formulae.brew.sh API.

This adds a much longer stale time (24 hours) to decide whether or not
the migrations files need downloaded from the API in Ruby land.
`brew update` will still update them every time.

Requires https://github.com/Homebrew/brew/pull/15628
Fixes https://github.com/Homebrew/brew/issues/14897
2023-07-05 17:18:12 +01:00
Bo Anderson
68289f1165
Add without_api specifier for CLI named args 2023-06-22 01:57:28 +01:00
Bo Anderson
44f058edb5
Refactor formula, cask and Ruby source downloads to use shared code 2023-04-27 23:23:07 +01:00
Douglas Eichelberger
24cf6076e8 brew style --fix 2023-04-24 20:42:39 -07:00
Markus Reiter
844db75361
Add source paths to API. 2023-04-07 15:20:01 +02:00
Mike McQuaid
5631310653
Auto-update from the API less often
Instead of doing so literally whenever we query for a formula, Instead
do so only when we're in an auto-updateable command.

This better fits the existing behaviour while still updating when it's
most important to do so.
2023-03-10 17:53:15 +00:00
Nanda H Krishna
51329635d9
api: fix merge_variations 2023-03-07 14:12:41 -05:00
Nanda H Krishna
bb4f41ea43
api: fix bottle_tag identification 2023-03-07 14:12:40 -05:00
Mike McQuaid
57ef4afe57
api: improve root messaging.
Co-authored-by: Bo Anderson <mail@boanderson.me>
2023-02-23 12:48:18 +00:00
Mike McQuaid
2884b1649b
api: don't download files as root when Homebrew's not owned by root.
This was mentioned in a random comment. While we're here, make some
helper functions to query this a bit more nicely elsewhere when we do
it.
2023-02-23 10:04:50 +00:00
Bo Anderson
e663f532a6
Checksum Ruby source file downloads 2023-02-22 22:50:24 +00:00
Bo Anderson
b7d6d00c34
api: use signed endpoint 2023-02-22 21:53:32 +00:00
Mike McQuaid
853b33bcda
Merge pull request #14742 from apainintheneck/respect-quiet-with-api-downloads
api: respect --quiet
2023-02-21 09:23:07 +00:00
apainintheneck
0b3b54e75d api: respect --quiet 2023-02-20 23:23:42 -08:00
Bo Anderson
c2342eca91
Further improvements to API handling in shell 2023-02-19 05:38:13 +00:00
Bo Anderson
ab6bef261c
api: avoid unnecessary file write operation 2023-02-16 16:23:13 +00:00
Mike McQuaid
f7f04bae26
api: use formulae.brew.sh for cask-source API again.
GitHub's raw endpoint is proving hilariously unreliable for us here.
2023-02-16 12:05:38 +00:00
Douglas Eichelberger
95742f4cfd Enabling typing in Homebrew::API module 2023-02-13 21:33:04 -08:00
Rylan Polster
f7fa5937d8
Allow brew info --json=v2 without taps with JSON API 2023-02-12 12:03:40 +00:00
Mike McQuaid
75a20689b1
Add HOMEBREW_API_AUTO_UPDATE_SECS
This sets the default and allows customising how often we try to
download files from the API.

This does not affect `brew update` as we want to always check every time
on an explicit call.
2023-02-11 07:22:50 +00:00
Mike McQuaid
e301fe8fd8
brew.sh: move shared curl speed limit settings here.
This avoids duplication and potentially allows it to be used for various
other `curl` calls.
2023-02-10 17:27:10 +00:00
Bo Anderson
15c291f054
api: don't add --time-cond on retries 2023-02-09 18:26:37 +00:00
Bo Anderson
a26a2d71a8
Use --speed-time over --max-time for API downloads 2023-02-09 18:25:52 +00:00
Flier Lu
f08c1e836d increase JSON_API_MAX_TIME 2023-02-09 21:06:46 +08:00
Xuehai Pan
4322e57dd0 utils/curl: make --show-error optional 2023-02-04 13:05:41 +00:00
Xuehai Pan
ba3bccf9ed api: download from HOMEBREW_API_DOMAIN 2023-02-04 13:05:20 +00:00
Mike McQuaid
082e75e692
Merge pull request #14500 from MikeMcQuaid/remove_api_versions
api/versions: remove.
2023-02-04 13:59:43 +01:00
Mike McQuaid
9ba6aef820
api: improve exception handling. 2023-02-04 13:22:15 +01:00
Mike McQuaid
2a01529cad
api/versions: remove.
We no longer (never?) need/use these APIs so can remove them from here
and from Homebrew/formulae.brew.sh.
2023-02-04 13:09:59 +01:00
Rylan Polster
cbda171c2b
Fix JSON file download failure fallback 2023-02-04 01:46:50 +01:00
Mike McQuaid
9a13f53cbb
Merge branch 'master' into remove-fetch-print 2023-02-03 13:10:19 +00:00
Rylan Polster
c30b489525
Homebrew::API::fetch_file_source: remove debug line 2023-02-03 11:48:02 +01:00
Mike McQuaid
561e520467
api: warn rather than fail if we've got a cached version.
Rather than failing every time we fail to update (breaking most usage
while offline) instead only fail if we cannot obtain the JSON and we
don't have a valid local file we can use.

Also tweak the timeout and retry logic and values to make a bit more
sense in this context and not be so noisy when offline.
2023-02-03 10:22:50 +00:00
Rylan Polster
2c78840f57
Fix typecheck issue 2023-01-28 02:16:09 -06:00
Rylan Polster
32a0877cad
Remove CaskSource API 2023-01-28 02:15:00 -06:00
Mike McQuaid
fd18c7b0ac
Tweak cask-source API handling
- Use raw.githubusercontent.com to download cask source rather than
  formulae.brew.sh. This allows us to remove these files
- output the tap's current `HEAD` for both formulae and cask JSON
- use this `HEAD` for the cask-source API to get the exact file on
  raw.githubusercontent.com rather than just whatever is newest (which
  is what the previous API did)
- set the `Tap` correctly when creating a `Cask` from the API
- if the `formula.json` file exists: print its modified time include
  `brew config`
- memoize `tap.git_head` as we'll be calling it a lot in the same
  process with the same value
2023-01-26 17:36:40 +00:00
Rylan Polster
bab85d84e9
Extract common JSON API fetch logic 2023-01-06 02:46:21 -05:00
Rylan Polster
89483abda9
Remove Bottle API 2022-06-14 16:06:05 -04:00
Bo Anderson
1d36c42fb7
Support offline usage under HOMEBREW_INSTALL_FROM_API 2022-06-14 16:06:05 -04:00
Sam Ford
f88966a8a5
Use curl options where appropriate 2021-09-07 14:13:19 -04:00
Rylan Polster
c32223a89c
Add cask-source API 2021-08-14 01:59:04 -04:00
Rylan Polster
eab0f88c3c
Remove json argument and extend Cachable 2021-08-09 10:29:55 -04:00
Rylan Polster
737dd1654b
Refactor API methods 2021-08-06 04:31:27 -04:00