1648 Commits

Author SHA1 Message Date
Max Howell
ee2b521ca8 Solving the GNU GetText issues
GNU GetText breaks eg. Ruby 1.9 builds, and some other formula I have been building too. But it is required by eg. glib. So to solve this we are going to by default not symlink gettext into the Homebrew prefix.

Formula that depend on GetText will have the gettext paths added to the brewing environment automatically. Neat.
2009-09-17 22:01:27 +01:00
Max Howell
c71d4ad2bc Default to patch level 1
Having gone through our patches it's clear that p1 is more standard.

Also fixed a bug where returning DATA outside of an array would fail to patch.
2009-09-16 17:08:32 +01:00
Max Howell
c28bd7b571 Allow formulae to use __END__
For this to work the "running script" must be the formulae file. Making this
so wasn't so hard, there is now an install.rb script which is included with
the -r flag to the ruby executable. An at_exit handler calls the install
function.

Having the install logic in its own file made it feel like there was so much
space that I added extra error handling. So there is something to be said for
separating functionality out into its own files.

Still the error handling sucks, we'll need to marshall the exception back to
the bin/brew command. Which is another PITA.

Still overall I think this will prove worthwhile. But if it doesn't we'll
revert.

As a first usage, you can put a diff after __END__ and return DATA from
Formula::patches to make Homebrew aware of it.
2009-09-16 14:49:06 +01:00
Max Howell
fd5ed391be Support patching using diffs on local filesystem 2009-09-16 14:49:05 +01:00
Brian Smyth
0a2cdea5fd Teach patch to uncompress patches if necessary.
This change also eliminates the somewhat duplicate codepath if patches
returns and Array rather than a Hash.
2009-09-16 14:49:05 +01:00
Clinton R. Nixon
6ee6bee01f Clean up indentation
Signed-off-by: Max Howell <max@methylblue.com>

I didn't commit it all, apologies. But I just can't read the sections nearly as easily if you indent private and protected. If it's a Ruby convention it frankly seems at odds with the rest of Ruby spacing conventions.
2009-09-14 20:33:46 +01:00
Max Howell
46ac04e410 Formula::var
Points to eg. Cellar/wget/var rather than Cellar/wget/1.1.5/var

Discussion: 1689bbc326f1201ea979178ebcadba344abf2568
2009-09-14 20:33:46 +01:00
Max Howell
f0f59659dd Overriding Object.class was not my intention
Renamed to Formula::class_s.
2009-09-11 17:42:53 +01:00
Max Howell
0a31190fdc Dependency resolution
Specify dependencies in your formula's deps function. You can return an Array,
String or Hash, eg:

    def deps
      { :optional => 'libogg', :required => %w[flac sdl], :recommended => 'cmake' }
    end

Note currently the Hash is flattened and qualifications are ignored. If you
only return an Array or String, the qualification is assumed to be :required.

Other packaging systems have problems when it comes to packages requiring a
specific version of a package, or some patches that may not work well with
other software. With Homebrew we have some options:

1.  If the formula is vanilla but an older version we can cherry-pick the old
    version and install it in the Cellar in parallel, but just not symlink it
    into /usr/local while forcing the formula that depends on it to link to
    that one and not any other versions of it.
2.  If the dependency requires patches then we shouldn't install this for use
    by any other tools, (I guess this needs to be decided on a per-situation
    basis). It can be installed into the parent formula's prefix, and not
    symlinked into /usr/local. In this case the dependency's Formula
    derivation should be saved in the parent formula's file (check git or
    flac for an example of this).

Both the above can be done currently with hacks, so I'll flesh out a proper
way sometime this week.
2009-09-10 19:23:03 +01:00
Adam Vandenberg
c3169b5600 Display exit code when nonzero.
Brew fails if a tool (make, or whatever) doesn't return an exit code
of 0. This patch displays the non-zero code on failure, so we can
better diagnose what caused the build to fail (or if we need to add
that exit code as exception 'success code'.)
2009-09-10 18:17:15 +01:00
Max Howell
c92e566976 We should certainly have a Formula::share()
I removed this months back as I found it confusing, does it mean:

prefix+'share' or prefix+'share'+name()

But honestly, it's obvious, it's the former. It's the same as the other path
functions.
2009-09-10 17:21:14 +01:00
Étienne Barrié
3809c0b419 Add support for SHA256 2009-09-07 16:10:50 +02:00
Max Howell
680e201923 Fix double newline after Interrupt
Seems to be an issue with Ruby system() call doing a double fork.
2009-09-05 20:46:07 +01:00
Ask Solem
21df479f1b Thrift formula
Thrift is a software framework for scalable cross-language services
development. It combines a powerful software stack with a code generation
engine to build services that work efficiently and seamlessly between C++,
Java, Python, PHP, and Ruby. Thrift was developed at Facebook and released as
open source.
2009-09-03 16:34:35 +01:00
Ben Alpert
b71b8e3972 Dict.org client formula
Added Formula::etc()

Added Pathname::write() convenience function which can write a string out to
the file it points too, raising if it would have to overwrite.
2009-09-01 11:15:25 +01:00
Max Howell
4d63b87e0a Change license to BSD
I confirmed this change with all relevant contributors first.
2009-08-31 16:09:17 +01:00
Max Howell
145e33abdf Better cache names for accessory-formula
Because formula don't get named unless the brew kit instantiates them accessory formula were getting named "__UNKNOWN__". Which sucks.

This isn't ideal for me as I made the naming use @name and @version to ensure unique naming. Now it is possible to have name clashes in the cache. So I need to solve it better at some point.
2009-08-30 16:11:44 +01:00
Max Howell
a1d31fabad FIX GithubGistFormula (fixes Homebrew/homebrew#20) 2009-08-30 15:32:15 +01:00
Adam Vandenberg
a67cf9bef2 Clarify --debug behavior.
Add a note that 'exit 1' will abort the installation in --debug mode.

Signed Off By: Max Howell <max@methylblue.com>

I ammended the text slightly and made the lines all 78 chars wide maximum.
2009-08-29 14:12:31 +01:00
Max Howell
f0c7e944bb Support optional HEAD builds for any formula
A formula can have just a @head url or the user can specify to install HEAD
with --head. We support subversion and git checkouts.

The version is set to HEAD for head builds.

Next step is making brew update handle these installs correctly.
2009-08-24 01:04:54 +01:00
Adam Vandenberg
4c2d4c8560 Add path for 'libexec'. 2009-08-24 01:04:53 +01:00
Max Howell
b6ccdad53e Proper validation of Formula.name and version 2009-08-24 01:04:53 +01:00
Max Howell
72bde8c583 Move download strategies into their own file 2009-08-24 01:04:53 +01:00
Max Howell
c532d11e7a Refactor away AbstractFormula
We'd gotten to the stage where Formula was so lean, it was pointless to
separate it.
2009-08-24 01:04:48 +01:00
Max Howell
b115f26870 GitDownloadStrategy
Untested
2009-08-24 01:03:30 +01:00
Adam Vandenberg
57a86034a3 Support building from Subversion repositories
Adds a new DownloadStrategy that checks files out from Subversion to the
cache, then exports over to the temp folder for the build.

To use checkout with the svn:// protocol or reimplement download_strategy and
return SubversionDownloadStrategy.
2009-08-24 01:03:30 +01:00
Adam Vandenberg
0eaf4bbcd9 Factor out downloading from Formula
This patch adds a ArchiveDownloadStrategy that handles downloading
tarbarlls and decompressing them into the staging area ready for brewing.

Refactored safe_system and curl into utils.rb

Signed-off-by: Max Howell <max@methylblue.com>

Modifications to Adam's original patch:

I reverted objectification of checksum verification because I couldn't think
of any other download validation methods that might be useful to us in the
future, so allowing such flexibility had no advantages. If we ever need this
to be OO we can add it. But for now less complexity is preferable.

I removed the @svnurl class member. Instead download_strategy is autodetected
by examining the url. The user can override the download_strategy in case this
fails. Thus we already can easily add support for clones of git repositories.
2009-08-24 01:03:23 +01:00
Adeel Ahmad Khan
1c55642645 Link binaries in sbin as well as bin.
Signed-off-by: Max Howell <max@methylblue.com>
2009-08-12 23:55:57 +08:00
Max Howell
a2066af2fd Allow user to specify patch level
The default is p0, but if you return a Hash instead of an array from patches you can specify patch level. See the comment documentation.

Closes Homebrew/homebrew#10
2009-08-11 18:16:12 +01:00
Max Howell
480bfa3793 CTRL-C for a child process should interrupt brew too 2009-08-10 18:17:11 +01:00
Max Howell
dd7bdce89c Abort debug install if exit is not zero 2009-08-10 18:16:47 +01:00
Max Howell
760c083c0c Refactor
Large refactor to Formula, mostly improving reliability and error handling but
also layout and readability.

General improvements so testing can be more complete.

Patches are automatically downloaded and applied for Formula that return a
list of urls from Formula::patches.

Split out the brew command logic to facilitate testing.

Facility from Adam Vandenberg to allow selective cleaning of files, added
because Python doesn't work when stripped.
2009-08-10 18:11:17 +01:00
Adam Vandenberg
cae0e78e60 Pull USERAGENT used by curl into constant 2009-08-10 16:15:24 +01:00
Adam Vandenberg
fea89daae6 Extract 'verify_download_integrity' method
In order to support more than just MD5 verification, extract 'verify_download'
into a separate method.
2009-08-10 16:14:43 +01:00
Max Howell
182ce1eff6 Formula::std_cmake_parameters
Because cmake syntax is batshit-insane, this stops people having to memorize
which parameters to supply, and thus prevents error.

I didn't do the same for Autotools deliberately as I have found that
which parameters are supported is somewhat inconsistent. Plenty don't even
support --disable-debug, thus I want the parameters getting used in the
contributors face so they can easily diagnose what is going on.
2009-08-06 20:25:59 +01:00
Max Howell
33b90794e1 HOMEBREW_CACHE is now a Pathname object
This is consistent with the other HOMEBREW_* path constants
2009-08-04 00:40:12 +01:00
Max Howell
8ce4e5923f FIX Github gist formulae 2009-08-04 00:36:48 +01:00
Max Howell
e2bc3c510e FIX allow @version to be set in derived Formula 2009-08-01 17:54:18 +01:00
Max Howell
055a694cd4 More tests for Formula and Keg 2009-07-31 14:21:27 +01:00
Max Howell
d082abbbe8 FIX only claim that Formula doesn't exist if it was a loaderror 2009-07-31 14:03:22 +01:00
Max Howell
c4972e218f FIX typo in formula.rb 2009-07-31 13:13:52 +01:00
Max Howell
5fd7fd0578 A basis for full test coverage 2009-07-31 04:59:08 +01:00
Max Howell
a39e0d20c3 opoo function for warning messages 2009-07-31 04:59:08 +01:00
Max Howell
9b19f194cc Refactor $foo into HOMEBREW_FOO
CONSTANTS are the far saner choice for these important parameters.

Split env up so I can redefine the CONSTANTS in unittest.rb.
2009-07-31 04:59:02 +01:00
Adam Vandenberg
ec65bb4819 Allow brewing without an MD5 hash
You can either have none, in which case a warning is displayed, or
you can have one, but it *must* match.
2009-07-31 00:29:58 +01:00
Max Howell
fc6e9e5bab Fix Formula.installed? 2009-07-29 01:00:26 +01:00
Max Howell
11060f399b Don't allow build to be rescued if the untar fails 2009-07-27 16:35:04 +01:00
Max Howell
fb5aefd4a0 Refactor--object orientate where sensible 2009-07-24 23:57:54 +01:00