Calling Keg#unlink on "#{f.rack}/#{f.version}" will perform the unlink
relative to the _new_ keg, rather than the keg we are upgrading from.
Fix this by resolving the linked_keg entry and unlinking relative to it.
FixesHomebrew/homebrew#10296.
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
Using xcrun as a proxy to execute the compiler tools is per its design. This means you can't treat ENV['CC'] as a path anymore, but I think I found the cases this was being expected and corrected them. It was not proper anyway to assume the variable was a path, it can be anything. Like a proxy. Like xcrun.
Also more thoroughly clear ENV.
If we're going to unset GREP_OPTIONS we may as well unset this one too,
as it causes similar issues. Recent autoconf unset both of these.
FixesHomebrew/homebrew#8165.
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
If a keg has been uninstalled via `rm -rf <keg>`, and a user tries to
reinstall it without `brew unlink`ing it first, it will fail to link as
the LinkedKegs entry still exists. This isn't desirable, and the user
should be able to reinstall the same formula on top of the old, dead
symlinks without problems, so let's just remove the LinkedKegs entry if
it matches the one we are installing anyway.
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
Doing so was the result of a quick hack to fix the "deps installed as
upgrades don't get linked" bug, but it was a mistake. Instead, always
return the LinkedKegs entry as a Pathname object, and let callers be
responsible for checking that it exists.
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
This reverts commit 2eabe2cbc84649696aeb6fa842a70f3794955597.
When Keg#unlink looks for symlinks relative to the keg, it can hit false
positives that actually belong to a different keg and unlink them
anyway. This breaks our "force identical directory symlinks to be shared
real directory" case.
This may be a problem in general with the unlinking code and should be
investigated.
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
If a formula makes it all the way to the actual install step, it is safe
to unlink the keg before linking; this will prune dead symlinks in the
case where a keg was removed with `rm -rf <keg>` but not unlinked with
`brew unlink`.
FixesHomebrew/homebrew#10077.
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
Symptom: If no python/ruby/perl is in your path, then `which x`.chomp
returns an empty string and `unless ""` is still true. So, N/A is never
displayed. Instead, ruby's Pathname.new("").realpath returns the cwd.
(I consider this realpath behavior a ruby bug) Fix: use empty?
ClosesHomebrew/homebrew#10027.
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
Now we handle some things more explicitly and in the process get rid of
the blanket rescue on the mktemp block, which is something of an
antipattern.
By unloading the class *after* determining the version, we avoid the
case where the class had previously been unloaded but Formula.factory
failed, and trying to unload the nonexistent class results in a
NameError. Doing it this way, we avoid having to rescue NameError and
thereby avoid hiding other cases where it may occur.
We also rescue TypeError which gets us past a few more bad formula in
the history in some instances.
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
This commit adds a `devel` entry to the DSL, allowing formulae to
specify an unstable branch.
`devel` takes a block, which should contain standard `url` and `md5`
fields (and `version`, if necessary). This must come after the standard
DSL fields.
This commit also migrates over all formulae currently using `devel` to
the new syntax, as well as formulae which used `head` for non-VCS urls.
The new syntax is also available for `stable` and `bottle`. `stable` is
an option alongside the old syntax. `bottle` replaces the old syntax.
Note that the @stable ivar in Formula has been renamed to @standard,
and the @bottle ivar has been renamed to @bottle_url.
ClosesHomebrew/homebrew#9735.
Signed-off-by: Misty De Meo <mistydemeo@gmail.com>