898 Commits

Author SHA1 Message Date
Jack Nagel
4ee255134d Replace UI uses of 'folder' with 'directory'
There are still methods and variables with the word "folder" in the
name, but at least user-facing messages and warnings should use the
correct terminology.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2012-02-24 19:43:40 -06:00
Max Howell
2431c00c92 Move this code into FormulaInstaller
The correct location for it IMO. Also added warning for the user.
2012-02-21 11:40:06 +00:00
Adam Vandenberg
47a81b0b80 Complain about non-exes in bin and non-libs in lib 2012-02-20 18:03:31 -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
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
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
Felix Buenemann
6012e29986 Omit check_m4 warning when appropriate
If the suggested modifications are already in place, just skip the
warning.

Closes Homebrew/homebrew#8624.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2012-01-01 23:15:31 -06:00
Charlie Sharpsteen
d83076c07e Generalize formula_installer dependency resolution
Use `Formula.factory dep.path` instead of `Formula.factory dep.name` so that
non-standard dependencies specified as URLs or paths can be handled properly.
2011-12-26 11:58:25 -08:00
Adam Vandenberg
fca07369ab Omit empty caveats 2011-12-20 20:11:54 -08:00
Misty De Meo
d9c3f19e6a Fix installation error from ARGV --HEAD filter
The ARGV filtering would strip `--HEAD` from dependency installations,
then proceed with trying to install the dependency from the latest
version in the formula. This causes an error if the latest version is
already installed, so check to see if formula is installed before
performing the installation.

Closes Homebrew/homebrew#8869.

Signed-off-by: Charlie Sharpsteen <source@sharpsteen.net>
2011-11-29 09:32:05 -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
Charlie Sharpsteen
e04e23492c formula_installer.rb: Improve receipt check
Using `f.installed?` instead of `f.prefix.exist?` ensures something was created
by the installation step before the install receipt is written.
2011-11-23 12:25:00 -08:00
Charlie Sharpsteen
39b3ed3c33 formula_installer.rb: Hotfix for head installs
For now, don't strip `--HEAD` from `ARGV` prior to forking for install.
Currently this doesn't work because the formula object the installer is acting
on has its `prefix` set while under the influence of `--HEAD`. So, the
installer bails out when it sees that nothing is installed to `f.prefix`.

This is a hotfix for issue Homebrew/homebrew#8668 to allow formulae to keep building. A proper
fix should ensure that formula installers are operating on objects with
appropriately set `prefix` values.
2011-11-21 11:26:05 -08:00
Charlie Sharpsteen
eefbf00963 Don't write receipt for empty installs
Fixes Homebrew/homebrew#8616.
2011-11-16 10:42:02 -08:00
Charlie Sharpsteen
33a61d1897 Add --fresh option to brew install
When invoked, this option will ensure brew doesn't re-use any options from
previous installs of a formula.
2011-11-14 10:44:18 -08:00
Charlie Sharpsteen
8ec2d8e043 Hotfix for filtered_args breaking brew upgrade
The `filtered_args` method added to the `FormulaInstaller` makes a call
`ARGV.formulae`. Unfortunately, `ARGV.formulae` will throw a
`FormulaUnspecifiedError` instead of returning an empty list. This patch
avoids the issue by checking `ARGV.named.empty?` before calling
`ARGV.formulae`.

Fixes Homebrew/homebrew#8576.
2011-11-14 08:22:59 -08:00
Charlie Sharpsteen
ec1c7aaa38 metadata: Use options from previous installs
FormulaInstaller now loads the install recipt of a previous install and appends
the `used_options` to ARGV before forking to build. This means `brew upgrade`
will "remember" which options were invoked for the last install and re-use
them.

Fixes Homebrew/homebrew#5250.
2011-11-13 12:14:56 -08:00
Charlie Sharpsteen
028104b861 metadata: Record installation options
Adds a new class called `Tab` that acts as a recipt for install options. A
`Tab` can be serialized to a JSON file for future reference.
2011-11-13 12:14:56 -08:00
Charlie Sharpsteen
cb681ffff6 formula_installer.rb: Pre-process ARGV before fork
`ARVG` is now filtered before the formula installer forks a new process. This
allows a chance to do things like strip out `--HEAD` flags for formulae that
weren't explicitly passed as arguments but came in as dependencies.

Fixes Homebrew/homebrew#7724.
2011-11-13 12:14:55 -08:00
Charlie Sharpsteen
555b9d149f formula_installer.rb: Call link before check_PATH
Otherwise, for formula that making the very first install into `sbin`, the
following line will fail with a critical error:

    bin = (HOMEBREW_PREFIX/bin.basename).realpath.to_s

Because `sbin` will not exist until after `link` runs.

This isn't very clean as it moves `check_PATH` away from the other checks in
`caveats`, but I couldn't think of a better hotfix that did not require a bit
of code shuffling and re-writing.
2011-09-13 19:40:51 -07:00
Adam Vandenberg
88538c2b4b Fix stripping of keg-only reasons during install 2011-09-01 10:06:28 -07:00
Max Howell
be79906b62 Only use the bottle if its version is up-to-date
Rationale: if you edit a formula to use a different source URL it should build that and not the pour the bottle. Obviously.
2011-08-25 02:37:18 +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
45ba18b4d5 Rename install.rb to build.rb for clarity and great justice
It was just confusing, and since the `brew upgrade` refactor this makes more sense too.

Shame it still downloads in there etc. but whatever. Homebrew 2 will fix!
2011-08-24 22:30:44 +01: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
19e387d92e brew upgrade
Consequence: you can no longer install when something is already installed, you must upgrade it. This doesn't apply if the formula in question was unlinked. You can still --force installs though.

Rationale: the old way of installing over the top would leave symlinks to multiple versions in /usr/local if the old version had a file the newer version didn't. The new upgrade command handles everything properly.
2011-08-24 22:30:43 +01:00
Adam Vandenberg
c5923168d6 Move -- higher in argument list
A spurious "--" argument was being passed to the installer script.
2011-06-21 07:27:13 -07:00
Adam Vandenberg
e4dce3d1c9 Show which deps will also be installed. 2011-04-07 08:00:12 -07:00
George Kulakowski
14d14fa69a Fix UnsatisfiedExternalDependencyError
The refactor branch doesn't catch the UEDE and print the error message
containing information about which dependency and how to install
it. This adds back that logic.

Signed-off-by: Adam Vandenberg <flangy@gmail.com>
2011-03-12 11:55:10 -08:00
Adam Vandenberg
bb58511b31 Fix 'brew install f' for already-installed brews. 2011-03-12 11:55:08 -08:00
Max Howell
cf29569099 More modular cmd/install and FormulaInstaller 2011-03-12 11:55:02 -08:00
Adam Vandenberg
06c7f4a29d fix jruby external deps 2010-10-21 21:58:18 -07:00
Adam Vandenberg
f990f083e8 ARGV - rename method that conflicts with optparse
optparse adds an "options" method to ARGV, and so does Homebrew.
Rename this method (and remove optparse blocking script) so that
Homebrew plays nicer with external Ruby software.

This fixes the issue where "gem install thin" would break
"brew server", for instance.
2010-08-07 18:08:51 -07:00
Adam Vandenberg
1f1da9266c Fix message and undent for external deps 2010-07-21 09:09:15 -07:00
Max Howell
a496ca0166 Make expand_deps a class function 2010-07-18 10:45:57 -07:00
Max Howell
5d75197c04 Some String.dedent action 2010-07-18 10:44:44 -07:00
Adam Vandenberg
cfc8fca74d Support jruby external dependencies.
* Add tests that run only if 'jruby' is installed.
* Note that if your formula has :jruby deps, it should likely
  "depend_on 'jruby'" as well.
2010-04-09 11:21:35 -07:00
Adam Vandenberg
d84b1711d0 Fix external perl checker. 2010-03-19 14:03:44 -07:00
Andre Arko
c2f1a41bbc Add support for external ruby deps, and fix external deps system.
Kernel#system special-cases the first argument, so you have to
make the first argument the entire command to be invoked, and
subsequent arguments the actual arguments to that command. In
order to use the user's interpreter, the first argument must be
"/usr/bin/env <name>".

Signed-off-by: Adam Vandenberg <flangy@gmail.com>
2010-02-25 09:17:00 -08:00
Max Howell
4bfb7cf24d Don't require beer_events
RubyCocoa is a large dependency, and any large system can cause unexpected errors. In this case the user's system was badly setup and RubyCocoa caused a dynamic loader issue.

We don't use beer_events currently due to other bugs that occurred sporadically with its use. So requiring it is unnecessary. So lets save ourselves trouble.

Fixes Homebrew/homebrew#487
2010-01-17 20:56:24 +00:00
Max Howell
df3cca94e1 Support Perl/CPAN external dependencies
WhoHas requires LWP::UserAgent.
2010-01-13 11:56:23 +00:00
Max Howell
9f871c9955 Adds: depends_on 'simplejson' => :python
So far we only added python, but we can add more.

Fixes Homebrew/homebrew#401
2010-01-13 11:23:15 +00:00
Max Howell
d3a52adce3 Nice the install process
Makes a big difference on OS X, you can still use the GUI and that.
2009-12-02 10:39:26 +00:00
Max Howell
fd3ddf8a72 Disable watch_out_for_spill temporarily
It's a great feature but it seems to conflict with our new system() replacement. Clearly the bug is still in our system() but what exactly it is is not clear and this bug sucks.

See Homebrew/homebrew#124
2009-11-11 17:29:34 +00:00
Max Howell
1da26d89ea Don't use Kernel.system much
It just seems to behave strangely with SIGINT. Eg. SIGINT causes tar to exit, but the SIGINT is ignored by our process. This is not the case when used with curl.
2009-11-09 17:55:11 +00:00
Max Howell
22afc5e1c7 Use our own popen implementation in Formula.system
The rationale here is that the --verbose mode had a bug where it didn't escape its parameters properly. Which caused ocassionally cryptic issues.
2009-11-08 15:21:09 +00:00
Max Howell
794a55a72b brew install improvements
Couldn't make this atomic, apologies.

Fixes a few things, like deps failing to build not aborting the install.
--force now works properly again.

Overall more robust code. I went back over it all and gave it a lot of
thought.

Cleaner separation of logic. Less code in brew, now the only code there is
ARGV handling, and basic sanity checks.

Not extending ARGV or ENV in global now as that would propagate to other tools
or utilities you may write.
2009-11-07 18:22:28 +00:00