537 Commits

Author SHA1 Message Date
Jack Nagel
9b5cb6cfb6 Allow brew versions to work with underspecified formulae 2013-04-27 14:44:48 -05:00
Simon Sigurdhsson
4f45077fde Remove global methods from formulae
Removes any global methods from formulae, and moves #kext_prefix (which
seems to be at least somewhat abstractable) into the Formula class. The
only formula with global methods is now aspell; it (and its generating
script in contrib) has been changed to prefix that method with
`aspell_`, to minimize the risk of name collisions.

Closes Homebrew/homebrew#19331.
Closes Homebrew/homebrew#19343.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2013-04-21 23:48:50 -05:00
Jack Nagel
3a0726406b Add tests for FormulaPin and simplify implementation 2013-04-16 01:58:11 -05:00
Jack Nagel
49682e854d Avoid expensive Pathname concatenation 2013-04-15 15:00:57 -05:00
Jack Nagel
33e00b7f7c Style nit 2013-04-14 23:29:15 -05:00
Jack Nagel
b258bee44e Don't use Pathname#/ in performance-critical code
This method (well, really, #join) is *twice* as slow as simple
concatenation, and shouldn't really be used at all in non-Formula code.
2013-04-14 20:09:20 -05:00
Jack Nagel
a05bb48807 Raise a useful exception for incomplete formulae 2013-04-13 17:40:14 -05:00
Jack Nagel
4bd34c9624 Allow "devel-only" formulae
It seems only natural that this should be possible, or at the very
least, it should not result in calling methods on nil.
2013-04-13 17:40:13 -05:00
Jack Nagel
2e26afe556 Improved formula attribute validation
The initializer for Formula does a number of validations, but it does
them in a weird order, and some attributes aren't validated under
certain circumstances. This became even more of a mess when most
software package attributes were moved into the SoftwareSpec class.

This commit removes the last vestiges of storing these attributes as
instance variables. In particular, it eliminates #set_instance_variable
and #validate_variable, replacing them with methods that operate on
SoftwareSpec instances, and generate more useful errors.

Doing these validations unconditionally in the initializer means we bail
out much earlier if the formula has invalid attributes or is not fully
specified, and no longer need to validate in #prefix.

Technically we don't need to validate in #brew either, but we continue
to do so anyway as a safety measure, and because we cannot enforce calls
to super in subclasses.
2013-04-13 17:40:12 -05:00
Jack Nagel
bd4aaac96b Check existence rather than rescue exceptions 2013-04-09 19:40:08 -05:00
Jack Nagel
9db0e68eb6 Unify indentation of access modifiers
These are class method calls, not some special keyword, and should be
indented as such (also all standard Ruby indenters do this).
2013-04-07 20:59:49 -05:00
Jack Nagel
62d25f9c8b Remove obsolete comment about download_strategy
The canonical way to select a custom download strategy is to pass

  :using => StrategyClass

as an argument to the url DSL method.
2013-04-05 14:41:14 -05:00
Mike McQuaid
462a418878 Add optional post_install method to Formula.
Sometimes we may want to run commands after bottle installation (such as
creating directories outside the Cellar) so this method allows us to do
so.

Closes Homebrew/homebrew#18382.
2013-04-01 22:12:43 +01:00
Simon Sigurdhsson
f8a88b5f28 brew-pin: prevent selected formulae from upgrade.
* Added `pin` et. al. to manpage.
* Added `brew pin` to `brew.1` * Added `brew unpin` to `brew.1`
* Added `brew list --pinned` to `brew.1`
* Added information about frozen formulae to `brew upgrade` in `brew.1`
* Added `pin` et.al. to completion scripts.
* Unpin formulae when uninstalling them
* Unpin and re-pin formulae when upgrading (avoids stale symlink)

References Homebrew/homebrew#18386.
Closes Homebrew/homebrew#18515.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2013-03-30 19:50:47 +00:00
Jack Nagel
593289a018 Make clear that this method discards arguments 2013-03-28 17:37:28 -05:00
Jack Nagel
8d000110cc Move this method somewhere more appropriate 2013-03-20 22:32:56 -05:00
Jack Nagel
c79d7272c8 Move Formula.all to compat 2013-03-20 22:32:56 -05:00
Mike McQuaid
b578a47bb9 brew-info: specify whether poured or built.
- Store in the tab if a bottle was poured for the build.
- Add an additional line of output to `brew info` outputting whether
  the formula was built from source or poured from a bottle.

Closes Homebrew/homebrew#18430.
Closes Homebrew/homebrew#18475.
2013-03-20 23:06:38 +00:00
Jack Nagel
c8168d8a4a Simplify SoftwareSpec checksum methods
Reader methods for specific checksum types have been absent from the
Formula class for some time, so there isn't any reason to expose them in
SoftwareSpec, either.

Thus, these methods now only act as setters, and #checksum should be
used to access the constructed Checksum object.
2013-03-18 15:10:36 -05:00
Jack Nagel
f8b4959742 Use a priority queue to select compilers
The existing case-statement with nested if-statements is gross and hard
to extend. Replacing it with a priority queue simplifies the logic and
makes it very easy to add new compilers to the fails_with system, which
we will likely want to do in the future.
2013-03-16 13:05:02 -05:00
Jack Nagel
7104e20bde Replace custom collection with Set
The original constraints that led to using a custom collection rather
than Array or Set here no longer exist, so let's avoid the pointless
abstraction here.
2013-03-16 13:05:02 -05:00
Jack Nagel
cc08d08d74 Switch compilers when no build is specified
Given the current state of OS X compilers, the original fails_with
behavior is becoming less useful, mostly resulting in build failures
each time the compiler is updated. So make the following changes:

When a build is specified, we retain the old behavior: switch compilers
if the available compiler is <= the build, don't switch if it is > the
build.

When no build is specified, unconditionally switch compilers, and don't
output the advice message. This allows us to mark formulae as
perpetually failing, avoiding the need to update formulae each time a
new compiler build is made available.

As a bonus, this makes the logic much easier to reason about.

Closes Homebrew/homebrew#18175.
2013-03-12 13:55:15 -05:00
Jack Nagel
79a67fd097 Pass filename and lineno arguments to class_eval 2013-03-12 00:38:52 -05:00
Mike McQuaid
8f35793020 Support 32-bit 10.6 bottles.
Closes Homebrew/homebrew#17735.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2013-03-01 17:49:09 +00:00
Mike McQuaid
22aec1d0d9 Add custom bottle URL support.
Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2013-03-01 17:49:09 +00:00
Adam Vandenberg
2e29260935 Revert "Shouldn't override def patch"
This reverts commit 6963a356510256762e425b5dbe2ee8c9ee0ace68.
2013-02-24 12:16:32 -08:00
Adam Vandenberg
72afade1ee Shouldn't override def patch 2013-02-22 09:34:06 -08:00
Jack Nagel
4749339e5b Formula: fix class-level version accessor
When given no arguments, this should return the stable version, but it
hasn't since we stopped setting this direction in the class's @version
variable.
2013-02-21 22:19:11 -06:00
Mike McQuaid
b65aa8a2f3 Only fails_with compiler version for developers.
Actually works properly now.

This reverts commit a0e56345ea55f7ee3c41d6bf13f9cfb3af635323.
2013-02-21 21:40:15 +00:00
Jack Nagel
1a799f04e6 Remove unused variables 2013-02-18 12:13:35 -06:00
Jack Nagel
57337a0748 Fix serialization of used_options 2013-02-16 21:19:35 -06:00
Jack Nagel
f93b4f44ad Fix option flag naming for tap deps
Fixes Homebrew/homebrew#17866.
2013-02-16 17:22:11 -06:00
Adam Vandenberg
d71c8beac9 formula: cinch up formatting 2013-02-11 21:33:43 -08:00
Jack Nagel
a63fa4356a Remove dead code
This code only existed to support very old formula syntax, which was
otherwise removed in e6b97bebd99779b52462dcd387191d804fc95b93.
2013-02-11 21:06:03 -06:00
Jack Nagel
248891fde1 Avoid nil in URL specs 2013-02-11 20:52:07 -06:00
Jack Nagel
97d3ae1775 Extract formula locks into a class 2013-02-09 18:19:50 -06:00
Jack Nagel
ea15442b9a Move ruby methods to FileUtils extension 2013-02-02 11:24:55 -06:00
Jack Nagel
2dac10a711 Fix args to ruby method 2013-02-02 11:23:55 -06:00
Adam Vandenberg
ea03719a34 Formula is not a formula.
Closes Homebrew/homebrew#17492.
2013-02-01 09:25:47 -08:00
Jack Nagel
1408610b81 Proper recursive expansion of requirements with filtering
Expand requirements recursively while applying the same optional? and
recommended? filters that dependencies are run through. Options
generated by requirements are now checked against the correct list of
requirements, eliminating the temporary "best guess" logic in the
installer.
2013-01-31 15:40:06 -06:00
Mike McQuaid
1bc460403b Make local bottle installation more robust.
Use versions to better get hold of the filename.
2013-01-30 21:51:21 -08:00
Mike McQuaid
0a3530ecd9 Add ruby/rake functions to use system framework version. 2013-01-30 21:29:19 -08:00
Mike McQuaid
58bc3b8054 Add bash and zsh completion directory functions. 2013-01-30 21:29:19 -08:00
Mike McQuaid
599b012702 Add pour_bottle? method to Formula.
Allows a formula to selectively disable bottle pouring.
e.g. the default Boost bottle does not work with a brewed Python.

Fixes Homebrew/homebrew#17142
2013-01-29 17:14:11 -08:00
Mike McQuaid
b58077b3e8 Don't use underscores in (new) bottle filenames.
Closes Homebrew/homebrew#14270
2013-01-29 17:14:09 -08:00
Jack Nagel
e9014c436c Generate options for optional and recommended requirements 2013-01-28 10:35:15 -06:00
Jack Nagel
adf90691f1 Split dependency classes into separate files 2013-01-26 20:30:05 -06:00
Jack Nagel
f62762b3ab Generate options immediately following depends_on
Given

  depends_on 'gnutls' => :recommended
  depends_on 'libgcrypt' unless build.without? 'gnutls'

the dependency on libgcrypt should be enabled by default. However, the
corresponding option has not yet been generated, so the condition is
true and the dependency is disabled.

Instead, add a hook method that fires after each depends_on and adds the
appropriate option.
2013-01-26 18:20:36 -06:00
Jack Nagel
9a179d8b06 locks: ensure lock directory exists
Fixes Homebrew/homebrew#17326.
2013-01-26 13:18:45 -06:00
Jack Nagel
109145bf21 Replace usages of recursive_deps with recursive_dependencies 2013-01-26 12:14:49 -06:00