aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew
diff options
context:
space:
mode:
authorMike McQuaid2016-10-24 10:21:07 +0100
committerMike McQuaid2016-10-24 10:21:07 +0100
commit762b76e43723f9c4b009c21217e4c3eea4b31adb (patch)
tree6d1eb7283d494b9924e78e5dcdf51ab7d6e4084c /Library/Homebrew
parent0c140f0970c4d4de81e8233913daa7fc768defad (diff)
downloadbrew-762b76e43723f9c4b009c21217e4c3eea4b31adb.tar.bz2
audit: check the version does not decrease.
This will prevent `brew upgrade` from working correctly.
Diffstat (limited to 'Library/Homebrew')
-rw-r--r--Library/Homebrew/dev-cmd/audit.rb12
1 files changed, 8 insertions, 4 deletions
diff --git a/Library/Homebrew/dev-cmd/audit.rb b/Library/Homebrew/dev-cmd/audit.rb
index 12eaf9167..a8592c8e9 100644
--- a/Library/Homebrew/dev-cmd/audit.rb
+++ b/Library/Homebrew/dev-cmd/audit.rb
@@ -653,10 +653,11 @@ class FormulaAuditor
return unless formula.tap.git? # git log is required
fv = FormulaVersions.new(formula, max_depth: 10)
- attributes = [:revision, :version_scheme]
+ no_decrease_attributes = [:revision, :version_scheme]
+ attributes = no_decrease_attributes + [:version]
attributes_map = fv.version_attributes_map(attributes, "origin/master")
- attributes.each do |attribute|
+ no_decrease_attributes.each do |attribute|
attributes_for_version = attributes_map[attribute][formula.version]
next if attributes_for_version.empty?
if formula.send(attribute) < attributes_for_version.max
@@ -664,11 +665,14 @@ class FormulaAuditor
end
end
- revision_map = attributes_map[:revision]
+ versions = attributes_map[:version].keys
+ if formula.version < versions.max
+ problem "version should not decrease"
+ end
return if formula.revision.zero?
-
if formula.stable
+ revision_map = attributes_map[:revision]
if revision_map[formula.stable.version].empty? # check stable spec
problem "'revision #{formula.revision}' should be removed"
end