603 Commits

Author SHA1 Message Date
Andrew Janke
d887dd39ec brew install: make -s apply only to given formula, not deps (#205) 2016-05-06 12:02:13 -07:00
Mike McQuaid
0ef21ddf87 analytics: move to a class.
Global namespaces are good to avoid when possible.
2016-05-03 14:21:08 +01:00
Andrew Janke
acc9a7ca85 brew test, install, update-test: add --keep-tmp option
Also enables sandbox for --interactive and --debug use of install
and test, using automatic retention.

Closes #66.

Signed-off-by: Andrew Janke <andrew@apjanke.net>
2016-04-18 12:23:08 -04: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
342ed4c830 formula_installer: report install attempts.
Closes https://github.com/Homebrew/legacy-homebrew/pull/50462.
2016-04-04 12:27:47 +01:00
ilovezfs
9bbaaca98c FormulaInstaller: rescue tap unavail for reqs too
Calling `compute_dependencies` will make sure both requirements and
dependencies are expanded, so that any referenced taps can be
auto-tapped. Prior to this commit only dependencies were expanded for
the sake of auto-tapping, so dependencies of requirements would cause
installation to fail whenever a tap unavailable exception was
encountered.

Closes Homebrew/homebrew#50271

Closes Homebrew/homebrew#50281.

Signed-off-by: ilovezfs <ilovezfs@icloud.com>
2016-03-29 16:19:37 +08:00
Mike McQuaid
f2faf49e3f formula_installer: use new pour_bottle DSL. 2016-02-18 10:21:20 +00:00
Mike McQuaid
c5ec986c72 formula_installer: improve bottle cellar message. 2016-02-18 10:21:20 +00:00
Mike McQuaid
e62dc13252 formula_installer: cleanup existing pour_bottle logic. 2016-02-18 10:21:20 +00:00
Xu Cheng
2facb5166c FormulaInstaller: uncache Tab to keep it fresh
Fixes Homebrew/homebrew#48612.
Fixes Homebrew/homebrew#48657.

Closes Homebrew/homebrew#48886.

Signed-off-by: Xu Cheng <xucheng@me.com>
2016-02-10 14:23:18 +08:00
Mike McQuaid
84a85b97ff Revert "formula_installed: tweak source build behaviour."
This reverts commit 5dd200c6b40f4fa9cc3a70cbc9ca2885e4626943.

Closes Homebrew/homebrew#47889.
2016-01-19 10:16:59 +00:00
Mike McQuaid
42681b51f8 formula_installer: build formula options better.
Previously we got all the options based on the build, any inherited
options, any passed options and the tab. We want to make sure that these
then exclude any options that don't exist as, otherwise, passing an
option that doesn't exist (or has been deleted) is enough to stop a
bottle being poured. This was particularly nasty on upgrades where we
deleted options and one left in the tab would stop the bottle being
poured.

Closes Homebrew/homebrew#47891.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2016-01-17 20:06:00 +00:00
Mike McQuaid
e7bffe4809 formula_installed: tweak source build behaviour.
Currently `brew install —build-from-source wget` builds all the
dependencies also from source. I can see people wanting to do this when
`HOMEBREW_BUILD_FROM_SOURCE` is set by passing it on the command-line
is mostly just annoying; it means you have to use `—build-bottle` and
deal with the CFLAGS and `post_install` changes if you want to build
from source. Tweak `formula_installer` so this behaviour is more
intuitive.

Closes Homebrew/homebrew#47889.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2016-01-17 20:05:32 +00:00
Martin Afanasjew
08fb36252c formula_installer: fix --default-fortran-flags
Setting the `FC` environment variable allows the user to override the
default Fortran compiler. The `SharedEnvExtension#fortran` method then
checks whether any of `FCFLAGS` and `FFLAGS` environment variables are
set and, if not, suggests to use `--default-fortran-flags` when running
`brew install`. However, `--default-fortran-flags` never makes it to
`build.rb` (that is executed by `FormulaInstaller`) because the flag is
not whitelisted in `FormulaInstaller#sanitized_ARGV_options`.

This change rectifies this and thereby eliminates the confusing message.

Fixes Homebrew/homebrew#47852.
2016-01-10 02:59:22 +01:00
Xu Cheng
885022a5e3 add Keg#empty_installation?
Avoid using `FormulaAuditor` in `FormulaInstaller`.

Closes Homebrew/homebrew#47887.

Signed-off-by: Xu Cheng <xucheng@me.com>
2016-01-09 20:28:15 +08:00
Zhiming Wang
6826cd68da formula_installer: improve empty installation detection
Use FormulaAuditor.audit_prefix_has_contents from audit.rb, which has
better logic.

Closes Homebrew/homebrew#47678.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2016-01-09 10:22:31 +00:00
Mike McQuaid
214c865167 bottle: make bottle checksums reproducible.
I've set all the variable data to versions that are dependent on the
latest source file date and various modification dates also to the
latest source file date. With this if you rerun `brew bottle`
multiple times in a row you will see the same checksum even if you have
`brew reinstall`ed (as long as upstream does not hardcode e.g. the
build date).

I debugged this with diffoscope and worked on this as part of the
Athens 2015 reproducible builds workshop:
https://reproducible-builds.org/events/athens2015/

Closes Homebrew/homebrew#46587.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2015-12-15 14:24:18 +00:00
Martin Afanasjew
a4a2b305f2 formula_installer: prefer 'Dependable#run?'
Both `req.tags.include?(:run)` and `req.run?` are currently equivalent,
but the latter relies less on implementation details.
2015-12-15 05:36:05 +01:00
Daniel Trebbien
af10515f81 Skip pouring from a bottle if --cc is passed
A formula should be built from source by default if the --cc option is
passed to specify a particular compiler.

Added a test to test_formula_installer: test_not_poured_from_bottle_when_compiler_specified

Modified test_formula_installer to assert that the formula was not poured
from a bottle. Similarly modified test_formula_installer_bottle to assert
that the formula *was* installed from a bottle.

Added an install method to the TestballBottle formula (the same as the
Testball formula's install method) so that the TestballBottle formula can
be "built from source".

Fixes Homebrew/homebrew#46046 - Build from source should be the default behavior if --cc
option is passed

Closes Homebrew/homebrew#46162.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2015-11-25 16:49:58 +00:00
Alexander Berezovsky
b0f188c2f5 formula_installer: fix quotation mismatch
Closes Homebrew/homebrew#46176.

Signed-off-by: Dominyk Tiller <dominyktiller@gmail.com>
2015-11-21 18:46:37 +00:00
Xu Cheng
39c9ce628f FormulaInstaller: don't try to build from source for interrupt
Closes Homebrew/homebrew#46078.

Signed-off-by: Xu Cheng <xucheng@me.com>
2015-11-17 23:51:11 +08:00
Martin Afanasjew
4d772042f7 keg_relocate: remove options from Keg#dylib_id_for
No longer used since commit 3b0cbe6a56d9133941482a9e2d033ad86cdb5e79.

Closes Homebrew/homebrew#45835.

Signed-off-by: Xu Cheng <xucheng@me.com>
2015-11-11 14:23:59 +08:00
Xu Cheng
82689d81f7 use Tap#install 2015-11-09 15:34:20 +08:00
Xu Cheng
fd3cfb11a6 merge dependencies for expand_requirements
Fixes Homebrew/homebrew#45414

Closes Homebrew/homebrew#45420.

Signed-off-by: Xu Cheng <xucheng@me.com>
2015-10-29 14:14:56 +08:00
Xu Cheng
f41925b360 allow install bottle unneeded formulae for non Xcode/CLT install 2015-10-19 21:41:36 +08:00
Xu Cheng
975771ab35 formula_installer: let build_bottle? check bottle_disabled?
Also don't pour bottle if it's disabled.
2015-10-19 21:41:36 +08:00
Xu Cheng
1b33c70d46 FormulaInstaller: cleanup files when pouring bottle failed
Closes Homebrew/homebrew#44325.

Signed-off-by: Xu Cheng <xucheng@me.com>
2015-09-26 13:51:56 +08:00
Xu Cheng
7b97dca554 use skip_deps_check? instead of ignore_deps? hack
We previously set `ignore_deps?` as true for DependencyInstaller to
avoid duplicated dependencies resolution. (See a9fc82aea30506eeacbddeb8b53fb85de8acb9d4)

However, this will cause problem when pouring bottle of a dependency is
failed. In this case, it will try to build dependency from source but
failed due to uninstalled build deps for this formula.

Another disadvantage for using `ignore_deps?` hack is we cannot
distinguish users passing `--ignore-dependencies` flag from we are in
`DependencyInstaller`.

So, let's differentiate these using `skip_deps_check?`
2015-09-26 13:51:56 +08:00
Xu Cheng
5045fc95bf FormulaInstaller: raise if pouring bottle failed and no Xcode/CLT installed 2015-09-26 13:51:56 +08:00
Xu Cheng
d911b5689a keg_relocate: split relocate_install_names and relocate_text_files
For bottle with `:any_skip_relocation`, relocating text files is
required.
2015-09-12 01:38:59 +08:00
Xu Cheng
3638c057f0 FormulaInstaller: reset git_available? when installing git
Closes Homebrew/homebrew#43693

Signed-off-by: Xu Cheng <xucheng@me.com>
2015-09-09 12:22:03 +08:00
Xu Cheng
f279a13977 formula_installer: fix syntax warning
Library/Homebrew/formula_installer.rb:636: warning: shadowing outer local variable - conflict_file
Library/Homebrew/formula_installer.rb:636: warning: shadowing outer local variable - backup_file

Closes Homebrew/homebrew#43602.

Signed-off-by: Xu Cheng <xucheng@me.com>
2015-09-06 20:15:38 +08:00
Alex Dunn
818c65542d remove Formula#file_modified?
It's been more trouble than it's worth.

Fixes Homebrew/homebrew#43607.
Closes Homebrew/homebrew#43049.

Closes Homebrew/homebrew#43615.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2015-09-06 13:13:59 +01:00
Xu Cheng
8830e401a9 formula_installer: check has_apple_developer_tools? once
Closes Homebrew/homebrew#43534.

Signed-off-by: Xu Cheng <xucheng@me.com>
2015-09-06 15:00:45 +08:00
Xu Cheng
ddb630b01c move sudo -k to formula_installer
sudo -k cannot be used inside sandbox

Closes Homebrew/homebrew#43345.

Signed-off-by: Xu Cheng <xucheng@me.com>
2015-08-28 17:15:29 +08:00
Dominyk Tiller
98499d1d29 sandbox: permit /var/tmp & DerivedData
Long term it would be nice to sandbox everything that writes to DerivedData
but it is essentially a cache directory of sorts.

The downside of allowing stuff to write there particularly is that DerivedData
is notoriously bad at getting cleaned up, so if you do a lot of Xcode-using
installations very quickly, you can chew your disk space up.

Closes Homebrew/homebrew#43276.

Signed-off-by: Dominyk Tiller <dominyktiller@gmail.com>
2015-08-25 22:01:24 +01:00
Xu Cheng
5266ff2739 formula_installer: tweak word 2015-08-23 23:30:14 +08:00
Xu Cheng
09c810c7f4 add link_overwrite DSL
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
2015-08-23 21:43:03 +08:00
Xu Cheng
9f20679366 formula_installer: fix when bottle pouring when creating new bottle
Formula#bottle_specification always exists, while Formula#bottle only
exists if the bottle is available and compatible.
2015-08-22 14:19:22 +08:00
Xu Cheng
a88c40b8c8 core file style update 2015-08-22 13:15:33 +08:00
Misty De Meo
727239e12f Merge bottle install without Xcode branch
Merge branch 'bottle_hooks'
2015-08-21 11:04:22 -07:00
William Woodruff
12b25f59cc Only print dep installation notice when deps will be installed 2015-08-21 11:02:33 -07:00
William Woodruff
8793a68ee4 Add no-Xcode documentation for all classes, methods 2015-08-21 11:02:33 -07:00
William Woodruff
1face808f5 Add guards to calls that would trigger Xcode install requests
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?
2015-08-21 11:02:33 -07:00
William Woodruff
f58506ea6f FormulaInstaller: add prevent_build_flags to eliminate code repetition
remove unneeded definition

change variable in FormulaInstaller.check_build_flags from bf to build_flags
2015-08-21 10:59:35 -07:00
William Woodruff
91e598cf3f Install: add BuildToolsError and BuildFlagsError
Add these new errors, and guards in formula installation and
cmd/{,un,re}install to match, move can_build? to the MacOS module,
flatten conditions, remove redundant can_build? check

reinstate removed (doctor) check
2015-08-21 10:59:09 -07:00
William Woodruff
76dcad7c82 Split compute_and_install_dependencies
This is so so that check_dependencies_bottled can be called when bottles
are being poured; implement check_dependencies_bottled
2015-08-21 10:58:45 -07:00
William Woodruff
8aad523063 Formula_installer: only attempt relocation install once
Check @@attempted for cctools so that we only attempt the relocation
install once, skip cxxstdlib check in cctools to prevent otool
execution prior to installation, skip fixing install names if
relocation is not required
2015-08-21 10:57:48 -07:00
William Woodruff
b46d5de492 Requirements: add CctoolsRequirement
Install it as a dependency unless already satisfied by Xcode.

require cctools_requirement

cctools_requirement should be satisfied by cctools present in opt

add build_env => false to the satify block options in CctoolsRequirement
2015-08-21 10:57:20 -07:00
William Woodruff
dcfac4f571 add install_relocation_tools stub 2015-08-21 10:56:46 -07:00