diff options
Diffstat (limited to 'Library')
| -rw-r--r-- | Library/Homebrew/formula.rb | 21 | ||||
| -rw-r--r-- | Library/Homebrew/formula_installer.rb | 2 | ||||
| -rw-r--r-- | Library/Homebrew/formulary.rb | 7 | ||||
| -rw-r--r-- | Library/Homebrew/tab.rb | 6 | ||||
| -rw-r--r-- | Library/Homebrew/test/fixtures/receipt.json | 2 | ||||
| -rw-r--r-- | Library/Homebrew/test/test_formula.rb | 21 | ||||
| -rw-r--r-- | Library/Homebrew/test/test_formulary.rb | 5 | ||||
| -rw-r--r-- | Library/Homebrew/test/test_tab.rb | 6 | ||||
| -rw-r--r-- | Library/Homebrew/test/testball.rb | 2 | ||||
| -rw-r--r-- | Library/Homebrew/test/testball_bottle.rb | 2 |
10 files changed, 22 insertions, 52 deletions
diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb index 479798829..90e6b2212 100644 --- a/Library/Homebrew/formula.rb +++ b/Library/Homebrew/formula.rb @@ -61,7 +61,7 @@ class Formula # The name specified when installing this {Formula}. # Could be the name of the {Formula}, or an alias. # e.g. `another-name-for-this-formula` - attr_reader :install_name + attr_reader :alias_path # The fully-qualified name of this {Formula}. # For core formula it's the same as {#name}. @@ -148,10 +148,10 @@ class Formula attr_accessor :build # @private - def initialize(name, path, spec, install_name: name) + def initialize(name, path, spec, alias_path: nil) @name = name @path = path - @install_name = install_name + @alias_path = alias_path @revision = self.class.revision || 0 @version_scheme = self.class.version_scheme || 0 @@ -508,21 +508,6 @@ class Formula installed_prefixes.map { |dir| Keg.new(dir) } end - # Formula reference to use to get an identical installation of the formula. - # - # Usually, the formula's path is a good canonical identifier for the formula. - # Just using whatever was passed to `brew install` isn't a good idea, because - # if it was e.g. a URL, it could end up being downloaded twice. - # - # However, if the formula was installed with an alias (i.e. `install_name` is - # different from `name`), that should be used instead so that information is - # preserved. Aliases are looked up in repositories that have already been - # tapped, so we don't have to worry about doing extra HTTP requests, or other - # expensive operations, when looking them up again. - def install_ref - install_name == name ? path : install_name - end - # The directory where the formula's binaries should be installed. # This is symlinked into `HOMEBREW_PREFIX` after installation or with # `brew link` for formulae that are not keg-only. diff --git a/Library/Homebrew/formula_installer.rb b/Library/Homebrew/formula_installer.rb index b9b72812e..ebcc3d4da 100644 --- a/Library/Homebrew/formula_installer.rb +++ b/Library/Homebrew/formula_installer.rb @@ -589,7 +589,7 @@ class FormulaInstaller -I #{HOMEBREW_LOAD_PATH} -- #{HOMEBREW_LIBRARY_PATH}/build.rb - #{formula.install_ref} + #{formula.alias_path || formula.path} ].concat(build_argv) Sandbox.print_sandbox_message if Sandbox.formula?(formula) diff --git a/Library/Homebrew/formulary.rb b/Library/Homebrew/formulary.rb index f95f9c51a..cbad28fc7 100644 --- a/Library/Homebrew/formulary.rb +++ b/Library/Homebrew/formulary.rb @@ -69,17 +69,16 @@ class Formulary # The formula's ruby file's path or filename attr_reader :path # The name used to install the formula - attr_reader :install_name + attr_reader :alias_path def initialize(name, path) @name = name @path = path.resolved_path - @install_name = name end # Gets the formula instance. def get_formula(spec) - klass.new(name, path, spec, :install_name => install_name) + klass.new(name, path, spec, :alias_path => alias_path) end def klass @@ -121,7 +120,7 @@ class Formulary path = alias_path.resolved_path name = path.basename(".rb").to_s super name, path - @install_name = alias_path.basename.to_s + @alias_path = alias_path end end diff --git a/Library/Homebrew/tab.rb b/Library/Homebrew/tab.rb index 0b26116c5..ec8cbe235 100644 --- a/Library/Homebrew/tab.rb +++ b/Library/Homebrew/tab.rb @@ -27,7 +27,7 @@ class Tab < OpenStruct "time" => Time.now.to_i, "source_modified_time" => formula.source_modified_time.to_i, "HEAD" => HOMEBREW_REPOSITORY.git_head, - "install_name" => formula.install_name, + "alias_path" => formula.alias_path.to_s, "compiler" => compiler, "stdlib" => stdlib, "source" => { @@ -162,7 +162,7 @@ class Tab < OpenStruct "time" => nil, "source_modified_time" => 0, "HEAD" => nil, - "install_name" => nil, + "alias_path" => nil, "stdlib" => nil, "compiler" => DevelopmentTools.default_compiler, "source" => { @@ -294,7 +294,7 @@ class Tab < OpenStruct "time" => time, "source_modified_time" => source_modified_time.to_i, "HEAD" => self.HEAD, - "install_name" => install_name, + "alias_path" => alias_path, "stdlib" => (stdlib.to_s if stdlib), "compiler" => (compiler.to_s if compiler), "source" => source diff --git a/Library/Homebrew/test/fixtures/receipt.json b/Library/Homebrew/test/fixtures/receipt.json index cf93f932d..39dcaea07 100644 --- a/Library/Homebrew/test/fixtures/receipt.json +++ b/Library/Homebrew/test/fixtures/receipt.json @@ -11,7 +11,7 @@ "poured_from_bottle": true, "time": 1403827774, "HEAD": "deadbeefdeadbeefdeadbeefdeadbeefdeadbeef", - "install_name": "test-formula", + "alias_path": "test-formula", "stdlib": "libcxx", "compiler": "clang", "source": { diff --git a/Library/Homebrew/test/test_formula.rb b/Library/Homebrew/test/test_formula.rb index b70ecbb6f..ce1ac28b1 100644 --- a/Library/Homebrew/test/test_formula.rb +++ b/Library/Homebrew/test/test_formula.rb @@ -8,30 +8,15 @@ class FormulaTests < Homebrew::TestCase name = "formula_name" path = Formulary.core_path(name) spec = :stable - install_name = "formula_alias" + alias_path = "formula_alias" - f = klass.new(name, path, spec, :install_name => install_name) + f = klass.new(name, path, spec, :alias_path => alias_path) assert_equal name, f.name assert_equal path, f.path - assert_equal install_name, f.install_name + assert_equal alias_path, f.alias_path assert_raises(ArgumentError) { klass.new } end - def test_install_ref_with_alias - name = "formula_name" - path = Formulary.core_path(name) - spec = :stable - install_name = "formula_alias" - - f = Testball.new(name, path, spec, :install_name => install_name) - assert_equal f.install_name, f.install_ref - end - - def test_install_ref_with_non_alias - f = Testball.new - assert_equal f.path, f.install_ref - end - def test_prefix f = Testball.new assert_equal HOMEBREW_CELLAR/f.name/"0.1", f.prefix diff --git a/Library/Homebrew/test/test_formulary.rb b/Library/Homebrew/test/test_formulary.rb index 0d34132ec..8b3417dad 100644 --- a/Library/Homebrew/test/test_formulary.rb +++ b/Library/Homebrew/test/test_formulary.rb @@ -85,10 +85,11 @@ class FormularyFactoryTest < Homebrew::TestCase def test_factory_from_alias alias_dir = CoreTap.instance.alias_dir alias_dir.mkpath - FileUtils.ln_s @path, alias_dir/"foo" + alias_path = alias_dir/"foo" + FileUtils.ln_s @path, alias_path result = Formulary.factory("foo") assert_kind_of Formula, result - assert_equal "foo", result.install_name + assert_equal alias_path, result.alias_path ensure alias_dir.rmtree end diff --git a/Library/Homebrew/test/test_tab.rb b/Library/Homebrew/test/test_tab.rb index dd61fd57b..85fcf4d16 100644 --- a/Library/Homebrew/test/test_tab.rb +++ b/Library/Homebrew/test/test_tab.rb @@ -43,7 +43,7 @@ class TabTests < Homebrew::TestCase assert_nil tab.stable_version assert_nil tab.devel_version assert_nil tab.head_version - assert_nil tab.install_name + assert_nil tab.alias_path assert_equal DevelopmentTools.default_compiler, tab.cxxstdlib.compiler assert_nil tab.cxxstdlib.type end @@ -117,7 +117,7 @@ class TabTests < Homebrew::TestCase assert_equal "2.14", tab.stable_version.to_s assert_equal "2.15", tab.devel_version.to_s assert_equal "HEAD-0000000", tab.head_version.to_s - assert_equal "test-formula", tab.install_name + assert_equal "test-formula", tab.alias_path end def test_to_json @@ -135,7 +135,7 @@ class TabTests < Homebrew::TestCase assert_equal @tab.stable_version, tab.stable_version assert_equal @tab.devel_version, tab.devel_version assert_equal @tab.head_version, tab.head_version - assert_equal @tab.install_name, tab.install_name + assert_equal @tab.alias_path, tab.alias_path end def test_remap_deprecated_options diff --git a/Library/Homebrew/test/testball.rb b/Library/Homebrew/test/testball.rb index c13c73adb..cce09738d 100644 --- a/Library/Homebrew/test/testball.rb +++ b/Library/Homebrew/test/testball.rb @@ -1,5 +1,5 @@ class Testball < Formula - def initialize(name = "testball", path = Pathname.new(__FILE__).expand_path, spec = :stable, install_name: name) + def initialize(name = "testball", path = Pathname.new(__FILE__).expand_path, spec = :stable, alias_path: nil) self.class.instance_eval do stable.url "file://#{File.expand_path("..", __FILE__)}/tarballs/testball-0.1.tbz" stable.sha256 TESTBALL_SHA256 diff --git a/Library/Homebrew/test/testball_bottle.rb b/Library/Homebrew/test/testball_bottle.rb index 584478afd..769f615aa 100644 --- a/Library/Homebrew/test/testball_bottle.rb +++ b/Library/Homebrew/test/testball_bottle.rb @@ -1,5 +1,5 @@ class TestballBottle < Formula - def initialize(name = "testball_bottle", path = Pathname.new(__FILE__).expand_path, spec = :stable, install_name: name) + def initialize(name = "testball_bottle", path = Pathname.new(__FILE__).expand_path, spec = :stable, alias_path: nil) self.class.instance_eval do stable.url "file://#{File.expand_path("..", __FILE__)}/tarballs/testball-0.1.tbz" stable.sha256 TESTBALL_SHA256 |
