160 Commits

Author SHA1 Message Date
Mike McQuaid
774ef54981
Improve Download Queue output
Update the naming, presence and values for various download queue
methods to improve the output for users while making the internal code
a little easier to follow.

While we're here, also ensure that a single formula download still
displays the download queue output and indirectly fix an issue with
bottle manifests being named incorrectly.
2025-08-04 15:51:02 +01:00
Mike McQuaid
ebd4ad6077
download_queue: fix patch handling.
These were being downloaded twice simultaneously which causes a locking
race condition.

While we're here, also improve the output of bottle manifests and
patches in the download queue.
2025-08-01 16:57:47 +01:00
Mike McQuaid
e3c3f5a356
Deprecate/disable/remove code for Homebrew 4.6
The next minor release will be Homebrew 4.6.0 so let's do the usual
deprecation/disable/remove code cycle.
2025-07-31 12:13:01 +01:00
Mike McQuaid
ed5805e50c
Add JSON API download strategy for download queue
This fixes the weird/broken existing behaviour which was incorrectly
creating symlinks at download time. It also defers much more logic to
the original code.

For clarity, rename the existing `API::Download` class to
`API::SourceDownload`.

While we're here:
- add a/improve the `download_type` method on all `Downloadable`
  subclasses to improve download queue output format
- move some logic to `RetryDownload`
2025-07-22 17:48:32 +01:00
Mike McQuaid
dc71b7c8f6
Cleanup extend/ directory usage.
- move some things out of `extend` that don't really fit there e.g.
  `Module`s that are included but not doing any
  overriding/monkeypatching
- move some code into `extend/os` to fix all remaining
  `rubocop:todo Homebrew/MoveToExtendOS`s
- remove some unneeded `bundle` skipper code that doesn't really make
  sense given our current bottling strategy
- extract some `Pathname` extensions to `extend/pathname` for separate
  files
- move a `ENV` `Kernel` extension into `kernel.rb`
- `odeprecate` a seemingly unused backwards compatibility method
- move `readline_nonblock` from a monkeypatch to a
  `ReadlineNonblock.read` method as its only used in one place
- fix up a link in documentation
2025-06-09 19:06:16 +01:00
Bo Anderson
35f874c036
Cleanup Downloadable variables and types 2025-04-23 03:30:15 +01:00
Mike McQuaid
c9a7b62b1d
Homebrew 4.5 deprecations/disables/removals
The usual cycle of deprecating, disabling, and removing things in
Homebrew major/minor releases.
2025-04-22 17:15:23 +01:00
Douglas Eichelberger
e58486cd4c
fix: Allow Formula.url with no args to get url 2025-03-26 12:15:25 -07:00
Douglas Eichelberger
9515714b44
Add interface for livecheck strategies 2025-02-26 16:45:39 -08:00
Douglas Eichelberger
3b3c55ca0d
fix: Remove misused YARD directives 2025-02-25 11:55:37 -08:00
Sam Ford
79e20b3512
Standardize livecheck block language formatting 2024-12-02 10:13:04 -05:00
Sam Ford
01cb74e525
livecheck: clarify livecheckable language
Formulae, casks, and resources have a `#livecheckable?` method that
indicates whether they contain a `livecheck` block. This is intended
to be read as "has a livecheckable?", not "is livecheckable?" (as
livecheck can find versions for some packages/resources without a
`livecheck` block). Unfortunately, correct understanding of this
method's behavior [outside of documentation] relies on historical
knowledge that few people possess, so this is often confusing to
anyone who hasn't been working on livecheck since 2020.

In the olden days, a "livecheckable" was a Ruby file containing a
`livecheck` block (originally a hash) with a filename that
corresponded to a related formula. The `livecheck` blocks in
livecheckable files were integrated into their respective formulae in
August 2020, so [first-party] livecheckables ceased to exist at that
time. From that point forward, we simply referred to these as
`livecheck` blocks.

With that in mind, this clarifies the situation by replacing
"livecheckable" language. This includes renaming `#livecheckable?` to
`#livecheck_defined?`, replacing usage of "livecheckable" as a noun
with "`livecheck` block", replacing "livecheckable" as a boolean with
"livecheck_defined", and replacing incorrect usage of "livecheckable"
as an adjective with "checkable".
2024-12-02 10:13:03 -05:00
Eric Knibbe
51be1d9652
revert setting --insecure to download ca-certificates 2024-11-24 14:57:32 -05:00
Michael Cho
ea0776c425
cmd/info: show size information
Co-authored-by: Mike McQuaid <mike@mikemcquaid.com>
Co-authored-by: Markus Reiter <me@reitermark.us>
2024-09-25 08:56:33 +01:00
Bo Anderson
70b8b41b37
resource: further fix manifest retry handling 2024-09-16 21:05:39 +01:00
Markus Reiter
fb0bf3b7a2
Fix wrong stage method being called. 2024-09-05 00:21:33 +02:00
Markus Reiter
404176af1d
Implement Downloadable for more types. 2024-09-04 22:54:28 +02:00
Markus Reiter
f41d2516ce
Fix type signatures. 2024-09-04 22:54:21 +02:00
Markus Reiter
b6d529dab3
Convert Downloadable to a module. 2024-09-04 22:54:21 +02:00
Markus Reiter
b297be77a1
Implement concurrent downloads. 2024-09-04 22:54:20 +02:00
Issy Long
45978435e7
rubocop: Use Sorbet/StrictSigil as it's better than comments
- Previously I thought that comments were fine to discourage people from
  wasting their time trying to bump things that used `undef` that Sorbet
  didn't support. But RuboCop is better at this since it'll complain if
  the comments are unnecessary.

- Suggested in https://github.com/Homebrew/brew/pull/18018#issuecomment-2283369501.

- I've gone for a mixture of `rubocop:disable` for the files that can't
  be `typed: strict` (use of undef, required before everything else, etc)
  and `rubocop:todo` for everything else that should be tried to make
  strictly typed. There's no functional difference between the two as
  `rubocop:todo` is `rubocop:disable` with a different name.

- And I entirely disabled the cop for the docs/ directory since
  `typed: strict` isn't going to gain us anything for some Markdown
  linting config files.

- This means that now it's easier to track what needs to be done rather
  than relying on checklists of files in our big Sorbet issue:

```shell
$ git grep 'typed: true # rubocop:todo Sorbet/StrictSigil' | wc -l
    268
```

- And this is confirmed working for new files:

```shell
$ git status
On branch use-rubocop-for-sorbet-strict-sigils
Untracked files:
  (use "git add <file>..." to include in what will be committed)
        Library/Homebrew/bad.rb
        Library/Homebrew/good.rb

nothing added to commit but untracked files present (use "git add" to track)

$ brew style
Offenses:

bad.rb:1:1: C: Sorbet/StrictSigil: Sorbet sigil should be at least strict got true.
^^^^^^^^^^^^^

1340 files inspected, 1 offense detected
```
2024-08-12 15:24:27 +01:00
Markus Reiter
ae6f43921a
Implement verify_download_integrity for bottle manifests. 2024-07-13 16:50:53 -04:00
Markus Reiter
05f07953fe
Create Resource::BottleManifest. 2024-07-13 16:47:00 -04:00
Mike McQuaid
6e9288470e
brew style --fix 2024-05-23 17:15:43 +01:00
Mike McQuaid
a37864da0f
Add HOMEBREW_ARTIFACT_DOMAIN_NO_FALLBACK
This fits the use-case I've heard multiple times where people want to
rely exclusively on their artifact provider.

Co-authored-by: Carlo Cabrera <30379873+carlocab@users.noreply.github.com>
2024-05-14 21:45:37 +09:00
Markus Reiter
480e264d9a
Lint Ruby docs. 2024-05-01 11:35:21 +02:00
Markus Reiter
caf87c0336
Warn about undocumented non-private APIs. 2024-05-01 11:35:20 +02:00
Markus Reiter
0f0055ede4
Make documentation @api private by default. 2024-04-26 19:04:20 +02:00
Markus Reiter
c76170a456
Hide #to_s in docs. 2024-04-26 14:04:55 +02:00
Mike McQuaid
ea2892f8ee
brew.rb: handle missing args. 2024-03-07 16:20:20 +00: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
8775465872
Enable Sorbet after running a developer command
We have no commands with Sorbet disabled and have had Sorbet enabled
for developers for a decent amount of time. As a result, we can enable
it for everyone who has run a developer command.

This also allows a bunch of `raise TypeError`s to be removed in favour
of relying on Sorbet here instead.
2023-09-02 08:39:28 -04:00
Markus Reiter
ff71668f0a
Fix type errors. 2023-05-09 01:13:55 +02:00
Markus Reiter
fe19ddc3a7
Remove Version#empty?. 2023-05-09 01:13:55 +02:00
Markus Reiter
a1efaf1864
Merge HeadVersion and NullVersion into Version. 2023-05-09 01:13:54 +02: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
Douglas Eichelberger
7720485f40 Enable types in Formula files 2023-03-25 08:50:06 -07:00
Markus Reiter
b8cb1d1a95
Simplify condition. 2023-03-13 02:40:03 +01:00
Markus Reiter
90665b074e
Simplify condition. 2023-03-13 02:38:03 +01:00
Issy Long
c6ff9b59c0
sorbet: Delete unused nilable? method; regenerate RBIs; fix errors 2023-03-12 22:44:31 +00:00
Issy Long
6d822d9a62
rubocop: Drop "fn" from Naming/MethodParameterName allowlist
- I originally thought this was short for "function", but upon closer
  inspection all its usages are to do with filenames. So, use "filename",
  it's clearer.
2023-03-08 14:40:56 +00:00
EricFromCanada
dfc9906184
internal messaging fixes 2023-02-10 23:17:16 -05:00
Xuehai Pan
d3093cd260 resource: automatic determine mirrors for PyPI resources 2022-09-16 01:57:19 +08:00
Xuehai Pan
46b3d24dd3 resource: automatic determine mirrors for glibc-bootstrap 2022-09-16 01:50:44 +08:00
Bo Anderson
cc97ae2152
resource: style tweak 2022-09-01 19:30:38 +01:00
Bo Anderson
911aa6ab18
resource: determine version before freezing 2022-09-01 18:30:58 +01:00
Bo Anderson
abfbb46678
Freeze formula definition once first instance is created 2022-08-31 20:40:42 +01:00
Lukas Oberhuber
676e3d4923 Change name of option on mktemp
From retain_in_sources to retain_in_cache
2022-08-01 18:30:14 -07:00
Lukas Oberhuber
8b1eb32e99 Sources now retained in Caches/Homebrew/Sources
Full path is ~/Library/Caches/Homebrew/Sources

This creates a brand new directory for each build, but leaves previous.
2022-07-31 20:33:25 +01:00