331 Commits

Author SHA1 Message Date
Michael Cho
05d3ce85cd
dev-cmd/bottle: check for prefix when not /usr/local
Fixes incorrectly marking bottles as relocatable, e.g.

425d4ea43d/Formula/p/pkgconf.rb (L34-L36)

This cannot be done for `/usr/local` as it is used outside Homebrew.
Other default prefixes are Homebrew-specific.
2025-02-23 14:28:31 -05:00
Bo Anderson
f727d07d43
dev-cmd/bottle: don't install gnu-tar when not needed 2025-01-31 10:57:47 +01:00
Carlo Cabrera
f26530dd9d
dev-cmd/bottle: improve :all bottle handling
Currently, we silently ignore cases where a formula previously had an
`:all` bottle but now no longer does.

These are most often due to (in order of likelihood):
- bottle reproducibility breakage in `brew`
- new hard-coded `/usr/local` references in text files in a bottle

The former is a bug that should be fixed, while the latter can be fixed
trivally with an `inreplace`.

Let's try to make sure we always do this by making `brew bottle` error
out so that we can catch these instances as they happen rather than
after the fact.

I haven't encountered any cases where a formula previously had an `:all`
bottle but no longer does for reasons other than the two outlined above.

If we do encouter those in the future, we can either:
- update `brew bottle` to skip this check, perhaps with a new flag
- delete the formula's old `:all` bottle before doing `brew bottle` so
  it doesn't error
2024-09-18 19:21:54 +08:00
Michael Cho
a07be232df
dev-cmd/bottle: use iso8601 for compliance with spec 2024-09-02 10:26:37 -04:00
Michael Cho
253db8def2
dev-cmd/bottle: include installed_size in metadata 2024-08-23 14:24:21 -04:00
Michael Cho
f627c70b71
dev-cmd/bottle: use default tar when bottling gnu-tar 2024-08-23 11:14:34 -04:00
Mike McQuaid
d9853fb412
dev-cmd/bottle: add missing require.
Another one of these.
2024-07-14 15:25:33 -04:00
Mike McQuaid
f39b5c1426
Merge pull request #17554 from Homebrew/cask-install-receipt 2024-07-13 10:55:06 -04:00
Rylan Polster
acd60181c2
Add cask install receipts 2024-07-04 01:47:13 -04:00
Issy Long
3d09094df0
Fewer T.musts 2024-07-02 16:20:39 +01:00
Issy Long
1db0834a91
dev-cmd/bottle: The cellar_parameter_needed? method returns always boolean 2024-07-02 11:21:29 +01:00
Issy Long
b9b065a54e
dev-cmd/bottle: Fix type errors (strings, symbols, either, none) thanks to the tests 2024-07-02 00:03:28 +01:00
Issy Long
3b695c6aa2
dev-cmd/bottle: Bump to Sorbet typed: strict 2024-07-01 23:38:26 +01:00
Mike McQuaid
64b86fe25c
bottle/github_packages: include path_exec_files.
`all_files` is added to the bottle JSON but not actually used by
`GitHubPackages` yet.
2024-06-19 21:49:31 +02:00
Patrick Linnane
8e089b2fd2
Revert "bottle/github_packages: include path_exec_files, all_files." 2024-06-18 09:59:27 -07:00
Mike McQuaid
6b8b4d3f26
bottle/github_packages: include path_exec_files, all_files. 2024-06-16 09:35:33 +02:00
Patrick Linnane
2a053b7bc8
Revert "bottle/github_packages: include path_exec_files, all_files." 2024-06-15 12:54:59 -07:00
Mike McQuaid
895cd02071
bottle/github_packages: include path_exec_files, all_files.
This provides an extra field to the GitHub Packages manifest about the
executable files in `bin` or `sbin` directories of the bottle.

It also provides an extra GitHub Packages JSON file with the list of all
files.

This would allow us (post a large rebottling effort) to start providing
this information in the Homebrew JSON API.

It also provides a much nicer information source for e.g.
homebrew-command-not-found that doesn't involve downloading actual
bottles.

Co-authored-by: Carlo Cabrera <30379873+carlocab@users.noreply.github.com>
2024-06-15 18:40:07 +01:00
Mike McQuaid
7461bf81a1
SBOM: more fixes.
- Remove use of (unused) `Cachable` module.
- Pass whether we're bottling to determine whether to create
  reproducible SBOM or not. A reproducible SBOM omits the time and
  compiler.
- Remove bottle information when bottling: we cannot know what e.g.
  the checksum (and, with GitHub Packages, therefore also the download
  location) will be before we've created the tarball contents.
- Always write a bottle on installation (unless we're bottling) to
  provide new bottle information or freshen the existing one with the
  information we stripped out for reproducibility e.g. the time and
  compiler.
- Don't need to handle a `nil` `@source_modified_time` as it's always
  set.

Fixes #17281
2024-05-13 07:36:51 +01:00
Mike McQuaid
442aa91704
SBOM improvements
- write a schema when installing formulae (if not already present)
- cache the schema on disk rather than downloading it every time
- make more methods/attributes `private`
- allow validation to be optional, only enable for Homebrew developers
  at installation time
- use the tab for more, correct information
- ensure that dependencies/bottles are written correctly
- use new SBOM 3 schema URL
- improve test coverage
2024-05-09 13:10:37 +01:00
Sean Molenaar
a43b7464c2 feat: add generated SPDX file on bottling 2024-05-07 20:33:22 +02:00
Markus Reiter
0b56d0be4a
Document Tab.for_keg and use Keg#tab where possible. 2024-04-28 20:50:13 +02:00
Douglas Eichelberger
65f8420232 Make things private 2024-03-30 16:43:11 -07:00
Douglas Eichelberger
c50fb2dbd2 Remove redundant cli/parser requires 2024-03-29 18:53:07 -07:00
Douglas Eichelberger
dc062bea52 Port Homebrew::DevCmd::PrPull 2024-03-22 09:33:28 -07:00
Douglas Eichelberger
6b19bc5535 Style cleanup 2024-03-20 10:36:19 -07:00
Douglas Eichelberger
ee0c967ce0 Port Homebrew::DevCmd::Bottle 2024-03-20 10:16:17 -07:00
Mike McQuaid
ea2892f8ee
brew.rb: handle missing args. 2024-03-07 16:20:20 +00:00
Issy Long
f4218a6316
Fix RuboCop Performance/MapCompact offenses
- Rename an iterator variable since it would make the line too long.
2024-02-25 22:59:59 +00:00
Eric Knibbe
e63b1f4da5
docs: monospace suggested values 2024-02-04 15:42:26 +01:00
Douglas Eichelberger
0cdd4eee3b Add Hash#deep_merge to extend/ 2024-01-19 13:36:16 -08:00
Bo Anderson
5aebde3ffd Add consistent path validation 2024-01-01 18:37:47 +00:00
Douglas Eichelberger
caf8259ae6 Code review changes 2023-12-27 15:29:33 -08:00
Douglas Eichelberger
3abbf4447e Some minor regexp match perf improvements 2023-12-27 13:16:36 -08:00
Issy Long
149b0e4f31
Fix new Style/MutableConstant RuboCop offenses for Ruby 3.1
- A follow-up to de592af20bbff5bcb548d2474f0722e59ff1129a, resetting the previous disabled comments too.
2023-12-16 11:57:06 +00:00
Bo Anderson
5692c8ecbf
Fix style violations under newer RuboCop 2023-12-14 05:47:12 +00:00
Bo Anderson
3b1c171184
Further split up Gemfile into groups 2023-09-27 17:33:44 +01:00
Mike McQuaid
e7dc14c015
dev-cmd/bottle: install gnu-tar before keg lock.
This allows the correct bottling of `gnu-tar` dependencies (and
`gnu-tar` itself). It also installs `gnu-tar` at a more appropriate
time in the `brew bottle` command.
2023-08-18 11:03:22 +01:00
Mike McQuaid
71888db8ba
bottle: reproducibility fixes.
I noticed from
https://github.com/Homebrew/homebrew-core/actions/runs/5751070010 that
we're no longer creating reproducible bottles between macOS and Linux.

All macOS checksums have changed but Linux ones have not. The main
difference between the two platforms is the `gtar` version used so let's
always just use the formula on both platforms.

While we're here, clear up the ordering and comments a little on the
reproducible `tar` arguments so that it's easier to compare with the
reproducible builds archives documentation.
2023-08-04 10:02:44 +01:00
Bo Anderson
bb7aef85db
Migrate remaining no-api commands to new scoped system 2023-06-22 17:11:20 +01:00
Douglas Eichelberger
24cf6076e8 brew style --fix 2023-04-24 20:42:39 -07:00
Ruiyang Wu
73a1380055 dev-cmd/bottle: Refactor setup_tar_and_args! to extend/os 2023-04-11 11:00:47 -04:00
Ruiyang Wu
d7427ab762 Don't save mac metadata/extended attributes for brew bottle
This commit includes `--no-mac-metadata` `--no-acls` and `--no-xattrs`
in `default_tar_args` for `brew bottle` command.

Although `default_tar_args` is only active when `--only-json-tab` is
not passed, in which case we don't require reproducible bottles, it is
nonetheless beneficial to "regularize" tarball creation. In
particular, this resolves a sporadic `brew tests
--only=dev-cmd/bottle:20` failure (see
https://github.com/orgs/Homebrew/discussions/4376 and
https://github.com/Homebrew/brew/pull/14997).

Furthermore, with `gnu tar`, `--no-acls` and `--no-xattrs` are default
flags. As for "mac metadata", although I couldn't find official
documentation, this post (https://superuser.com/a/61188) shares some
info:
- Resource forks (resource forks have been extended attributes since 10.4)
  - Custom icons set in Finder and the images of Icon\r files
  - Metadata in PSD files
  - Objects stored in scpt files, AppleScript Editor window state, descriptions of scripts
- Information about aliases (aliases stop working if extended attributes are removed)
- Quarantine status or source URLs of files downloaded from the internet
- Spotlight comments
- Encoding of files saved with TextEdit
- Caret position of files opened with TextMate
- Skim notes

None of these is supposed to be in the bottle I believe.
2023-04-11 11:00:47 -04:00
Douglas Eichelberger
4d32699f61 Placate rubocop 2023-03-14 23:01:09 -07:00
Douglas Eichelberger
f4c9a96c70 Enable types in dev-cmd 2023-03-14 08:32:03 -07:00
Issy Long
e9d994622e
rubocop: Drop "f" from Naming/MethodParameterName allowlist
- This either stands for "file" but more often than not "formula".
2023-03-11 00:17:27 +00:00
Issy Long
298bb65dfb
rubocop: Entirely disable Metrics cops
- These are arbitrary length limits that had a load of disables in code.
- The limits were only increasing over time rather than decreasing.
- Fixing the problematic code to be shorter would take a long time for
  questionable gain since the problem has been around so long.
2023-02-21 00:34:17 +00:00
Issy Long
f8654bd363
rubocop: In-line disables of Metrics/{Module,Block,Class}Length
- We're not going to make the really long things be any shorter any time soon.
- The instructions in issue 14685 say, pragmatically, "disable all the rubocop
  rules we're never going to realistically fix e.g. Metrics/ClassLength". But
  that felt like a slippery slope to more _really_ long modules/classes/blocks,
  and the limits are here for a reason.
2023-02-19 16:33:23 +00:00
Mike McQuaid
30b2a546e5
Revert "move dev-cmd/bottle methods to extend/os" 2023-02-10 17:01:22 +00:00
hyuraku
ddf4d6af79 repair style 2023-02-07 23:53:09 +09:00