69 Commits

Author SHA1 Message Date
Michael Cho
d4e06b4d45
patch: restore output from failed patch 2024-12-19 14:56:00 -05:00
Przemysław Kryger
ff03947ba0 Use @@HOMEBREW_PREFIX@@ for replacements in external patches 2024-10-23 16:51:01 +01:00
Przemysław Kryger
13a26d5517
Use patch arguments directly
Co-authored-by: Mike McQuaid <mike@mikemcquaid.com>
2024-10-23 16:26:14 +01:00
Przemysław Kryger
a03d65b5c9 Allow HOMEBREW_PREFIX replacement in external patches
This fixes #15925
2024-10-23 15:15:17 +01: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
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
fe4ef62aa9
Hide #inspect in docs. 2024-04-26 13:20:05 +02:00
Douglas Eichelberger
3abbf4447e Some minor regexp match perf improvements 2023-12-27 13:16:36 -08: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
827fc87cde Enable more typing 2023-03-15 14:29:15 -07:00
EricFromCanada
dfc9906184
internal messaging fixes 2023-02-10 23:17:16 -05:00
nandahkrishna
8e5451df2f
style: use parentheses for assignment in conditions 2021-02-12 18:33:37 +05:30
Seeker
7a5a8baac5 patch: delete legacy code
SoftwareSpec#add_legacy_patches and Patch#normalize_legacy_patches
were added almost 6 years ago; let's delete them

See commit 665b14c4a44c272b46b8559836e9fdbeee5d8a46

```
$ grep -r 'normalize_legacy_patches' Library/Homebrew
./software_spec.rb:    list = Patch.normalize_legacy_patches(list)
./patch.rb:  def self.normalize_legacy_patches(list)
```

```
$ grep -r 'add_legacy_patches' Library/Homebrew
./software_spec.rb:  def add_legacy_patches(list)
```
2021-01-13 18:40:46 -08:00
Mike McQuaid
d496f5c121
Deprecations for Homebrew 2.6.0
Do the usual deprecate/disable dance for the Homebrew 2.6.0 release.

Not to be merged until the next release will definitely be 2.6.0.
2020-11-24 16:44:02 +00:00
Markus Reiter
da9289eff0 Add more type signatures. 2020-11-13 12:26:36 +01:00
Markus Reiter
24ae318a3d Move type annotations into files. 2020-10-10 14:59:39 +02:00
Mike McQuaid
2e5272d04c Deprecate/disable code for Homebrew 2.5.0.
Do the usual "disable deprecations" and "uncomment pending deprecations"
dance and delete/deprecate/disable relevant/related code.
2020-09-03 10:34:22 +01:00
Markus Reiter
b9894e2241 Document Patch. 2020-08-26 03:13:59 +02:00
Markus Reiter
36458b2356 Remove unnecessary check. 2020-07-30 03:21:12 +02:00
Markus Reiter
ca18a72673 Refactor output_unsupported_error. 2020-07-30 03:21:12 +02:00
Mike McQuaid
4f75a77b08
Update deprecations
Add more deprecations, disable deprecations and remove disabled code.
2020-05-18 13:50:46 +01:00
Mike McQuaid
6ed1ccd8e8
Fetch (all) resources when building from source
Also:
- when `brew test` or `brew postinstall` is run allow `Resource#stage`
  to fetch the resource.
- make `Formula#fetch` and `Resource#fetch` fetch external patches too.

Follow-up from #7549 and #7546.
2020-05-12 12:37:54 +01:00
Mike McQuaid
1e265247ca
rubocop: apply autofixes. 2020-03-13 21:16:18 +00:00
Bo Anderson
43d6caf0e3 patch: add support for changing directory 2020-03-09 19:51:10 +00:00
Mike McQuaid
c4f72312ce
Fixup brew style failures. 2019-04-30 09:19:18 +01:00
Mike McQuaid
36dbad3922
Add frozen_string_literal to all files. 2019-04-20 13:27:36 +09:00
Mike McQuaid
86f43f79ee
Enable/fix optional Ruby frozen string literal usage
Combined with https://github.com/Homebrew/homebrew-test-bot/pull/247
this will test Homebrew's use of frozen strings in CI. After this we
will then enable it for Homebrew developers and eventually all Homebrew
users.
2019-04-19 10:30:41 +09:00
EricFromCanada
20167e5f1b Adjust comments to tidy API docs output. 2018-10-18 21:42:43 -04:00
Markus Reiter
e9b9ea49a1 Update to RuboCop 0.59.1. 2018-09-17 03:45:59 +02:00
Markus Reiter
2452b27866 Refactor ErrorDuringExecution. 2018-07-19 16:41:27 +02:00
Mike McQuaid
4ab0a18c8f patch: improve nil strip message.
As reported https://github.com/Homebrew/brew/pull/4037#issuecomment-379591755.
2018-04-08 16:48:50 -07:00
ilovezfs
7c07ec5fc1 resource: allow patches to be applied 2018-01-22 01:10:14 -08:00
Shaun Jackman
e32299e652 patch: Use patch found in the PATH 2017-11-19 13:54:46 -08:00
Markus Reiter
9bee9ca575 Use “squiggly” heredocs. 2017-10-18 14:39:09 +02:00
Markus Reiter
175ca909ee Clean up code style and remove .rubocop_todo.yml. 2017-10-08 16:10:37 +02:00
Mike McQuaid
021cef4b2b Autocorrect Rubocop Style/SpecialGlobalVars. 2017-06-12 09:11:42 +01:00
Alyssa Ross
b01a9b0695 patch: clean up with Forwardable 2017-05-22 20:39:17 +01:00
Markus Reiter
58e36c7319 Fix Style/GuardClause. 2016-09-24 12:24:35 +02:00
Markus Reiter
52ff988530 Fix RuboCop CaseEquality. 2016-09-23 15:30:06 +02:00
Mike McQuaid
3982950e61 rubocop --auto-correct all hash-rocket usage. 2016-09-17 16:14:13 +01:00
Mike McQuaid
6693915399 rubocop --auto-correct all remaining files.
But remove some manual `.freeze`s on constants that shouldn't be
constants.
2016-09-17 16:14:13 +01:00
Misty De Meo
1ed7108052 Array#count alias didn't always exist
Fixes mistydemeo/tigerbrew#408.
2016-02-06 14:20:56 -08:00
ilovezfs
cc3d041c26 DSL method "apply" to specify patch files
The "apply" DSL method can be called from patch-do blocks to specify
the paths within an archive of the desired patch files, which will be
applied in the order in which they were supplied to the "apply" calls.
If "apply" isn't used, raise an error whenever the extracted directory
doesn't contain exactly one file.

The "apply" method can be called zero or more times within a patch-do
block with the following syntaxes supported:

    apply "single_apply"
    apply "multiple_apply_1", "multiple_apply_2"
    apply [array_of_apply]

If apply must be used, a single call using the second syntax above is
usually best practice. Each apply leaf should be the relative path to a
specific patch file in the extracted directory.

For example, if extracting this-v123-patches.tar.gz gives you

    this-123
    this-123/.DS_Store
    this-123/LICENSE.txt
    this-123/patches
    this-123/patches/A.diff
    this-123/patches/B.diff
    this-123/patches/C.diff
    this-123/README.txt

and you want to apply only B.diff and C.diff, then you need to use
"patches/B.diff" and "patches/C.diff" for the lowest-level apply leaves.

The code was provided by Xu Cheng. Any mistakes are mine.
2016-02-01 18:37:36 +00:00
BrewTestBot
13d544e11e Core files style updates.
Closes Homebrew/homebrew#42354.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2015-08-03 13:22:35 +01:00
Jack Nagel
0f01e9ff43 Remove the direct url writer from Resource 2015-01-08 14:18:41 -05:00
Jack Nagel
d2d7516cc0 Allow debugging patching failures
Closes Homebrew/homebrew#33056.
2014-12-26 19:42:11 -05:00
Jack Nagel
5575fb843c Don't raise NotImplementedError 2014-12-23 01:04:44 -05:00