15 Commits

Author SHA1 Message Date
Martin Afanasjew
ea4d137e87 dependency: fix merging tags in 'merge_repeats'
While it may suffice to merge string and non-reserved tags by forming a
union of all tags of dependencies of the same name, this approach fails
to work for the reserved tags. These are now merged such that the most
restrictive tag (meaning sometimes an empty tag) is preserved.

The previous behavior caused essential dependencies to be omitted and
builds to fail in response. E.g., multiple `:fortran` dependencies with
tags `[]`, `[:recommended]`, and `[:optional]` would have been expanded
and merged to `"gcc"` with tags `[:recommended, :optional]`, causing it
to be no longer seen as a required dependency.

Closes Homebrew/homebrew#47040.

Signed-off-by: Martin Afanasjew <martin@afanasjew.de>
2015-12-17 13:50:38 +01:00
Martin Afanasjew
0f9abe57ea tests: add (failing) tests for merging deps tags
The general idea is that merging multiple dependencies of the same name
should produce the strictest tag instead of a (meaningless) union of the
reserved tags. For example, if a dependency is both a `:recommended` and
an `:optional` dependency at different points in the dependency tree,
the resulting merged dependency should be tagged as `:recommended`.
Handle all other reserved tags in the same spirit.
2015-12-17 13:50:38 +01:00
Mike McQuaid
e5ba31fcdc Allow multiple option_names in dep/reqs.
This means that dependencies can be merged but still maintain all
their option names.

Closes Homebrew/homebrew#46916.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2015-12-15 08:37:16 +00:00
Mike McQuaid
484c70d19f test_dependency: add failing option names test.
This test will obviously fail but it does mark that the option names
are not being merged correctly.
2015-12-15 08:37:16 +00:00
Mike McQuaid
7095378b31 Add option_name tests. 2015-12-15 08:37:16 +00:00
BrewTestBot
13d544e11e Core files style updates.
Closes Homebrew/homebrew#42354.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2015-08-03 13:22:35 +01:00
Jack Nagel
a412b49c2c Fix dependency equality 2014-11-21 17:03:58 -06:00
Jack Nagel
7d8a901f7a Add assert_eql to provide better failure messages for eql? tests 2014-07-03 16:55:13 -05:00
Jack Nagel
58a75b0f71 Use assert_predicate 2014-06-18 20:34:09 -05:00
Jack Nagel
06305e6211 Switch to Minitest 2014-06-18 20:34:09 -05:00
Jack Nagel
982e9239b8 Use a custom test class so we can avoid monkeypatching 2014-06-18 20:32:51 -05:00
Jack Nagel
b322020338 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
adf90691f1 Split dependency classes into separate files 2013-01-26 20:30:05 -06:00
Jack Nagel
046d802d09 FormulaInstaller: allow formulae to pass options to deps
Formulae can now pass build options to dependencies. The following
syntax is supported:

  depends_on 'foo' => 'with-bar'
  depends_on 'foo' => ['with-bar', 'with-baz']

If a dependency is already installed but lacks the required build
options, an exception is raised. Eventually we may be able to just stash
the existing keg and reinstall it with the combined set of used_options
and passed options, but enabling that is left for another day.
2013-01-26 12:14:46 -06:00
Jack Nagel
fe4f39dcee Split up dependency test coverage
The DependencyCollector tests are really integration tests, while the
rest are closer to real unit tests. Split them up so that the tests can
be run in isolation on a per-class basis.
2013-01-13 21:01:15 -06:00