aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/dev-cmd
diff options
context:
space:
mode:
Diffstat (limited to 'Library/Homebrew/dev-cmd')
-rw-r--r--Library/Homebrew/dev-cmd/audit.rb48
-rw-r--r--Library/Homebrew/dev-cmd/boneyard-formula-pr.rb166
-rw-r--r--Library/Homebrew/dev-cmd/bottle.rb2
-rw-r--r--Library/Homebrew/dev-cmd/man.rb4
-rw-r--r--Library/Homebrew/dev-cmd/test.rb2
-rw-r--r--Library/Homebrew/dev-cmd/tests.rb2
-rw-r--r--Library/Homebrew/dev-cmd/update-test.rb14
7 files changed, 49 insertions, 189 deletions
diff --git a/Library/Homebrew/dev-cmd/audit.rb b/Library/Homebrew/dev-cmd/audit.rb
index 0fc26656a..1a4bb24a1 100644
--- a/Library/Homebrew/dev-cmd/audit.rb
+++ b/Library/Homebrew/dev-cmd/audit.rb
@@ -331,25 +331,33 @@ class FormulaAuditor
problem "File should end with a newline" unless text.trailing_newline?
- versioned_formulae = Dir[formula.path.to_s.gsub(/\.rb$/, "@*.rb")]
- needs_versioned_alias = !versioned_formulae.empty? &&
- formula.tap &&
- formula.aliases.grep(/.@\d/).empty?
- if needs_versioned_alias
- _, last_alias_version = File.basename(versioned_formulae.sort.reverse.first)
- .gsub(/\.rb$/, "")
- .split("@")
- major, minor, = formula.version.to_s.split(".")
- alias_name = if last_alias_version.split(".").length == 1
- "#{formula.name}@#{major}"
- else
- "#{formula.name}@#{major}.#{minor}"
+ if formula.versioned_formula?
+ unversioned_formula = Pathname.new formula.path.to_s.gsub(/@.*\.rb$/, ".rb")
+ unless unversioned_formula.exist?
+ unversioned_name = unversioned_formula.basename(".rb")
+ problem "#{formula} is versioned but no #{unversioned_name} formula exists"
+ end
+ else
+ versioned_formulae = Dir[formula.path.to_s.gsub(/\.rb$/, "@*.rb")]
+ needs_versioned_alias = !versioned_formulae.empty? &&
+ formula.tap &&
+ formula.aliases.grep(/.@\d/).empty?
+ if needs_versioned_alias
+ _, last_alias_version = File.basename(versioned_formulae.sort.reverse.first)
+ .gsub(/\.rb$/, "")
+ .split("@")
+ major, minor, = formula.version.to_s.split(".")
+ alias_name = if last_alias_version.split(".").length == 1
+ "#{formula.name}@#{major}"
+ else
+ "#{formula.name}@#{major}.#{minor}"
+ end
+ problem <<-EOS.undent
+ Formula has other versions so create an alias:
+ cd #{formula.tap.alias_dir}
+ ln -s #{formula.path.to_s.gsub(formula.tap.path, "..")} #{alias_name}
+ EOS
end
- problem <<-EOS.undent
- Formula has other versions so create an alias:
- cd #{formula.tap.alias_dir}
- ln -s #{formula.path.to_s.gsub(formula.tap.path, "..")} #{alias_name}
- EOS
end
return unless @strict
@@ -1185,6 +1193,10 @@ class FormulaAuditor
problem "'fails_with :llvm' is now a no-op so should be removed"
end
+ if line =~ /system\s+['"](otool|install_name_tool|lipo)/ && formula.name != "cctools"
+ problem "Use ruby-macho instead of calling #{$1}"
+ end
+
if formula.tap.to_s == "homebrew/core"
["OS.mac?", "OS.linux?"].each do |check|
next unless line.include?(check)
diff --git a/Library/Homebrew/dev-cmd/boneyard-formula-pr.rb b/Library/Homebrew/dev-cmd/boneyard-formula-pr.rb
deleted file mode 100644
index 7531ef9cf..000000000
--- a/Library/Homebrew/dev-cmd/boneyard-formula-pr.rb
+++ /dev/null
@@ -1,166 +0,0 @@
-#: @hide_from_man_page
-#: * `boneyard-formula-pr` [`--dry-run`] [`--local`] [`--reason=<reason>`] <formula> :
-#: Creates a pull request to boneyard a formula.
-#:
-#: If `--dry-run` is passed, print what would be done rather than doing it.
-#:
-#: If `--local` is passed, perform only local operations (i.e. don't push or create PR).
-#:
-#: If `--reason=<reason>` is passed, append this to the commit/PR message.
-
-require "formula"
-require "json"
-require "fileutils"
-
-begin
- require "json"
-rescue LoadError
- puts "Homebrew does not provide Ruby dependencies; install with:"
- puts " gem install json"
- odie "Dependency json is not installed."
-end
-
-module Homebrew
- module_function
-
- def boneyard_formula_pr
- local_only = ARGV.include?("--local")
- formula = ARGV.formulae.first
- reason = ARGV.value("reason")
- odie "No formula found!" unless formula
-
- formula_relpath = formula.path.relative_path_from(formula.tap.path)
- formula_file = "#{formula.name}.rb"
- bottle_block = File.read(formula.path).include? " bottle do"
- boneyard_tap = Tap.fetch("homebrew", "boneyard")
- tap_migrations_path = formula.tap.path/"tap_migrations.json"
- if ARGV.dry_run?
- ohai "brew update"
- ohai "brew tap #{boneyard_tap.name}"
- ohai "cd #{formula.tap.path}"
- cd formula.tap.path
- ohai "cp #{formula_relpath} #{boneyard_tap.path}"
- ohai "git rm #{formula_relpath}"
- unless File.exist? tap_migrations_path
- ohai "Creating tap_migrations.json for #{formula.tap.name}"
- ohai "git add #{tap_migrations_path}"
- end
- ohai "Loading tap_migrations.json"
- ohai "Adding #{formula.name} to tap_migrations.json"
- else
- safe_system HOMEBREW_BREW_FILE, "update"
- safe_system HOMEBREW_BREW_FILE, "tap", boneyard_tap.name
- cd formula.tap.path
- cp formula_relpath, boneyard_tap.formula_dir
- safe_system "git", "rm", formula_relpath
- unless File.exist? tap_migrations_path
- tap_migrations_path.write <<-EOS.undent
- {
- }
- EOS
- safe_system "git", "add", tap_migrations_path
- end
- tap_migrations = JSON.parse(File.read(tap_migrations_path))
- tap_migrations[formula.name] = boneyard_tap.name
- tap_migrations = tap_migrations.sort.inject({}) { |acc, elem| acc.merge!(elem[0] => elem[1]) }
- tap_migrations_path.atomic_write(JSON.pretty_generate(tap_migrations) + "\n")
- end
- unless which("hub") || local_only
- if ARGV.dry_run?
- ohai "brew install hub"
- else
- safe_system HOMEBREW_BREW_FILE, "install", "hub"
- end
- end
- branch = "#{formula.name}-boneyard"
-
- reason = " because #{reason}" if reason
-
- if ARGV.dry_run?
- ohai "cd #{formula.tap.path}"
- ohai "git checkout --no-track -b #{branch} origin/master"
- ohai "git commit --no-edit --verbose --message=\"#{formula.name}: migrate to boneyard\" -- #{formula_relpath} #{tap_migrations_path.basename}"
-
- unless local_only
- ohai "hub fork --no-remote"
- ohai "hub fork"
- ohai "hub fork (to read $HUB_REMOTE)"
- ohai "git push $HUB_REMOTE #{branch}:#{branch}"
- ohai "hub pull-request -m $'#{formula.name}: migrate to boneyard\\n\\nCreated with `brew boneyard-formula-pr`#{reason}.'"
- end
-
- ohai "git checkout -"
- else
- cd formula.tap.path
- safe_system "git", "checkout", "--no-track", "-b", branch, "origin/master"
- safe_system "git", "commit", "--no-edit", "--verbose",
- "--message=#{formula.name}: migrate to boneyard",
- "--", formula_relpath, tap_migrations_path.basename
-
- unless local_only
- safe_system "hub", "fork", "--no-remote"
- quiet_system "hub", "fork"
- remote = Utils.popen_read("hub fork 2>&1")[/fatal: remote (.+) already exists\./, 1]
- odie "cannot get remote from 'hub'!" unless remote
- safe_system "git", "push", remote, "#{branch}:#{branch}"
- pr_message = <<-EOS.undent
- #{formula.name}: migrate to boneyard
-
- Created with `brew boneyard-formula-pr`#{reason}.
- EOS
- pr_url = Utils.popen_read("hub", "pull-request", "-m", pr_message).chomp
- end
-
- safe_system "git", "checkout", "-"
- end
-
- if ARGV.dry_run?
- ohai "cd #{boneyard_tap.path}"
- ohai "git checkout --no-track -b #{branch} origin/master"
- if bottle_block
- ohai "Removing bottle block"
- else
- ohai "No bottle block to remove"
- end
- ohai "git add #{formula_file}"
- ohai "git commit --no-edit --verbose --message=\"#{formula.name}: migrate from #{formula.tap.repo}\" -- #{formula_file}"
-
- unless local_only
- ohai "hub fork --no-remote"
- ohai "hub fork"
- ohai "hub fork (to read $HUB_REMOTE)"
- ohai "git push $HUB_REMOTE #{branch}:#{branch}"
- ohai "hub pull-request --browse -m $'#{formula.name}: migrate from #{formula.tap.repo}\\n\\nGoes together with $PR_URL\\n\\nCreated with `brew boneyard-formula-pr`#{reason}.'"
- end
-
- ohai "git checkout -"
- else
- cd boneyard_tap.formula_dir
- safe_system "git", "checkout", "--no-track", "-b", branch, "origin/master"
- if bottle_block
- Utils::Inreplace.inreplace formula_file, / bottle do.+?end\n\n/m, ""
- end
- safe_system "git", "add", formula_file
- safe_system "git", "commit", "--no-edit", "--verbose",
- "--message=#{formula.name}: migrate from #{formula.tap.repo}",
- "--", formula_file
-
- unless local_only
- safe_system "hub", "fork", "--no-remote"
- quiet_system "hub", "fork"
- remote = Utils.popen_read("hub fork 2>&1")[/fatal: remote (.+) already exists\./, 1]
- odie "cannot get remote from 'hub'!" unless remote
- safe_system "git", "push", remote, "#{branch}:#{branch}"
- safe_system "hub", "pull-request", "--browse", "-m", <<-EOS.undent
- #{formula.name}: migrate from #{formula.tap.repo}
-
- Goes together with #{pr_url}.
-
- Created with `brew boneyard-formula-pr`#{reason}.
- EOS
- end
-
- safe_system "git", "checkout", "-"
- end
- end
-end
diff --git a/Library/Homebrew/dev-cmd/bottle.rb b/Library/Homebrew/dev-cmd/bottle.rb
index b11da5607..8d3038a5a 100644
--- a/Library/Homebrew/dev-cmd/bottle.rb
+++ b/Library/Homebrew/dev-cmd/bottle.rb
@@ -6,7 +6,7 @@
#: generated DSL. Passing `--keep-old` will attempt to keep it at its
#: original value, while `--no-rebuild` will remove it.
#:
-#: If `--verbose` is passed, print the bottling commands and any warnings
+#: If `--verbose` (or `-v`) is passed, print the bottling commands and any warnings
#: encountered.
#:
#: If `--skip-relocation` is passed, do not check if the bottle can be marked
diff --git a/Library/Homebrew/dev-cmd/man.rb b/Library/Homebrew/dev-cmd/man.rb
index a146f23a8..4e5103910 100644
--- a/Library/Homebrew/dev-cmd/man.rb
+++ b/Library/Homebrew/dev-cmd/man.rb
@@ -106,7 +106,9 @@ module Homebrew
Utils.popen(["ronn", format_flag] + shared_args, "rb+") do |ronn|
ronn.write markup
ronn.close_write
- target.atomic_write ronn.read
+ ronn_output = ronn.read
+ ronn_output.gsub!(%r{</?var>}, "`") if format_flag == "--markdown"
+ target.atomic_write ronn_output
end
end
diff --git a/Library/Homebrew/dev-cmd/test.rb b/Library/Homebrew/dev-cmd/test.rb
index 4898629b0..288aa8a87 100644
--- a/Library/Homebrew/dev-cmd/test.rb
+++ b/Library/Homebrew/dev-cmd/test.rb
@@ -7,7 +7,7 @@
#: To test the development or head version of a formula, use `--devel` or
#: `--HEAD`.
#:
-#: If `--debug` is passed and the test fails, an interactive debugger will be
+#: If `--debug` (or `-d`) is passed and the test fails, an interactive debugger will be
#: launched with access to IRB or a shell inside the temporary test directory.
#:
#: If `--keep-tmp` is passed, the temporary files created for the test are
diff --git a/Library/Homebrew/dev-cmd/tests.rb b/Library/Homebrew/dev-cmd/tests.rb
index 18e7d96f2..91c7d880b 100644
--- a/Library/Homebrew/dev-cmd/tests.rb
+++ b/Library/Homebrew/dev-cmd/tests.rb
@@ -3,7 +3,7 @@
#: `--only=`<test_script> runs only <test_script>_spec.rb, and `--seed`
#: randomizes tests with the provided value instead of a random seed.
#:
-#: If `--verbose` is passed, print the command that runs the tests.
+#: If `--verbose` (or `-v`) is passed, print the command that runs the tests.
#:
#: If `--coverage` is passed, also generate code coverage reports.
#:
diff --git a/Library/Homebrew/dev-cmd/update-test.rb b/Library/Homebrew/dev-cmd/update-test.rb
index 2ff168669..add05bc7c 100644
--- a/Library/Homebrew/dev-cmd/update-test.rb
+++ b/Library/Homebrew/dev-cmd/update-test.rb
@@ -33,12 +33,24 @@ module Homebrew
elsif date = ARGV.value("before")
Utils.popen_read("git", "rev-list", "-n1", "--before=#{date}", "origin/master").chomp
elsif ARGV.include?("--to-tag")
- Utils.popen_read("git", "tag", "--list", "--sort=-version:refname").lines[1].chomp
+ previous_tag =
+ Utils.popen_read("git", "tag", "--list", "--sort=-version:refname").lines[1]
+ unless previous_tag
+ safe_system "git", "fetch", "--tags", "--depth=1"
+ previous_tag =
+ Utils.popen_read("git", "tag", "--list", "--sort=-version:refname").lines[1]
+ end
+ previous_tag.to_s.chomp
else
Utils.popen_read("git", "rev-parse", "origin/master").chomp
end
+ odie "Could not find start commit!" if start_commit.empty?
+
start_commit = Utils.popen_read("git", "rev-parse", start_commit).chomp
+ odie "Could not find start commit!" if start_commit.empty?
+
end_commit = Utils.popen_read("git", "rev-parse", "HEAD").chomp
+ odie "Could not find end commit!" if end_commit.empty?
puts "Start commit: #{start_commit}"
puts "End commit: #{end_commit}"