334 Commits

Author SHA1 Message Date
Bo Anderson
20d86c0185
Refactor some tag handling into a Utils::Bottles::Tag class 2021-04-08 17:23:57 +01:00
Bo Anderson
1bb651469f
dev-cmd/bottle: don't fail on --keep-old with unchanged values 2021-04-07 20:26:36 +01:00
Mike McQuaid
8800b85f64
More GitHub Packages bulk upload fixes
- replace invalid non-ASCII characters from the descriptions
- handle invalid macOS versions on attempting to load old formulae from
  old bottles
- let `rubocop` auto-remove a no-longer needed `rubocop:disable`
- fix `skopeo` credentials argument
2021-04-07 17:03:44 +01:00
Mike McQuaid
5cae3f4096
dev-cmd/bottle: fix license output.
Don't output the complex license object but instead use the same format
we use for `Formula#to_hash`.
2021-04-06 14:41:27 +01:00
Mike McQuaid
ab0d9f18a5
Merge pull request #10977 from MikeMcQuaid/github_packages_tab_download
GitHub Packages Tab download
2021-04-02 09:43:27 +01:00
nandahkrishna
53a7065bcc
Allow specifying committer for some dev-cmds 2021-04-01 22:22:31 +05:30
Mike McQuaid
4f57adf42f
github_packages: fix org.opencontainers.image.created. 2021-04-01 17:37:16 +01:00
Mike McQuaid
d8a2cf9efc
Write tabs to bottle JSON, optionally not bottle
- Write a subset of the tab required for bottles as an annotation.
- Add option on new bottle creation to skip writing tab into bottle
  and instead add it (and other useful metadata) to bottle JSON.
- Read formula information and tab from bottle JSON.
- Write prettier JSON to disk.
- Don't write `HEAD` to tab; this duplicates `HOMEBREW_VERSION`.
- Allow `brew bottle` to use `--json` to generate JSON files from a
  local bottle file.
2021-03-31 09:43:37 +01:00
Bo Anderson
e49a338896
Implement caching for dependency expansion 2021-03-20 16:56:00 +00:00
nandahkrishna
8e5451df2f
style: use parentheses for assignment in conditions 2021-02-12 18:33:37 +05:30
Rylan Polster
727ac9b47f
bottle: write bottles with new syntax 2021-02-03 20:46:20 -05:00
Mike McQuaid
4afebd2872
Fixup brew bottle (and tests) for #10447. 2021-01-28 13:19:41 +00:00
Michka Popoff
de2e309d50
cellars: write tag specific cellars
With #10186 now merged, the tag specific cellar information is being read by brew.
This PR (once merged) will start adding the cellar information for each tag instead
of having a single cellar line on the top of the bottle block.

Each new CI build in homebrew-core will slowly start migrating the cellar lines to
the right place. If keep-old is used, the old "all tag" cellar line is removed and
added to each tag.
2021-01-28 13:19:40 +00:00
EricFromCanada
2ed324ebc0 use backticks around suggested input, flags, and binaries 2021-01-26 16:19:47 -05:00
Seeker
8693ca4e4d software_spec: change BottleSpecification#checksums to return array 2021-01-21 22:52:26 -08:00
Rylan Polster
e172f0704e
Merge pull request #10360 from Rylan12/bash-completions-files
completions: complete files where appropriate in bash
2021-01-20 09:19:25 -05:00
Michka Popoff
3eea1434cc bottle: tag specific cellars 2021-01-19 10:14:25 +01:00
Rylan Polster
4ef8c8279f
completions: complete files where appropriate in bash 2021-01-19 01:03:05 -05:00
Rylan Polster
d1f3e39b7b
Update commands to generate usage banner 2021-01-18 21:20:11 -05:00
Dawid Dziurla
cf654da251
dev-cmd: indicate multiple named args in usage banner 2021-01-15 13:04:07 +01:00
Rylan Polster
da811373d3 Add named_args DSL for commands 2021-01-13 17:09:42 -05:00
Seeker
14b4916dda utils/ast: move helper functions from FormulaAST to AST 2021-01-11 20:35:14 -08:00
Seeker
2ebfb4221c utils/ast: add FormulaAST class 2021-01-10 09:25:46 -08:00
Seeker
b9854bd4cf rubocops: add unless_multiple_conditions 2021-01-08 10:33:54 -08:00
Seeker
332778025a utils/ast: add Sorbet method signatures 2021-01-07 13:54:05 -08:00
Seeker
ec841e7b62 bottle: add old_checksums helper function 2021-01-01 15:23:09 -08:00
Seeker
4cbd4f296b bottle: add tests for merge_bottle_spec 2020-12-31 11:29:10 -08:00
Seeker
6f606b4e58 bottle: check actual bottle block contents when --keep-old 2020-12-31 09:52:24 -08:00
Seeker
24636d8bea utils/ast: cleanup
- move `add_bottle_stanza!` from `Utils::Bottles` to `Utils::AST`
- add `replace_bottle_stanza!`
- simplify parameters
2020-12-29 03:40:39 -08:00
Michka Popoff
a704abc6dc bottle --merge: check for all cellars 2020-12-24 12:12:23 +01:00
Seeker
4f2b74a149 bottle: fix --merge test failure 2020-12-24 10:45:20 +01:00
Seeker
1ea8b82a54 bottle: add merge_bottle_spec helper function 2020-12-24 10:45:20 +01:00
Mike McQuaid
0bbf965807
More bottling HOMEBREW_LIBRARY changes
- Refuse to create bottles which have non-relocatable references to
  `HOMEBREW_LIBRARY`. This allows us to make all bottles ignore where
  `HOMEBREW_REPOSITORY` is (even those that aren't `cellar :any`).
  I cannot see any circumstances in which any bottle should link to
  anything within `HOMEBREW_REPOSITORY`.
- Remove audit that becomes unnecessary given the above change.
- Relocate references to `@HOMEBREW_LIBRARY@` but don't actually write
  any references yet. This will allow us to move to using
  `@HOMEBREW_LIBRARY` and remove all relocation of `HOMEBREW_REPOSITORY`
  in a future release (2.7.1, most likely).
2020-12-18 13:50:10 +00:00
Seeker
b8aa67be5b bottle: add bottle stanza by traversing AST 2020-12-10 13:38:57 -08:00
Michka Popoff
d768b6649a bottle: add tests for json merging
- Extract the json reading from the json merging: it makes the code hard to understand.
This helps for the separation of concerns: the jsons are read in one method;
and merged in a second one
- Added a first test to check the merge function

No change in behaviour was done, this change is just there to increase code coverage
and to prepare for #9315
2020-12-07 19:58:49 +01:00
Markus Reiter
6750448d95 Fix some auto-correctable type errors. 2020-11-29 21:23:54 +01:00
Michka Popoff
95bf529ad2 bottle merge: add support for linux cellar
The first attempt to build and pull a formula (hello) for linux in homebrew-core
resulted in a wrong cellar line being added to the formula's bottle block.

How to test/debug this, using the 4 bottles that where built for hello:
brew bottle --merge --debug hello--2.10_1.mojave.bottle.json hello--2.10_1.x86_64_linux.bottle.json hello--2.10_1.big_sur.bottle.json hello--2.10_1.catalina.bottle.json

This command would add create the following bottle block:

  bottle do
    cellar "/home/linuxbrew/.linuxbrew/Cellar"
    sha256 "a0af7dcbb5c83f6f3f7ecd507c2d352c1a018f894d51ad241ce8492fa598010f" => :big_sur
    sha256 "5334dd344986e46b2aa4f0471cac7b0914bd7de7cb890a34415771788d03f2ac" => :catalina
    sha256 "22948764d8f8d7be4870ff92dae64d986eb63a9150b219c20fff87d1a6aa93d6" => :mojave
    sha256 "702dc7f78444d2f4f1c19324be654bcbb8b99dd0e9ce26c3e2fbc3b6464a189f" => :x86_64_linux
  end

After the change in this PR, the result is the following:

  bottle do
    sha256 "a0af7dcbb5c83f6f3f7ecd507c2d352c1a018f894d51ad241ce8492fa598010f" => :big_sur
    sha256 "5334dd344986e46b2aa4f0471cac7b0914bd7de7cb890a34415771788d03f2ac" => :catalina
    sha256 "22948764d8f8d7be4870ff92dae64d986eb63a9150b219c20fff87d1a6aa93d6" => :mojave
    sha256 "702dc7f78444d2f4f1c19324be654bcbb8b99dd0e9ce26c3e2fbc3b6464a189f" => :x86_64_linux
  end

The brew bottle --merge code will pick the most common cellar line between the 4 bottles, by order of priority:
- non-relocatable (fixed cellar path)
- cellar :any
- cellar :any_skip_relocation

In the case of the hello bottle, the 3 mac bottles are "cellar :any_skip_relocation", and the linux bottle
is non-relocatable. So the linux bottle wins and the code correctly determines that the 4 bottles should
be non-relocatable.

In that case, the /home/linuxbrew/.linuxbrew/Cellar path is defined as cellar, and by convention
we do not write that out to the formula file, hence the cellar path check that needs to be modified
in this PR.

This PR also fixes the same situation for mac ARM cellar paths
2020-11-26 15:11:55 +01:00
Markus Reiter
1b732ec7b2 Fix RuboCop offenses. 2020-11-16 02:05:29 +01:00
Rylan Polster
20ee7e8881 add Lint/DuplicateBranch cop exceptions 2020-11-16 02:02:52 +01:00
Markus Reiter
da9289eff0 Add more type signatures. 2020-11-13 12:26:36 +01:00
Mike McQuaid
5afff3f3aa
Handle macOS Homebrew on ARM
- Output `brew doctor` and `brew install` messages noting this configuration is (currently) unsupported and encourage use of Rosetta instead
- Output Rosetta 2 usage in `brew config` on ARM (whether in Rosetta 2 or not)
- Check the architecture of (newly installed) dependencies and ensure they are using the correct architecture.
- Don't allow installing macOS Intel Homebrew in macOS ARM Homebrew default prefix (and vice versa
- Actually write out the architecture of dependencies to the tab rather than generating and throwing them away
- Set and document the expected default prefix for macOS Intel Homebrew, macOS ARM Homebrew (`/opt/homebrew`) and Homebrew on Linux

While we're here:
- Don't say Big Sur is a prerelease version but still make it clear we
  don't support it (yet).
- Don't reference non-existent IRC channel
2020-11-12 17:06:47 +00:00
Seeker
50ce5ef3a4 bottle: fix adding bottle block to formulae with special licenses 2020-11-08 07:23:33 -08:00
Mike McQuaid
4f3c590873
Unify and use Git username/email/GPG handling.
We're using essentially the same logic to setup Git for committing in
multiple places but the way we're doing so is inconsistent. Moved to
using two shared utility methods and use them consistently.
2020-11-02 12:21:18 +00:00
Markus Reiter
24ae318a3d Move type annotations into files. 2020-10-10 14:59:39 +02:00
Dustin Rodrigues
f41dd1834f bottle: new formula license may be a list, not just a string 2020-09-23 21:08:44 -04:00
Mike McQuaid
fb4d08a49a Fix brew style 2020-09-11 10:29:22 +01:00
Dustin Rodrigues
8ab5ea5249 bottle: use File.lutime instead of system call 2020-09-06 19:43:30 -04:00
Mike McQuaid
8b97c27c21 brew style manual fixes 2020-09-01 14:26:45 +01:00
Mike McQuaid
dbe427073d
Merge pull request #8399 from MLH-Fellowship/migrate-to-args-named
args: Migrate usage of args loading methods to args.named
2020-08-25 10:07:27 +01:00
William Ma
fa7bd3bff6 args: Migrate usage of args loading methods to args.named 2020-08-23 09:02:20 -04:00