Specifying dependencies with a URL works, even if by accident, but
factory is called repeatedly on this URL and this results in multiple
downloads of the same file.
Fix this by checking const_defined? here too, and DRY up the code a bit.
FixesHomebrew/homebrew#14285.
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
Due to the new const_defined? checks, passing certain names (such as
those that start with a digit) that are illegal constant names will
raise NameError. Catch this and error out gracefully, as we would have
previously.
FixesHomebrew/homebrew#14342.
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
build.rb calls Formula.factory to get a usable Formula object to pass to
its install method. However, because the formula file is the actual
executing script, its class is already defined, and loading it again
causes the class to be re-evaluated, which, unfortunately, is not
idempotent.
This bug has existed for a very long time, and its side effects include
duplicate entries the deps array and mirrors array, among others.
Fortunately, the fix is very simple.
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
Usually, the "foo-version already installed" error is printed by
FormulaInstaller. However, if an up-to-date formula that has outdated
deps is passed on the command line, we proceed to upgrade the deps and
then print a message saying that the formulae given on the command line
is already installed.
Catch this earlier, when the outdated list is being populated, print an
appropriate message, and skip the up-to-date formula.
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
When combining the set of old-style and new-style options, make sure
that the leading "--" is stripped.
Fixes displaying options in `brew options`, and the exotic case of
declaring options using the old syntax and then checking them with
`build.include?`
conflicts_with is a thin wrapper around Requirement which simplifies
marking conflicts between formulae.
ClosesHomebrew/homebrew#13687.
Signed-off-by: Misty De Meo <mistydemeo@gmail.com>
Since 3ee9b7bd88a2d9017cdf005b10567a1d6d8ec211 ("SoftwareSpec:
initialize @mirrors"), @active_spec.mirrors will always be non-nil.
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
Now that a URL, version, and the (for lack of a better term) "specs"
associated with said URL (e.g. the VCS revision, or a download strategy
hint) are neatly bundled up in a SoftwareSpec object, it doesn't make
sense to pass them individually to download strategy constructors. These
constructors now take only the formula name and a SoftwareSpec as
parameters.
This allows us to move mirror handling out out of Formula#fetch and into
the download strategies themselves. While doing so, we adjust the mirror
implementation a bit; mirrors now assume the same "specs" as their
owner's URL. They are still only useable by the CurlDownloadStrategy,
but this provides a basis for extending mirror support to other
strategies.
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
Most Homebrew builds produce libraries, so CMake should give priority to
libraries when resolving dependencies.
ClosesHomebrew/homebrew#12497.
Signed-off-by: Charlie Sharpsteen <source@sharpsteen.net>
This differs from the current std_cmake_parameters in that it returns an
array instead of a string. Doing so makes dealing with it in formulae
much more pleasant, and for new formula hackers, less surprising.
std_cmake_parameters is retained in compat to maintain compatibility
with external formulae.
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
The test for this previously passed, but only because the constructor
for SoftwareSpecification was raising an exception. method_added needs
to be a class method because methods are being defined on the class, not
the object, and to test it properly we have to eval the class in the
test itself.
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
- Formulae can now declare failures on any compiler.
- FailsWithLLVM and associated formula elements have been moved to
compat.
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
I wanted to make it possible to not do the additional newline (in brew) if this code path is hit. But I didn't see a way to do it without overriding the Interrupt exception and throwing a new one.
“Never add more code than necessary for aesthetics in error handling.” — mxcl