Skip to content
This repository was archived by the owner on Mar 12, 2019. It is now read-only.

Commit 83db371

Browse files
committed
Merge tag Homebrew/1.3.5 into Linuxbrew/master
1 parent b689007 commit 83db371

File tree

164 files changed

+1064
-850
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

164 files changed

+1064
-850
lines changed

.travis.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ matrix:
1111
fast_finish: true
1212
include:
1313
- os: osx
14-
osx_image: xcode8.3
14+
osx_image: xcode9
1515
rvm: system
1616
- os: linux
1717
sudo: false
@@ -22,19 +22,19 @@ before_install:
2222
- export HOMEBREW_NO_AUTO_UPDATE=1
2323
- export HOMEBREW_DEVELOPER=1
2424
- if [ "${TRAVIS_OS_NAME}" = "osx" ]; then
25-
git clone --depth=1 https://github.com/Linuxbrew/homebrew-test-bot Library/Taps/homebrew/homebrew-test-bot;
2625
HOMEBREW_REPOSITORY="$(brew --repo)";
2726
sudo chown -R "$USER" "$HOMEBREW_REPOSITORY/Library/Taps";
2827
mv "$HOMEBREW_REPOSITORY/Library/Taps" "$PWD/Library";
2928
sudo rm -rf "$HOMEBREW_REPOSITORY";
3029
sudo ln -s "$PWD" "$HOMEBREW_REPOSITORY";
30+
git clone --depth=1 https://github.com/Linuxbrew/homebrew-test-bot Library/Taps/homebrew/homebrew-test-bot;
3131
else
3232
umask 022;
33-
git clone --depth=1 https://github.com/Linuxbrew/homebrew-test-bot Library/Taps/homebrew/homebrew-test-bot;
3433
git fetch --unshallow;
3534
export PATH="$PWD/bin:$PATH";
3635
HOMEBREW_CORE_TAP_DIR="$(brew --repo "homebrew/core")";
3736
mkdir -p "$HOMEBREW_CORE_TAP_DIR";
37+
git clone --depth=1 https://github.com/Linuxbrew/homebrew-test-bot Library/Taps/homebrew/homebrew-test-bot;
3838
HOMEBREW_TEST_BOT_TAP_DIR="$(brew --repo "homebrew/test-bot")";
3939
ln -s "$HOMEBREW_TEST_BOT_TAP_DIR/.git" "$HOMEBREW_TEST_BOT_TAP_DIR/Formula" "$HOMEBREW_CORE_TAP_DIR";
4040
fi
File renamed without changes.

CONTRIBUTING.md

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
# Contributing to Linuxbrew
22

3+
First time contributing to Linuxbrew? Read our [Code of Conduct](https://github.com/Linuxbrew/brew/blob/master/CODE_OF_CONDUCT.md#code-of-conduct).
4+
35
[Linuxbrew](https://github.com/Linuxbrew/brew) is a fork of [Homebrew](https://github.com/Homebrew/brew). Homebrew/brew is merged into Linuxbrew/brew roughly once per week. If you have access to a macOS system and are able to test your changes there: please submit your pull request to Homebrew rather than to Linuxbrew. If not, please submit your pull requests to Linuxbrew. Patches to fix issues that you have reproduced on both Linuxbrew and Homebrew on macOS should be sent to Homebrew. Please send your pull request to Linuxbrew if you are in doubt.
46

57
Patches to fix issues particular to Linux should not affect the behaviour of the formula on macOS. Use `if OS.mac?` and `if OS.linux?` as necessary to preserve the existing behaviour on macOS.
68

7-
# Contributing to Linuxbrew
8-
First time contributing to Linuxbrew? Read our [Code of Conduct](https://github.com/Linuxbrew/brew/blob/master/CODEOFCONDUCT.md#code-of-conduct).
9-
109
### Report a bug
1110

1211
* run `brew update` (twice)

Library/.rubocop.yml

+20-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
AllCops:
2-
TargetRubyVersion: 2.0
2+
TargetRubyVersion: 2.3
33
Exclude:
44
- '**/Casks/**/*'
55
- '**/vendor/**/*'
@@ -119,7 +119,7 @@ Style/Encoding:
119119
Enabled: true
120120

121121
# dashes in filenames are typical
122-
Style/FileName:
122+
Naming/FileName:
123123
Regex: !ruby/regexp /^[\w\@\-\+\.]+(\.rb)?$/
124124

125125
# falsely flags e.g. curl formatting arguments as format strings
@@ -189,12 +189,29 @@ Style/TrailingCommaInArguments:
189189
EnforcedStyleForMultiline: comma
190190

191191
# we have too many variables like sha256 where this harms readability
192-
Style/VariableNumber:
192+
Naming/VariableNumber:
193193
Enabled: false
194194

195195
Style/WordArray:
196196
MinSize: 4
197197

198+
# we want to add this slowly and manually
199+
Style/FrozenStringLiteralComment:
200+
Enabled: false
201+
202+
# generally rescuing StandardError is fine
203+
Lint/RescueWithoutErrorClass:
204+
Enabled: false
205+
206+
# implicitly allow EOS as we use it everywhere
207+
Naming/HeredocDelimiterNaming:
208+
Blacklist:
209+
- END, EOD, EOF
210+
211+
# we output how to use interpolated strings too often
212+
Lint/InterpolationCheck:
213+
Enabled: false
214+
198215
# Disable for Linuxbrew
199216
Style/MultilineIfModifier:
200217
Enabled: false

Library/Homebrew/.rubocop.yml

+3-2
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ Metrics/ParameterLists:
3232
Style/BlockDelimiters:
3333
Exclude:
3434
- '**/*_spec.rb'
35+
- '**/shared_examples/**/*.rb'
3536

3637
# so many of these in formulae but none in here
3738
Style/GuardClause:
@@ -42,12 +43,12 @@ Style/HashSyntax:
4243
EnforcedStyle: ruby19_no_mixed_keys
4344

4445
# we won't change backward compatible method names
45-
Style/MethodName:
46+
Naming/MethodName:
4647
Exclude:
4748
- 'compat/**/*'
4849

4950
# we won't change backward compatible predicate names
50-
Style/PredicateName:
51+
Naming/PredicateName:
5152
Exclude:
5253
- 'compat/**/*'
5354
NameWhitelist: is_32_bit?, is_64_bit?

Library/Homebrew/.rubocop_todo.yml

+1-8
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ Security/MarshalLoad:
8181
- 'utils/fork.rb'
8282

8383
# Offense count: 1
84-
Style/AccessorMethodName:
84+
Naming/AccessorMethodName:
8585
Exclude:
8686
- 'extend/ENV/super.rb'
8787

@@ -136,10 +136,3 @@ Style/MutableConstant:
136136
- 'formulary.rb'
137137
- 'tab.rb'
138138
- 'tap.rb'
139-
140-
# Offense count: 8
141-
Style/OpMethod:
142-
Exclude:
143-
- 'dependencies.rb'
144-
- 'install_renamed.rb'
145-
- 'options.rb'

Library/Homebrew/.simplecov

+21-16
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,6 @@ SimpleCov.start do
1111
# tests to be dropped. This causes random fluctuations in test coverage.
1212
merge_timeout 86400
1313

14-
add_filter "/Homebrew/compat/"
15-
add_filter "/Homebrew/dev-cmd/tests.rb"
16-
add_filter "/Homebrew/test/"
17-
add_filter "/Homebrew/vendor/"
18-
1914
if ENV["HOMEBREW_INTEGRATION_TEST"]
2015
command_name "#{ENV["HOMEBREW_INTEGRATION_TEST"]} (#{$PROCESS_ID})"
2116

@@ -33,22 +28,32 @@ SimpleCov.start do
3328
end
3429
else
3530
command_name "#{command_name} (#{$PROCESS_ID})"
31+
32+
subdirs = Dir.chdir(SimpleCov.root) { Dir.glob("*") }
33+
.reject { |d| d.end_with?(".rb") || ["test", "vendor"].include?(d) }
34+
.map { |d| "#{d}/**/*.rb" }.join(",")
35+
3636
# Not using this during integration tests makes the tests 4x times faster
3737
# without changing the coverage.
38-
track_files "#{SimpleCov.root}/**/*.rb"
38+
track_files "#{SimpleCov.root}/{#{subdirs},*.rb}"
3939
end
4040

41+
add_filter %r{^/compat/}
42+
add_filter %r{^/dev-cmd/tests.rb$}
43+
add_filter %r{^/test/}
44+
add_filter %r{^/vendor/}
45+
4146
# Add groups and the proper project name to the output.
4247
project_name "Homebrew"
43-
add_group "Cask", "/Homebrew/cask/"
44-
add_group "Commands", %w[/Homebrew/cmd/ /Homebrew/dev-cmd/]
45-
add_group "Extensions", "/Homebrew/extend/"
46-
add_group "OS", %w[/Homebrew/extend/os/ /Homebrew/os/]
47-
add_group "Requirements", "/Homebrew/requirements/"
48-
add_group "Scripts", %w[
49-
/Homebrew/brew.rb
50-
/Homebrew/build.rb
51-
/Homebrew/postinstall.rb
52-
/Homebrew/test.rb
48+
add_group "Cask", %r{^/cask/}
49+
add_group "Commands", [%r{/cmd/}, %r{^/dev-cmd/}]
50+
add_group "Extensions", %r{^/extend/}
51+
add_group "OS", [%r{^/extend/os/}, %r{^/os/}]
52+
add_group "Requirements", %r{^/requirements/}
53+
add_group "Scripts", [
54+
%r{^/brew.rb$},
55+
%r{^/build.rb$},
56+
%r{^/postinstall.rb$},
57+
%r{^/test.rb$},
5358
]
5459
end

Library/Homebrew/brew.rb

+15-13
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,12 @@
55
std_trap = trap("INT") { exit! 130 } # no backtrace thanks
66

77
# check ruby version before requiring any modules.
8-
RUBY_TWO = RUBY_VERSION.split(".").first.to_i >= 2
9-
raise "Homebrew must be run under Ruby 2!" unless RUBY_TWO
8+
RUBY_VERSION_SPLIT = RUBY_VERSION.split "."
9+
RUBY_X = RUBY_VERSION_SPLIT[0].to_i
10+
RUBY_Y = RUBY_VERSION_SPLIT[1].to_i
11+
if RUBY_X < 2 || (RUBY_X == 2 && RUBY_Y < 3)
12+
raise "Homebrew must be run under Ruby 2.3!"
13+
end
1014

1115
require "pathname"
1216
HOMEBREW_LIBRARY_PATH = Pathname.new(__FILE__).realpath.parent
@@ -105,18 +109,16 @@
105109
possible_tap = OFFICIAL_CMD_TAPS.find { |_, cmds| cmds.include?(cmd) }
106110
possible_tap = Tap.fetch(possible_tap.first) if possible_tap
107111

108-
if possible_tap && !possible_tap.installed?
109-
brew_uid = HOMEBREW_BREW_FILE.stat.uid
110-
tap_commands = []
111-
if Process.uid.zero? && !brew_uid.zero?
112-
tap_commands += %W[/usr/bin/sudo -u ##{brew_uid}]
113-
end
114-
tap_commands += %W[#{HOMEBREW_BREW_FILE} tap #{possible_tap}]
115-
safe_system(*tap_commands)
116-
exec HOMEBREW_BREW_FILE, cmd, *ARGV
117-
else
118-
odie "Unknown command: #{cmd}"
112+
odie "Unknown command: #{cmd}" if !possible_tap || possible_tap.installed?
113+
114+
brew_uid = HOMEBREW_BREW_FILE.stat.uid
115+
tap_commands = []
116+
if Process.uid.zero? && !brew_uid.zero?
117+
tap_commands += %W[/usr/bin/sudo -u ##{brew_uid}]
119118
end
119+
tap_commands += %W[#{HOMEBREW_BREW_FILE} tap #{possible_tap}]
120+
safe_system(*tap_commands)
121+
exec HOMEBREW_BREW_FILE, cmd, *ARGV
120122
end
121123
rescue UsageError => e
122124
require "cmd/help"

Library/Homebrew/cask/lib/hbc.rb

-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
require "hbc/staged"
2626
require "hbc/system_command"
2727
require "hbc/topological_hash"
28-
require "hbc/underscore_supporting_uri"
2928
require "hbc/url"
3029
require "hbc/utils"
3130
require "hbc/verify"

Library/Homebrew/cask/lib/hbc/artifact.rb

-39
Original file line numberDiff line numberDiff line change
@@ -25,44 +25,5 @@
2525

2626
module Hbc
2727
module Artifact
28-
# NOTE: Order is important here!
29-
#
30-
# The `uninstall` stanza should be run first, as it may
31-
# depend on other artifacts still being installed.
32-
#
33-
# We want to extract nested containers before we
34-
# handle any other artifacts.
35-
#
36-
CLASSES = [
37-
PreflightBlock,
38-
Uninstall,
39-
NestedContainer,
40-
Installer,
41-
App,
42-
Suite,
43-
Artifact, # generic 'artifact' stanza
44-
Colorpicker,
45-
Pkg,
46-
Prefpane,
47-
Qlplugin,
48-
Dictionary,
49-
Font,
50-
Service,
51-
StageOnly,
52-
Binary,
53-
InputMethod,
54-
InternetPlugin,
55-
AudioUnitPlugin,
56-
VstPlugin,
57-
Vst3Plugin,
58-
ScreenSaver,
59-
PostflightBlock,
60-
Zap,
61-
].freeze
62-
63-
def self.for_cask(cask)
64-
odebug "Determining which artifacts are present in Cask #{cask}"
65-
CLASSES.flat_map { |klass| klass.for_cask(cask) }
66-
end
6728
end
6829
end

Library/Homebrew/cask/lib/hbc/artifact/abstract_artifact.rb

+40-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
module Hbc
22
module Artifact
33
class AbstractArtifact
4+
include Comparable
45
extend Predicable
56

67
def self.english_name
@@ -19,8 +20,45 @@ def self.dirmethod
1920
@dirmethod ||= "#{dsl_key}dir".to_sym
2021
end
2122

22-
def self.for_cask(cask)
23-
cask.artifacts[dsl_key].to_a
23+
def <=>(other)
24+
return unless other.class < AbstractArtifact
25+
return 0 if self.class == other.class
26+
27+
@@sort_order ||= [ # rubocop:disable Style/ClassVars
28+
PreflightBlock,
29+
# The `uninstall` stanza should be run first, as it may
30+
# depend on other artifacts still being installed.
31+
Uninstall,
32+
# We want to extract nested containers before we
33+
# handle any other artifacts.
34+
NestedContainer,
35+
Installer,
36+
[
37+
App,
38+
Suite,
39+
Artifact,
40+
Colorpicker,
41+
Prefpane,
42+
Qlplugin,
43+
Dictionary,
44+
Font,
45+
Service,
46+
InputMethod,
47+
InternetPlugin,
48+
AudioUnitPlugin,
49+
VstPlugin,
50+
Vst3Plugin,
51+
ScreenSaver,
52+
],
53+
# `pkg` should be run before `binary`, so
54+
# targets are created prior to linking.
55+
Pkg,
56+
Binary,
57+
PostflightBlock,
58+
Zap,
59+
].each_with_index.flat_map { |classes, i| [*classes].map { |c| [c, i] } }.to_h
60+
61+
(@@sort_order[self.class] <=> @@sort_order[other.class]).to_i
2462
end
2563

2664
# TODO: this sort of logic would make more sense in dsl.rb, or a

Library/Homebrew/cask/lib/hbc/artifact/abstract_flight_block.rb

-6
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,6 @@ def self.uninstall_dsl_key
1111
dsl_key.to_s.prepend("uninstall_").to_sym
1212
end
1313

14-
def self.for_cask(cask)
15-
[dsl_key, uninstall_dsl_key].flat_map do |key|
16-
[*cask.artifacts[key]].map { |block| new(cask, key => block) }
17-
end
18-
end
19-
2014
attr_reader :directives
2115

2216
def initialize(cask, **directives)

Library/Homebrew/cask/lib/hbc/artifact/abstract_uninstall.rb

+6-3
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def to_h
3737
end
3838

3939
def summarize
40-
to_h.map { |key, val| [*val].map { |v| "#{key.inspect} => #{v.inspect}" }.join(", ") }.join(", ")
40+
to_h.flat_map { |key, val| [*val].map { |v| "#{key.inspect} => #{v.inspect}" } }.join(", ")
4141
end
4242

4343
private
@@ -253,7 +253,7 @@ def uninstall_trash(*paths, **options)
253253
end
254254

255255
def trash_paths(*paths, command: nil, **_)
256-
command.run!("/usr/bin/osascript", args: ["-e", <<-'EOS'.undent, *paths])
256+
result = command.run!("/usr/bin/osascript", args: ["-e", <<-'EOS'.undent, *paths])
257257
on run argv
258258
repeat with i from 1 to (count argv)
259259
set item i of argv to (item i of argv as POSIX file)
@@ -267,14 +267,17 @@ def trash_paths(*paths, command: nil, **_)
267267
set trashedItem to POSIX path of (item i of trashedItems as string)
268268
set output to output & trashedItem
269269
if i < count trashedItems then
270-
set output to output & (do shell script "printf \"\\0\"")
270+
set output to output & character id 0
271271
end if
272272
end repeat
273273
274274
return output
275275
end tell
276276
end run
277277
EOS
278+
279+
# Remove AppleScript's automatic newline.
280+
result.tap { |r| r.stdout.sub!(/\n$/, "") }
278281
end
279282

280283
def uninstall_rmdir(*directories, command: nil, **_)

0 commit comments

Comments
 (0)