280 Commits

Author SHA1 Message Date
Markus Reiter
844db75361
Add source paths to API. 2023-04-07 15:20:01 +02:00
Douglas Eichelberger
ccfc1be6fe Rename lvar 2023-03-27 09:39:18 -07:00
Douglas Eichelberger
1c411f6086 Code review changes 2023-03-26 08:57:39 -07:00
Douglas Eichelberger
7720485f40 Enable types in Formula files 2023-03-25 08:50:06 -07:00
Mike McQuaid
a0eb5ebec7
formulary: require service.
This is used in this file.
2023-03-24 09:23:09 +00:00
apainintheneck
bc85857e13 service: make serialization non-recursive
This helps with type annotations and makes it easier to
reason about the code as well.
2023-03-21 23:20:49 -07:00
apainintheneck
db8d488db4 service: add info to API json and load from api
As a part of serializing the hash, certain path
placeholders are used for the HOMEBREW_PREFIX and $HOME
directories. Beyond that certain elements need to be
turned back into strings like cron and sockets and symbols
need to be preserved as well.

The run command accepts either an arg or kwargs so it
has to be treated specially here.
2023-03-19 00:09:10 -07:00
Douglas Eichelberger
0eccc0e987 git grep -l Utils::Inflection | xargs gsed -i 's|Utils::Inflection|Utils|g' 2023-02-27 20:18:27 -08:00
Douglas Eichelberger
2c73d4d9b7 Replace deconstantize inflection with util 2023-02-27 20:17:33 -08:00
Douglas Eichelberger
d62211d3af Replace demodulize inflection with util 2023-02-27 20:17:33 -08:00
Bo Anderson
e86a8c2477
Move HOMEBREW_NO_INSTALL_FROM_API defaults to shell 2023-02-24 21:53:08 +00:00
Mike McQuaid
f280ce069b
Support loading formulae/casks from subdirectories
Previously, we required all formulae and casks to be in a specific
formula or cask directory but did not check any subdirectories.

This commit allows using subdirectories for official taps, the only
ones likely to be big enough to warrant sharding in this way and to
avoid potentially breaking backwards compatibility for existing taps.

This was inspired by the most recent issues with homebrew-cask.
2023-02-24 10:57:41 +00:00
Bo Anderson
e663f532a6
Checksum Ruby source file downloads 2023-02-22 22:50:24 +00:00
Bo Anderson
cacd7194f6
Support link_overwrite and conflicts_with in API 2023-02-20 16:28:07 +00:00
Mike McQuaid
14a11f5c72
formulary: use default bottle root_url.
We never change this value in `formula.json` so ignore it for security.
2023-02-20 10:03:23 +00:00
Bo Anderson
efc5088f85
formulary: fix git clone handling for API formulae 2023-02-15 05:31:23 +00:00
Mike McQuaid
237eec8ef8
Overhaul Formula/Cask JSON generation
- Use constants for placeholders
- Monkeypatch to set `HOMEBREW_PREFIX` consistently to placeholder
- Use environment variable to set `Dir.home` consistently to placeholder
- Use `appdir` short-circuit to set `Cask#appdir` consistently to placeholder
- Use `Cask.generating_hash!` to enable "generating mode" with these patches
- Fix `Formula#caveats` from JSON

Fixes #14505
Fixes #14595
2023-02-14 14:19:40 +00:00
Mike McQuaid
e0ba9a1249
Merge pull request #14617 from Bo98/api-reqs-oldname
formulary: support requirements, aliases etc from API
2023-02-14 11:54:55 +00:00
Bo Anderson
7c1b642035
formulary: fix uses_from_macos handling on macOS 2023-02-14 04:07:51 +00:00
Bo Anderson
9b26bf9b92
formulary: support requirements, aliases etc from API 2023-02-14 03:32:56 +00:00
Rylan Polster
f7fa5937d8
Allow brew info --json=v2 without taps with JSON API 2023-02-12 12:03:40 +00:00
Xuehai Pan
176637acd8 formulary: respect HOMEBREW_BOTTLE_DOMAIN when installing from API 2023-02-07 13:03:25 +00:00
Mike McQuaid
ca95704c95
Merge pull request #14520 from Bo98/api-source
Better support source builds under API mode
2023-02-06 16:05:14 +01:00
Bo Anderson
2055792791
Better support source builds under API mode 2023-02-06 13:27:36 +00:00
Bo Anderson
33681f90e3
Add HEAD information to JSON API 2023-02-06 13:06:39 +00:00
Bo Anderson
83b23e6d5e
Fix license handling for API formulae 2023-02-06 10:09:40 +00:00
Rylan Polster
cc78b155c6
Add stable checksum to the JSON API 2022-10-21 01:22:36 -04:00
Rylan Polster
f66b5ff208
Include test deps when loading a formula from the API 2022-09-21 02:53:58 -04:00
Bo Anderson
0a7063ac51
formulary: fix error with absolute alias paths
Fixes #13883.
2022-09-19 02:35:01 +01:00
Mike McQuaid
6eaa510615
Merge pull request #13842 from Rylan12/api-in-tab
Include `loaded_from_api` key in `Tab`
2022-09-15 09:16:58 +01:00
Rylan Polster
e8f2d8f6c5
Load formulae from their aliases using the API 2022-09-14 23:59:10 -04:00
Rylan Polster
b44f715f82
Include loaded_from_api key in Tab 2022-09-14 22:23:01 -04:00
Rylan Polster
233cef08cf
Fix style 2022-07-25 18:31:35 +02:00
Rylan Polster
d4e5886571
Simplify checking for variations hash availability
Co-authored-by: Mike McQuaid <mike@mikemcquaid.com>
2022-07-25 17:43:54 +02:00
Rylan Polster
bae5abda82
Remove uses_from_macos dep duplication in FormulaAPILoader 2022-07-25 08:49:19 +02:00
Rylan Polster
7392f9811e
Formulary: use variations hash when installing from API 2022-07-24 22:59:42 +02:00
Gregory Anders
f387c7f0b2 Require deprecate_disable module in formulary
This solves a recurrent issue where various brew commands (e.g. doctor,
cleanup) would print the following stack trace:

    Error: uninitialized constant Formulary::DeprecateDisable
    Did you mean?  DeprecatedOption
    /opt/homebrew/Library/Homebrew/formulary.rb:269:in `convert_to_deprecate_disable_reason_string_or_symbol'
    /opt/homebrew/Library/Homebrew/formulary.rb:171:in `block in load_formula_from_api'
    /opt/homebrew/Library/Homebrew/formulary.rb:139:in `initialize'
    /opt/homebrew/Library/Homebrew/formulary.rb:139:in `new'
    /opt/homebrew/Library/Homebrew/formulary.rb:139:in `load_formula_from_api'
    /opt/homebrew/Library/Homebrew/formulary.rb:519:in `load_from_api'
    /opt/homebrew/Library/Homebrew/formulary.rb:510:in `klass'
    /opt/homebrew/Library/Homebrew/formulary.rb:296:in `get_formula'
    /opt/homebrew/Library/Homebrew/formulary.rb:542:in `factory'
    /opt/homebrew/Library/Homebrew/formulary.rb:565:in `from_rack'
    /opt/homebrew/Library/Homebrew/cleanup.rb:85:in `stale_formula?'
    /opt/homebrew/Library/Homebrew/cleanup.rb:58:in `stale?'
    /opt/homebrew/Library/Homebrew/cleanup.rb:356:in `block in cleanup_cache'
    /opt/homebrew/Library/Homebrew/cleanup.rb:339:in `each'
    /opt/homebrew/Library/Homebrew/cleanup.rb:339:in `cleanup_cache'
    /opt/homebrew/Library/Homebrew/cleanup.rb:222:in `clean!'
    /opt/homebrew/Library/Homebrew/cmd/cleanup.rb:58:in `cleanup'
    /opt/homebrew/Library/Homebrew/brew.rb:93:in `<main>'
2022-07-19 06:29:14 -06:00
Rylan Polster
b63474398e
Always prefer loading from API when HOMEBREW_INSTALL_FROM_API is set 2022-06-17 13:54:05 -04:00
Rylan Polster
15cf890ed7
Fix caveats when loading from the API 2022-06-16 20:24:22 -04:00
Rylan Polster
3cf86dad30
Handle deprecate/disable symbols when loading from the API 2022-06-16 16:22:59 -04:00
Rylan Polster
dd81ca57ca
Cleanup 2022-06-16 13:26:51 -04:00
Rylan Polster
996ca83a73
Don't ignore errors when loading from the API 2022-06-15 16:57:15 -04:00
Rylan Polster
ccd46af7c6
Cleanup 2022-06-14 16:42:10 -04:00
Rylan Polster
90c6aef0f0
Fix style 2022-06-14 16:06:05 -04:00
Rylan Polster
e53ccbc3cd
Remove unnecessary code 2022-06-14 16:06:05 -04:00
Rylan Polster
827acd3dc6
Align API loading with other formula loading 2022-06-14 16:06:05 -04:00
Rylan Polster
944d7eebf0
Add bottle rebuild when loading from 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
Alexander Bayandin
7fb74cb1dc
Fix error message duplication for installation from URL 2021-12-03 13:15:42 +00:00
fn ⌃ ⌥
db0c1d999b Print warning if given old short name of renamed formula 2021-11-17 22:20:48 -08:00