From 36b2af2e0f5a72f0eccdec0c929a89188dc0f0dc Mon Sep 17 00:00:00 2001 From: Andrew Janke <andrew@apjanke.net> Date: Wed, 13 Apr 2016 02:53:41 -0400 Subject: [PATCH] superenv: fix formula prefix path to consider revisions Old logic doesn't include revision. This fixes that, and passes the whole formula prefix path to avoid duplicating the path-construction logic. Closes #80. Signed-off-by: Andrew Janke <andrew@apjanke.net> --- Library/ENV/4.3/cc | 12 +++--------- Library/Homebrew/extend/ENV/super.rb | 3 +-- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/Library/ENV/4.3/cc b/Library/ENV/4.3/cc index 6b3efd2599..e7ab6500fd 100755 --- a/Library/ENV/4.3/cc +++ b/Library/ENV/4.3/cc @@ -15,7 +15,7 @@ require "set" class Cmd attr_reader :config, :prefix, :cellar, :opt, :tmpdir, :sysroot, :deps - attr_reader :archflags, :optflags, :keg_regex, :formula, :formula_version + attr_reader :archflags, :optflags, :keg_regex, :formula_prefix def initialize(arg0, args) @arg0 = arg0 @@ -29,8 +29,7 @@ class Cmd @archflags = ENV.fetch("HOMEBREW_ARCHFLAGS") { "" }.split(" ") @optflags = ENV.fetch("HOMEBREW_OPTFLAGS") { "" }.split(" ") @deps = Set.new(ENV.fetch("HOMEBREW_DEPENDENCIES") { "" }.split(",")) - @formula = ENV["HOMEBREW_FORMULA"] - @formula_version = ENV["HOMEBREW_FORMULA_VERSION"] + @formula_prefix = ENV["HOMEBREW_FORMULA_PREFIX"] # matches opt or cellar prefix and formula name @keg_regex = %r[(#{Regexp.escape(opt)}|#{Regexp.escape(cellar)})/([\w\-_\+]+)] end @@ -208,7 +207,7 @@ class Cmd return keep_orig?(path) unless ENV["HOMEBREW_EXPERIMENTAL_FILTER_FLAGS_ON_DEPS"] # Allow references to self - if keg_path && path.start_with?(keg_path) + if formula_prefix && path.start_with?("#{formula_prefix}/") true # first two paths: reject references to Cellar or opt paths # for unspecified dependencies @@ -281,11 +280,6 @@ class Cmd %W[#{sysroot}/usr/lib /usr/local/lib] end - def keg_path - return nil if formula.nil? - "#{cellar}/#{formula}/#{formula_version}" - end - def configure? # configure scripts generated with autoconf 2.61 or later export as_nl ENV.key? "as_nl" diff --git a/Library/Homebrew/extend/ENV/super.rb b/Library/Homebrew/extend/ENV/super.rb index 8566c7d0df..c3ae3362f9 100644 --- a/Library/Homebrew/extend/ENV/super.rb +++ b/Library/Homebrew/extend/ENV/super.rb @@ -69,8 +69,7 @@ module Superenv self["HOMEBREW_LIBRARY_PATHS"] = determine_library_paths self["HOMEBREW_DEPENDENCIES"] = determine_dependencies unless formula.nil? - self["HOMEBREW_FORMULA"] = formula.name - self["HOMEBREW_FORMULA_VERSION"] = formula.version + self["HOMEBREW_FORMULA_PREFIX"] = formula.prefix end if MacOS::Xcode.without_clt? || (MacOS::Xcode.installed? && MacOS::Xcode.version.to_i >= 7) -- GitLab