8248 Commits

Author SHA1 Message Date
Martin Afanasjew
5f049637d9 ENV: protect against environment being reset
We cannot really recover from this, but at least we'll provide a clearer
error message than trying to call `exec` with an empty string.
2016-02-05 22:07:07 +01:00
Martin Afanasjew
f9efa18be1 ENV: protect against RUBYLIB/RUBYOPT
Some things can break in hard to debug ways if users or build scripts
set these variables, causing our otherwise quite robust Ruby wrappers
to fail. In theory, we could also use `--disable-rubyopt`, but this is
not supported in Ruby 1.8 (and we still care about it).
2016-02-05 22:07:07 +01:00
Martin Afanasjew
49990ee93f ENV: use HOMEBREW_RUBY_PATH in compiler/SCM shims
Use the same interpreter for the shims that is also used to run the main
Homebrew process (the one invoked via `brew`). The magic basically lies
in executing `ruby` with the `-x` option (supported since at least 1.8)
and in the following shebang line.
2016-02-05 22:07:07 +01:00
Xu Cheng
12a452557d make HOMEBREW_BREW_FILE a Pathname object
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.

Closes Homebrew/homebrew#48872.

Signed-off-by: Xu Cheng <xucheng@me.com>
2016-02-06 02:52:48 +08:00
ilovezfs
ca77025f8b Don't accidentally inherit group "wheel" from /tmp
Because files on OS X are assigned the group of the directory in which
they are created, using /tmp during the installation process would
result in some installed files having the group "wheel" even though
"admin" was intended.

Thanks to Xu Cheng for suggesting a simpler location for the fix.

Closes Homebrew/homebrew#45869

Closes Homebrew/homebrew#48732.

Signed-off-by: Xu Cheng <xucheng@me.com>
2016-02-05 21:52:29 +08:00
ilovezfs
fb9818ae8c HOMEBREW_BREW_FILE was unset for the tests
This fixes a regression introduced by 3f6a355, which caused
HOMEBREW_BREW_FILE to be unset while running the tests.

Patch provided by Xu Cheng.
2016-02-05 21:52:11 +08:00
Dominyk Tiller
58cf0ec2b9 audit: add check for insecure hackage urls 2016-02-04 14:57:55 +00:00
William Woodruff
afe0fde49c os/mac: optionally use ruby_macho.
- and branch for dylib_id_and_dylibs
- add branches for dylib id changing and change_install_name
- rename MachO module to HomebrewMachO to prevent namespace clashes
  with MachO in ruby-macho. this will eventually be replaced entirely
  with direct calls to ruby-macho methods
- break ruby-macho implementation out into separate RubyMachO module,
  and include either RubyMachO or CctoolsMachO (the original
  implementation) based on the HOMEBREW_RUBY_MACHO env var
- move ArchitectureListExtension and RubyMachO into separate files
- create {ruby_,cctools_,,}relocate.rb for isolation of different
  methods of mach-o relocation (ruby-macho vs. cctools)
- fill in require_install_name_tool? for ruby_relocate.rb
- rename {ruby_,cctools_,,}relocate.rb to keg, isolate requires in
  os/mac

Closes Homebrew/homebrew#45001.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2016-02-03 21:25:40 +00:00
William Woodruff
1cb6a2ad18 vendor: vendor ruby_macho library. 2016-02-03 21:25:20 +00:00
William Woodruff
35e2209c10 architecture_list: add new module.
remove old mach.rb, replace with cctools_mach.rb and prune ELF case
move ArchitectureListExtension to separate file ELF support is
maintained in Linuxbrew
2016-02-03 21:24:21 +00:00
ilovezfs
37e423ebb2 os/mac/hardware: add Skylake CPU.
Closes Homebrew/homebrew#48781.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2016-02-03 21:10:01 +00:00
ilovezfs
051cd36046 test_integration_cmds: fix warning.
Closes Homebrew/homebrew#48772.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2016-02-03 21:09:12 +00:00
Baptiste Fontaine
bdf0e0ef4d tests: remove the problematic test-bot test
It makes Travis checks fail on the master.
2016-02-03 18:11:29 +01:00
Baptiste Fontaine
299419a881 tests: more integration tests
Closes Homebrew/homebrew#48785.

Signed-off-by: Baptiste Fontaine <batifon@yahoo.fr>
2016-02-03 16:28:28 +01:00
Baptiste Fontaine
6cccc2d0fe tests: remove unnecessary code 2016-02-03 16:28:28 +01:00
Baptiste Fontaine
abf75cd08f tests: add audit regression test for Homebrew/homebrew#48744
Closes Homebrew/homebrew#48748.

Signed-off-by: Baptiste Fontaine <batifon@yahoo.fr>
2016-02-03 14:04:31 +01:00
Baptiste Fontaine
cdd990f9d7 audit: use start_with? to check the name in the desc 2016-02-03 14:04:31 +01:00
Martin Afanasjew
5b89c33cac pull: fix ambiguity issues for tap migrations
`Formula[name]` gets called with an unqualified name and thus will throw
`TapFormulaAmbiguityError` exceptions (silently ignored) if both the old
and the new tap are present and changes for the new tap are pulled
before the migrated formulae are removed from the old tap.

The result is an empty or incomplete `changed_formulae`, causing issues
with pulling the corresponding bottles and possibly other problems, too.
2016-02-03 00:36:48 +01:00
Dominyk Tiller
18668ce24e official_taps: add gui 2016-02-02 18:08:13 +00:00
ilovezfs
cc3d041c26 DSL method "apply" to specify patch files
The "apply" DSL method can be called from patch-do blocks to specify
the paths within an archive of the desired patch files, which will be
applied in the order in which they were supplied to the "apply" calls.
If "apply" isn't used, raise an error whenever the extracted directory
doesn't contain exactly one file.

The "apply" method can be called zero or more times within a patch-do
block with the following syntaxes supported:

    apply "single_apply"
    apply "multiple_apply_1", "multiple_apply_2"
    apply [array_of_apply]

If apply must be used, a single call using the second syntax above is
usually best practice. Each apply leaf should be the relative path to a
specific patch file in the extracted directory.

For example, if extracting this-v123-patches.tar.gz gives you

    this-123
    this-123/.DS_Store
    this-123/LICENSE.txt
    this-123/patches
    this-123/patches/A.diff
    this-123/patches/B.diff
    this-123/patches/C.diff
    this-123/README.txt

and you want to apply only B.diff and C.diff, then you need to use
"patches/B.diff" and "patches/C.diff" for the lowest-level apply leaves.

The code was provided by Xu Cheng. Any mistakes are mine.
2016-02-01 18:37:36 +00:00
ilovezfs
604323e641 brew.rb: use $stderr for debug and errors.
Closes Homebrew/homebrew#48634.
Closes Homebrew/homebrew#48681.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2016-02-01 18:37:36 +00:00
Felix Bünemann
f32c2a9974 brew search: properly handle 503 errors.
This avoids crashing with an unknown key error, if the GitHub api
response does not contain the ratelimit headers, e.g. when GitHub is
down. It also tries to display the JSON error message in addition to
the HTTP status.

Closes Homebrew/homebrew#48538.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2016-02-01 18:37:36 +00:00
Dominyk Tiller
a584711115 rubocop: disable Style/ConditionalAssignment
Closes Homebrew/homebrew#48708.

Signed-off-by: Dominyk Tiller <dominyktiller@gmail.com>
2016-02-01 18:32:22 +00:00
Baptiste Fontaine
a173196e32 tests: more integration tests
Closes Homebrew/homebrew#48674.

Signed-off-by: Baptiste Fontaine <batifon@yahoo.fr>
2016-01-31 16:03:36 +01:00
Andrew Janke
40a287f3c3 config.rb: add comment explaining HOMEBREW_TEMP logic 2016-01-30 21:40:26 -05:00
Dominyk Tiller
c6e0c9538f test_cmd_audit: add resource placement test 2016-01-31 00:39:29 +00:00
Dominyk Tiller
557f6e33a9 audit: check resource placement 2016-01-31 00:39:29 +00:00
Baptiste Fontaine
86eb44c96c tests: more integration tests
Closes Homebrew/homebrew#48635.

Signed-off-by: Baptiste Fontaine <batifon@yahoo.fr>
2016-01-31 00:46:35 +01:00
Martin Afanasjew
9cab301185 diagnostic: improve check for 'gnubin' in PATH
Both `coreutils` and `findutils` suggest to add `#{opt_libexec}/gnubin`
to PATH in their caveats to get the non-prefixed binaries from those
formulae. Check this in addition to the version-specific directory that
is less likely to be in PATH.

Closes Homebrew/homebrew#48207.

Signed-off-by: Martin Afanasjew <martin@afanasjew.de>
2016-01-28 12:53:17 +01:00
Xu Cheng
47d1c2c4e6 update-bash: don't be quiet for git init
The output will help to show git is initialized in the first time.
Hence, offer a better UX.
2016-01-28 19:32:41 +08:00
Xu Cheng
0ec5fec801 update-bash: git related improvement
* Use git function instead of refreshing bash cache on `git` path.
* Better `which_git`:
  * Take user's setting of `HOMEBREW_GIT` and `GIT` env variable into
    account.
  * Always expand git path.
  * Only check Xcode installation for OS X.

Closes Homebrew/homebrew#48508.

Signed-off-by: Xu Cheng <xucheng@me.com>
2016-01-28 19:03:38 +08:00
Xu Cheng
d1b7c91787 update-bash: fix git_init_if_necessary
* Make sure `.git` directory be deleted at any error. So we won't have a
  stale setup.
* Run `git fetch` and `git reset` when initialize git in the first time.
  Otherwise, we will get error and merging problem afterwards.

Closes Homebrew/homebrew#48509.

Signed-off-by: Xu Cheng <xucheng@me.com>
2016-01-28 19:03:24 +08:00
Andrew Janke
fe5a225648 rtags: boneyard
Closes Homebrew/homebrew#48528.

Signed-off-by: Andrew Janke <andrew@apjanke.net>
2016-01-27 18:27:39 -05:00
Baptiste Fontaine
47aa71e633 tests: don't try to rm an unexisting file
This line is necessary if the test fails. If it passes the file won't
exist anymore and shouldn't be removed.
2016-01-27 23:03:44 +01:00
Baptiste Fontaine
c25e11563c tests: fix a file leak 2016-01-27 22:38:24 +01:00
Martin Afanasjew
4cc8d3ed8b diagnostic: speed up check for outdated Homebrew
Determine the age of the local `HEAD` first and only if it is older than
24 hours proceed with the much more expensive `git ls-remote` to check
if there are any new upstream commits (there usually will be).

This keeps the overall logic unaltered, but significantly speeds up the
check for users that have recently updated (still slow for all others).

Closes Homebrew/homebrew#48499.

Signed-off-by: Martin Afanasjew <martin@afanasjew.de>
2016-01-27 19:07:09 +01:00
Tim D. Smith
2e2d2ab6ab allow PYTHONPATH to override Homebrew site-packages 2016-01-27 09:52:24 -08:00
Mike McQuaid
7260b35c31 config: fail when HOMEBREW_BREW_FILE is unset.
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.

Closes Homebrew/homebrew#48261.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2016-01-27 12:49:25 +00:00
Mike McQuaid
e07b5a98e0 update-bash: fully resolve Git's path in hash.
Otherwise Bash can cache a relative PATH and then get upset when it
changes directory and cannot find it any more.

Closes Homebrew/homebrew#48493.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2016-01-27 10:25:34 +00:00
Martin Afanasjew
99fd172ea8 tests: validate developer bash commands
Also change the logic a bit to iterate over the individual files per
directory, as having a directory without bash commands will otherwise
pass a literal `*.sh` to `bash -n`, causing it to fail.

Closes Homebrew/homebrew#48323.

Signed-off-by: Martin Afanasjew <martin@afanasjew.de>
2016-01-26 16:26:08 +01:00
Martin Afanasjew
da47ca9213 bin/brew: put commands into 'homebrew-' namespace
This should help to avoid collisions with external commands and other
shell functions in the future and is closer to what we do in Ruby, where
commands are namespaced by being methods of the `Homebrew` module.
2016-01-26 16:26:08 +01:00
Martin Afanasjew
29d80643d2 brew.rb: don't re-export for external commands
`bin/brew` already sets up a bunch of environment variables. There's no
need to re-export them for external commands. (`HOMEBREW_LIBRARY_PATH`
and `HOMEBREW_CACHE` continue to be determined later in the Ruby code.)
2016-01-26 16:26:07 +01:00
Martin Afanasjew
aa8329b5a0 update-bash: stop handling command name argument 2016-01-26 16:26:07 +01:00
Martin Afanasjew
6106ac9035 update-bash: discourage direct use
Remove the executable bit from the file to make it clear it is not
supposed to be executed directly. This should make the shebang line and
the early check also unnecessary.
2016-01-26 16:26:07 +01:00
Mike McQuaid
c2a928eb51 Add Haskell::Cabal#cabal_clean_lib back to compat.
We shouldn't have removed this DSL method without a compat fallback.

Closes Homebrew/homebrew#48479.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2016-01-26 11:49:15 +00:00
Mike McQuaid
21924396f0 update-report: don't duplicate "already updated".
This would be displayed more than once when verbose output was enabled.

Closes Homebrew/homebrew#48469.
2016-01-26 09:09:20 +00:00
Xu Cheng
9d216a53f8 bottle: clear tab cache
We cached the tab file content during formula loading.
Let's discard them, so we can read tab content after relocation
2016-01-26 15:52:45 +08:00
Xu Cheng
1f2ca73ac1 bottle: ensure to restore relocation on text files 2016-01-26 15:50:17 +08:00
Mike McQuaid
a59c1ae6cb os/mac: hide GCC warnings in config output. 2016-01-25 20:03:13 +00:00
Mike McQuaid
ca8bb1a33c update-bash: release to non-developers.
Allow people to run this command (so we can ask people to test it)
without having to set `HOMEBREW_DEVELOPER`.

Closes Homebrew/homebrew#48260.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2016-01-25 16:33:52 +00:00