There are plenty of IO operations inside Tap object, and it will be more
when implementing formula alias reverse look up(e.g. list all of alias
names for a formula). So let's cache them.
Some benchmark:
$ time brew info $(brew ruby -e 'puts Formula.tap_names') > /dev/null
Before: 6.40s user 2.42s system 96% cpu 9.134 total
After: 4.75s user 0.77s system 97% cpu 5.637 total
ClosesHomebrew/homebrew#44377.
Signed-off-by: Xu Cheng <xucheng@me.com>
The default is almost never useful. 15 seems like a good medium as it'll
not fill a 80x24 default but provides a bit more context. Also allow it
to be overriden for developers and `test-bot`.
Sometimes we accidentally install files outside prefix. After we fix that,
users will get nasty link conflict error. So we create a whitelist here to
allow overwriting certain files. e.g.
link_overwrite "bin/foo", "lib/bar"
link_overwrite "share/man/man1/baz-*"
During FormulaInstaller#link, the whitelist conflict files will be
backup into HOMEBREW_CACHE/Backup
add guard in Formula#file_modified? to prevent git popup
add guard in Superenv.bin before calling MacOS::Xcode.version
add guard against missing Xcode/CLT in Xcode.uncached_version
return nil instread of 0 in uncached_version when Xcode/CLT are not present, to distinguish from linuxbrew behavior
checks against pour_bottle? and needs_relocation?, add guard around keg.relocate_install_names to check pour_bottle?/needs_relocation? as well
needs_relocation? becomes skip_relocation?, use cellar attr to indicate relocation instead of does_not_need_relocation
MacOS.can_build? becomes MacOS.has_apple_developer_tools?
Before
```
$ time brew readall
brew readall 10.63s user 0.36s system 99% cpu 11.003 total
```
After
```
$ time brew readall
brew readall 5.62s user 0.24s system 99% cpu 5.859 total
```
ClosesHomebrew/homebrew#42302.
Signed-off-by: Xu Cheng <xucheng@me.com>
One minor consequence of our seizing of the HOME variable during builds for
sandboxing purposes is that if you're doing an interactive or git installation
zsh flags up that it hasn't found any config files and throws you into the
`zsh-newuser-install` area.
Not really a problem, just a nuisance.
Since the check is just for existence rather than content, we can work around
this by creating an empty config file when the `SHELL` environmental variable
includes zsh.