872 Commits

Author SHA1 Message Date
Jack Nagel
a9e6f07732 Formula#system: sanitize args before exec
This prevents passing nested arrays to exec; the same thing is done in
safe_system.

Fixes Homebrew/homebrew#10295.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2012-02-24 17:29:02 -06:00
Jack Nagel
f295661ca6 Remove unused :force switches
The :force behavior for ENV.gcc has been the default for some time, and
was used to force vanilla gcc in case the gcc symlink pointed at
llvm-gcc; for ENV.clang, this doesn't mattera as clang is just clang.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2012-02-21 00:22:27 -06:00
LeFnord
b0ece7613f cast name to string
Some times a Pathname is passed in here

Signed-off-by: Adam Vandenberg <flangy@gmail.com>
2012-02-17 18:59:36 -08:00
Jack Nagel
c1fecab365 Don't return nil from Formula#linked_keg
Doing so was the result of a quick hack to fix the "deps installed as
upgrades don't get linked" bug, but it was a mistake. Instead, always
return the LinkedKegs entry as a Pathname object, and let callers be
responsible for checking that it exists.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2012-02-10 23:52:01 -06:00
Mike McQuaid
27ecdb4266 Split bottle logic.
Fixes Homebrew/homebrew#8805.
2012-02-09 21:05:17 +00:00
Adam Vandenberg
fe6ab92857 Split some classes to formula_support
formula.rb is getting big, let's start splitting things out.
2012-02-04 18:45:08 -08:00
Adam Vandenberg
d312a54d46 Remove aka warning 2012-02-03 20:02:41 -08:00
Jack Nagel
3001391a5d Add and use plist helper methods
These will be used to unify the label namespaces in embedded plists,
i.e. 'homebrew.mxcl.<formula>'.

plist_path returns the full path to a plist file located at the top
level of the keg; plist_path.basename can be used if just the filename
is needed.

c.f. Homebrew/homebrew#9346.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2012-02-03 19:50:58 -06:00
Misty De Meo
b6fa08f2d2 devel: reset mirrors when building devel
Otherwise stable mirrors will be considered when the devel download
fails.

Fixes Homebrew/homebrew#9910.
2012-02-02 13:13:07 -06:00
Misty De Meo
d121bcdada Add devel to the DSL, + stable and bottle blocks
This commit adds a `devel` entry to the DSL, allowing formulae to
specify an unstable branch.

`devel` takes a block, which should contain standard `url` and `md5`
fields (and `version`, if necessary). This must come after the standard
DSL fields.

This commit also migrates over all formulae currently using `devel` to
the new syntax, as well as formulae which used `head` for non-VCS urls.

The new syntax is also available for `stable` and `bottle`. `stable` is
an option alongside the old syntax. `bottle` replaces the old syntax.

Note that the @stable ivar in Formula has been renamed to @standard,
and the @bottle ivar has been renamed to @bottle_url.

Closes Homebrew/homebrew#9735.

Signed-off-by: Misty De Meo <mistydemeo@gmail.com>
2012-01-25 21:45:19 -06:00
Mike McQuaid
555e7ff893 Don't try and use GCC on Xcode 4.2: it's gone Jim.
Closes Homebrew/homebrew#9622.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2012-01-16 21:00:24 +00:00
Mike McQuaid
c28779d4e0 Bump highest seen LLVM version.
Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2012-01-16 21:00:24 +00:00
Jack Nagel
411d15d407 Unlink old keg when upgrading dependencies
Installing a formula via `brew install` may trigger upgrades of its
dependencies if the dependencies are installed but outdated. However, we
never unlinked the existing keg in FormulaInstaller#install_dependency
which caused the link step to fail.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2012-01-15 17:18:17 -06:00
Charlie Sharpsteen
acc33a56e7 Allow Formula.canonical_name to use Pathname objects 2011-12-26 11:58:25 -08:00
Charlie Sharpsteen
33db0a9665 formula.rb: Don't apply fails_with_llvm to Clang
Clang is vastly different than LLVM-GCC and is under active development. Using
Clang is a viable solution to formula that fail with LLVM and a suggested
recourse for users of XCode 4.2 or newer.

Fixes Homebrew/homebrew#9242.
2011-12-24 12:48:10 -08:00
Adam Vandenberg
2dba766fda Expose stable/unstable specs 2011-12-18 16:24:56 -08:00
Adam Vandenberg
fd082f63b6 Extract checksum type function 2011-12-18 16:24:56 -08:00
Adam Vandenberg
f052bcbd62 Simplify a couple of comments 2011-12-18 16:24:55 -08:00
Charlie Sharpsteen
94f84544c6 formula.rb: Fix use of xcode_version in LLVM check
Should be `MacOS.xcode_version`.

Fixes Homebrew/homebrew#8966.
2011-12-04 10:12:40 -08:00
Charlie Sharpsteen
ec71780612 formula.rb: Change fails_with_llvm for XCode 4.2
Suggest trying `--use-clang` instead of `--use-gcc` (which does nothing).

Signed-off-by: Adam Vandenberg <flangy@gmail.com>
2011-12-03 12:33:02 -08:00
Charlie Sharpsteen
0d08a5af00 formula.rb: Initialize path to nil or a Pathname
For consistency, ensure that the `path` member of formula objects is always a
`Pathname`.
2011-11-27 16:44:42 -08:00
Charlie Sharpsteen
b5f942764a Re-work ARGV filtering to properly handle --HEAD
Previously, stripping arguments like `--HEAD` for dependencies failed because
that flag affects the installation prefix encoded into formula objects. The
previous implementation of `ARGV` filtering tried to contain all changes to a
single method call before the `FormulaInstaller` forks. This update spreads
things out a bit:

  - The Homebrew `ARGV` extension adds a new method, `filter_for_dependencies`
    which strips flags like `--HEAD`, yields to a block, then restores the
    original contents of ARGV.

  - The `explicitly_requested?` test, which returns true or false depending on
    if a formula object is a member of `ARGV.formulae`, is now a method of
    `Formula` objects.

  - `FormulaInstaller` objects now execute the installation of dependencies
    inside an `ARGV.filter_for_dependencies` block if the dependency was
    `explicitly_requested?`.

Fixes Homebrew/homebrew#8668.
Closes Homebrew/homebrew#7724.
2011-11-27 14:37:31 -08:00
Jack Nagel
0a49981a30 Add an attr_reader for 'head'
This allows `brew audit` to inspect the head URLs, for example; until
now, that check was failing silently.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2011-10-10 15:34:28 -05:00
Charlie Sharpsteen
e7aaeda953 formula.rb: Don't attempt to mirror unstable URLs
If a build is being influenced by an option such as `--HEAD`. Don't attempt
mirrors if a download fails.

Fixes Homebrew/homebrew#7971.
2011-10-04 18:36:31 -07:00
Charlie Sharpsteen
d05478e85b formula.rb: Move cache dir creation to fetch
So that the cache directory will get created if the user runs `brew fetch`
instead of `brew install` as the first command.
2011-09-19 19:05:44 -07:00
Max Howell
6bd47cf0f9 Only try mirrors for CurlDownloadStrategies
Also adjust output text slightly for prettiness.

A possibly useful side effect here is safe_system has a defined Exception (subclassing RuntimeError) now.
2011-09-19 23:30:10 +01:00
Jack Nagel
1dc0775a15 Revert "Pretty-print the "Trying a mirror" message"
This reverts commit af8e3b5aeacdb10a412560e131d631ba733a8346.

Sorry for the noise.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2011-09-19 12:19:50 -05:00
Jack Nagel
9b3c22c7bd Pretty-print the "Trying a mirror" message
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2011-09-19 12:15:56 -05:00
Charlie Sharpsteen
9d19506ee9 mirror support: Add mirror method to Formula.rb
Mirrors can now be declared using the `mirror` method which works similar to
`depends_on` and takes the same arguments as `url`.

The formula class now has a public `fetch` method that cycles through the
mirror list if the downloader for the primary URL throws a `DownloadError`.
Other brew commands, like brew-fetch, also benefit from mirror support by using
this method.

Closes Homebrew/homebrew#7574.
2011-09-19 09:24:43 -07:00
Charlie Sharpsteen
94dba21f7d Centralize definition of rack in formula.rb
`rack` is a commonly used alias for `formula.prefix.parent`---so common that it
gets defined and used quite a bit. This patch makes `rack` an official method
of the `Formula` class.
2011-09-16 08:55:38 -07:00
Max Howell
bf3433bde7 With xcodebuild don't set CC, CXX, etc.
The compiler setting in the xcodeproj is overridden by the CC setting in the environment. This is a bit insane IMO since the xcodeproj itself has detailed decisions about what tools to use.

Fixes Homebrew/homebrew#6406.
2011-09-10 11:30:00 +01:00
Max Howell
d37918b20f If LLVM isn't installed then fails_with_llvm? is true
This makes sense, I assure you. Fixes Homebrew/homebrew#7458.
2011-09-06 17:51:23 +01:00
Max Howell
06795b8953 Allow :force for ENV.gcc
This is used with fails_with_llvm so that if GCC cannot be found (and we suspect this is the case with Xcode 4.2) the build will fail.

Quite possibly it should be the default.
2011-09-06 11:22:22 +01:00
Max Howell
d71e1d0786 Use GCC if we tested against the latest LLVM
Latest is hardcoded, so we'll have to update as new Xcode's come along.
2011-09-01 14:33:54 +01:00
Max Howell
a27eda9df2 Allow fails_with_llvm {}
And fix node and ruby to use LLVM without complaint with Xcode 4.1 and Lion.
2011-09-01 10:29:31 +01:00
Max Howell
00cd7a3a9b cp CMakeCaches.txt not CMakeLists.txt
CMakeLists.txt is the build instructions not the build logs. The cache is not much better, but there is no equivalent of config.log, so…
2011-09-01 10:28:45 +01:00
Max Howell
abc8c2f9d7 Restore previous fails_with_llvm? behaviour
I've not been very careful lately, I apologise.

Fixes Homebrew/homebrew#7338.
2011-09-01 09:39:54 +01:00
Rory O'Connell
9520b6cc3c Fix type checking in fails_with_llvm
Signed-off-by: Adam Vandenberg <flangy@gmail.com>
2011-08-31 14:46:44 -07:00
Max Howell
3b689db6d3 Missing end. Doing too many things at once. Sorry. 2011-08-31 17:37:38 +01:00
Max Howell
b309396b02 cp over CMakeLists.txt if cmake builds fail
The self help text does not mention the log, but we can add this later, and for now at least the file is salvaged.

Closes Homebrew/homebrew#5940.
2011-08-31 17:36:41 +01:00
Max Howell
cf1a6e185c Don't fail to build with llvm if llvm build is newer 2011-08-31 17:36:41 +01:00
Max Howell
b5c709e2ed Save config.log to ~/Library/Logs/Homebrew
Also tidied error output. Still could be tidied quite a lot but I am still considering how best to go about it.
2011-08-31 15:35:59 +01:00
Charlie Sharpsteen
2e0a2cb175 formula.rb: Don't curl when DATA is the only patch
Executing `curl(*patches)` was failing on Leopard when `patches` was an empty
list. `git-bisect` identified 48552bb42a69ece4eb2a6d9acf81a0b47adb19c9 as the
commit that caused this bug to surface by adding `--insecure` to the arg list
on Leopard. This is odd because the following both exit with status 2:

    curl
    curl --insecure

The only apparent difference is that `curl --insecure` prints "no URL
specified!" to stderr along with the usage message.

Also renamed `patches` to `external_patches` as it is more descriptive.
2011-08-29 15:01:38 -07:00
Max Howell
f52955ec98 Correct typo 2011-08-26 16:55:12 +01:00
Max Howell
fd96bb6e3a Apologies, forgot to amend the commit 2011-08-26 14:48:47 +01:00
Max Howell
0822907d6d Some more sanity with ENV.compiler
Deprecated use_clang? etc. since the logic was such that multiple states could be set, when in reality only one compiler can be set.

Changed fails_with_llvm handling so if HOMEBREW_USE_LLVM is set then it tries to build even if the formula has fails_with_llvm set. Rationale: mostly they will no longer fail and we need to catch these cases.
2011-08-26 14:21:37 +01:00
Charlie Sharpsteen
f7bd98875b Leopard: Fix undefined method count for Array
Leopard runs Ruby 1.8.6 while Snow Leopard runs 1.8.7 and `Array.count` was not
introduced until 1.8.7.

Using `Array.length` instead.
2011-08-24 17:45:19 -07:00
Max Howell
6ac0a28523 Implement bottles again
Bottles now pour purely, without doing all the other unnecessary stuff that happened before the `brew upgrade` code shuffle.

Formula.pourable? removed since it was install-specific metadata and not related to the formula itself. Now all such logic is in the FormulaInstaller which is much cleaner.

I also changed the bottle cache location to the normal directory and added a .bottle pre-extension. Thus you can see everything in one directory without messing about.
2011-08-24 22:30:43 +01:00
Max Howell
4dc8318dc3 Observe all applicable options in handle_llvm_failure 2011-08-24 22:30:43 +01:00
Max Howell
39453f5a9d Auto-substitute certain variables in DATA patches
HOMEBREW_PREFIX for example.
2011-08-24 22:30:43 +01:00