Commit Graph
309 Commits
Author SHA1 Message Date
Jack Nagel faa35b4fcd Avoid unnecessary float to string conversion 2013-06-15 10:13:20 -05:00
Jack Nagel 55a122ea0c Run tests under actual OS version 2013-06-14 19:19:26 -05:00
Jack Nagel e17d2a24fc Use Hardware::CPU module 2013-06-14 10:34:17 -05:00
Jack Nagel 5f032942ed Remove unused variable 2013-06-12 17:25:29 -05:00
Jack Nagel 2bba5c3f07 Check method existence rather than Ruby version 2013-06-11 17:05:44 -05:00
Jack Nagel fa582cb9ac Add failing test for a misdetected version 2013-06-10 14:55:23 -05:00
Misty De Meo 30c79ab65b Add :ld64 dependency
This allows formulae which won't build with Tiger's ld to conditionally
request a dependency on the ld64 formula. This modifies the build
environment appropriately, and will only be active on Tiger.
2013-06-08 19:10:38 -05:00
Jack Nagel e660d7bdd8 Merge repeated deps with differing options
When expanding dependencies, repeated deps are treated as equal and all
but the first are discarded when #uniq is called on the resulting array.
However, they may have different sets of options attached, so we cannot
assume they are the same.

After the initial expansion, we group them by name and then create a new
Dependency object for each name, merging the options from each group.

Fixes #20335.
2013-06-08 12:23:15 -05:00
Jack Nagel a41d7942a0 Add Enumerable#group_by 2013-06-08 12:23:14 -05:00
Jack Nagel d74c024000 test_dependency_expansion: dep names should always be strings 2013-06-07 21:54:27 -05:00
Jack Nagel 99c976e8cb Fix failing test 2013-06-07 20:57:07 -05:00
Jack Nagel f155d31943 Decouple bottle tags from MacOS.cat 2013-06-06 16:02:27 -05:00
Jack Nagel 3f3c5ae976 Improve tokenization of version strings
Tokens like "b4", "beta1", "p195", &c. are now treated as atoms rather
than being broken down even further. Additionally, we enable support for
padding in the middle of versions strings, so we can successfully
compare something like "2.1-p195" with "2.1.0-p194" by inferring that
"2.1" is really "2.1.0".

This fixes the comparison "9.9.3-P1" > "9.9.3" which previously has not
been handled correctly.
2013-06-05 22:03:58 -05:00
Jack Nagel b262a009ba Add failing test for patchlevel version comparisons 2013-06-05 10:06:37 -05:00
Jack Nagel 0759cce3c2 Extract attr_rw from Formula for reuse
Closes #20239.
2013-06-04 11:06:18 -05:00
Jack Nagel b2972dc1f9 Allow explicit conversion of requirements to deps
Fixes #19857.
2013-06-03 16:52:00 -05:00
Jack Nagel 9dc4c326bf Remove empty test file
This breaks my test runner in weird ways.
2013-06-03 15:05:00 -05:00
Samuel John 0b50110107 Python 2.x and 3.x support
New `depends_on :python` Dependency.
New `depends_on :python3` Dependency.

To avoid having multiple formulae with endings -py2 and -py3,
we will handle support for different pythons (2.x vs. 3.x)
in the same formula.
Further brewed vs. external python will be transparently supported.

The formula also gets a new object `python`, which is false if
no Python is available or the user has disabled it. Otherwise
it is defined and provides several support methods:

python.site_packages # the site-packages in the formula's Cellar
python.global_site_packages
python.binary # the full path to the python binary
python.prefix
python.version
python.version.major
python.version.minor
python.xy # => e.g. "python2.7"
python.incdir # includes of python
python.libdir # the python dylib library
python.pkg_config_path # used internally by brew
python.from_osx?
python.framework?
python.universal?
python.pypy?
python.standard_caveats # Text to set PYTHONPATH for python.from_osx?
python.if3then3 # => "" for 2.x and to "3" for 3.x.

Further, to avoid code duplication, `python` takes an optional
block that is run twice if the formula defines depends_on
:python AND :python3.

python do
  system python, 'setup.py', "--prefix=#{prefix}"
end

Read more in the Homebrew wiki.
2013-06-03 17:29:43 +02:00
Jack Nagel 4635363e2f test_mach: move helper method out of global namespace 2013-06-01 19:40:26 -05:00
Jack Nagel b433d51586 Require hardware where it is needed 2013-06-01 19:38:48 -05:00
Jack Nagel 54e6140a18 Add tests for Formula#installed_prefix 2013-05-25 17:19:19 -05:00
Jack Nagel ae57857ac5 tests: extract common formula helper 2013-05-25 17:19:18 -05:00
Jack Nagel a121f7850c Fix CompilerSelector tests on systems that have gcc 4.0 2013-05-21 22:44:23 -05:00
Misty De Meo 7780e13182 CompilerSelector: raise when no compatible compiler
This replaces the old behaviour of falling back to the original
compiler with no messaging.

Fixes #19170.
Fixes mistydemeo/tigerbrew#45.
2013-05-20 23:25:15 -05:00
Jack Nagel e830796fb7 Add test for ARGV.flag? 2013-05-20 22:34:53 -05:00
Jack Nagel 4b2ea73f2e test_keg: reduce noise by including FileUtils 2013-05-14 16:29:36 -05:00
Jack Nagel aece0a4e0a test_keg: make mode an ivar 2013-05-14 16:29:36 -05:00
Jack Nagel 2a35e35336 Add type accessors to Dependencies 2013-05-10 23:45:06 -05:00
Jack Nagel 565a5fe126 Refactor Dependency.expand 2013-05-10 23:45:05 -05:00
Jack Nagel 366ac016bd Reorganize compat 2013-05-10 23:27:28 -05:00
Desmond Brand fc565bee26 Overwrite broken symlinks with --overwrite
Closes #19480.

Signed-off-by: Misty De Meo <mistydemeo@gmail.com>
2013-05-09 09:21:34 -05:00
Jack Nagel 62389cc274 Reduce allocations in dependency construction
By always passing around a single, unnested array rather than splatting
and then defensively flattening and compacting things, we can avoid
allocating a bunch of unnecessary arrays. This gives a performance boost
of roughly 4% when enumerating 2500 formulae, and has the side effect of
cleaning up the dependency API.
2013-05-06 16:08:50 -05:00
Jack Nagel 0d001785fd TypeError is appropriate here 2013-05-06 16:08:49 -05:00
Jack Nagel 777473449b Don't test error message
Now that we are testing for a custom exception type, we don't need to
make any assertion about the message.
2013-04-27 14:50:35 -05:00
Jack Nagel 03a4ecfbca Allow brew versions to work with underspecified formulae 2013-04-27 14:44:48 -05:00
Mike McQuaid 94a944aa3f Add deps target to tests Rakefile for needed gems. 2013-04-26 22:32:26 +01:00
Jack Nagel 2cf21c31b6 Add a couple more version tests 2013-04-24 15:02:05 -05:00
Jack Nagel e279048d01 Split up big version detection test 2013-04-24 15:01:54 -05:00
Jack Nagel b596f73c03 Add tests for FormulaPin and simplify implementation 2013-04-16 01:58:11 -05:00
Jack Nagel ee5e60edf2 Don't create MacOS.version multiple times 2013-04-15 16:04:35 -05:00
Jack Nagel 884a4aa812 Remove extra require 2013-04-13 20:07:14 -05:00
Jack Nagel a99554879d Use assert_operator 2013-04-13 19:50:02 -05:00
Jack Nagel ef4de70a5f Remove obsolete tests
This behavior is now tested at more appropriate levels in
test_software_spec, test_formula_spec_selection, and
test_formula_validation.
2013-04-13 18:23:06 -05:00
Jack Nagel 04e2ae6d60 Make a specific assertion in this test 2013-04-13 17:40:14 -05:00
Jack Nagel 6f252fe1d2 Raise a useful exception for incomplete formulae 2013-04-13 17:40:14 -05:00
Jack Nagel d78efa8f02 Add tests for formula spec selection
These tests document the relative precedence of the stable, bottle,
devel, and head specifications, and the conditions that can influence
which is selected (e.g. command-line flags).
2013-04-13 17:40:13 -05:00
Jack Nagel f0b7f44415 Allow "devel-only" formulae
It seems only natural that this should be possible, or at the very
least, it should not result in calling methods on nil.
2013-04-13 17:40:13 -05:00
Jack Nagel 563d8be6bd Improved formula attribute validation
The initializer for Formula does a number of validations, but it does
them in a weird order, and some attributes aren't validated under
certain circumstances. This became even more of a mess when most
software package attributes were moved into the SoftwareSpec class.

This commit removes the last vestiges of storing these attributes as
instance variables. In particular, it eliminates #set_instance_variable
and #validate_variable, replacing them with methods that operate on
SoftwareSpec instances, and generate more useful errors.

Doing these validations unconditionally in the initializer means we bail
out much earlier if the formula has invalid attributes or is not fully
specified, and no longer need to validate in #prefix.

Technically we don't need to validate in #brew either, but we continue
to do so anyway as a safety measure, and because we cannot enforce calls
to super in subclasses.
2013-04-13 17:40:12 -05:00
Jack Nagel a722605dd5 Clean up checksum verification tests 2013-04-13 16:36:30 -05:00
Jack Nagel f3272fe14b Eliminate test_bucket
Most of the behavior tested here is now tested elsewhere. Move the
remaining useful tests to better places.
2013-04-10 22:27:56 -05:00