433 Commits

Author SHA1 Message Date
Mike McQuaid
b3f0e571f4
Merge pull request #3090 from jcs/no_color
Tty: if NO_COLOR env var is present, disable color
2018-02-12 20:50:34 +00:00
joshua stein
7388acb86e Tty: if HOMEBREW_NO_COLOR env var is present, disable color
bin/brew will recognize NO_COLOR variable and copy it to
HOMEBREW_NO_COLOR
2018-02-12 14:19:25 -06:00
Mike McQuaid
a30c74987a brew, diagnostic: tweak CI variable checks.
I've adjusted test-bot in:
603918939a
to set CI=1 for Jenkins to make future JENKINS_HOME checks unnecessary.

The only `TRAVIS_*` variable we care about is `TRAVIS_SUDO` so whitelist
that specifically rather than passing through loads of others.
2018-02-12 16:41:21 +00:00
xiehuc
3e6adb7e33 update all_proxy and man pages #3751 2018-02-01 18:11:29 +08:00
xiehuc
a214387358 add ALL_PROXY for brew
Signed-off-by: xiehuc <xiehuc@gmail.com>
2018-01-30 15:36:35 +08:00
Ivars Berzinsh
25f65c1a13 Added no_proxy to filtered env 2017-12-18 08:53:15 +02:00
Mike McQuaid
e13a93dd75 Default environment filtering to on for all users. 2017-12-05 14:07:28 +00:00
David Christenson
489eae91ba
Include SSH_AUTH_SOCK in filtered environment
Include SSH_AUTH_SOCK (if set) in the filtered environment to avoid SSH
issues with git.
2017-11-29 15:30:57 -07:00
Mike McQuaid
959f54d3ce
bin/brew: add lowercase variants. 2017-11-29 12:06:22 +00:00
Mike McQuaid
4bd184b706
Merge branch 'master' into master 2017-11-29 11:39:04 +00:00
Bruno R. Barreyra
230a333950 Adding proxy variables to FILTERED_ENV
Fixes #3500
2017-11-29 11:29:10 +01:00
Markus Reiter
9d98f1a8ab Whitelist SUDO_ASKPASS environment variable. 2017-11-29 00:36:16 +01:00
Markus Reiter
f7066bae27 Fix Utils::Shell.parent. 2017-11-28 21:05:51 +01:00
Mike McQuaid
63408a10ff bin/brew: whitelist http_proxy.
Fixes #3494.
2017-11-28 14:52:08 +00:00
Mike McQuaid
f7baa3b380 bin/brew: whitelist JENKINS_* vars. 2017-11-27 16:32:03 +00:00
Mike McQuaid
cd7049bb72 bin/brew: don't set empty, unfiltered variables.
Otherwise we unconditionally set e.g. `CI`, `TRAVIS`.
2017-11-27 14:43:24 +00:00
Mike McQuaid
f262cbc531
Merge pull request #3487 from MikeMcQuaid/dev-env-filtering
Enable environment filtering for developers.
2017-11-27 11:20:42 +00:00
Mike McQuaid
fb6cf0c3f8 More environment filtering fixes
- Make `brew pull` pass through Git environment variables
- Whitelist all `TRAVIS_` variables.
2017-11-27 10:48:03 +00:00
Mike McQuaid
b26a0d4a91 Enable environment filtering for developers.
If folks have set `HOMEBREW_DEVELOPER` or run a `dev-cmd` then enable
environment filtering by default for them.
2017-11-27 10:15:26 +00:00
Mike McQuaid
3625c69625 bin/brew: tweak CI whitelisting. 2017-11-18 09:10:25 +00:00
Mike McQuaid
166a75b9d6 bin/brew: passthrough CI var. 2017-11-18 09:08:38 +00:00
Mike McQuaid
c86299188f bin/brew: no environment filtering on test-bot.
test-bot sets environment filtering itself.
2017-11-17 14:43:05 +00:00
Mike McQuaid
5241d07474 environment filtering: pass through TRAVIS vars.
We use these internally so let's map them to `HOMEBREW_` variables.
2017-11-13 10:01:54 +00:00
Mike McQuaid
3f8f2c6726 bump-formula-pr: use GitHub vars under env filter.
Ensure that the various variables are passed through and reset
correctly. If we end up doing this in a bunch of places we may add some
helpers to simplify this.
2017-11-07 07:54:34 +00:00
Mike McQuaid
9c85d737ad bin/brew: don't set blank HOMEBREW_* variables.
When creating the necessary HOMEBREW_* variables ensure that they aren't
set if their value would be empty.
2017-05-14 20:05:26 +01:00
Mike McQuaid
8205e61e64 More environment filtering tweaks
- only document HOMEBREW_* variables in the manpage (although still
  read from all the original environment variables).
- resort manpage environment variables in alphabetical order
- check the original path for trailing slashes
2017-05-13 11:42:01 +01:00
Mike McQuaid
adab59cd7a brew: set Bintray variables.
These are set as `HOMEBREW_BINTRAY_*` and then used by the rest of
`brew` as normal.
2017-04-23 21:04:15 +01:00
Mike McQuaid
45a7730f61 Fix and remove various TODOs.
Fix those that can be done so without tearing Homebrew to pieces and
remove the comments for those that can never be done.
2017-04-23 15:10:18 +01:00
Mike McQuaid
69c7a20896 Fix brew edit with environment filtering.
For many people `brew edit` makes use of the `EDITOR` variable to pick a
sensible editor. With environment filtering enabled unless this editor
is found in the default system PATH it'll fall back to e.g. `vim`.

Instead, ensure that we export the original, pre-filtering `PATH` as
`HOMEBREW_PATH` and use that internally to locate the editor. In future
this same approach will likely be used for requirements to be able to
find tools, too, and for other variables which we want to expose to
Homebrew itself but not other build tools.

Note that `HOMEBREW_PATH` is the same as `PATH` when build filtering
hasn't been enabled.
2017-04-21 18:26:12 +01:00
Mike McQuaid
d3ae1cc264 bin/brew: tweak variable names. 2017-02-26 20:42:24 +00:00
Doug Hazell
6f5913ccdd Tidy up the latest draft 2017-02-23 15:36:26 +00:00
Doug Hazell
9395ec4d30 Update based on comments (without a mutex...) 2017-02-23 15:32:44 +00:00
Doug Hazell
ac4c9d1324 Update from comments 2017-02-23 15:21:46 +00:00
Doug Hazell
5d1576784a Mechanism to dynamically add HOMEBREW.* vars to 'env -i' command string in 'bin/brew' 2017-02-19 02:12:46 +00:00
Doug Hazell
0bb0228962 Presumably the "env -I" was a typo for "env -i"
Just sourcing brew.sh causes the "Example usage" msg due to lacking command args but changing the last line of your suggestion to:
  /bin/bash "$HOMEBREW_LIBRARY/Homebrew/brew.sh" "$@"
worked.

If all of the 'HOMEBREW.*' vars, that other parts of the system require, are only added in brew.sh then your suggestion is cleaner.
2017-02-12 14:31:37 +00:00
Doug Hazell
90b3f9b19a fixup 2017-01-16 21:47:58 +00:00
Doug Hazell
eca3f117ba Update with comments in the code 2017-01-16 21:25:25 +00:00
Mike McQuaid
d0ff64666a bin/brew: improve /usr/local/bin/brew handling.
If `/usr/local` is the prefix but not the repository (so bottles can be
used) then running `/usr/local/bin/brew` works great but
`$HOMEBREW_REPOSITORY/bin/brew` assumes the prefix is
`$HOMEBREW_REPOSITORY`. This is a pain when doing work on the Homebrew
repository and having e.g. `bin` in your `$PATH`. Improve this
behaviour so `bin/brew` knows how to handle this situation.
2016-08-24 10:56:28 +01:00
Mike McQuaid
2f9bf5f047 bin/brew: split up brew file symlink check.
This will enable this code to be reused in a future commit and makes it
more obvious what’s being done.
2016-08-24 10:56:28 +01:00
Mike McQuaid
db4ce3d6b7 bin/brew: refactor HOMEBREW_PREFIX="/" logic.
The previous approach of trying to do it on one line was confusing.
2016-08-24 10:56:28 +01:00
Mike McQuaid
a07ab8bb92 brew.{rb,sh}: move to Library/Homebrew. (#506) 2016-07-15 19:33:30 +01:00
Martin Afanasjew
3c5f007bfa bin/brew: fix corner cases in prefix computation
If `bin/brew` happens to be symlinked to `/brew`, `/bin/brew`, or some
similar location or (worse yet) Homebrew is installed to `/`, then
computation of the prefix and/or repository path could break down and
result in an invalid or empty path.

Closes Homebrew/homebrew-core#2430.
2016-06-29 16:20:47 +02:00
Martin Afanasjew
359b67c6c8 bin/brew: rename 'chdir' to 'quiet_cd'
This is inspired by `quiet_system` with basically the same implication
(suppress output), making the name a lot less confusing and avoiding a
clash with the `chdir` function defined in `Library/brew.sh`.
2016-06-29 13:38:50 +02:00
Mike McQuaid
61e9d43ead bin/brew: unset POSIX mode.
We're using /bin/bash and not /bin/sh for a reason so don't allow users
to override this (seen in Homebrew/homebrew#49514).

Closes Homebrew/homebrew#49515.
2016-02-25 11:33:04 +00:00
David Caldwell
bff90a7233 brew: Make HOMEBREW_REPOSITORY different from prefix only when 'brew' is a symlink
Closes Homebrew/homebrew#49261.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2016-02-18 09:32:46 +00:00
David Caldwell
94034a6915 brew: Make HOMEBREW_LIBRARY based off of HOMEBREW_REPOSITORY
This makes the logic match the Ruby code from before it was moved here
(see 390e327f55126f7ee9519bc6c03a0c0aa14f7168)
2016-02-18 09:32:46 +00:00
David Caldwell
9e32aede10 brew: Don't re-canonicalize
HOMEBREW_BREW_FILE and BREW_FILE_DIRECTORY are already canonicalized.
2016-02-18 09:32:46 +00:00
Mike McQuaid
691e4aec11 bin/brew: move logic to Library.
`bin/brew` is getting a bit bloated and it's annoying to open all of
`HOMEBREW_PREFIX` in your editor of choice and have it search through
the `Cellar`. Let's instead keep the bare minimum in `bin/brew` and
move the rest to `Library`.

Closes Homebrew/homebrew#49185.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2016-02-16 09:31:58 +00:00
Mike McQuaid
578e68b2c1 brew: remove ln from sudo command check list. 2016-02-15 11:39:41 +00:00
Mike McQuaid
f6cbf7bab0 Move internal command aliases from Ruby to Bash.
This means that internal command aliases can be used for Bash commands
(such as the new, Bash-based `brew update`).

Fixes Homebrew/homebrew#49182.

Closes Homebrew/homebrew#49184.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2016-02-15 11:35:25 +00:00