From 0a007fc983c83d610b918bdd8e38038e2732c170 Mon Sep 17 00:00:00 2001 From: David Broder-Rodgers Date: Thu, 15 Dec 2016 22:36:39 +0000 Subject: Updated homepage 404 check to use explicit parameters and return the status code --- Library/Homebrew/dev-cmd/audit.rb | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'Library/Homebrew/dev-cmd') diff --git a/Library/Homebrew/dev-cmd/audit.rb b/Library/Homebrew/dev-cmd/audit.rb index 0112c524f..cc5a0e62c 100644 --- a/Library/Homebrew/dev-cmd/audit.rb +++ b/Library/Homebrew/dev-cmd/audit.rb @@ -564,11 +564,10 @@ class FormulaAuditor end return unless @online - begin - nostdout { curl "--connect-timeout", "15", "-o", "/dev/null", homepage } - rescue ErrorDuringExecution - problem "The homepage is not reachable (curl exit code #{$?.exitstatus})" - end + status_code, = curl_output "--connect-timeout", "15", "--output", "/dev/null", "--range", "0-0", \ + "--write-out", "%{http_code}", homepage + return if status_code.start_with? "20" + problem "The homepage #{homepage} is not reachable (HTTP status code #{status_code})" end def audit_bottle_spec -- cgit v1.2.3 From 637aae48e4814e2799a06838c24f06a2a2ef0a36 Mon Sep 17 00:00:00 2001 From: David Broder-Rodgers Date: Mon, 19 Dec 2016 08:45:21 +0000 Subject: Markups --- Library/Homebrew/dev-cmd/audit.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Library/Homebrew/dev-cmd') diff --git a/Library/Homebrew/dev-cmd/audit.rb b/Library/Homebrew/dev-cmd/audit.rb index cc5a0e62c..754cb597b 100644 --- a/Library/Homebrew/dev-cmd/audit.rb +++ b/Library/Homebrew/dev-cmd/audit.rb @@ -564,8 +564,8 @@ class FormulaAuditor end return unless @online - status_code, = curl_output "--connect-timeout", "15", "--output", "/dev/null", "--range", "0-0", \ - "--write-out", "%{http_code}", homepage + status_code, = curl_output "--connect-timeout", "15", "--output", "/dev/null", "--range", "0-0", + "--write-out", "%{http_code}", homepage return if status_code.start_with? "20" problem "The homepage #{homepage} is not reachable (HTTP status code #{status_code})" end -- cgit v1.2.3 From cc09bb14c16c8e4f6b360f30074522c2ee25167b Mon Sep 17 00:00:00 2001 From: Tom Schoonjans Date: Mon, 19 Dec 2016 21:51:57 +0100 Subject: brew create: add meson support meson is quickly gaining popularity as build system, in combination with ninja. Several Gnome projects for example are currently transitioning from autotools to meson, mostly because it allows for Visual Studio builds, which is impossible to accomplish with autotools. In order to facilitate generating meson based Formulas, I added support for meson to brew-create. --- Library/Homebrew/dev-cmd/create.rb | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'Library/Homebrew/dev-cmd') diff --git a/Library/Homebrew/dev-cmd/create.rb b/Library/Homebrew/dev-cmd/create.rb index 11544dbef..5d46e73b9 100644 --- a/Library/Homebrew/dev-cmd/create.rb +++ b/Library/Homebrew/dev-cmd/create.rb @@ -1,4 +1,4 @@ -#: * `create` [`--autotools`|`--cmake`] [`--no-fetch`] [`--set-name` ] [`--set-version` ] [`--tap` `/`]: +#: * `create` [`--autotools`|`--cmake`|`--meson`] [`--no-fetch`] [`--set-name` ] [`--set-version` ] [`--tap` `/`]: #: Generate a formula for the downloadable file at and open it in the editor. #: Homebrew will attempt to automatically derive the formula name #: and version, but if it fails, you'll have to make your own template. The `wget` @@ -8,6 +8,7 @@ #: #: If `--autotools` is passed, create a basic template for an Autotools-style build. #: If `--cmake` is passed, create a basic template for a CMake-style build. +#: If `--meson` is passed, create a basic template for a Meson-style build. #: #: If `--no-fetch` is passed, Homebrew will not download to the cache and #: will thus not add the SHA256 to the formula for you. @@ -59,6 +60,8 @@ module Homebrew :cmake elsif ARGV.include? "--autotools" :autotools + elsif ARGV.include? "--meson" + :meson end if fc.name.nil? || fc.name.strip.empty? @@ -175,6 +178,9 @@ class FormulaCreator <% if mode == :cmake %> depends_on "cmake" => :build + <% elsif mode == :meson %> + depends_on "meson" => :build + depends_on "ninja" => :build <% elsif mode.nil? %> # depends_on "cmake" => :build <% end %> @@ -191,6 +197,13 @@ class FormulaCreator "--disable-dependency-tracking", "--disable-silent-rules", "--prefix=\#{prefix}" + <% elsif mode == :meson %> + mkdir "build" do + system "meson", "--prefix=\#{prefix}", ".." + system "ninja" + system "ninja", "test" + system "ninja", "install" + end <% else %> # Remove unrecognized options if warned by configure system "./configure", "--disable-debug", @@ -199,7 +212,9 @@ class FormulaCreator "--prefix=\#{prefix}" # system "cmake", ".", *std_cmake_args <% end %> + <% if mode != :meson %> system "make", "install" # if this fails, try separate make/make install steps + <% end %> end test do -- cgit v1.2.3 From 3ebd7df62d0b05a8a010bec74793cc4e688a2fc8 Mon Sep 17 00:00:00 2001 From: Zhiming Wang Date: Thu, 22 Dec 2016 00:54:08 -0500 Subject: bump-formula-pr: fix removal of old mirrors Previously, old mirrors are only removed if the requested spec is stable, and if the mirror lines only have two leading spaces. This leads to stale mirror line(s) when the formula a stable block like stable do url "http://example.com/v1.0.tar.gz" mirror "http://example.net/v1.0.tar.gz" end where the mirror line is lead by four spaces. In this commit, we discard the /(^ mirror .*\n)?/ pattern, and instead create a pattern with the exact url and flexible leading spaces for each mirror of the requested spec. --- Library/Homebrew/dev-cmd/bump-formula-pr.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'Library/Homebrew/dev-cmd') diff --git a/Library/Homebrew/dev-cmd/bump-formula-pr.rb b/Library/Homebrew/dev-cmd/bump-formula-pr.rb index b1f851b8d..8fdbd97b6 100644 --- a/Library/Homebrew/dev-cmd/bump-formula-pr.rb +++ b/Library/Homebrew/dev-cmd/bump-formula-pr.rb @@ -156,7 +156,9 @@ module Homebrew replacement_pairs << [/^ revision \d+\n(\n( head "))?/m, "\\2"] end - replacement_pairs << [/(^ mirror .*\n)?/, ""] if requested_spec == :stable + replacement_pairs += formula_spec.mirrors.map do |mirror| + [/ +mirror \"#{mirror}\"\n/m, ""] + end replacement_pairs += if new_url_hash [ -- cgit v1.2.3 From 1ab8b5e35b46b9029c75016fb02c2bd63b4f3f08 Mon Sep 17 00:00:00 2001 From: Zhiming Wang Date: Thu, 22 Dec 2016 18:57:57 -0500 Subject: create: remove :x11 dep from new formula template --- Library/Homebrew/dev-cmd/create.rb | 1 - 1 file changed, 1 deletion(-) (limited to 'Library/Homebrew/dev-cmd') diff --git a/Library/Homebrew/dev-cmd/create.rb b/Library/Homebrew/dev-cmd/create.rb index f684f95f6..3b8ba3344 100644 --- a/Library/Homebrew/dev-cmd/create.rb +++ b/Library/Homebrew/dev-cmd/create.rb @@ -178,7 +178,6 @@ class FormulaCreator <% elsif mode.nil? %> # depends_on "cmake" => :build <% end %> - depends_on :x11 # if your formula requires any X11/XQuartz components def install # ENV.deparallelize # if your formula fails when building in parallel -- cgit v1.2.3 From 8ffe231f44f18aeb482a213e50c3959a3f6405ab Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Thu, 29 Dec 2016 11:46:49 +0000 Subject: audit: don't allow openssl & libressl dependency. Formulae should not depend on both OpenSSL and LibreSSL (even optionally). This is to avoid descending into madness where every formulae that could use LibreSSL has to have option and switching logic. Homebrew has standardised on OpenSSL and will do so everywhere that LibreSSL is not a hard requirement. --- Library/Homebrew/dev-cmd/audit.rb | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'Library/Homebrew/dev-cmd') diff --git a/Library/Homebrew/dev-cmd/audit.rb b/Library/Homebrew/dev-cmd/audit.rb index 93431c951..ef22cbb7a 100644 --- a/Library/Homebrew/dev-cmd/audit.rb +++ b/Library/Homebrew/dev-cmd/audit.rb @@ -788,6 +788,10 @@ class FormulaAuditor problem "Please set plist_options when using a formula-defined plist." end + if text =~ /depends_on\s+['"]openssl['"]/ && text =~ /depends_on\s+['"]libressl['"]/ + problem "Formulae should not depend on both OpenSSL and LibreSSL (even optionally)." + end + return unless text.include?('require "language/go"') && !text.include?("go_resource") problem "require \"language/go\" is unnecessary unless using `go_resource`s" end -- cgit v1.2.3 From 59180ec370560d461d9fa44a3e510e9f1ea68375 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Fri, 23 Dec 2016 20:29:56 +0000 Subject: audit: improve reliability of homepage audit. - Don't run on Yosemite where the system Curl is too old for some modern HTTPS homepages - Try up to 3 times in case of transient failures. --- Library/Homebrew/dev-cmd/audit.rb | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'Library/Homebrew/dev-cmd') diff --git a/Library/Homebrew/dev-cmd/audit.rb b/Library/Homebrew/dev-cmd/audit.rb index ef22cbb7a..757cc0df4 100644 --- a/Library/Homebrew/dev-cmd/audit.rb +++ b/Library/Homebrew/dev-cmd/audit.rb @@ -569,9 +569,20 @@ class FormulaAuditor end return unless @online - status_code, = curl_output "--connect-timeout", "15", "--output", "/dev/null", "--range", "0-0", - "--write-out", "%{http_code}", homepage - return if status_code.start_with? "20" + + # The system Curl is too old and unreliable with HTTPS homepages on + # Yosemite and below. + return unless MacOS.version >= :el_capitan + + retries = 3 + retries.times do + status_code, = curl_output "--connect-timeout", "15", + "--output", "/dev/null", + "--range", "0-0", + "--write-out", "%{http_code}", + homepage + return if status_code.start_with? "20" + end problem "The homepage #{homepage} is not reachable (HTTP status code #{status_code})" end -- cgit v1.2.3 From b3c6334d3cde6d653427ae29892e3a14af9c5bd9 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Fri, 30 Dec 2016 20:17:34 +0000 Subject: audit: use new curl_args form. This will use Curl’s default user agent to reduce homepage errors and provides a function that can be used for other audits to perform similar tests on URLs. --- Library/Homebrew/dev-cmd/audit.rb | 42 +++++++++++++++++++++++++++------------ 1 file changed, 29 insertions(+), 13 deletions(-) (limited to 'Library/Homebrew/dev-cmd') diff --git a/Library/Homebrew/dev-cmd/audit.rb b/Library/Homebrew/dev-cmd/audit.rb index 757cc0df4..74ba987f6 100644 --- a/Library/Homebrew/dev-cmd/audit.rb +++ b/Library/Homebrew/dev-cmd/audit.rb @@ -169,6 +169,33 @@ class FormulaAuditor @specs = %w[stable devel head].map { |s| formula.send(s) }.compact end + def url_status_code(url, range: false) + # The system Curl is too old and unreliable with HTTPS homepages on + # Yosemite and below. + return "200" unless DevelopmentTools.curl_handles_most_https_homepages? + + extra_args = [ + "--connect-timeout", "15", + "--output", "/dev/null", + "--write-out", "%{http_code}" + ] + extra_args << "--range" << "0-0" if range + extra_args << url + + args = curl_args( + extra_args: extra_args, + show_output: true, + default_user_agent: true + ) + retries = 3 + status_code = nil + retries.times do + status_code = Open3.popen3(*args) { |_, stdout, _, _| stdout.read } + break if status_code.start_with? "20" + end + status_code + end + def audit_style return unless @style_offenses display_cop_names = ARGV.include?("--display-cop-names") @@ -570,19 +597,8 @@ class FormulaAuditor return unless @online - # The system Curl is too old and unreliable with HTTPS homepages on - # Yosemite and below. - return unless MacOS.version >= :el_capitan - - retries = 3 - retries.times do - status_code, = curl_output "--connect-timeout", "15", - "--output", "/dev/null", - "--range", "0-0", - "--write-out", "%{http_code}", - homepage - return if status_code.start_with? "20" - end + status_code = url_status_code(homepage) + return if status_code.start_with? "20" problem "The homepage #{homepage} is not reachable (HTTP status code #{status_code})" end -- cgit v1.2.3 From d7ab913f312a3dd0852ba874d7585c4aad3c6166 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Tue, 3 Jan 2017 22:12:21 +0000 Subject: audit: deprecate env :std/:userpaths for strict. This should apply only for new formulae but we should start gradually phasing it out for older ones too. --- Library/Homebrew/dev-cmd/audit.rb | 2 ++ 1 file changed, 2 insertions(+) (limited to 'Library/Homebrew/dev-cmd') diff --git a/Library/Homebrew/dev-cmd/audit.rb b/Library/Homebrew/dev-cmd/audit.rb index 74ba987f6..601031d6e 100644 --- a/Library/Homebrew/dev-cmd/audit.rb +++ b/Library/Homebrew/dev-cmd/audit.rb @@ -1048,6 +1048,8 @@ class FormulaAuditor return unless @strict + problem "`#{$1}` in formulae is deprecated" if line =~ /(env :(std|userpaths))/ + if line =~ /system ((["'])[^"' ]*(?:\s[^"' ]*)+\2)/ bad_system = $1 unless %w[| < > & ; *].any? { |c| bad_system.include? c } -- cgit v1.2.3 From a3bffe70bcf33e6051140b1a93c9f48714605af6 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Wed, 4 Jan 2017 11:13:41 +0000 Subject: Use docs.brew.sh links. --- Library/Homebrew/dev-cmd/create.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Library/Homebrew/dev-cmd') diff --git a/Library/Homebrew/dev-cmd/create.rb b/Library/Homebrew/dev-cmd/create.rb index da855e382..07dd1b322 100644 --- a/Library/Homebrew/dev-cmd/create.rb +++ b/Library/Homebrew/dev-cmd/create.rb @@ -159,7 +159,7 @@ class FormulaCreator end def template; <<-EOS.undent - # Documentation: https://github.com/Homebrew/brew/blob/master/docs/Formula-Cookbook.md + # Documentation: http://docs.brew.sh/Formula-Cookbook.html # http://www.rubydoc.info/github/Homebrew/brew/master/Formula # PLEASE REMOVE ALL GENERATED COMMENTS BEFORE SUBMITTING YOUR PULL REQUEST! -- cgit v1.2.3 From e7a81caaf4bc0468fdc302656efebd584e10a3f6 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Sat, 7 Jan 2017 14:03:08 +0000 Subject: Allow `brew audit` to fake a Safari user-agent. This allows us to detect if homepages such as e.g. `aiccu` which blocks `curl` are up or not. --- Library/Homebrew/dev-cmd/audit.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'Library/Homebrew/dev-cmd') diff --git a/Library/Homebrew/dev-cmd/audit.rb b/Library/Homebrew/dev-cmd/audit.rb index 601031d6e..6d43c51bf 100644 --- a/Library/Homebrew/dev-cmd/audit.rb +++ b/Library/Homebrew/dev-cmd/audit.rb @@ -169,7 +169,7 @@ class FormulaAuditor @specs = %w[stable devel head].map { |s| formula.send(s) }.compact end - def url_status_code(url, range: false) + def url_status_code(url, range: false, user_agent: :default) # The system Curl is too old and unreliable with HTTPS homepages on # Yosemite and below. return "200" unless DevelopmentTools.curl_handles_most_https_homepages? @@ -185,7 +185,7 @@ class FormulaAuditor args = curl_args( extra_args: extra_args, show_output: true, - default_user_agent: true + user_agent: user_agent ) retries = 3 status_code = nil @@ -597,7 +597,7 @@ class FormulaAuditor return unless @online - status_code = url_status_code(homepage) + status_code = url_status_code(homepage, user_agent: :browser) return if status_code.start_with? "20" problem "The homepage #{homepage} is not reachable (HTTP status code #{status_code})" end -- cgit v1.2.3 From c276a44ebae578bdbd3048916f2a90ae20e72dd1 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Mon, 9 Jan 2017 12:16:55 +0000 Subject: bump-formula-pr: check for URL presence. If it's not there, produce a nicer error. Fixes #1805. --- Library/Homebrew/dev-cmd/bump-formula-pr.rb | 2 ++ 1 file changed, 2 insertions(+) (limited to 'Library/Homebrew/dev-cmd') diff --git a/Library/Homebrew/dev-cmd/bump-formula-pr.rb b/Library/Homebrew/dev-cmd/bump-formula-pr.rb index 8fdbd97b6..68bf32d0b 100644 --- a/Library/Homebrew/dev-cmd/bump-formula-pr.rb +++ b/Library/Homebrew/dev-cmd/bump-formula-pr.rb @@ -124,6 +124,8 @@ module Homebrew false elsif !hash_type odie "#{formula}: no tag/revision specified!" + elsif !new_url + odie "#{formula}: no url specified!" else rsrc_url = if requested_spec != :devel && new_url =~ /.*ftpmirror.gnu.*/ new_mirror = new_url.sub "ftpmirror.gnu.org", "ftp.gnu.org/gnu" -- cgit v1.2.3 From 346d68eb04013d2322796ed1a0edd7de007a156d Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Mon, 9 Jan 2017 13:24:51 +0000 Subject: audit: check virtualenv and setuptools resource. `virtualenv_install_with_resources` will automatically define and install a `setuptools` resource so this is unnecessary. References https://github.com/Homebrew/homebrew-core/pull/8570 --- Library/Homebrew/dev-cmd/audit.rb | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'Library/Homebrew/dev-cmd') diff --git a/Library/Homebrew/dev-cmd/audit.rb b/Library/Homebrew/dev-cmd/audit.rb index 6d43c51bf..744aa6fbe 100644 --- a/Library/Homebrew/dev-cmd/audit.rb +++ b/Library/Homebrew/dev-cmd/audit.rb @@ -819,6 +819,11 @@ class FormulaAuditor problem "Formulae should not depend on both OpenSSL and LibreSSL (even optionally)." end + if text =~ /virtualenv_(create|install_with_resources)/ && + text =~ /resource\s+['"]setuptools['"]\s+do/ + problem "Formulae using virtualenvs do not need a `setuptools` resource." + end + return unless text.include?('require "language/go"') && !text.include?("go_resource") problem "require \"language/go\" is unnecessary unless using `go_resource`s" end -- cgit v1.2.3 From 9dca10f9dc428e85afa399de4b76dbeac81a32b2 Mon Sep 17 00:00:00 2001 From: ilovezfs Date: Fri, 13 Jan 2017 16:26:59 -0800 Subject: audit: whitelist unstable versions already in core also allow higher stable versions with the same version prefix --- Library/Homebrew/dev-cmd/audit.rb | 38 +++++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) (limited to 'Library/Homebrew/dev-cmd') diff --git a/Library/Homebrew/dev-cmd/audit.rb b/Library/Homebrew/dev-cmd/audit.rb index 744aa6fbe..88d9a535c 100644 --- a/Library/Homebrew/dev-cmd/audit.rb +++ b/Library/Homebrew/dev-cmd/audit.rb @@ -678,11 +678,47 @@ class FormulaAuditor end end + unstable_whitelist = %w[ + aalib 1.4rc5 + automysqlbackup 3.0-rc6 + aview 1.3.0rc1 + distcc 3.2rc1 + elm-format 0.5.2-alpha + ftgl 2.1.3-rc5 + hidapi 0.8.0-rc1 + libcaca 0.99b19 + premake 4.4-beta5 + pwnat 0.3-beta + pxz 4.999.9 + recode 3.7-beta2 + speexdsp 1.2rc3 + sqoop 1.4.6 + tcptraceroute 1.5beta7 + testssl 2.8rc3 + tiny-fugue 5.0b8 + vbindiff 3.0_beta4 + ].each_slice(2).to_a.map do |formula, version| + [formula, version.sub(/\d+$/, "")] + end + + gnome_devel_whitelist = %w[ + gtk-doc 1.25 + libart 2.3.21 + pygtkglext 1.1.0 + ].each_slice(2).to_a.map do |formula, version| + [formula, version.split(".")[0..1].join(".")] + end + stable = formula.stable case stable && stable.url when /[\d\._-](alpha|beta|rc\d)/ - problem "Stable version URLs should not contain #{$1}" + matched = $1 + version_prefix = stable.version.to_s.sub(/\d+$/, "") + return if unstable_whitelist.include?([formula.name, version_prefix]) + problem "Stable version URLs should not contain #{matched}" when %r{download\.gnome\.org/sources}, %r{ftp\.gnome\.org/pub/GNOME/sources}i + version_prefix = stable.version.to_s.split(".")[0..1].join(".") + return if gnome_devel_whitelist.include?([formula.name, version_prefix]) version = Version.parse(stable.url) if version >= Version.create("1.0") minor_version = version.to_s.split(".", 3)[1].to_i -- cgit v1.2.3 From f4496e85e515180f96e0863af3047bf3f4a94e81 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Sun, 15 Jan 2017 02:31:11 -0800 Subject: audit: don't allow universal for new formulae. We're frowning on these now so may as well turn that into code. --- Library/Homebrew/dev-cmd/audit.rb | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'Library/Homebrew/dev-cmd') diff --git a/Library/Homebrew/dev-cmd/audit.rb b/Library/Homebrew/dev-cmd/audit.rb index 744aa6fbe..f2306debf 100644 --- a/Library/Homebrew/dev-cmd/audit.rb +++ b/Library/Homebrew/dev-cmd/audit.rb @@ -481,6 +481,10 @@ class FormulaAuditor next unless @strict + if o.name == "universal" + problem "macOS has been 64-bit only since 10.6 so universal options are deprecated." + end + if o.name !~ /with(out)?-/ && o.name != "c++11" && o.name != "universal" problem "Options should begin with with/without. Migrate '--#{o.name}' with `deprecated_option`." end -- cgit v1.2.3 From feea90c0ddee280193182d8cce2ce56bc8e4aa6f Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Mon, 16 Jan 2017 20:15:20 +0000 Subject: create: handle null versions. Fixes #1821 --- Library/Homebrew/dev-cmd/create.rb | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'Library/Homebrew/dev-cmd') diff --git a/Library/Homebrew/dev-cmd/create.rb b/Library/Homebrew/dev-cmd/create.rb index 07dd1b322..b4cda0fad 100644 --- a/Library/Homebrew/dev-cmd/create.rb +++ b/Library/Homebrew/dev-cmd/create.rb @@ -142,12 +142,10 @@ class FormulaCreator def generate! raise "#{path} already exists" if path.exist? - if version.nil? + if version.nil? || version.null? opoo "Version cannot be determined from URL." puts "You'll need to add an explicit 'version' to the formula." - end - - if fetch? && version + elsif fetch? r = Resource.new r.url(url) r.version(version) -- cgit v1.2.3 From dac66c4ada178c09b3b9b77feb2eaa7442b7443e Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Tue, 17 Jan 2017 10:43:43 +0000 Subject: Add `keg_only :versioned_formula`. This is used to indicate a formula is a version of another formula. This will be used to provide a consistent interface for older formulae versions and replaces the use of `conflicts_with`. --- Library/Homebrew/dev-cmd/audit.rb | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'Library/Homebrew/dev-cmd') diff --git a/Library/Homebrew/dev-cmd/audit.rb b/Library/Homebrew/dev-cmd/audit.rb index 394e0e763..281839621 100644 --- a/Library/Homebrew/dev-cmd/audit.rb +++ b/Library/Homebrew/dev-cmd/audit.rb @@ -459,6 +459,14 @@ class FormulaAuditor end def audit_conflicts + if formula.versioned_formula? + problem <<-EOS + Versioned formulae should not use `conflicts_with`. + Use `keg_only :versioned_formula` instead. + EOS + return + end + formula.conflicts.each do |c| begin Formulary.factory(c.name) @@ -497,7 +505,7 @@ class FormulaAuditor return unless @new_formula return if formula.deprecated_options.empty? - return if formula.name.include?("@") + return if formula.versioned_formula? problem "New formulae should not use `deprecated_option`." end -- cgit v1.2.3 From 42486c1181bdf4ed85f334ccb1edbb6632cfc4b2 Mon Sep 17 00:00:00 2001 From: Zhiming Wang Date: Tue, 17 Jan 2017 10:16:35 -0500 Subject: bottle: add: improve regexp to recognize comments This would have eliminated the need for Homebrew/homebrew-core#9000, for instance. --- Library/Homebrew/dev-cmd/bottle.rb | 1 + 1 file changed, 1 insertion(+) (limited to 'Library/Homebrew/dev-cmd') diff --git a/Library/Homebrew/dev-cmd/bottle.rb b/Library/Homebrew/dev-cmd/bottle.rb index 9618cf412..75078cffd 100644 --- a/Library/Homebrew/dev-cmd/bottle.rb +++ b/Library/Homebrew/dev-cmd/bottle.rb @@ -435,6 +435,7 @@ module Homebrew else string = s.sub!( /( + (\ {2}\#[^\n]*\n)* # comments \ {2}( # two spaces at the beginning (url|head)\ ['"][\S\ ]+['"] # url or head with a string ( -- cgit v1.2.3 From 4f0505f759d355d6a514485733c0ea3349711655 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Tue, 17 Jan 2017 19:09:41 +0000 Subject: audit: only warn on versioned conflicts_with. Rather than all versioned formulae regardless. Oops. --- Library/Homebrew/dev-cmd/audit.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Library/Homebrew/dev-cmd') diff --git a/Library/Homebrew/dev-cmd/audit.rb b/Library/Homebrew/dev-cmd/audit.rb index 281839621..594555695 100644 --- a/Library/Homebrew/dev-cmd/audit.rb +++ b/Library/Homebrew/dev-cmd/audit.rb @@ -459,7 +459,7 @@ class FormulaAuditor end def audit_conflicts - if formula.versioned_formula? + if formula.conflicts.any? && formula.versioned_formula? problem <<-EOS Versioned formulae should not use `conflicts_with`. Use `keg_only :versioned_formula` instead. -- cgit v1.2.3 From cebe137499cc5e74dd0b34e54226a1ade7a4bf60 Mon Sep 17 00:00:00 2001 From: ilovezfs Date: Wed, 18 Jan 2017 11:03:36 -0800 Subject: audit: exempt wine's deps from the universal deprecation This can be reverted when wine's dependencies are all vendored. --- Library/Homebrew/dev-cmd/audit.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Library/Homebrew/dev-cmd') diff --git a/Library/Homebrew/dev-cmd/audit.rb b/Library/Homebrew/dev-cmd/audit.rb index 594555695..5b0102130 100644 --- a/Library/Homebrew/dev-cmd/audit.rb +++ b/Library/Homebrew/dev-cmd/audit.rb @@ -489,7 +489,7 @@ class FormulaAuditor next unless @strict - if o.name == "universal" + if o.name == "universal" && !Formula["wine"].recursive_dependencies.map(&:name).include?(formula.name) problem "macOS has been 64-bit only since 10.6 so universal options are deprecated." end -- cgit v1.2.3 From 22f294af90ed08e2da9d0652fdc9c560c7797bed Mon Sep 17 00:00:00 2001 From: Xu Cheng Date: Sun, 22 Jan 2017 19:50:14 +0800 Subject: bottle: fix regex Noted that this is intended for the revision of this formula instead of rebuild of a bottle. --- Library/Homebrew/dev-cmd/bottle.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Library/Homebrew/dev-cmd') diff --git a/Library/Homebrew/dev-cmd/bottle.rb b/Library/Homebrew/dev-cmd/bottle.rb index 75078cffd..7367e5c37 100644 --- a/Library/Homebrew/dev-cmd/bottle.rb +++ b/Library/Homebrew/dev-cmd/bottle.rb @@ -443,7 +443,7 @@ module Homebrew (\n^\ {3}[\S\ ]+$)* # options can be in multiple lines )?| (homepage|desc|sha1|sha256|version|mirror)\ ['"][\S\ ]+['"]| # specs with a string - rebuild\ \d+ # rebuild with a number + revision\ \d+ # revision with a number )\n+ # multiple empty lines )+ /mx, '\0' + output + "\n" -- cgit v1.2.3 From 19e61355b38b8ba96db0ca71849bb536af0490bf Mon Sep 17 00:00:00 2001 From: Alyssa Ross Date: Sun, 22 Jan 2017 20:54:37 +0000 Subject: tests: remove with_git_env method A common git environment is now used in all tests, so this is no longer required. --- Library/Homebrew/dev-cmd/tests.rb | 1 + 1 file changed, 1 insertion(+) (limited to 'Library/Homebrew/dev-cmd') diff --git a/Library/Homebrew/dev-cmd/tests.rb b/Library/Homebrew/dev-cmd/tests.rb index b4f3c2d40..05bdda8d2 100644 --- a/Library/Homebrew/dev-cmd/tests.rb +++ b/Library/Homebrew/dev-cmd/tests.rb @@ -34,6 +34,7 @@ module Homebrew %w[AUTHOR COMMITTER].each do |role| ENV["GIT_#{role}_NAME"] = "brew tests" ENV["GIT_#{role}_EMAIL"] = "brew-tests@localhost" + ENV["GIT_#{role}_DATE"] = "Sun Jan 22 19:59:13 2017 +0000" end Homebrew.install_gem_setup_path! "bundler" -- cgit v1.2.3