aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/formula.rb
diff options
context:
space:
mode:
authorJack Nagel2014-03-05 20:12:51 -0600
committerJack Nagel2014-03-05 20:12:51 -0600
commit6008187d5f54c5cb60a407155b73888ac6d521df (patch)
treef85a7e9038f4e3da086b7199b5d8e496e1835659 /Library/Homebrew/formula.rb
parentb5e1715333d9e34499f19a46ff9aeecfe4b05e6c (diff)
downloadbrew-6008187d5f54c5cb60a407155b73888ac6d521df.tar.bz2
Encode formula revision in installation prefix
In order to allow kegs built with the same version but differing formula revisions to coexist, we must encode the revision as part of the keg's name. This is necessary to actually perform an upgrade, as we cannot upgrade a keg in-place, and temporarily moving it pending the result of the upgrade is error-prone and potentially slow. To accomplish this, we introduce a new Formula#pkg_version method that concatenates the active_spec version with the formula revision. An exception is made for a formula that has no revision: the tag is omitted. This preserves compatibility with existing installations.
Diffstat (limited to 'Library/Homebrew/formula.rb')
-rw-r--r--Library/Homebrew/formula.rb6
1 files changed, 4 insertions, 2 deletions
diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb
index 6ad5eae3a..07fcc5a67 100644
--- a/Library/Homebrew/formula.rb
+++ b/Library/Homebrew/formula.rb
@@ -10,6 +10,7 @@ require 'build_options'
require 'formulary'
require 'software_spec'
require 'install_renamed'
+require 'pkg_version'
class Formula
include FileUtils
@@ -18,7 +19,7 @@ class Formula
attr_reader :name, :path, :homepage, :build
attr_reader :stable, :bottle, :devel, :head, :active_spec
- attr_reader :revision
+ attr_reader :pkg_version, :revision
# The current working directory during builds and tests.
# Will only be non-nil inside #stage and #test.
@@ -55,6 +56,7 @@ class Formula
@active_spec = determine_active_spec
validate_attributes :url, :name, :version
@build = determine_build_options
+ @pkg_version = PkgVersion.new(version, revision)
@pin = FormulaPin.new(self)
@@ -152,7 +154,7 @@ class Formula
Keg.new(installed_prefix).version
end
- def prefix(v=version)
+ def prefix(v=pkg_version)
Pathname.new("#{HOMEBREW_CELLAR}/#{name}/#{v}")
end
def rack; prefix.parent end