50 Commits

Author SHA1 Message Date
Mike McQuaid
7801878c74
post_install: improvements and fixes.
- warn if running `brew postinstall` explicitly and there's no
  `post_install` defined in the formula
- add a `post_install` alias for `brew postinstall` to make life
  easier for those jumping between `postinstall` and `post_install` in
  e.g. Homebrew development
- refactor `post_install` formula path logic into a new method for
  improved readability
- handle the JSON API `post_install` formula path case
2023-07-28 11:26:09 +01:00
Bo Anderson
8dc2e80a98
Significantly improve install speeds with smarter postinstall detection 2023-06-22 03:06:45 +01:00
Douglas Eichelberger
24cf6076e8 brew style --fix 2023-04-24 20:42:39 -07:00
Rylan Polster
d1f3e39b7b
Update commands to generate usage banner 2021-01-18 21:20:11 -05:00
Dawid Dziurla
332372469f
cmd: indicate multiple named args in usage banner 2021-01-15 13:04:00 +01:00
Rylan Polster
da811373d3 Add named_args DSL for commands 2021-01-13 17:09:42 -05:00
Markus Reiter
5be4c9b5e0 Upgrade typed sigils. 2020-11-25 17:04:19 +01:00
Markus Reiter
7c5d8a5288 Refactor FormulaInstaller. 2020-11-18 09:30:11 +01: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
William Ma
fa7bd3bff6 args: Migrate usage of args loading methods to args.named 2020-08-23 09:02:20 -04:00
Markus Reiter
e9d8f09da1 Pass debug?, quiet? and verbose? to FormulaInstaller. 2020-08-06 16:12:52 +02:00
Markus Reiter
d4c2ffd705 Refactor CLI::Parser. 2020-07-31 15:07:17 +02:00
Markus Reiter
c0d42dd922 Remove --force from global_options. 2020-07-28 10:31:11 +02:00
Markus Reiter
8a1f8ab858 Pass args to FormulaInstaller instead of using global args. 2020-07-25 04:21:21 +02:00
Mike McQuaid
a7fe0ed847
cmd: use more and cleanup new args APIs. 2020-03-05 09:40:15 +00:00
Gautham Goli
959b88266d
ARGV: Replace usages of ARGV.resolved_formulae with Homebrew.args 2020-01-02 13:56:19 +00:00
EricFromCanada
90e830c19e cmd: add raises for invalid input 2019-12-15 00:04:45 -05:00
EricFromCanada
329c6c78be manpages: relocate some sections
Reorder switches as force/quiet/verbose/debug, --installed before --all, and link to SPECIFYING FORMULAE from top of page.
2019-08-20 08:58:20 -04:00
Mike McQuaid
36dbad3922
Add frozen_string_literal to all files. 2019-04-20 13:27:36 +09:00
Mike McQuaid
e40b171127
Rename cli_parser to cli/parser. 2019-04-17 22:16:50 +09:00
Mike McQuaid
6cb7a00f2d
cmd: remove --help headers and tweak docs. 2019-01-30 21:39:28 +00:00
Gautham Goli
f92aac6cd6
postinstall: Use CLI::Parser to parse args 2018-11-11 20:17:33 +05:30
Miha Rekar
ca141caec2
Move post_install from cmd to FormulaInstaller 2018-05-12 14:03:37 +02:00
Mike McQuaid
12c454822a sandbox: stop printing message.
We’re always using the sandbox where possible now so this is just
noise for the vast majority of our users.
2017-08-07 11:16:36 +01:00
Mike McQuaid
f951a22bea Install etc/var files on postinstall.
Also, don't delete them after that. This means that `brew postinstall`
becomes a way to easily reinstall configuration files for any formula
without needing any changes to any bottles or requiring a reinstall.
2017-05-03 09:00:17 +01:00
Mike McQuaid
2b547583a3 postinstall: don't allow writes to prefix itself.
Only the top-level directories inside it. We don't want formulae writing
random junk in e.g. `/usr/local` even in `postinstall`.
2016-12-13 00:13:20 +00:00
Mike McQuaid
58d998e208 postinstall: allow write access to cellars in repository.
If HOMEBREW_CELLAR (or HOMEBREW_PREFIX) are children of
HOMEBREW_REPOSITORY it’s important to deny write to the repository and
enable write to the Cellar/prefix afterwards.
2016-10-11 09:36:20 +01:00
Markus Reiter
0ab750bf24 Use module_function for commands. 2016-10-02 00:24:47 +02:00
Mike McQuaid
536c48e804 sandbox: tweak HOMEBREW_REPOSITORY handling.
If we have a HOMEBREW_REPOSITORY and HOMEBREW_PREFIX mismatch (now the
default) then we can block access to the whole of HOMEBREW_REPOSITORY
rather than just the HOMEBREW_LIBRARY and `.git`.
2016-09-23 08:29:05 +01:00
Mike McQuaid
ebdb879fe4 Add --help to all developer commands.
Also, flag those that we never want to be in a manpage.
2016-09-08 09:05:00 +01:00
Andrew Janke
954445634c separate build and test logs 2016-08-19 01:04:32 -04:00
Mike McQuaid
c6151951d6 cmd/postinstall: use Sandbox.formula? method. 2016-08-15 08:33:59 +01:00
Andrew Janke
acc9a7ca85 brew test, install, update-test: add --keep-tmp option
Also enables sandbox for --interactive and --debug use of install
and test, using automatic retention.

Closes #66.

Signed-off-by: Andrew Janke <andrew@apjanke.net>
2016-04-18 12:23:08 -04:00
Xu Cheng
52de8d9373 postinstall: sanitize ARGV options 2015-10-10 11:19:22 +08:00
Dominyk Tiller
98499d1d29 sandbox: permit /var/tmp & DerivedData
Long term it would be nice to sandbox everything that writes to DerivedData
but it is essentially a cache directory of sorts.

The downside of allowing stuff to write there particularly is that DerivedData
is notoriously bad at getting cleaned up, so if you do a lot of Xcode-using
installations very quickly, you can chew your disk space up.

Closes Homebrew/homebrew#43276.

Signed-off-by: Dominyk Tiller <dominyktiller@gmail.com>
2015-08-25 22:01:24 +01:00
Baptiste Fontaine
8ba0fb9fcf unnecessary calls to .select simplified
These are minor perf optimizations.

Closes Homebrew/homebrew#43028.

Signed-off-by: Baptiste Fontaine <batifon@yahoo.fr>
2015-08-18 00:18:22 +02:00
Xu Cheng
e60dc64828 only run post_install if it's defined
Closes Homebrew/homebrew#42593.

Signed-off-by: Xu Cheng <xucheng@me.com>
2015-08-08 17:50:49 +08:00
Xu Cheng
2ebd1c974b print sandbox message
Closes Homebrew/homebrew#42293.

Signed-off-by: Xu Cheng <xucheng@me.com>
2015-07-31 19:52:36 +08:00
Xu Cheng
8cebb64eec auto disable sandbox for interactive shell
Closes Homebrew/homebrew#38792.

Signed-off-by: Xu Cheng <xucheng@me.com>
2015-07-22 15:12:15 +08:00
Xu Cheng
437a3182b0 postinstall: use ARGV.resolved_formulae 2015-05-27 13:53:41 +08:00
Jack Nagel
2ca8172fe9 Let the test environment inject its own load path 2015-04-29 19:15:11 -04:00
Jack Nagel
16dfe3dd40 Add Formula#logs 2015-04-25 23:14:05 -04:00
Xu Cheng
fbc47d86ad sandbox: add deny_write_homebrew_library method 2015-04-23 12:33:54 +08:00
Xu Cheng
adedbb86f1 sandbox: record log
Closes Homebrew/homebrew#38711.

Signed-off-by: Xu Cheng <xucheng@me.com>
2015-04-17 14:09:24 +08:00
Xu Cheng
d1617e86d0 sandbox postinstall
Closes Homebrew/homebrew#38479.

Signed-off-by: Xu Cheng <xucheng@me.com>
2015-04-15 19:51:54 +08:00
Jack Nagel
cd522b1719 Always respect build options when invoking post_install
Fixes Homebrew/homebrew#36335.
2015-02-07 11:02:35 -05:00
Jack Nagel
83b9043c8e Remove more unused requires 2014-06-19 19:15:35 -05:00
Jack Nagel
10a1952d2c Only "extend self" once on the Homebrew module 2014-06-19 13:10:36 -05:00
Mike McQuaid
626b56f9f6 brew-postinstall: add new command.
Runs post-install jobs in case they failed or need rerun for any reason.
2013-09-01 13:57:40 +01:00