Enable tracking of formula revisions

It is useful to be able to prompt upgrades in response to events other
than a version update; for example, when a dependency is updated and its
library version changes, dependents need to be rebuilt to link against
the new library.

Currently we cannot do this automatically, which means a flood of
tickets whenever the library version of a popular library changes.

To address this, we need to track an additional piece of metadata, the
"revision" of the formula, which can be incremented when appropriate to
prompt an upgrade. It can then be reset to zero when the next version
change occurs.
This commit is contained in:
Jack Nagel 2014-03-05 20:12:51 -06:00
parent 7e8c693218
commit b5e1715333

View File

@ -18,6 +18,7 @@ class Formula
attr_reader :name, :path, :homepage, :build attr_reader :name, :path, :homepage, :build
attr_reader :stable, :bottle, :devel, :head, :active_spec attr_reader :stable, :bottle, :devel, :head, :active_spec
attr_reader :revision
# The current working directory during builds and tests. # The current working directory during builds and tests.
# Will only be non-nil inside #stage and #test. # Will only be non-nil inside #stage and #test.
@ -34,6 +35,7 @@ class Formula
@name = name @name = name
@path = path @path = path
@homepage = self.class.homepage @homepage = self.class.homepage
@revision = self.class.revision || 0
set_spec :stable set_spec :stable
set_spec :devel set_spec :devel
@ -662,7 +664,7 @@ class Formula
class << self class << self
attr_reader :keg_only_reason, :cc_failures attr_reader :keg_only_reason, :cc_failures
attr_rw :homepage, :plist_startup, :plist_manual attr_rw :homepage, :plist_startup, :plist_manual, :revision
def specs def specs
@specs ||= [stable, devel, head, bottle].freeze @specs ||= [stable, devel, head, bottle].freeze