58 Commits

Author SHA1 Message Date
Adam Vandenberg
a3668bef76 Find version number in *-src.tarball
Signed-Off-By: Max Howell <max@methylblue.com>

I added a unittest.
2009-09-25 18:57:44 +01:00
Max Howell
44a1fa418e Use full paths to all system utilities
Otherwise you run the risk of not running the exact version / make of the utility you planned.

Fixes Homebrew/homebrew#48

Really we need to do this formula too, so I guess a make and cmake function are on the way…
2009-09-24 18:26:24 +01:00
Clinton R. Nixon
44a3d59630 Added small DSL for formulas
You can now use "url", "version", "homepage", and any checksums as
class methods, like so:

    class Dos2unix <Formula
      url 'http://www.sfr-fresh.com/linux/misc/old/dos2unix-3.1.tar.gz'
      md5 '25ff56bab202de63ea6f6c211c416e96'
      homepage 'http://www.sfr-fresh.com/linux/misc/'
    end

The previous usage ("@url = 'http://example.com/tarball.tgz'") still
works, maintaining compatibility with previous formulas.

"dos2unix.rb" is translated into the new format as an example.
2009-09-23 14:51:11 -04:00
Max Howell
e9701dbc81 Merge branch 'deps'
Conflicts:
	Library/Formula/imagemagick.rb
	Library/Formula/taglib.rb
	Library/Homebrew/brew.h.rb
	Library/Homebrew/formula.rb
	bin/brew
2009-09-21 18:46:28 +01:00
Max Howell
3d421c8649 Update references to masterbrew
I left update_from_masterbrew! as a historical reference.
2009-09-18 14:32:21 +01:00
Max Howell
710a160b8f Rename refresh_brew.rb to update.rb
I didn't change the class name, it's clear from the context where it is used what it does. However when just looking at files to figure out the nature of Homebrew I believe in clear naming.

Otherwise funny names earn you points.
2009-09-17 18:39:58 +01:00
Eloy Duran
7ebd012128 Made the Library tests green on 10.6.0 2009-09-17 00:24:59 +02:00
Eloy Duran
bb03db8e6c Before trying to update, first checkout the masterbrew branch. 2009-09-17 00:24:11 +02:00
Eloy Duran
c9f056c327 Make sure git commands in RefreshBrew are executed with the proper working dir. 2009-09-17 00:24:11 +02:00
Eloy Duran
c1989b79ad Update Homebrew and list the updated formulae. 2009-09-17 00:24:11 +02: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
David Höppner
f150e5ece2 Fix unittest test_arch_for_command for 10.5 2009-09-14 20:33:46 +01:00
Sean Wolfe
80a54dc5b2 Couchdb and dependency formulae
Signed-off-by: Max Howell <max@methylblue.com>

I squashed a number of commits here, and also replaced the use of nspr.prefix with HOMEBREW_PREFIX as in theory we are flexible with our requirement for dependencies, although with the limited build system that SpiderMonkey possesses this is difficult for us to achieve anyway…
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
d62fd87436 Fix lame version, eg. 398-2
Included test this time!
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
981dba1b35 Function to return a binary's Mach-O architectures
Added a utility method to get an array of architecture names for
a given executable.

This will be useful for, say, figuring out what Python was compiled for,
to know what to compile a C-based module as.

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

I added a test and made the function use `which` if the path provided is not
absolute. I considered allowing relative paths, but then it is possible for
the function to take eg. the svn binary from the current directory when you
meant the one in the path, and that could be a confusing bug.
2009-09-10 18:17:15 +01:00
Étienne Barrié
3809c0b419 Add support for SHA256 2009-09-07 16:10:50 +02:00
Étienne Barrié
b2e12c4517 Add test for SHA1 2009-09-07 15:26:43 +02:00
Max Howell
e30c1c8850 Cache ARGV calcs
Means unshift doesn't work, but well, that's almost a feature :P
2009-09-05 14:35:26 +01:00
spicyj
ba8ba4c451 Improvements to build environment determination
Simplified hardware model testing.

Even smarter compiler option generation using sysctl and new GCC 4.2 features.

Get processor count from sysctl and thus remove our dependency on RubyCocoa.
2009-09-03 16:34:31 +01:00
Max Howell
422ec29363 Tests for Pathname+Yeast
I removed the rename and mv functions as when I wrote the tests I realised the function implied the pathname object would be updated to reflect the moved or renamed file. However that cannot be done. Also frankly I think writing it out in full makes clearer code.
2009-09-02 15:07:26 +01:00
Max Howell
fbda4b45d6 Build optimisations for 64 bit Snow Leopard
Specifying -v/--verbose shows the build environment before the build

MACOS_VERSION contains the floating point value of the OS X version

A test for some floating point assumptions I make
2009-09-02 15:07:18 +01:00
Max Howell
f6743bbfd7 Tests for hw.model and brew.h.rb 2009-09-01 12:05:26 +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
11c67fe0b4 Ruby 1.9 version style 2009-08-30 15:49:38 +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
f9d7b34945 Don't return a version that equals the basename
Return nil instead
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
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
Adam Vandenberg
9bc60b80b6 Fix comment about ENV overrides 2009-08-21 14:40:26 +01:00
Max Howell
355bfc1751 Pathname.version on directories ignores extname
Because directories don't have extensions.

Included test
2009-08-12 13:43:20 +01:00
Max Howell
ab9f59f227 More ARGV tests 2009-08-11 01:30:39 +01:00
Max Howell
e24e46c793 TEST Zip'd archives can be extracted 2009-08-10 18:16:12 +01:00
Max Howell
dae260561e Support github tagged download versions
eg. http://github.com/lloyd/yajl/tarball/1.0.5
2009-08-10 18:11:23 +01:00
Max Howell
6dbdc9ab0c Remove duplicates from ARGV.named
Includes test
2009-08-10 18:11:23 +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
Max Howell
e9dbdadcac Remove all testing temporaries when done 2009-08-04 01:31:32 +01:00
Max Howell
a1d5450f0c The unittest now emulates a fresh install better
In future, this will hopefully prevent regressions like issue Homebrew/homebrew#7.
2009-08-04 01:07:36 +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
a5ca752658 Refactor and clean up code 2009-08-01 18:10:20 +01:00
Max Howell
055a694cd4 More tests for Formula and Keg 2009-07-31 14:21:27 +01:00
Max Howell
7e0d5bf165 Tests for Formula.* 2009-07-31 14:04:24 +01:00
Max Howell
5fd7fd0578 A basis for full test coverage 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
Max Howell
fb5aefd4a0 Refactor--object orientate where sensible 2009-07-24 23:57:54 +01:00
Max Howell
17968f51c4 Support gloox version style 2009-07-10 03:11:05 +01:00
Max Howell
a648e46d8a Leave permissions of installed files in sensible state
No write permission for files, executable when required etc.
2009-06-26 13:05:48 +01:00