Removes any global methods from formulae, and moves #kext_prefix (which
seems to be at least somewhat abstractable) into the Formula class. The
only formula with global methods is now aspell; it (and its generating
script in contrib) has been changed to prefix that method with
`aspell_`, to minimize the risk of name collisions.
ClosesHomebrew/homebrew#19331.
ClosesHomebrew/homebrew#19343.
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
After converting to Pathname to create paths, using '+=' will result in
path concatenation by '/', which result in weird path like
'gcc--svn/-HEAD'. This patch should fix this.
ClosesHomebrew/homebrew#19233.
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
Currently we check if "tag" is present in LANGUAGE_MODULES for every
String dep, even if tag is nil. Stop doing this, and make the
LANGUAGE_MODULES array into a Set instead to improve lookup performance.
This is an internal method, but is called a bunch of times in
performance-critical codepaths, and is ultra slow because the constant
is interpoplated into the Regexp each time the method is called.
Alas, this has been fixed in Ruby 1.9+.
Benchmark.bm do |b|
b.report("before") do
100_000.times { /(\.#{MacOS.cat}\.bottle\.(\d+\.)?tar\.gz)$/ }
end
b.report("after ") do
100_000.times { /(\.#{MacOS.cat}\.bottle\.(\d+\.)?tar\.gz)$/o }
end
end
user system total real
before 35.400000 0.140000 35.540000 ( 35.619674)
after 0.020000 0.000000 0.020000 ( 0.016662)
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).
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.
brew versions is hardcoded to cd to HOMEBREW_REPOSITORY before running
git, and as such fails to report previous versions for any formulae
from a tapped repository.
Add two new private methods repository and entry_name to replace the
hardcoded HOMEBREW_REPOSITORY and formula path, and brew versions
work for both builtin and tapped formulae.
ClosesHomebrew/homebrew#12356.
ClosesHomebrew/homebrew#19069.
Reported-by: Misty De Meo <mistydemeo@gmail.com>
Suggested-by: Jack Nagel <jacknagel@gmail.com>
Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
Signed-off-by: Jack Nagel <jacknagel@gmail.com>