1111 Commits

Author SHA1 Message Date
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
Jack Nagel
cf08b71bf8 FormulaInstaller: construct new ARGV from an Options collection
The array of options that is passed to the spawned build process is a
combination of the current ARGV, options passed in by a dependent
formula, and an existing install receipt. The objects that are
interacting here each expect the resulting collection to have certain
properties, and the expectations are not consistent.

Clear up this confusing mess by only dealing with Options collections.
This keeps our representation of options uniform across the codebase.

We can remove BuildOptions dependency on HomebrewArgvExtension, which
allows us to pass any Array-like collection to Tab.create. The only
other site inside of FormulaInstaller that uses the array is the #exec
call, and there it is splatted and thus we can substitute our Options
collection there as well.
2013-01-26 12:14:47 -06:00
Jack Nagel
55681ca201 Dependency.expand_dependencies
Move Formula.expand_dependencies into the Dependency class, and extend
it to allow arbitrary filters to be applied when enumerating deps.

When supplied with a block, expand_dependencies will yield a [dependent,
dependency] pair for each dependency, allowing callers to filter out
dependencies that may not be applicable or useful in a given situation.

Deps can be skipped by simple calling Dependency.prune in the block,
e.g.:

  Dependency.expand_dependencies do |f, dep|
    Dependency.prune if dep.to_formula.installed?
  end

The return value of the method is the filtered list.

If no block is supplied, a default filter that omits optional or
recommended deps based on what the dependent formula has requested is
applied.

Formula#recursive_dependencies is now implemented on top of this,
allowing FormulaInstaller to exact detailed control over what deps are
installed. `brew missing` and `brew upgrade` can learn to use this to
apply the installed options set when expanding dependencies.

Move Formula.expand_deps and Formula#recursive_deps into compat, because
these methods do not respect the new optional and recommended tags and
thus should no longer be used.
2013-01-26 12:14:46 -06:00
Adam Vandenberg
d0161091d8 Let option override with/without descriptions 2013-01-26 12:14:45 -06:00
Adam Vandenberg
6193167f58 Add support for optional and recommended deps
Optional deps are not installed by default but generate a corresponding
"with-foo" option for the formula. Recommended deps _are_ installed by
default, and generate a corresponding "without-foo" option.
2013-01-26 12:14:45 -06:00
Adam Vandenberg
99850fcbda Formula::finalize_dsl 2013-01-26 12:14:45 -06:00
Jack Nagel
37a56fa513 FormulaInstaller: implement installation locks
FormulaInstaller now attempts to take a lock on a "foo.brewing" file for
the formula and all of its dependencies before attempting installation.

The lock is an advisory lock implemented using flock(), and as such it
only locks out other processes that attempt to take the lock. It also
means that it is never necessary to manually remove the lock file,
because the lock is not enforced by I/O.

The uninstall, link, and unlink commands all learn to respect this lock
as well, so that the installation cannot be corrupted by a concurrent
Homebrew process, and keg operations cannot occur simultaneously.
2013-01-26 12:14:45 -06:00
Jack Nagel
e9e16fefa9 Dependency#to_formula and associated helpers 2013-01-26 12:14:44 -06:00
Jack Nagel
a569261a9b Formula#recursive_dependencies
This behaves like recursive_deps, but the resulting list consists of
Dependency objects instead of Formula objects. The list maintains the
installable order property of recursive_deps.

While in the area, add some comments clarifying the purpose of related
methods.
2013-01-26 12:14:43 -06:00
Jack Nagel
5088fdd543 Move BuildOptions to a separate file 2013-01-26 11:37:02 -06:00
Mike McQuaid
21f1efcba6 We use formulae as the plural of formula. 2013-01-26 13:16:55 +00:00
Jack Nagel
c53af42117 Allow env DSL to take a block
In addition to

  env :userpaths
  env :std

requirements can now do

  env do
    append 'PATH', '/some/path/to/bin'
    # and more
  end
2013-01-21 17:24:10 -06:00
Jack Nagel
58440a2c5b Make Formula#installed? more idiomatic 2013-01-17 21:30:23 -06:00
Jack Nagel
79295ecaf8 More robust way to avoid attempting to marshal Procs 2013-01-09 19:25:02 -06:00
Jack Nagel
003a9e7fd7 Don't store test Proc if we might need to marshall the formula
Procs cannot be marshalled, but formula objects may be as part of the
BuildError exception. If the formula object has a reference to a Proc,
this will fail.

Work around it by not storing the test Procs during installations.
2013-01-09 18:33:35 -06:00
Jack Nagel
967a60a054 Detect when tests are defined 2013-01-07 17:37:28 -06:00
Mike McQuaid
7473d2b12f Fix local bottle installation with hyphens. 2013-01-07 20:27:27 +00:00
Jack Nagel
1c99c68594 Allow tests to be specified in the DSL
Tests can now be specified as a block in the DSL. A temporary test
directory is set up automatically when calling Formula#test. The
semantics of the test remain the same: the block can either raise an
exception or return false to signal failure.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2013-01-06 21:22:31 -06:00
Jack Nagel
a358bee8e2 Clean up BuildEnvironment interface a bit 2012-12-26 14:37:02 -06:00
Jack Nagel
68d1dfe5d7 Revert "Add launchctl_instructions method"
This code makes assumptions about the existence of prefix which are
valid in the context of the installer, but not necessarily in the
context of `brew info`, thus `brew info` on an outdated formula errors
out.

This reverts commit e5b53dd64b769b67805d1054d906f7083939d905.
2012-12-16 19:56:15 -06:00
Lorenzo Manacorda
d23366ae9a Add launchctl_instructions method
Closes Homebrew/homebrew#16604.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2012-12-16 23:31:30 +00:00
Jack Nagel
8dafce0d95 Properly escape log filename
Closes Homebrew/homebrew#16485.
2012-12-11 14:01:36 -06:00
Mike McQuaid
c4fb2b73e2 Support installing bottles from local files. 2012-12-01 12:45:23 +00:00
Misty De Meo
9c294364c6 Fix Formula.factory for Formula subclasses
Fixes Homebrew/homebrew#16288.
2012-11-28 10:58:29 -06:00
Misty De Meo
a171ec18fe Formula.factory: raise on encountering non-Formula
Formula.factory naively assumed that any already-loaded constant
fed into it was a formula, with confusing results when trying to
`brew install` a name from the ruby stdlib.

Fixes Homebrew/homebrew#16284.
2012-11-28 10:01:00 -06:00
Mike McQuaid
faf51f254d Make generic caveats for launchd plist files. 2012-11-25 23:05:52 +00:00
Jack Nagel
c9ef48724c Remove outdated comment 2012-11-24 17:42:45 -06:00