65 Commits

Author SHA1 Message Date
Bo Anderson
5b5833c33b dependency: return test deps on all levels
Filtering for this is now handled properly in places where this function is used.

In some scenarios, we _want_ test deps on more than the first level (Homebrew.args.include_formula_test_deps?).
2020-05-19 19:17:17 +01:00
Mike McQuaid
5dd8ead51a
Rename Formula#installed? to Formula#latest_version_installed?
This naming has always been a bit weird and confusing so let's change
it and provide a `compat` fallback for later deprecation.
2019-12-03 11:42:42 +00:00
Mike McQuaid
36dbad3922
Add frozen_string_literal to all files. 2019-04-20 13:27:36 +09:00
Mike McQuaid
d1ea6f38d3
Fix mutable constants violations. 2019-04-19 21:46:20 +09:00
EricFromCanada
20167e5f1b Adjust comments to tidy API docs output. 2018-10-18 21:42:43 -04:00
Markus Reiter
e9b9ea49a1 Update to RuboCop 0.59.1. 2018-09-17 03:45:59 +02:00
Mike McQuaid
6b817f775f Formula: handle bad tap runtime dependencies.
Also add some better exceptions for the cases that `nil`s end up
getting passed around incorrectly.
2018-06-01 19:22:33 +01:00
Mike McQuaid
d2c23bde6d Audit use of :run dependencies.
These are a no-op so let's remove them.
2018-03-19 10:11:08 +00:00
Mike McQuaid
1dfeff7274 deps: don't display recursive test dependencies.
You only care about the test dependencies for the specific formula you
are testing right now.
2018-03-14 15:41:20 +00:00
Mike McQuaid
924c4af3de dep*: fix more :test dependency resolution. 2018-03-08 09:46:53 +00:00
Markus Reiter
175ca909ee Clean up code style and remove .rubocop_todo.yml. 2017-10-08 16:10:37 +02:00
Mike McQuaid
01e9ec9a9f Rubocop: automatic rule fixes. 2017-09-24 21:23:59 +01:00
Markus Reiter
3b4ee58c49 Refactor using Forwardable and DelegateClass. 2017-06-28 09:25:31 +02:00
Alyssa Ross
0b216798bb Revert "Revert "uses: properly handle untapped fo…
…rmulae in recursive dependency expansion""

This reverts commit dc9819b86c60b5c6fd10373ff318d8ef60f97d52.
2017-01-16 23:28:26 +00:00
Mike McQuaid
dc9819b86c Revert "uses: properly handle untapped formulae in recursive dependency expansion" 2017-01-07 13:15:18 +00:00
Alyssa Ross
4c061fc183 dependency: TapDependency#tap returns a Tap
Previously, this returned a String, but a Tap instance seems much more
sensible.

I couldn't find anywhere this method was actually used, so the change
shouldn't break anything.
2017-01-05 00:22:56 +00:00
Mike McQuaid
f7f15673a8 Fix dependency option handling.
- formula_installer: only recompute dependencies when necessary i.e.
when a bottle pour fails.
- formula_installer: re-add accidentally remove dependency options
- dependency: missing options are only those that actually exist on a
formula
2016-12-10 17:58:41 +00:00
Markus Reiter
e851c9bf6c Style/Alias: Prefer alias. 2016-09-23 18:19:53 +02:00
Xu Cheng
8749ecc383 Dependency.expand: ensure pop stack
During the dependencies expansion, there may be errors (e.g. FormulaUnavaiableError).
As result, some deps will be left behind in the stack and interfere afterwards
dependencies expansion.

So let's ensure stack clean for each expansions.

Fixes Homebrew/homebrew#48834.
2016-02-07 14:58:05 +08:00
Mike McQuaid
5b7dd99e99 Revert "Revert "dependency: don't recurse infinitely.""
This reverts commit fa43883dd1cd82f234b79c4a322339f03b9c098d.

Closes Homebrew/homebrew#48187.
2016-01-18 08:59:52 +00:00
Mike McQuaid
cd0366da0d Revert "dependency: don't recurse infinitely."
This reverts commit 16ffbe1a2b2d99da42481dc50f70dbfee4472da6.
2016-01-17 20:55:05 +00:00
Mike McQuaid
20106e4268 dependency: don't recurse infinitely.
If we have a dependency cycle ensure that infinite recursion does not
result by storing state in a stack which we push/pop from for each
level of recursion and verify that we haven’t been through this
dependency already.

Closes Homebrew/homebrew#47933.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2016-01-17 20:12:03 +00:00
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
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
Xu Cheng
0bce3b3f36 TapDependency: allow passing arbitrary option_name 2015-08-20 17:31:17 +08:00
Xu Cheng
ae0e270727 favor flat_map over map...flatten 2015-08-06 22:33:46 +08: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
Mike McQuaid
b3d44da9e3 TapDependency: add tap accessor. 2014-12-29 12:20:03 +00:00
Jack Nagel
dd820192ee Hashes do not iterate in insertion order on Ruby 1.8 2014-11-21 22:25:36 -06:00
Jack Nagel
a412b49c2c Fix dependency equality 2014-11-21 17:03:58 -06:00
Jack Nagel
6b9a929e40 Rewrite missing_options in a more obvious way 2014-08-27 23:28:00 -05:00
Jack Nagel
566442606a Remove an unnecessary default argument 2014-08-23 22:41:35 -05:00
Jack Nagel
b7b8b88cea Replace the build object rather than mutate it 2014-08-11 17:48:30 -05:00
Jack Nagel
fd86e6d636 Remove confusing implicit options handling
This code is supposed to allow

  depends_on "foo" => "with-bar"

to work when foo has only a "without-bar" option.

The options system was not designed to support this. Unfortunately, it
was bolted on anyway. The implementation is extremely difficult to
understand, and it only works for certain types of options, which is
confusing from a user's point of view. Luckily, no formulae in core or
the official taps rely on the behavior in order to function.

It is hindering progress in improving this code, so I am removing it.
2014-07-30 21:46:22 -05:00
Jack Nagel
fbefa76ce2 Always use class.name to build inspect strings 2014-07-01 18:39:15 -05:00
Jack Nagel
4d9d01893e Move deprecated Formula class methods to compat
These have all been moved to Formulary.
2014-06-22 15:03:17 -05:00
Jack Nagel
c6bc01ab58 Add TapDependency 2014-02-28 11:16:55 -06:00
Jack Nagel
1981e78eb2 Eliminate mutation of Dependency objects 2014-02-27 14:22:43 -06:00
Jack Nagel
793d6de6c3 Pass expansion-time build options to install_dependency 2014-02-27 14:22:43 -06:00
Jack Nagel
96df4fe1da Apply cyclic dependency hack unconditionally 2014-02-27 14:22:42 -06:00
Jack Nagel
e9b687070a Remove requested? dependency magic 2014-02-27 14:22:42 -06:00
Jack Nagel
257a2206a4 Eliminate unnecessary arrays and call to flatten 2014-02-13 15:39:13 -05:00
Mike McQuaid
d4db3d5d40 dependency: don't try and expand yourself.
This can happen on e.g. fossil where the dependency HEAD requires having
an install of fossil in order to check it out. Bit of a silly edge case
but this handles it.

Fixes Homebrew/homebrew#25605
2014-01-03 21:33:07 +00:00
Jack Nagel
08055e1776 Ensure option names are consistent for default formula requirements 2013-12-09 14:36:10 -06:00
Jack Nagel
677c78d77e Pass deps collection to be expanded as a parameter 2013-12-09 14:36:10 -06:00
Jack Nagel
2fb5ead38a Prevent deps of build-time deps from leaking into the build environment
When decided what dependencies should be part of the build environment
(and have appropriate entries added to variables like PKG_CONFIG_PATH),
we select the entire dependency tree except for

 (1) inactive optional and recommended deps (2) indirect build-time deps
 (i.e., build-time deps of other deps)

There is a third category that sould be excluded: dependencies of direct
build-time deps. These are irrelevant to the build, and including them
can cause unexpected linkages.
2013-11-13 10:38:14 -06:00
Jack Nagel
0c523da706 Dependency: tighten equality check 2013-11-05 16:02:26 -06:00
Jack Nagel
a2c949bfb7 Allow Dependency objects to be marshaled
When an exception is raised in the build process, it is marshaled and
sent to the main process over a pipe. The marshaled exception has
a reference to the formula, so the formula and all objects it references
are marshaled as well.

Previously this did not include dependencies, as they were stored only
on the class and not referenced by an instance variable. However, now
they are stored on SoftwareSpec instances, to which the formula *does*
have a direct reference, so they must be marshalable.
2013-09-27 23:36:57 -05:00
Jack Nagel
71586d09aa Avoid the need to compact the expanded deps array 2013-08-20 14:16:17 -05:00
Jack Nagel
c05275e362 Update comment 2013-07-22 21:49:14 -05:00