9434 Commits

Author SHA1 Message Date
Xu Cheng
f57739deda travis: remove dead code 2016-04-12 18:42:25 +08:00
Mike McQuaid
891dcc7c27 update: use official GitHub SHA API. (#75)
This is coming out of preview shortly so use the new API content-type.
2016-04-12 11:12:23 +01:00
Mike McQuaid
0c85113053 Homebrew (opt-in) Analytics tweaks. (#57)
- add `HOMEBREW_PRODUCT` global variable
- only differentiate between `/usr/local` and `non-/usr/local` Homebrew
  prefixes to avoid sharing sensitive user information
- note if e.g. build errors are occurring under CI
- Add `HOMEBREW_NO_ANALYTICS` variable (this will be how people opt-out
  when this is enabled for everyone)
- Add `HOMEBREW_ANALYTICS_DEBUG` variable to output all the analytics
  that are sent
- Move Bash analytics code to `Library/Homebrew/utils/analytics.sh`
- Add documentation for our analytics and why/what/when/how and opt-out
- Only official Homebrew commands are reported
- Ruby analytics are now reported in a forked, background process
2016-04-12 11:02:22 +01:00
Mike McQuaid
279df8ec81 .travis.yml: only build on latest OS X. (#74)
We have Jenkins to test the other versions.
2016-04-12 11:02:15 +01:00
Mike McQuaid
1d5458843e Cache Tap#private? checks.
Use both an in-class and a `.git/config` cache for this so we can ensure
that the `Tap#private?` check is fast. Also, make sure this cache value
is set both when initially installing and updating a tap.

Thanks to @xu-cheng for most of the implementation here.
2016-04-12 11:00:23 +01:00
Xu Cheng
c1427fd295 help: support highlighted output
Closes #68.

Signed-off-by: Xu Cheng <xucheng@me.com>
2016-04-12 17:57:18 +08:00
Xu Cheng
af1eb007e2 help: handle alias
Before this fix
```
$ brew --help ls
Error: Unknown command: ls
```

After this fix
```
$ brew --help ls
brew list, ls
<snip>
```
2016-04-12 14:29:49 +08:00
Andrew Janke
496fff643f doco: more updates for core/formula separation
Closes #71.

Signed-off-by: Andrew Janke <andrew@apjanke.net>
2016-04-11 19:29:42 -04:00
Mike McQuaid
4a7cd160c3 Auto-update when running brew install/upgrade.
Also, slightly tweak the behavior of `brew update` in this case so that
it doesn't print annoying output and still allows the `brew edit` flow
for people with `HOMEBREW_DEVELOPER` set.
2016-04-11 09:31:50 +01:00
Martin Afanasjew
0382134cf8 brew.rb: adjust behavior for undocumented commands
Don't exit with a non-zero status code just because an internal command
happens to be undocumented. Also print the generic help in these cases
to provide some help (including a reference to the man page).
2016-04-10 22:59:25 +02:00
Max Nordlund
10edfcd218 Fix documentation error
Closes #10.

Signed-off-by: Martin Afanasjew <martin@afanasjew.de>
2016-04-10 22:59:25 +02:00
Max Nordlund
c8a2cd4e10 Generate the new man page 2016-04-10 22:59:25 +02:00
Max Nordlund
fa1fd70a37 Add all the top level comments 2016-04-10 22:59:25 +02:00
Max Nordlund
b21f699ff2 Implement the brew help command
This is also used by `brew <cmd> --help`. The basic idea is to have the
documentation as a top level comment in each command file. To find these
comments, they have to be like this `#:`.

This is also used by the `brew man` command to keep the documentation
DRY, and for that there are now a header and footer for the man page.
2016-04-10 22:59:24 +02:00
Dominyk Tiller
32ae71b256 xcode: expect 7.3 on 10.11
xcode: expect 7.3 on 10.11
2016-04-10 20:00:11 +01:00
Tim D. Smith
116075dda9 Remove advice on bad Python linking
This is pathological and something that should be fixed in core, not by
working around it.

Closes https://github.com/Homebrew/legacy-homebrew/pull/45704.
2016-04-09 18:21:05 -07:00
Martin Afanasjew
883751d666 diagnostic: fix style of previously skipped method
Fix style of previously omitted `check_for_bad_install_name_tool`
method to be in line with changes made in #49.

Closes #56.

Signed-off-by: Martin Afanasjew <martin@afanasjew.de>
2016-04-09 16:12:17 +02:00
Martin Afanasjew
eb137dc924 Revert "diagnostic: improve check for 'install_name_tool'"
This reverts commit 9f79c05656a44f926898774c6029025002bcd621.

Restore check to continue to inspect `/usr/bin/install_name_tool`. See
Homebrew/legacy-homebrew#50091 and Homebrew/legacy-homebrew#50509 for
the full context and more details.
2016-04-09 16:12:17 +02:00
Martin Afanasjew
1d9977b7c1 diagnostic: prefer guard clauses for readability
Guard clauses instead of if/unless blocks make the checks easier to
understand and reduce nesting, thus improving overall readability.

This includes the following additional minor changes:

- Make indentation of commands consistent inside diagnostic messages.
- Fix minor typos and inconsistent punctuation in diagnostic messages.
- Fix here documents to always start with `<<-EOS.undent` on a new line,
  followed by the message (indented once), followed by `EOS` (at the
  same level like `<<-EOS.undent`).
- Always separate the check logic (and guard clauses) from the following
  message by a single empty line (for consistency and readability).
- Standardize on `message` as the variable name when diagnostic messages
  need to be constructed from multiple parts.
- Where easily possible, adapt check logic to stay within 80-column
  limit, use more expressive variable names, and break down long
  expressions into multiple statements with intermediate results.

Closes #49.

Signed-off-by: Martin Afanasjew <martin@afanasjew.de>
2016-04-08 17:57:30 +02:00
Martin Afanasjew
6a82bc49c7 brew.sh: make sure to always use system 'awk'
This should prevent issues like #47 and make us more resilient.
2016-04-08 16:32:05 +02:00
Martin Afanasjew
d7aa0c0335 scm/git: prevent exec bomb with 'env :userpaths'
Using `git` from `Formula#install` can cause an exec bomb if used in a
formula with `env :userpaths` because that causes both `Library/ENV/4.3`
and `Library/ENV/scm` to be in PATH, both of which contain a `git`
binary that is the same SCM wrapper. Those will mutually exec each other
indefinitely as they fail to detect that they are the same wrapper.

Extend the exec-bomb protection to check the paths after all symbolic
links have been expanded to prevent this situation.

Fixes #43.
Fixes Homebrew/homebrew-core#133.
Fixed Homebrew/homebrew-core#143.

Closes #46.

Signed-off-by: Martin Afanasjew <martin@afanasjew.de>
2016-04-08 00:04:15 +02:00
Xu Cheng
d5085edce0 curl: fall back to /usr/bin/curl when HOMEBREW_CURL doesn't exist
This can happen when `HOMEBREW_CURL` is set to brewed curl, but during

`brew resinstall curl`, brewed curl's symlink is temporary

unlinked.



So let's fallback to /usr/bin/curl in this case.
2016-04-07 14:57:37 +08:00
Martin Afanasjew
f3cc0596a6 brew.sh: tweak HOMEBREW_PROCESSOR on Linux
`uname -p` seems to be less useful on Linux (Debian 8 yields `unknown`),
thus prefer `uname -m` on those systems to determine the processor type.

Closes #35.

Signed-off-by: Martin Afanasjew <martin@afanasjew.de>
2016-04-07 08:25:41 +02:00
Martin Afanasjew
2ca97490af brew.sh: fix HOMEBREW_OS_VERSION on Linux et al.
On Linux (and other non-OS X platforms), `HOMEBREW_OS_VERSION` was
*always* replaced with the product name, leading to less useful user
agent. E.g., on a reasonably up-to-date Debian system:
  Linuxbrew/0.9.9 (Linux; unknown Linuxbrew)

With this fix the user agent is instead (first if `lsb_release` is
available and outputs something, second otherwise):
  Linuxbrew/0.9.9 (Linux; unknown Debian GNU/Linux 8.3 (jessie))
  Linuxbrew/0.9.9 (Linux; unknown 3.16.0-4-amd64)
2016-04-07 08:25:41 +02:00
Martin Afanasjew
d83cd56603 brew.sh: avoid unnecessary 'cat'
Bash can read directly from a file in its command substitution.
2016-04-07 08:25:41 +02:00
Martin Afanasjew
b2fe2945d3 brew.sh: simplify HOMEBREW_OSX_VERSION_NUMERIC
Use `printf -v` and strip out the unnecessary `echo`, thus avoiding two
unnecessary command substitutions.
2016-04-07 08:25:41 +02:00
Martin Afanasjew
3a99d8093c brew.sh: streamline setting HOMEBREW_{OSX,LINUX}
For uses like this one, `case` is much more compact and easier to read.
2016-04-07 08:25:41 +02:00
Martin Afanasjew
8ab2fb6868 analytics: avoid unnecessary string interpolation 2016-04-07 08:25:41 +02:00
Martin Afanasjew
e747648c53 always prefer HOMEBREW_CURL over plain 'curl' 2016-04-07 08:25:41 +02:00
Misty De Meo
f016a21470 superenv: comment sources of ignored paths
Closes #32.

Signed-off-by: Misty De Meo <mistydemeo@github.com>
2016-04-06 16:16:14 -07:00
Misty De Meo
ef4cad0c77 superenv: don't filter out all /opt paths
This was intended to filter out MacPorts and X11 paths, but the user
may have valid reasons to have other things here that might get linked
against.
2016-04-06 16:16:14 -07:00
Andrew Janke
1f8b6cb576 test-bot: add safety margin to output truncation size 2016-04-06 16:48:07 -04:00
Dominyk Tiller
bbb1fcd17c test-bot: stop using --recursive for brew uses
We're not sure this is working as it was intended to, and the primary
end product so far has been making every Ruby 1.8.7 build, which is the Ruby
we use on Mavericks for compatibility, take 5-15 minutes longer per build
than 2.x Rubies.

Cumulatively this is responsible for the vast majority of CI slowness over the
last couple months as Mavericks plays catch-up and everything else waits for it
to do so.

We may revisit this in future, but for now the harm is greater than the "risk".

This technically reverts 7b26c585c2.
2016-04-06 17:57:05 +01:00
Martin Afanasjew
7771f3af81 tests: update prune --verbose test
Closes #15.

Signed-off-by: Martin Afanasjew <martin@afanasjew.de>
2016-04-06 10:31:54 +02:00
Martin Afanasjew
f2245adaa7 tests: update linkapps/unlinkapps tests 2016-04-06 10:31:54 +02:00
Martin Afanasjew
ea38a70395 prune: handle broken app symlinks
Remove broken symlinks from `/Applications` and `~/Applications` that
were previously created by `brew linkapps`, but are no longer valid
because formulae were uninstalled or the provided apps have changed.
2016-04-06 10:31:54 +02:00
Martin Afanasjew
b50e950f0e unlinkapps: add --dry-run option
Add `--dry-run` option as is customary for destructive commands. Update
`bash` completion and man page accordingly. Also correct and update
documentation for both `brew linkapps` and `brew unlinkapps` in more
general terms.
2016-04-06 10:31:54 +02:00
Martin Afanasjew
dcf406f1e4 unlinkapps: modernize
Simplify code by using `Pathname` methods as much as possible. Also
avoid calling external commands for basic functionality like unlinking,
reduce code duplication by using a method from `cmd/linkapps.rb`, count
unlinked symlinks with `ObserverPathnameExtension`, and adjust output
for consistency with `brew linkapps`.
2016-04-06 10:31:54 +02:00
Martin Afanasjew
f63180927c linkapps: modernize
Simplify code by using `Pathname` methods as much as possible. Also
avoid calling external commands for basic functionality like symlink
creation, refactor code that can be shared with `brew unlinkapps`, and
print a summary line at the end (if symlinks were created).
2016-04-06 10:31:54 +02:00
Martin Afanasjew
15b42301e5 brew.sh: make analytics 'curl' fully asynchronous
If analytics are enabled and `brew` is used in a command substitution
context, e.g. `brew search` for tab completion, the result is that even
though the Google Analytics `curl` process runs in the background it
still is attached to the captured `stdout`, thus could theoretically
contribute to the result of the command substitution and consequently
makes the command substitution block on the completion of this process.
Redirecting `stdout` (and `stderr` for good measure) to `/dev/null`
makes this process truly asynchronous in these contexts.

Furthermore, even if the process is in the background, it is still
included in the shell's job list and thus shell internals like `wait`
(used in `cmd/update.sh`) have to wait on this process, even if they
never intended to do so. Removing the analytics process from the job
list via `disown` avoids this unintended effect.

Fixes #29.

Closes #34.

Signed-off-by: Martin Afanasjew <martin@afanasjew.de>
2016-04-06 10:28:06 +02:00
Martin Afanasjew
37b817ed39 test-bot: fix access to relocated method
Fix bug introduced in a2c23dfec569c6e73d90cb20c7d4c26cced258d5. Moving
this method apparently made it inaccessible from `Homebrew::Step`.
2016-04-06 06:35:28 +02:00
Martin Afanasjew
a2c23dfec5 test-bot: fix undefined method error
The method `fix_encoding!` is private to `Homebrew::Step` but is also
required by the `Homebrew.sanitize_output_for_xml` method for truncating
overly long logs. Move `fix_encoding!` into the `Homebrew` module to
make it accessible from both this method and the `Homebrew::Step` class.

This amends commit 343091c828d1e572829b86253d79b326c1986bcd.
2016-04-06 06:22:22 +02:00
Dominyk Tiller
a9c0361a1d audit: require plist_options when using plist
Closes #19.

Signed-off-by: Dominyk Tiller <dominyktiller@gmail.com>
2016-04-05 23:57:53 +01:00
Dominyk Tiller
776a73da7c test_cmd_audit: add plist test 2016-04-05 23:57:53 +01:00
Dominyk Tiller
149334d88d audit: check plist placement 2016-04-05 23:57:53 +01:00
Andrew Janke
343091c828 Merge pull request #27 from apjanke/test-bot-xml-filter
test-bot: revise Step output transcoding and XML character filtering
2016-04-05 17:23:24 -04:00
ilovezfs
332c990377 FileUtils::mktemp pass gid to Etc.getgrgid as int
We need to move the Snow Leopard fix down since Etc.getgrgid can't
handle a string.

Closes #31.

Signed-off-by: ilovezfs <ilovezfs@icloud.com>
2016-04-05 12:24:40 -07:00
tim smith
3afacc351c Speed up tab completion
Fixes #20. Closes #23.
2016-04-05 09:48:28 -07:00
ilovezfs
fad235d8e8 tap: support --full even if installed
Makes `tap` re-runnable and unshallows when requested with `--full`.
Tapping with a different URL raises an exception.

The homebrew/core tap cannot be untapped with `untap` so running
`brew tap --full homebrew/core` is now a built-in way to get a full
clone of this tap without resorting to workarounds.

Closes #17.

Signed-off-by: ilovezfs <ilovezfs@icloud.com>
2016-04-05 07:25:27 -07:00
Xu Cheng
1b7e13df4f CoreTap#install: fix clone target setting
When invoking `brew tap homebrew/core`, the input options will be like
`{ :clone_target => nil }`. This renders `Hash#merge` a dead operation.

It doesn't impact Homebrew itself, but could cause problem for
downstream projects Linxubrew/Tigerbrew when they adopt core/formula
separation.
2016-04-05 19:34:47 +08:00