diff options
| author | Jack Nagel | 2013-06-28 21:17:12 -0500 |
|---|---|---|
| committer | Jack Nagel | 2013-06-28 21:17:23 -0500 |
| commit | a16c80add0f350501b3c9d4c0cf12c0010263178 (patch) | |
| tree | c32bae62140b211dff4bd69422892cf7aca2864f | |
| parent | 7ffc75e50175e0ec8f3f7a52a6bb3d5af0babb6f (diff) | |
| download | homebrew-a16c80add0f350501b3c9d4c0cf12c0010263178.tar.bz2 | |
Detect versions in tag specs
Closes #18300.
Closes #20891.
| -rw-r--r-- | Library/Formula/closure-compiler.rb | 1 | ||||
| -rw-r--r-- | Library/Formula/git-flow.rb | 1 | ||||
| -rw-r--r-- | Library/Formula/git-now.rb | 1 | ||||
| -rw-r--r-- | Library/Formula/ical-buddy.rb | 4 | ||||
| -rw-r--r-- | Library/Formula/libwebsockets.rb | 1 | ||||
| -rw-r--r-- | Library/Formula/mr.rb | 1 | ||||
| -rw-r--r-- | Library/Formula/multimarkdown.rb | 1 | ||||
| -rw-r--r-- | Library/Formula/tmap.rb | 2 | ||||
| -rw-r--r-- | Library/Formula/torsocks.rb | 2 | ||||
| -rw-r--r-- | Library/Formula/trash.rb | 1 | ||||
| -rw-r--r-- | Library/Formula/tuntap.rb | 1 | ||||
| -rw-r--r-- | Library/Homebrew/cmd/audit.rb | 2 | ||||
| -rw-r--r-- | Library/Homebrew/formula_support.rb | 15 | ||||
| -rw-r--r-- | Library/Homebrew/test/test_software_spec.rb | 6 | ||||
| -rw-r--r-- | Library/Homebrew/version.rb | 8 |
15 files changed, 26 insertions, 21 deletions
diff --git a/Library/Formula/closure-compiler.rb b/Library/Formula/closure-compiler.rb index c8a6bdfeb..66ebe9434 100644 --- a/Library/Formula/closure-compiler.rb +++ b/Library/Formula/closure-compiler.rb @@ -3,7 +3,6 @@ require 'formula' class ClosureCompiler < Formula homepage 'http://code.google.com/p/closure-compiler/' url 'https://code.google.com/p/closure-compiler/', :using => :git, :tag => 'v20130411' - version '20130411' head 'https://code.google.com/p/closure-compiler/', :using => :git diff --git a/Library/Formula/git-flow.rb b/Library/Formula/git-flow.rb index e5194109d..51566caf2 100644 --- a/Library/Formula/git-flow.rb +++ b/Library/Formula/git-flow.rb @@ -13,7 +13,6 @@ class GitFlow < Formula # Use the tag instead of the tarball to get submodules url 'https://github.com/nvie/gitflow.git', :tag => '0.4.1' - version '0.4.1' head 'https://github.com/nvie/gitflow.git', :branch => 'develop' diff --git a/Library/Formula/git-now.rb b/Library/Formula/git-now.rb index 876dba292..267ba40b7 100644 --- a/Library/Formula/git-now.rb +++ b/Library/Formula/git-now.rb @@ -3,7 +3,6 @@ require 'formula' class GitNow < Formula homepage 'https://github.com/iwata/git-now' url 'https://github.com/iwata/git-now.git', :tag => 'v0.1.0.9' - version '0.1.0.9' head 'https://github.com/iwata/git-now.git', :branch => 'develop' diff --git a/Library/Formula/ical-buddy.rb b/Library/Formula/ical-buddy.rb index 7b470b320..b2cd1d6fc 100644 --- a/Library/Formula/ical-buddy.rb +++ b/Library/Formula/ical-buddy.rb @@ -4,9 +4,7 @@ class IcalBuddy < Formula # NOTE: the official tarball doesn't actually contain any source, # just a prebuilt i386 binary homepage 'http://hasseg.org/icalBuddy/' - url 'http://hasseg.org/git-public/icalBuddy.git', - :tag => 'v1.8.8' - version '1.8.8' + url 'http://hasseg.org/git-public/icalBuddy.git', :tag => 'v1.8.8' head 'http://hasseg.org/git-public/icalBuddy.git' diff --git a/Library/Formula/libwebsockets.rb b/Library/Formula/libwebsockets.rb index 8b404fa5b..eca3452f6 100644 --- a/Library/Formula/libwebsockets.rb +++ b/Library/Formula/libwebsockets.rb @@ -3,7 +3,6 @@ require 'formula' class Libwebsockets < Formula homepage 'http://git.warmcat.com/cgi-bin/cgit/libwebsockets' url 'git://git.warmcat.com/libwebsockets', :tag => 'v1.22-chrome26-firefox18' - version '1.22' depends_on 'cmake' => :build diff --git a/Library/Formula/mr.rb b/Library/Formula/mr.rb index 5b0a12ffb..635538f7c 100644 --- a/Library/Formula/mr.rb +++ b/Library/Formula/mr.rb @@ -3,7 +3,6 @@ require 'formula' class Mr < Formula homepage 'http://kitenet.net/~joey/code/mr/' url 'http://git.kitenet.net/git/mr.git', :tag => '1.15' - version '1.15' def install system "make" diff --git a/Library/Formula/multimarkdown.rb b/Library/Formula/multimarkdown.rb index d0b4bc832..dbe918096 100644 --- a/Library/Formula/multimarkdown.rb +++ b/Library/Formula/multimarkdown.rb @@ -5,7 +5,6 @@ class Multimarkdown < Formula # Use the tag instead of the tarball to get submodules url 'https://github.com/fletcher/peg-multimarkdown.git', :tag => '3.7' - version '3.7' head 'https://github.com/fletcher/peg-multimarkdown.git', :branch => 'development' diff --git a/Library/Formula/tmap.rb b/Library/Formula/tmap.rb index 222197024..d351637c0 100644 --- a/Library/Formula/tmap.rb +++ b/Library/Formula/tmap.rb @@ -3,8 +3,6 @@ require 'formula' class Tmap < Formula homepage 'https://github.com/iontorrent/TMAP' url 'https://github.com/iontorrent/TMAP.git', :tag => 'tmap.3.2.0' - sha1 'da3eb4ce3428cec1f5ac12467af4802df6188711' - version '3.2.0' head 'https://github.com/iontorrent/TMAP.git' diff --git a/Library/Formula/torsocks.rb b/Library/Formula/torsocks.rb index 4283806ca..c5450d143 100644 --- a/Library/Formula/torsocks.rb +++ b/Library/Formula/torsocks.rb @@ -3,7 +3,7 @@ require 'formula' class Torsocks < Formula homepage 'https://gitweb.torproject.org/torsocks.git/' url 'https://git.torproject.org/torsocks.git', :tag => '1.3' - version '1.3' + head 'https://git.torproject.org/torsocks.git', :branch => 'master' depends_on :autoconf diff --git a/Library/Formula/trash.rb b/Library/Formula/trash.rb index b7e6d0d3e..e914c1b1d 100644 --- a/Library/Formula/trash.rb +++ b/Library/Formula/trash.rb @@ -3,7 +3,6 @@ require 'formula' class Trash < Formula homepage 'http://hasseg.org/trash/' url 'http://hasseg.org/git-public/trash.git/', :using => :git, :tag => 'v0.8.2' - version '0.8.2' def install system "make" diff --git a/Library/Formula/tuntap.rb b/Library/Formula/tuntap.rb index 075ebbb6c..34e0bc094 100644 --- a/Library/Formula/tuntap.rb +++ b/Library/Formula/tuntap.rb @@ -3,7 +3,6 @@ require 'formula' class Tuntap < Formula homepage 'http://tuntaposx.sourceforge.net/' url 'git://git.code.sf.net/p/tuntaposx/code', :tag => 'release_20111101' - version '20111101' head 'git://git.code.sf.net/p/tuntaposx/code', :branch => 'master' diff --git a/Library/Homebrew/cmd/audit.rb b/Library/Homebrew/cmd/audit.rb index f19a461a7..603dac89b 100644 --- a/Library/Homebrew/cmd/audit.rb +++ b/Library/Homebrew/cmd/audit.rb @@ -276,7 +276,7 @@ class FormulaAuditor problem "Invalid or missing #{spec} version" else version_text = s.version unless s.version.detected_from_url? - version_url = Version.parse(s.url) + version_url = Version.detect(s.url, s.specs) if version_url.to_s == version_text.to_s && s.version.instance_of?(Version) problem "#{spec} version #{version_text} is redundant with version scanned from URL" end diff --git a/Library/Homebrew/formula_support.rb b/Library/Homebrew/formula_support.rb index f5936ea65..1ef4d3abc 100644 --- a/Library/Homebrew/formula_support.rb +++ b/Library/Homebrew/formula_support.rb @@ -35,6 +35,14 @@ class SoftwareSpec raise e end + def detect_version(val) + case val + when nil then Version.detect(url, specs) + when String then Version.new(val) + when Hash then Version.new_with_scheme(*val.shift) + end + end + # The methods that follow are used in the block-form DSL spec methods Checksum::TYPES.each do |cksum| class_eval <<-EOS, __FILE__, __LINE__ + 1 @@ -52,12 +60,7 @@ class SoftwareSpec end def version val=nil - @version ||= - case val - when nil then Version.parse(@url) - when Hash then Version.new_with_scheme(*val.shift) - else Version.new(val) - end + @version ||= detect_version(val) end def mirror val diff --git a/Library/Homebrew/test/test_software_spec.rb b/Library/Homebrew/test/test_software_spec.rb index 0090ec099..f3eed4769 100644 --- a/Library/Homebrew/test/test_software_spec.rb +++ b/Library/Homebrew/test/test_software_spec.rb @@ -60,6 +60,12 @@ class SoftwareSpecTests < Test::Unit::TestCase assert_instance_of scheme, @spec.version end + def test_version_from_tag + @spec.url('http://foo.com/bar-1.0.tar.gz', :tag => 'v1.0.2') + assert_version_equal '1.0.2', @spec.version + assert @spec.version.detected_from_url? + end + def test_mirrors assert_empty @spec.mirrors @spec.mirror('foo') diff --git a/Library/Homebrew/version.rb b/Library/Homebrew/version.rb index 066852b8e..e9af49844 100644 --- a/Library/Homebrew/version.rb +++ b/Library/Homebrew/version.rb @@ -154,6 +154,14 @@ class Version end end + def self.detect(url, specs={}) + if specs.has_key?(:tag) + new(specs[:tag][/((?:\d+\.)*\d+)/, 1], true) + else + parse(url) + end + end + def initialize(val, detected=false) @version = val.to_s @detected_from_url = detected |
