We don’t really have a better solution than this because of how the auto-updater’s Bash code worked on the version they are updating from. Users will never hit this more than once.
Fixes#5513
This means that any new environment variables or changes to `bin/brew`
or `brew.sh` will be used in the new process. This also allows the
removal of various fallbacks from autoupdates from old versions.
Consolidate the handling of which directories need to exist and which
need to be writable. Additionally, add a fatal check for formula
installations to ensure that any directories that need to be writable
are so before attempting an installation.
Fixes#4626.
- Ensure that `HOMEBREW_TEMP` is only displayed in `brew config` when
it's non-default.
- Attempt to create a missing `HOMEBREW_TEMP` directory rather than
failing to `realpath`. Note this will still fail on permissions errors
which is to be expected.
If people have `HOMEBREW_RUBY_PATH` set then things explode in a rather
confusing fashion. Instead, run `bundle` for them with the arguments
that they'd want.
Also, move `macho` requires into the module itself; it's a pain having
to do everything for Bundler before requiring `pathname` which is a core
Ruby class.
Homebrew's actually ended up using a fair few gems. While we want to
avoid Bundler at runtime (and this PR still does that, in fact uses
Bundler even less at runtime than it did before) writing our own version
to use at build-time seems redundant.
Ensure that `brew update` always runs the LinkedKegs migration if needed
as it may not have been run by `brew update` if it was using `--preinstall` or
a `git pull` etc.
Also, if the old paths still exist: just use them instead.
Finally, always try to unlink/unpin before link/pin.
Fixes https://github.com/Homebrew/homebrew-core/issues/4918.
TMPDIR, TEMP and TMP (when set) are not whitelisted for writing in
sandbox.rb, which could result in sandbox violations when programs
attempt to write to these locations.
Setting TMPDIR, TEMP and TMP to HOMEBREW_TEMP (which defaults to /tmp
when not set) works around the aforementioned problem and also improves
uniformity in the locations of tempfiles created during Homebrew
operations.
Caveat: Non-matching HOMEBREW_TEMP and TMPDIR could lead to undesirable
side effects in certain cases, e.g., emacsclient not being able to find
an existing server (whose socket lives in $TMPDIR/emacs$UID/) when
launched through brew edit.
Move some stuff formerly in `Library/ENV` around:
- Move `Library/ENV/$XCODE_VERSION` to `Library/Homebrew/env/super` as they are
all superenv wrappers and all symlinks to the same version. We never needed
the "separate shims for separate versions" functionality and it just adds
confusion.
- Move `Library/ENV/pkgconfig` to `Library/Homebrew/env/pkgconfig` to get more
things under `Library/Homebrew`
- Move `Library/ENV/scm` to `Library/scm` as these wrappers are not actually
used by or related to superenv (or stdenv) in any way.
Since #292, HOMEBREW_CACHE was moved to a per-user directory. This makes
it unsuitable to store global lock files on multiple users environment.
Therefore, introducing a global lock directory `/Library/Lock.d` to
store lock files from formula lockers as well as `brew update`.
`Library/ENV` like `Library/Homebrew` is part of Homebrew basecode. It
should be able to be accessed during the `brew tests`.
By adding HOMEBREW_ENV_PATH variable, we allow test suit to locate these
codes.
The default HOMEBREW_LIBRARY_PATH should be
/usr/local/Library/Homebrew
not
/usr/local/Library/Homebrew/Homebrew
ClosesHomebrew/homebrew#49384.
Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
Currently HOMEBREW_BREW_FILE is a String, while other of HOMEBREW_*
variables are all Pathname. This commit unifies them all as Pathname,
so it will not cause any confusion.
ClosesHomebrew/homebrew#48872.
Signed-off-by: Xu Cheng <xucheng@me.com>
Not sure why this is happening (beyond the Chef cookbook stupidly
deciding to not call through `bin/brew`) but fail and print a scary
looking error to hope to point people in the right direction.
ClosesHomebrew/homebrew#48261.
Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>