aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/formula.rb
AgeCommit message (Collapse)Author
2013-01-28Generate options for optional and recommended requirementsJack Nagel
2013-01-26Split dependency classes into separate filesJack Nagel
2013-01-26Generate options immediately following depends_onJack Nagel
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-26locks: ensure lock directory existsJack Nagel
Fixes Homebrew/homebrew#17326.
2013-01-26Replace usages of recursive_deps with recursive_dependenciesJack Nagel
2013-01-26FormulaInstaller: construct new ARGV from an Options collectionJack Nagel
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-26Dependency.expand_dependenciesJack Nagel
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-26Let option override with/without descriptionsAdam Vandenberg
2013-01-26Add support for optional and recommended depsAdam Vandenberg
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-26Formula::finalize_dslAdam Vandenberg
2013-01-26FormulaInstaller: implement installation locksJack Nagel
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-26Dependency#to_formula and associated helpersJack Nagel
2013-01-26Formula#recursive_dependenciesJack Nagel
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-26Move BuildOptions to a separate fileJack Nagel
2013-01-26We use formulae as the plural of formula.Mike McQuaid
2013-01-21Allow env DSL to take a blockJack Nagel
In addition to env :userpaths env :std requirements can now do env do append 'PATH', '/some/path/to/bin' # and more end
2013-01-17Make Formula#installed? more idiomaticJack Nagel
2013-01-09More robust way to avoid attempting to marshal ProcsJack Nagel
2013-01-09Don't store test Proc if we might need to marshall the formulaJack Nagel
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-07Detect when tests are definedJack Nagel
2013-01-07Fix local bottle installation with hyphens.Mike McQuaid
2013-01-06Allow tests to be specified in the DSLJack Nagel
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>
2012-12-26Clean up BuildEnvironment interface a bitJack Nagel
2012-12-16Revert "Add launchctl_instructions method"Jack Nagel
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-16Add launchctl_instructions methodLorenzo Manacorda
Closes Homebrew/homebrew#16604. Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2012-12-11Properly escape log filenameJack Nagel
Closes Homebrew/homebrew#16485.
2012-12-01Support installing bottles from local files.Mike McQuaid
2012-11-28Fix Formula.factory for Formula subclassesMisty De Meo
Fixes Homebrew/homebrew#16288.
2012-11-28Formula.factory: raise on encountering non-FormulaMisty De Meo
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-25Make generic caveats for launchd plist files.Mike McQuaid
2012-11-24Remove outdated commentJack Nagel
2012-11-09Formula#system: don't try to close a closed streamJack Nagel
The new formula debugger users continuations to jump back up the stack, and thus anything that has the potential to be executed twice (i.e. ensure blocks) needs to to be essentially idempotent. Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2012-11-06Move conflict message into conflict classJack Nagel
2012-10-31Fix build failure being non-verbose when --verboseMax Howell
2012-10-28formula: shorten path helpersAdam Vandenberg
2012-10-28debrew: formula debugging for homebrewCamillo Lugaresi
A new feature for easing the pain of working with complex formulas, or formulas for large packages. When running brew in debug mode (-d), if an exception propagates outside the formula's install method, you now get a menu which lets you return to the point where the exception was raised and perfom several useful actions, such as: - printing a backtrace - entering IRB to examine the context and test ruby code - entering the debugger (if ruby-debug is available) - entering a shell - ignoring the exception or proceeding with the raise as normal Signed-off-by: Max Howell <mxcl@me.com> * Fixed conflict in build.rb. * Removed old debug handling in Formula.brew. Closes Homebrew/homebrew#10435.
2012-10-21Allow varags to skip_cleanAdam Vandenberg
2012-10-15Manage Requirements using ComparableSetMisty De Meo
ComparableSet only allows a single object of a given class, choosing the object with the greatest value. This was mainly created for Requirements, so that, e.g., two X11Dependencies of differing strictness don't both end up in the same requirement set. Fixes Homebrew/homebrew#15240.
2012-10-09Don't munge tapped formula names in Formula.factoryJack Nagel
This started happening as a result of bbc167b, which avoids reloading previously defined formulae. The exception alters its message if the name parameter appears to be a tapped formula, but this is lost if we only pass in the "stem" of the pathname. Long-term this probably needs some restructuring, perhaps with a separate exception for tapped formula, but for now this should re-enable the more useful error message. Fixes Homebrew/homebrew#15374. Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2012-09-28Only handle build-errors when it's a build-errorMax Howell
Refs Homebrew/homebrew#15164.
2012-09-27Make FileUtils extension available globallyJack Nagel
Now that we are monkeypatching copy_metadata, we should load our extension up front for consistency. Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2012-09-27Don't set $VERBOSE when building nonverboselyMisty De Meo
Setting $VERBOSE in the environment makes the haskell-platform build fall down, which is surely one of the odder bugs I've run into. See Homebrew/homebrew#15164.
2012-09-27When builds fail verbosely, be verboseMax Howell
2012-09-25Clean up and improve build-error output and logsMax Howell
All logs are now stored from each command executed in Formula.install. Error output is truncated to five lines in an attempt to not overwhelm the user and to encourage users to read the error output and report the bug properly. Maybe we can get that figure up from 70% to 90%.
2012-09-17info: Add JSON outputMisty De Meo
Output JSON with the --json=v1 option. Output is in an array, and supports one or more formulae (or all, with the --all option). Why 'v1'? The format is unstable, presumably we'll deprecate it someday. It should be solid by Homebrew 1.0. Closes Homebrew/homebrew#13299.
2012-09-14Support env :std, :userpathsAdam Vandenberg
Closes Homebrew/homebrew#14654.
2012-09-09Install plists by defaultAdam Vandenberg
2012-09-09allow skip_clean :laAdam Vandenberg
2012-08-31Hide --disable-debug from non verbose output alsoMax Howell
2012-08-30Fixes Homebrew/homebrew#14542; ocaml superenv issuesMax Howell
This patch removes most of the settings for CC, CXX etc. because we are trying to be minimal. Then we force the compiler to Homebrew's choice underneath in superenv. We however leave LD because we prefer that build-systems use the c-compiler for linking, it generally works better (copiously tested), however when the build-system explicitly calls ld, we respect that. This gets around the ocaml bug in question, since somehow clang was crashing during link, but the ld tool itself (which is kind of clang, kind of llvm-gcc) is okay with this. Also moved the setting of O (so that cc-args are refurbished) into a make wrapper. Not sure if this matter much, but seems more consistent.