diff options
| author | Xu Cheng | 2016-01-14 13:33:56 +0800 |
|---|---|---|
| committer | Xu Cheng | 2016-01-14 15:26:21 +0800 |
| commit | 31da9b266a5eab3bc349d62e7f5cd7cb67741375 (patch) | |
| tree | dfd330b17246eda1144dc7538df1615a6ac0aeeb /Library/Homebrew/cmd | |
| parent | 5f22586389fed1365208abbe06861ca49d3f27d8 (diff) | |
| download | brew-31da9b266a5eab3bc349d62e7f5cd7cb67741375.tar.bz2 | |
audit: enforce revision check
Add two checks:
* revision should be reset to 0 for new version.
* revision should not decrease inside the same version interval.
Closes Homebrew/homebrew#48032.
Signed-off-by: Xu Cheng <xucheng@me.com>
Diffstat (limited to 'Library/Homebrew/cmd')
| -rw-r--r-- | Library/Homebrew/cmd/audit.rb | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/Library/Homebrew/cmd/audit.rb b/Library/Homebrew/cmd/audit.rb index 3c9ed0386..8c700f42e 100644 --- a/Library/Homebrew/cmd/audit.rb +++ b/Library/Homebrew/cmd/audit.rb @@ -1,4 +1,5 @@ require "formula" +require "formula_versions" require "utils" require "extend/ENV" require "formula_cellar_checks" @@ -579,6 +580,19 @@ class FormulaAuditor end end + def audit_revision + return unless formula.tap # skip formula not from core or any taps + return unless formula.tap.git? # git log is required + + fv = FormulaVersions.new(formula) + revision_map = fv.revision_map("origin/master") + if (revisions = revision_map[formula.version]).any? + problem "revision should not decrease" if formula.revision < revisions.max + else + problem "revision should be removed" unless formula.revision == 0 + end + end + def audit_legacy_patches return unless formula.respond_to?(:patches) legacy_patches = Patch.normalize_legacy_patches(formula.patches).grep(LegacyPatch) @@ -932,6 +946,7 @@ class FormulaAuditor audit_formula_name audit_class audit_specs + audit_revision audit_desc audit_homepage audit_bottle_spec |
