337 Commits

Author SHA1 Message Date
Adam Vandenberg
f1d0f7adbb Formula factory: re-raise certain NameErrors.
Some name errors, such as NoMethodError, represent programming errors.
Re-raise them to get a usable error message.

Closes Homebrew/homebrew#14467.
2012-08-26 17:06:38 -07:00
Jack Nagel
fd151f8999 factory: always check const_defined? before requiring
Specifying dependencies with a URL works, even if by accident, but
factory is called repeatedly on this URL and this results in multiple
downloads of the same file.

Fix this by checking const_defined? here too, and DRY up the code a bit.

Fixes Homebrew/homebrew#14285.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2012-08-23 18:13:54 -05:00
Jack Nagel
5e0cbdab9b factory: rescue NameError
Due to the new const_defined? checks, passing certain names (such as
those that start with a digit) that are illegal constant names will
raise NameError. Catch this and error out gracefully, as we would have
previously.

Fixes Homebrew/homebrew#14342.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2012-08-21 15:55:20 -05:00
Max Howell
ee11f32fb7 conflicts_with message: recommend unlink
Yes uninstall works, but lets not push people towards that, they can presumably guess that, in the rare case they'd prefer that option.
2012-08-21 12:09:06 -04:00
Max Howell
9274f7cda1 Formula.Enumerable
Deprecated Formula.all, replaced usage with more appropriate enumerable options. Just check out how much nicer `brew audit` runs now.
2012-08-21 12:09:05 -04:00
Jack Nagel
35e32f352d factory: don't reload previously defined formulae
build.rb calls Formula.factory to get a usable Formula object to pass to
its install method. However, because the formula file is the actual
executing script, its class is already defined, and loading it again
causes the class to be re-evaluated, which, unfortunately, is not
idempotent.

This bug has existed for a very long time, and its side effects include
duplicate entries the deps array and mirrors array, among others.
Fortunately, the fix is very simple.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2012-08-19 12:04:44 -05:00
Jack Nagel
c6b3cd7cf4 Don't lie about upgrading up-to-date formulae
Usually, the "foo-version already installed" error is printed by
FormulaInstaller. However, if an up-to-date formula that has outdated
deps is passed on the command line, we proceed to upgrade the deps and
then print a message saying that the formulae given on the command line
is already installed.

Catch this earlier, when the outdated list is being populated, print an
appropriate message, and skip the up-to-date formula.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2012-08-18 19:33:39 -05:00
Jack Nagel
329f0a8490 Replace version strings with Version objects 2012-08-18 11:12:08 -05:00
Jack Nagel
53cf970312 build: expand requirements recursively when modifying ENV
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2012-08-14 22:35:28 -05:00
Max Howell
b0e50ba13d Formula.select and Formula.installed 2012-08-13 10:14:59 -04:00
Jack Nagel
a054dc5019 Add :when_xquartz_installed as a keg-only reason
Using :when_xquartz_installed will tell the keg-only machinery to activate
if XQuartz is installed.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2012-08-12 17:28:15 -05:00
Misty De Meo
d1c0d4c879 Fix normalization of old- and new-style options
When combining the set of old-style and new-style options, make sure
that the leading "--" is stripped.

Fixes displaying options in `brew options`, and the exotic case of
declaring options using the old syntax and then checking them with
`build.include?`
2012-08-11 16:54:03 -05:00
Jack Nagel
f5eaef0aee Deprecate ancient formula syntax
Closes Homebrew/homebrew#13444.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2012-08-09 23:56:54 -05:00
Adam Vandenberg
d1d52b3467 Add option to the DSL
Closes Homebrew/homebrew#9982
2012-08-08 22:01:27 -07:00
Jack Nagel
4f809d0311 Simplify printing conflicts in brew info
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2012-08-07 14:24:54 -05:00
Jack Nagel
82d3890495 Fix typo in conflicts_with DSL method
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2012-08-07 14:24:34 -05:00
Adam Vandenberg
8c8701f268 Allow multiple unsatisfied fatal requirements
Closes Homebrew/homebrew#13335.
2012-08-07 10:49:45 -07:00
Misty De Meo
0c237a8679 Add conflicts_with DSL method
conflicts_with is a thin wrapper around Requirement which simplifies
marking conflicts between formulae.

Closes Homebrew/homebrew#13687.

Signed-off-by: Misty De Meo <mistydemeo@gmail.com>
2012-07-30 13:47:12 -03:00
Jack Nagel
c71002a4a3 Formula: mirrors are always non-nil
Since 3ee9b7bd88a2d9017cdf005b10567a1d6d8ec211 ("SoftwareSpec:
initialize @mirrors"), @active_spec.mirrors will always be non-nil.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2012-07-17 03:23:59 -05:00
Jack Nagel
56fe164e95 Teach download strategies to take a SoftwareSpec
Now that a URL, version, and the (for lack of a better term) "specs"
associated with said URL (e.g. the VCS revision, or a download strategy
hint) are neatly bundled up in a SoftwareSpec object, it doesn't make
sense to pass them individually to download strategy constructors. These
constructors now take only the formula name and a SoftwareSpec as
parameters.

This allows us to move mirror handling out out of Formula#fetch and into
the download strategies themselves. While doing so, we adjust the mirror
implementation a bit; mirrors now assume the same "specs" as their
owner's URL. They are still only useable by the CurlDownloadStrategy,
but this provides a basis for extending mirror support to other
strategies.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2012-07-04 22:47:35 -05:00
Jack Nagel
76b2eee777 Refactor checksumming
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2012-07-04 22:47:33 -05:00
Jack Nagel
98a11b8e57 Introduce new formula specs 2012-07-04 22:47:32 -05:00
Charlie Sharpsteen
d1a4806390 std_cmake_args: Search for Frameworks last
Most Homebrew builds produce libraries, so CMake should give priority to
libraries when resolving dependencies.

Closes Homebrew/homebrew#12497.

Signed-off-by: Charlie Sharpsteen <source@sharpsteen.net>
2012-06-03 10:03:56 -07:00
Jack Nagel
a13857b150 Introduce std_cmake_args method
This differs from the current std_cmake_parameters in that it returns an
array instead of a string. Doing so makes dealing with it in formulae
much more pleasant, and for new formula hackers, less surprising.

std_cmake_parameters is retained in compat to maintain compatibility
with external formulae.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2012-05-22 16:32:12 -05:00
Max Howell
4a48a5f7a3 Don't fall into the no-extension OK trap
`require` is OK without an .rb extension, but the rest of our code will be confused and generate weird errors.

Fixes Homebrew/homebrew#11558.
2012-05-15 02:27:11 -04:00
Adam Vandenberg
e8c0b01f24 patches - support detection of compression types 2012-05-02 19:57:33 -07:00
Mike McQuaid
995186a72c Fix Ruby warnings.
Fixes Homebrew/homebrew#11966.
2012-05-01 20:45:17 +08:00
Mike McQuaid
0eb97d5c32 Generate the bottle download URL correctly.
Fixes Homebrew/homebrew#11561.
Fixes Homebrew/homebrew#11614.
2012-04-24 18:53:45 +10:00
Mike McQuaid
47b2eedddc Revert "Generate the bottle download URL correctly."
This reverts commit 092004e7820791030f568af0e3b03389ea4f7ee3.
2012-04-24 18:10:06 +10:00
Mike McQuaid
2c46c4e0c2 Generate the bottle download URL correctly.
Fixes Homebrew/homebrew#11561.
Fixes Homebrew/homebrew#11614.
2012-04-24 18:08:14 +10:00
Jack Nagel
9614301be4 Fix protection against overriding Formula#brew
The test for this previously passed, but only because the constructor
for SoftwareSpecification was raising an exception. method_added needs
to be a class method because methods are being defined on the class, not
the object, and to test it properly we have to eval the class in the
test itself.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2012-04-06 17:32:43 -05:00
Mike McQuaid
62a98753ec Populate empty mirror_list for bottles.
Fixes Homebrew/homebrew#11434.
2012-04-04 20:50:22 +10:00
Mike McQuaid
a947064994 Version bottles. 2012-04-03 11:43:41 +10:00
Jack Nagel
de444ead0b New fails_with infrastructure
- Formulae can now declare failures on any compiler.
 - FailsWithLLVM and associated formula elements have been moved to
   compat.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2012-04-01 12:39:59 -05:00
Mike McQuaid
49b16f3462 Fix broken default bottle URL. 2012-03-23 05:58:14 +13:00
Adam Vandenberg
7c50020822 Use Patches 2012-03-19 18:50:17 -07:00
Mike McQuaid
85452c5e91 Fix bottles on non-Lion. 2012-03-18 20:48:11 +13:00
Mike McQuaid
64457b2315 Remove reliance of bottle DSL on EOCLASS. 2012-03-18 20:38:18 +13:00
Misty De Meo
aa91bd27d2 Implement new bottle syntax in formula.rb
Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2012-03-18 20:38:18 +13:00
Mike McQuaid
d47cf55f68 Use fetch for downloading bottles.
Fixes Homebrew/homebrew#10958.
2012-03-18 15:16:57 +13:00
Max Howell
3bfea440cb Downcase tap parameters in Formula.canonical_name
See previous commit's explanation.
2012-03-18 01:51:10 +00:00
Max Howell
598f7b69d9 Record tap-origin in the install-receipt 2012-03-16 21:06:17 +00:00
Max Howell
3f25dd60fa canonical_name can resolve taps 2012-03-16 21:06:15 +00:00
Max Howell
544b3c38c8 ohai'ing this is ugly IMO
I wanted to make it possible to not do the additional newline (in brew) if this code path is hit. But I didn't see a way to do it without overriding the Interrupt exception and throwing a new one.

“Never add more code than necessary for aesthetics in error handling.” — mxcl
2012-03-15 13:04:17 +00:00
Adam Vandenberg
715f808421 roll back stricter version check 2012-03-10 10:02:05 -08:00
Adam Vandenberg
cef5429f93 Use new Requirements code in Homebrew 2012-03-10 09:24:10 -08:00
Mike McQuaid
552dcdc703 Move most bottle stuff to a bottles.rb file. 2012-03-10 18:10:40 +13:00
Mike McQuaid
4a306f32f4 Support bottles for non-Lion OSX versions. 2012-03-10 18:09:35 +13:00
Adam Vandenberg
aef580261b Tell the user when build logs are copied 2012-03-09 18:48:23 -08:00
Adam Vandenberg
04088ba96d Do a stricter version check
A version should always be set when going through the constructor
so tighten this check. Also do some style clean ups here.
2012-03-09 18:44:48 -08:00