398 Commits

Author SHA1 Message Date
Jack Nagel
80c7a80a46 Remove duplicate test 2013-10-31 14:49:23 -05:00
Mike McQuaid
d9d2443d5d Cleanup use of some global constants. 2013-10-30 13:20:48 -07:00
Jack Nagel
2dd44f7791 Resource: push conditional down into #verify_download_integrity 2013-10-30 10:16:20 -05:00
Jack Nagel
383b321119 Disallow initializing Versions with non-strings
Closes Homebrew/homebrew#23553.
2013-10-25 17:29:45 -05:00
Jack Nagel
e67286369e Stop coercing MACOS_VERSION to a float 2013-10-25 17:29:36 -05:00
Mike McQuaid
3716dae0ce test_utils: fix Mavericks arch test. 2013-10-23 22:15:28 +01:00
Mike McQuaid
0296ffa0ef test_formula: add Mavericks bottles. 2013-10-23 22:15:28 +01:00
Mike McQuaid
0c332a23a2 test_formula: use different/consistent SHA-1. 2013-10-23 22:15:28 +01:00
Misty De Meo
5568f1851d Bottle tag tests: fix Tiger Intel 64 2013-10-22 13:57:40 -07:00
Jack Nagel
63e1c71c50 Eagerly initialize formula specs
Declarations of dependencies, options, and resources in the DSL only
apply to specs that have already been initialized. For example, given
this snippet:

  url ...
  sha1 ...

  depends_on 'foo'

  devel do
    url ...
    sha1 ...
  end

The dependency 'foo' will be recorded for the stable spec, but not the
devel spec, since it was not initialized prior to the call to
depends_on.

While it is considered best practice to declare all specs (stable,
devel, head, and bottle) prior to other declarations, there is nothing
that enforces this ordering, so when it happens it can be confusing and
hard to debug.

To prevent this, we can initialize all specs up front. This comes with
a performance penalty for commands that load all formulae into memory,
but that is probably outweighed by what we gain in correctness.

Fixes Homebrew/homebrew#23425.
2013-10-22 13:31:08 -05:00
Misty De Meo
de871a4daf Fix bottle_tag tests 2013-10-21 18:07:06 -07:00
Jack Nagel
c511d7d2f4 Add OS.mac? and OS.linux? 2013-10-18 12:56:51 -05:00
Jack Nagel
5ae32d5a79 Remove pointless assertion 2013-10-14 21:46:52 -05:00
Jack Nagel
d87f1fb5ec Assert on state, not something that didn't happen 2013-10-14 21:46:21 -05:00
Jack Nagel
167017f89a Resource: do not mutate passed-in specs hash 2013-10-11 20:21:41 -05:00
Jack Nagel
284a3716ea CurlDownloadStrategy: dup mirror list before mutating it 2013-10-11 19:14:52 -05:00
Mike McQuaid
28a20b70fc icu4c: add bottle regex. 2013-10-11 08:40:19 +01:00
Jack Nagel
ed7f8faed2 VCSDownloadStrategy: rename checkout_name to cache_filename 2013-10-11 00:21:23 -05:00
Mike McQuaid
a6e2245732 git_etc: update based on bottle etc/var changes. 2013-10-10 16:46:47 +01:00
Jack Nagel
6c5a9ae0fb Extract a new superclass for VCS-based download strategies 2013-10-09 21:41:15 -05:00
Xiyue Deng
022f1225e6 Fix test failure for C++ stdlib. 2013-10-07 03:40:41 -07:00
Misty De Meo
87b0137198 CxxStdlib: allow for nil stdlibs
A nil stdlib value represents non-C++ code.
2013-10-06 19:26:06 -07:00
Jack Nagel
50c7c6bbd6 Check types in Formula#==
Comparing two objects should not raise an exception, even if they have
different types.

The semantics of #== are now the same as #eql?, so make one an alias.
2013-10-04 21:19:15 -05:00
Jack Nagel
57560c03e6 Handle invalid names in download strategies
When subformulae are initialized without a name parameter, Homebrew
assigns the name "__UNKNOWN__". This may cause collisions in the cache.

Currently CurlDownloadStrategy and its descendants handles this by
extracting the basename form the URL and using that as the cached
filename. However, other strategies simply raise an exception.

We can improve the other strategies by URL-encoding the URL string and
using that as the cached directory name.

Note that this happens very rarely, especially now that resources (which
always have a name) are preferred to subformulae. The most common case
is a subformula that specifies a head download.

Closes Homebrew/homebrew#22949.
2013-09-30 22:56:02 -05:00
Jack Nagel
c5289f2503 Infer dependencies from download strategies and URLs
Closes Homebrew/homebrew#20849.
Closes Homebrew/homebrew#22871.
2013-09-28 16:37:05 -05:00
Jack Nagel
d1ce5bafc9 Raise when given an invalid download strategy spec
When DownloadStrategyDetector.detect is given a second argument, and
that argument is not a symbol or an AbstractDownloadStrategy subclass,
it is silently ignored, and we fall back to guessing the strategy based
on the URL.

This means I can do

  url 'http://foo.com/bar.tar.gz', :using => Class.new

and things will appear to work, even though I have clearly passed an
invalid value for :using.

A more useful behavior is to raise an exception for unknown strategy
specifications.
2013-09-26 17:00:00 -05:00
Jack Nagel
567f3448c9 Set owner of resources to SoftwareSpec object 2013-09-23 21:39:33 -05:00
Jack Nagel
5511a8b3f5 Move dependencies to SoftwareSpec 2013-09-21 19:27:24 -05:00
Jack Nagel
a8d3aca169 Move options to SoftwareSpec 2013-09-21 19:27:24 -05:00
Jack Nagel
65fc34cd03 Add tests to ensure ENV.compiler is correct 2013-09-20 22:54:07 -05:00
Jack Nagel
5b7b8fb5da At some point this started working again 2013-09-20 15:52:08 -05:00
Jack Nagel
9c7a18bdcb Make spec-scoped resources override top-level resources 2013-09-17 21:29:53 -05:00
Jack Nagel
3793c05845 SoftwareSpec tests are now Resource tests 2013-09-17 21:29:50 -05:00
Jack Nagel
71b21c920f Copies of BuildOptions should not share underlying collections 2013-09-14 17:03:56 -05:00
Jack Nagel
cecf9a564f Tear down the cache after installation tests 2013-09-14 11:53:32 -05:00
Jack Nagel
a31fcb554c Move SoftwareSpec to a separate file 2013-09-14 10:16:52 -05:00
Jack Nagel
adceeb52f6 Stop exposing the download strategy from Formula 2013-09-13 22:33:46 -05:00
Jack Nagel
f2ebc0e325 Stop mutating dependency specifications 2013-09-13 09:57:53 -05:00
Misty De Meo
15a3ae3d28 Fix CompilerSelector test for llvm
Update test to reflect that llvm-gcc should take precedence over
non-Apple GCC.
2013-09-10 13:08:03 -07:00
Mike McQuaid
ab20ed0bc2 Optionally use git to keep brew etc versioned.
Still in alpha state.
Handles defaults and merging changes with new versions.
Enable by setting the HOMEBREW_GIT_ETC environment variable.

Closes Homebrew/homebrew#15751.
Closes Homebrew/homebrew#17713.
2013-09-07 13:39:43 +01:00
Jack Nagel
a871baadf5 Fix breakage in option recognition
Fixes Homebrew/homebrew#22347.
2013-09-05 18:51:27 -05:00
Samuel John
59a0c1e1b5 Improve python tests for brew bots
Allow `build.with?` and similar methods to be used during the test
phase. The BuildOptions (`build`) are initialized with the
`Tab.used_options` unless explicitly overwritten on the command line.

So basically `build.with?` works in `def install` and in `test do` as
one would naively expect. (For the test, gramatically it should be
`built.with?` but who cares)

If a formula was installed `--with-python`, now the tests are also
run `--with-python`. This enables us to use the `python do ... end` in
a meaningful manner.

Using `python do ... end` blocks for the tests, because the bot.brew.sh has
system python per default and we need to set the PYTHONPATH for the test.
Potentially to different values for Python 2.x and 3.x.
2013-09-05 15:26:57 +02:00
Misty De Meo
b71682bdc7 Tab: track C++ stdlib in use
There are subtle incompatibilities between Apple's libstdc++ and the
libstdc++ used by the various GNU GCC formulae. In addition, we'll
likely also be supporting libc++ in the future, and that's also
incompatible with the other stdlibs.

Tracking it in the tab lets us make sure that dependencies are all
built against the same stdlib to avoid subtle breakage.
2013-09-01 13:19:13 -07:00
Misty De Meo
ef1d9c0cd0 Implement fails_with for non-Apple compilers
This adds support for non-Apple GCC compilers in the fails_with code.
A fails_with block for a non-Apple compiler looks like:

fails_with :gcc => '4.8.1' do
  cause 'Foo'
end

Non-Apple compilers don't have build numbers, so compiler failures are
based on version strings instead.

Internally non-Apple compilers can be distinguished because they are
passed around as strings instead of symbols.

In addition, this alters the priority list for compilers, with the
following changes:

* Apple GCC 4.2 and LLVM-GCC swap positions, with GCC now taking
  priority. (Maybe LLVM-GCC should just go away.)
* Non-Apple GCC compilers are ranked below GCC 4.2 but above LLVM-GCC
  and Apple GCC 4.0.
2013-09-01 13:19:13 -07:00
Jack Nagel
dd94518a40 Add test for option description rules 2013-08-31 20:40:06 -05:00
Jack Nagel
6ed24d3877 Add test for dependency options 2013-08-31 16:09:49 -05:00
Jack Nagel
870e47e68c Add some tests for ENV.{append,prepend} behavior 2013-08-26 15:02:51 -05:00
Jack Nagel
9b2e04593f Options: ensure copies do not share the underlying collection 2013-08-22 11:49:24 -05:00
Jack Nagel
7654077752 Demonstrate the Set-like nature of Options collections
Options collections are backed by Sets, and thus trying to push a new
option with a name that duplicates an existing option cannot succeed.

Later, we can exploit this behavior and remove some conditionals.
2013-08-22 11:35:00 -05:00
Jack Nagel
865b68de10 Add tests for ENV.{append,prepend}_path 2013-08-19 17:21:14 -05:00