language
stringclasses
1 value
owner
stringlengths
2
15
repo
stringlengths
2
21
sha
stringlengths
45
45
message
stringlengths
7
36.3k
path
stringlengths
1
199
patch
stringlengths
15
102k
is_multipart
bool
2 classes
Other
Homebrew
brew
b387c09d0d077fffed81b32c320c4d8a0c148fc1.json
linkage: test all kegs if none are specified
Library/Homebrew/dev-cmd/linkage.rb
@@ -1,5 +1,5 @@ -#: * `linkage` [`--test`] [`--reverse`] <formula>: -#: Checks the library links of an installed formula. +#: * `linkage` [`--test`] [`--reverse`] [<formulae>]: +#: Checks the library links of installed formulae. #: #: Only works on installed formulae. An error is raised if it is run on #: uninstalled formulae. @@ -9,6 +9,8 @@ #: #: If `--reverse` is passed, print the dylib followed by the binaries #: which link to it for each library the keg references. +#: +#: If <formulae> are given, check linkage for only the specified brews. require "cache_store" require "linkage_checker" @@ -26,8 +28,13 @@ def linkage end CacheStoreDatabase.use(:linkage) do |db| - ARGV.kegs.each do |keg| - ohai "Checking #{keg.name} linkage" if ARGV.kegs.size > 1 + kegs = if ARGV.kegs.empty? + Formula.installed.collect(&:opt_or_installed_prefix_keg).reject(&:nil?) + else + ARGV.kegs + end + kegs.each do |keg| + ohai "Checking #{keg.name} linkage" if kegs.size > 1 result = LinkageChecker.new(keg, cache_db: db)
true
Other
Homebrew
brew
b387c09d0d077fffed81b32c320c4d8a0c148fc1.json
linkage: test all kegs if none are specified
docs/Manpage.md
@@ -799,8 +799,8 @@ With `--verbose` or `-v`, many commands print extra debugging information. Note If `--pry` is passed or HOMEBREW_PRY is set, pry will be used instead of irb. - * `linkage` [`--test`] [`--reverse`] `formula`: - Checks the library links of an installed formula. + * `linkage` [`--test`] [`--reverse`] [`formulae`]: + Checks the library links of installed formulae. Only works on installed formulae. An error is raised if it is run on uninstalled formulae. @@ -811,6 +811,8 @@ With `--verbose` or `-v`, many commands print extra debugging information. Note If `--reverse` is passed, print the dylib followed by the binaries which link to it for each library the keg references. + If `formulae` are given, check linkage for only the specified brews. + * `man` [`--fail-if-changed`]: Generate Homebrew's manpages.
true
Other
Homebrew
brew
b387c09d0d077fffed81b32c320c4d8a0c148fc1.json
linkage: test all kegs if none are specified
manpages/brew.1
@@ -738,8 +738,8 @@ Enter the interactive Homebrew Ruby shell\. If \fB\-\-examples\fR is passed, several examples will be shown\. If \fB\-\-pry\fR is passed or HOMEBREW_PRY is set, pry will be used instead of irb\. . .TP -\fBlinkage\fR [\fB\-\-test\fR] [\fB\-\-reverse\fR] \fIformula\fR -Checks the library links of an installed formula\. +\fBlinkage\fR [\fB\-\-test\fR] [\fB\-\-reverse\fR] [\fIformulae\fR] +Checks the library links of installed formulae\. . .IP Only works on installed formulae\. An error is raised if it is run on uninstalled formulae\. @@ -750,6 +750,9 @@ If \fB\-\-test\fR is passed, only display missing libraries and exit with a non\ .IP If \fB\-\-reverse\fR is passed, print the dylib followed by the binaries which link to it for each library the keg references\. . +.IP +If \fIformulae\fR are given, check linkage for only the specified brews\. +. .TP \fBman\fR [\fB\-\-fail\-if\-changed\fR] Generate Homebrew\'s manpages\.
true
Other
Homebrew
brew
13c65eed70605fb150024ad0efb67467aa2463ae.json
Change docs to use symbols instead of class names.
Library/Homebrew/download_strategy.rb
@@ -363,7 +363,7 @@ def initialize(path) end # S3DownloadStrategy downloads tarballs from AWS S3. -# To use it, add ":using => S3DownloadStrategy" to the URL section of your +# To use it, add `:using => :s3` to the URL section of your # formula. This download strategy uses AWS access tokens (in the # environment variables AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY) # to sign the request. This strategy is good in a corporate setting, @@ -395,7 +395,7 @@ def _fetch # GitHubPrivateRepositoryDownloadStrategy downloads contents from GitHub # Private Repository. To use it, add -# ":using => GitHubPrivateRepositoryDownloadStrategy" to the URL section of +# `:using => :github_private_repo` to the URL section of # your formula. This download strategy uses GitHub access tokens (in the # environment variables HOMEBREW_GITHUB_API_TOKEN) to sign the request. This # strategy is suitable for corporate use just like S3DownloadStrategy, because @@ -453,8 +453,7 @@ def validate_github_repository_access! end # GitHubPrivateRepositoryReleaseDownloadStrategy downloads tarballs from GitHub -# Release assets. To use it, add -# ":using => GitHubPrivateRepositoryReleaseDownloadStrategy" to the URL section +# Release assets. To use it, add `:using => :github_private_release` to the URL section # of your formula. This download strategy uses GitHub access tokens (in the # environment variables HOMEBREW_GITHUB_API_TOKEN) to sign the request. class GitHubPrivateRepositoryReleaseDownloadStrategy < GitHubPrivateRepositoryDownloadStrategy @@ -498,7 +497,7 @@ def fetch_release_metadata end # ScpDownloadStrategy downloads files using ssh via scp. To use it, add -# ":using => ScpDownloadStrategy" to the URL section of your formula or +# `:using => :scp` to the URL section of your formula or # provide a URL starting with scp://. This strategy uses ssh credentials for # authentication. If a public/private keypair is configured, it will not # prompt for a password. @@ -1115,20 +1114,21 @@ def with_fossil_env end class DownloadStrategyDetector - def self.detect(url, strategy = nil) - if strategy.nil? + def self.detect(url, using = nil) + strategy = if using.nil? detect_from_url(url) - elsif strategy == S3DownloadStrategy - require_aws_sdk - strategy - elsif strategy.is_a?(Class) && strategy < AbstractDownloadStrategy - strategy - elsif strategy.is_a?(Symbol) - detect_from_symbol(strategy) + elsif using.is_a?(Class) && using < AbstractDownloadStrategy + using + elsif using.is_a?(Symbol) + detect_from_symbol(using) else raise TypeError, "Unknown download strategy specification #{strategy.inspect}" end + + require_aws_sdk if strategy == S3DownloadStrategy + + strategy end def self.detect_from_url(url) @@ -1154,7 +1154,6 @@ def self.detect_from_url(url) when %r{^https?://(.+?\.)?sourceforge\.net/hgweb/} MercurialDownloadStrategy when %r{^s3://} - require_aws_sdk S3DownloadStrategy when %r{^scp://} ScpDownloadStrategy @@ -1165,15 +1164,19 @@ def self.detect_from_url(url) def self.detect_from_symbol(symbol) case symbol - when :hg then MercurialDownloadStrategy - when :nounzip then NoUnzipCurlDownloadStrategy - when :git then GitDownloadStrategy - when :bzr then BazaarDownloadStrategy - when :svn then SubversionDownloadStrategy - when :curl then CurlDownloadStrategy - when :cvs then CVSDownloadStrategy - when :post then CurlPostDownloadStrategy - when :fossil then FossilDownloadStrategy + when :hg then MercurialDownloadStrategy + when :nounzip then NoUnzipCurlDownloadStrategy + when :git then GitDownloadStrategy + when :github_private_repo then GitHubPrivateRepositoryDownloadStrategy + when :github_private_release then GitHubPrivateRepositoryReleaseDownloadStrategy + when :bzr then BazaarDownloadStrategy + when :s3 then S3DownloadStrategy + when :scp then ScpDownloadStrategy + when :svn then SubversionDownloadStrategy + when :curl then CurlDownloadStrategy + when :cvs then CVSDownloadStrategy + when :post then CurlPostDownloadStrategy + when :fossil then FossilDownloadStrategy else raise "Unknown download strategy #{symbol} was requested." end
true
Other
Homebrew
brew
13c65eed70605fb150024ad0efb67467aa2463ae.json
Change docs to use symbols instead of class names.
Library/Homebrew/formula.rb
@@ -2150,7 +2150,7 @@ def specs # `:curl` (normal file download. Will also extract.) # `:nounzip` (without extracting) # `:post` (download via an HTTP POST) - # `S3DownloadStrategy` (download from S3 using signed request) + # `:s3` (download from S3 using signed request) # # <pre>url "https://packed.sources.and.we.prefer.https.example.com/archive-1.2.3.tar.bz2"</pre> # <pre>url "https://some.dont.provide.archives.example.com",
true
Other
Homebrew
brew
13c65eed70605fb150024ad0efb67467aa2463ae.json
Change docs to use symbols instead of class names.
Library/Homebrew/manpages/brew.1.md.erb
@@ -116,7 +116,7 @@ Note that environment variables must have a value set to be detected. For exampl When using the `S3` download strategy, Homebrew will look in these variables for access credentials (see <https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-started.html#cli-environment> - to retrieve these access credentials from AWS). If they are not set, + to retrieve these access credentials from AWS). If they are not set, the `S3` download strategy will download with a public (unsigned) URL.
true
Other
Homebrew
brew
13c65eed70605fb150024ad0efb67467aa2463ae.json
Change docs to use symbols instead of class names.
docs/Manpage.md
@@ -1116,7 +1116,7 @@ Note that environment variables must have a value set to be detected. For exampl When using the `S3` download strategy, Homebrew will look in these variables for access credentials (see <https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-started.html#cli-environment> - to retrieve these access credentials from AWS). If they are not set, + to retrieve these access credentials from AWS). If they are not set, the `S3` download strategy will download with a public (unsigned) URL.
true
Other
Homebrew
brew
51fa19496624b693c42ceaa1a7264e6fe7d665a3.json
Move `cached_location` to `#initialize`.
Library/Homebrew/download_strategy.rb
@@ -14,6 +14,7 @@ def stage end end + attr_reader :cached_location attr_reader :meta, :name, :version, :shutup private :meta, :name, :version, :shutup @@ -68,10 +69,6 @@ def chdir end private :chdir - # @!attribute [r] cached_location - # The path to the cached file or directory associated with the resource. - def cached_location; end - # @!attribute [r] # return most recent modified time for all files in the current working directory after stage. def source_modified_time @@ -108,7 +105,7 @@ def initialize(url, name, version, **meta) super @ref_type, @ref = extract_ref(meta) @revision = meta[:revision] - @clone = HOMEBREW_CACHE/cache_filename + @cached_location = HOMEBREW_CACHE/"#{name}--#{cache_tag}" end def fetch @@ -146,10 +143,6 @@ def commit_outdated?(commit) commit != @last_commit end - def cached_location - @clone - end - def head? version.respond_to?(:head?) && version.head? end @@ -166,10 +159,6 @@ def cache_tag raise NotImplementedError end - def cache_filename - "#{name}--#{cache_tag}" - end - def repo_valid? raise NotImplementedError end @@ -187,6 +176,11 @@ def extract_ref(specs) end class AbstractFileDownloadStrategy < AbstractDownloadStrategy + def initialize(url, name, version, **meta) + super + @cached_location = HOMEBREW_CACHE/"#{name}-#{version}#{ext}" + end + def stage super chdir @@ -209,12 +203,11 @@ def ext end class CurlDownloadStrategy < AbstractFileDownloadStrategy - attr_reader :mirrors, :tarball_path, :temporary_path + attr_reader :mirrors, :temporary_path def initialize(url, name, version, **meta) super @mirrors = meta.fetch(:mirrors, []) - @tarball_path = HOMEBREW_CACHE/"#{name}-#{version}#{ext}" @temporary_path = Pathname.new("#{cached_location}.incomplete") end @@ -238,10 +231,6 @@ def fetch retry end - def cached_location - tarball_path - end - def clear_cache super rm_rf(temporary_path) @@ -366,8 +355,6 @@ def stage # This strategy extracts local binary packages. class LocalBottleDownloadStrategy < AbstractFileDownloadStrategy - attr_reader :cached_location - def initialize(path) @cached_location = path end @@ -520,11 +507,11 @@ def fetch_release_metadata # url "scp://example.com/src/abc.1.0.tar.gz" # ... class ScpDownloadStrategy < AbstractFileDownloadStrategy - attr_reader :tarball_path, :temporary_path + attr_reader :temporary_path def initialize(url, name, version, **meta) super - @tarball_path = HOMEBREW_CACHE/"#{name}-#{version}#{ext}" + @cached_location = HOMEBREW_CACHE/"#{name}-#{version}#{ext}" @temporary_path = Pathname.new("#{cached_location}.incomplete") parse_url_pattern end @@ -554,10 +541,6 @@ def fetch end end - def cached_location - tarball_path - end - def clear_cache super rm_rf(temporary_path)
true
Other
Homebrew
brew
51fa19496624b693c42ceaa1a7264e6fe7d665a3.json
Move `cached_location` to `#initialize`.
Library/Homebrew/test/download_strategies_spec.rb
@@ -234,8 +234,8 @@ def setup_git_repo expect(subject.send(:_curl_args)).to eq(["--user", "download:123456"]) end - describe "#tarball_path" do - subject { described_class.new(url, name, version, **specs).tarball_path } + describe "#cached_location" do + subject { described_class.new(url, name, version, **specs).cached_location } context "when URL ends with file" do it { is_expected.to eq(HOMEBREW_CACHE/"foo-.tar.gz") }
true
Other
Homebrew
brew
81939dc496f54f5f1ce390578c17797ce95de4f5.json
Pass `verbose` to unpack strategies.
Library/Homebrew/download_strategy.rb
@@ -333,7 +333,8 @@ def _fetch class NoUnzipCurlDownloadStrategy < CurlDownloadStrategy def stage UnpackStrategy::Uncompressed.new(cached_location) - .extract(basename: basename_without_params) + .extract(basename: basename_without_params, + verbose: ARGV.verbose? && !shutup) end end
true
Other
Homebrew
brew
81939dc496f54f5f1ce390578c17797ce95de4f5.json
Pass `verbose` to unpack strategies.
Library/Homebrew/system_command.rb
@@ -47,7 +47,9 @@ def run! result end - def initialize(executable, args: [], sudo: false, input: [], print_stdout: false, print_stderr: true, verbose: false, must_succeed: false, env: {}, **options) + def initialize(executable, args: [], sudo: false, env: {}, input: [], must_succeed: false, + print_stdout: false, print_stderr: true, verbose: false, **options) + @executable = executable @args = args @sudo = sudo
true
Other
Homebrew
brew
81939dc496f54f5f1ce390578c17797ce95de4f5.json
Pass `verbose` to unpack strategies.
Library/Homebrew/unpack_strategy/air.rb
@@ -1,3 +1,5 @@ +# frozen_string_literal: true + module UnpackStrategy class Air include UnpackStrategy @@ -17,13 +19,17 @@ def dependencies @dependencies ||= [Hbc::CaskLoader.load("adobe-air")] end + AIR_APPLICATION_INSTALLER = + "/Applications/Utilities/Adobe AIR Application Installer.app/Contents/MacOS/Adobe AIR Application Installer" + + private_constant :AIR_APPLICATION_INSTALLER + private def extract_to_dir(unpack_dir, basename:, verbose:) - system_command!( - "/Applications/Utilities/Adobe AIR Application Installer.app/Contents/MacOS/Adobe AIR Application Installer", - args: ["-silent", "-location", unpack_dir, path], - ) + system_command! AIR_APPLICATION_INSTALLER, + args: ["-silent", "-location", unpack_dir, path], + verbose: verbose end end end
true
Other
Homebrew
brew
81939dc496f54f5f1ce390578c17797ce95de4f5.json
Pass `verbose` to unpack strategies.
Library/Homebrew/unpack_strategy/bzip2.rb
@@ -17,7 +17,9 @@ def self.can_extract?(path) def extract_to_dir(unpack_dir, basename:, verbose:) FileUtils.cp path, unpack_dir/basename, preserve: true quiet_flags = verbose ? [] : ["-q"] - system_command! "bunzip2", args: [*quiet_flags, unpack_dir/basename] + system_command! "bunzip2", + args: [*quiet_flags, unpack_dir/basename], + verbose: verbose end end end
true
Other
Homebrew
brew
81939dc496f54f5f1ce390578c17797ce95de4f5.json
Pass `verbose` to unpack strategies.
Library/Homebrew/unpack_strategy/cab.rb
@@ -15,7 +15,8 @@ def self.can_extract?(path) def extract_to_dir(unpack_dir, basename:, verbose:) system_command! "cabextract", args: ["-d", unpack_dir, "--", path], - env: { "PATH" => PATH.new(Formula["cabextract"].opt_bin, ENV["PATH"]) } + env: { "PATH" => PATH.new(Formula["cabextract"].opt_bin, ENV["PATH"]) }, + verbose: verbose end def dependencies
true
Other
Homebrew
brew
81939dc496f54f5f1ce390578c17797ce95de4f5.json
Pass `verbose` to unpack strategies.
Library/Homebrew/unpack_strategy/dmg.rb
@@ -4,8 +4,6 @@ module UnpackStrategy class Dmg include UnpackStrategy - using Magic - module Bom DMG_METADATA = Set.new %w[ .background @@ -51,19 +49,21 @@ def bom class Mount include UnpackStrategy - def eject + def eject(verbose: false) tries ||= 3 return unless path.exist? if tries > 1 system_command! "diskutil", args: ["eject", path], - print_stderr: false + print_stderr: false, + verbose: verbose else system_command! "diskutil", args: ["unmount", "force", path], - print_stderr: false + print_stderr: false, + verbose: verbose end rescue ErrorDuringExecution => e raise e if (tries -= 1).zero? @@ -81,10 +81,14 @@ def extract_to_dir(unpack_dir, basename:, verbose:) filelist.puts(path.bom) filelist.close - system_command! "mkbom", args: ["-s", "-i", filelist.path, "--", bomfile.path] + system_command! "mkbom", + args: ["-s", "-i", filelist.path, "--", bomfile.path], + verbose: verbose end - system_command! "ditto", args: ["--bom", bomfile.path, "--", path, unpack_dir] + system_command! "ditto", + args: ["--bom", bomfile.path, "--", path, unpack_dir], + verbose: verbose FileUtils.chmod "u+w", Pathname.glob(unpack_dir/"**/*").reject(&:symlink?) end @@ -111,7 +115,7 @@ def extract_to_dir(unpack_dir, basename:, verbose:) raise "No mounts found in '#{path}'; perhaps it is a bad disk image?" if mounts.empty? mounts.each do |mount| - mount.extract(to: unpack_dir) + mount.extract(to: unpack_dir, verbose: verbose) end end end @@ -120,23 +124,25 @@ def mount(verbose: false) Dir.mktmpdir do |mount_dir| mount_dir = Pathname(mount_dir) - without_eula = system_command("hdiutil", + without_eula = system_command "hdiutil", args: ["attach", "-plist", "-nobrowse", "-readonly", "-noidme", "-mountrandom", mount_dir, path], input: "qn\n", - print_stderr: false) + print_stderr: false, + verbose: verbose # If mounting without agreeing to EULA succeeded, there is none. plist = if without_eula.success? without_eula.plist else cdr_path = mount_dir/path.basename.sub_ext(".cdr") - system_command!("hdiutil", args: ["convert", "-quiet", "-format", "UDTO", "-o", cdr_path, path]) + system_command! "hdiutil", + args: ["convert", "-quiet", "-format", "UDTO", "-o", cdr_path, path], + verbose: verbose - with_eula = system_command!( - "/usr/bin/hdiutil", - args: ["attach", "-plist", "-nobrowse", "-readonly", "-noidme", "-mountrandom", mount_dir, cdr_path], - ) + with_eula = system_command! "hdiutil", + args: ["attach", "-plist", "-nobrowse", "-readonly", "-noidme", "-mountrandom", mount_dir, cdr_path], + verbose: verbose if verbose && !(eula_text = without_eula.stdout).empty? ohai "Software License Agreement for '#{path}':" @@ -158,7 +164,9 @@ def mount(verbose: false) begin yield mounts ensure - mounts.each(&:eject) + mounts.each do |mount| + mount.eject(verbose: verbose) + end end end end
true
Other
Homebrew
brew
81939dc496f54f5f1ce390578c17797ce95de4f5.json
Pass `verbose` to unpack strategies.
Library/Homebrew/unpack_strategy/fossil.rb
@@ -28,7 +28,8 @@ def extract_to_dir(unpack_dir, basename:, verbose:) system_command! "fossil", args: ["open", path, *args], chdir: unpack_dir, - env: { "PATH" => PATH.new(Formula["fossil"].opt_bin, ENV["PATH"]) } + env: { "PATH" => PATH.new(Formula["fossil"].opt_bin, ENV["PATH"]) }, + verbose: verbose end end end
true
Other
Homebrew
brew
81939dc496f54f5f1ce390578c17797ce95de4f5.json
Pass `verbose` to unpack strategies.
Library/Homebrew/unpack_strategy/generic_unar.rb
@@ -21,7 +21,8 @@ def dependencies def extract_to_dir(unpack_dir, basename:, verbose:) system_command! "unar", args: ["-force-overwrite", "-quiet", "-no-directory", "-output-directory", unpack_dir, "--", path], - env: { "PATH" => PATH.new(Formula["unar"].opt_bin, ENV["PATH"]) } + env: { "PATH" => PATH.new(Formula["unar"].opt_bin, ENV["PATH"]) }, + verbose: verbose end end end
true
Other
Homebrew
brew
81939dc496f54f5f1ce390578c17797ce95de4f5.json
Pass `verbose` to unpack strategies.
Library/Homebrew/unpack_strategy/gzip.rb
@@ -18,7 +18,8 @@ def extract_to_dir(unpack_dir, basename:, verbose:) FileUtils.cp path, unpack_dir/basename, preserve: true quiet_flags = verbose ? [] : ["-q"] system_command! "gunzip", - args: [*quiet_flags, "-N", "--", unpack_dir/basename] + args: [*quiet_flags, "-N", "--", unpack_dir/basename], + verbose: verbose end end end
true
Other
Homebrew
brew
81939dc496f54f5f1ce390578c17797ce95de4f5.json
Pass `verbose` to unpack strategies.
Library/Homebrew/unpack_strategy/lha.rb
@@ -21,7 +21,8 @@ def dependencies def extract_to_dir(unpack_dir, basename:, verbose:) system_command! "lha", args: ["xq2w=#{unpack_dir}", path], - env: { "PATH" => PATH.new(Formula["lha"].opt_bin, ENV["PATH"]) } + env: { "PATH" => PATH.new(Formula["lha"].opt_bin, ENV["PATH"]) }, + verbose: verbose end end end
true
Other
Homebrew
brew
81939dc496f54f5f1ce390578c17797ce95de4f5.json
Pass `verbose` to unpack strategies.
Library/Homebrew/unpack_strategy/lzip.rb
@@ -23,7 +23,8 @@ def extract_to_dir(unpack_dir, basename:, verbose:) quiet_flags = verbose ? [] : ["-q"] system_command! "lzip", args: ["-d", *quiet_flags, unpack_dir/basename], - env: { "PATH" => PATH.new(Formula["lzip"].opt_bin, ENV["PATH"]) } + env: { "PATH" => PATH.new(Formula["lzip"].opt_bin, ENV["PATH"]) }, + verbose: verbose end end end
true
Other
Homebrew
brew
81939dc496f54f5f1ce390578c17797ce95de4f5.json
Pass `verbose` to unpack strategies.
Library/Homebrew/unpack_strategy/lzma.rb
@@ -17,7 +17,8 @@ def extract_to_dir(unpack_dir, basename:, verbose:) quiet_flags = verbose ? [] : ["-q"] system_command! "unlzma", args: [*quiet_flags, "--", unpack_dir/basename], - env: { "PATH" => PATH.new(Formula["xz"].opt_bin, ENV["PATH"]) } + env: { "PATH" => PATH.new(Formula["xz"].opt_bin, ENV["PATH"]) }, + verbose: verbose end def dependencies
true
Other
Homebrew
brew
81939dc496f54f5f1ce390578c17797ce95de4f5.json
Pass `verbose` to unpack strategies.
Library/Homebrew/unpack_strategy/mercurial.rb
@@ -13,7 +13,8 @@ def self.can_extract?(path) def extract_to_dir(unpack_dir, basename:, verbose:) system_command! "hg", args: ["--cwd", path, "archive", "--subrepos", "-y", "-t", "files", unpack_dir], - env: { "PATH" => PATH.new(Formula["mercurial"].opt_bin, ENV["PATH"]) } + env: { "PATH" => PATH.new(Formula["mercurial"].opt_bin, ENV["PATH"]) }, + verbose: verbose end end end
true
Other
Homebrew
brew
81939dc496f54f5f1ce390578c17797ce95de4f5.json
Pass `verbose` to unpack strategies.
Library/Homebrew/unpack_strategy/p7zip.rb
@@ -21,7 +21,8 @@ def dependencies def extract_to_dir(unpack_dir, basename:, verbose:) system_command! "7zr", args: ["x", "-y", "-bd", "-bso0", path, "-o#{unpack_dir}"], - env: { "PATH" => PATH.new(Formula["p7zip"].opt_bin, ENV["PATH"]) } + env: { "PATH" => PATH.new(Formula["p7zip"].opt_bin, ENV["PATH"]) }, + verbose: verbose end end end
true
Other
Homebrew
brew
81939dc496f54f5f1ce390578c17797ce95de4f5.json
Pass `verbose` to unpack strategies.
Library/Homebrew/unpack_strategy/rar.rb
@@ -21,7 +21,8 @@ def dependencies def extract_to_dir(unpack_dir, basename:, verbose:) system_command! "unrar", args: ["x", "-inul", path, unpack_dir], - env: { "PATH" => PATH.new(Formula["unrar"].opt_bin, ENV["PATH"]) } + env: { "PATH" => PATH.new(Formula["unrar"].opt_bin, ENV["PATH"]) }, + verbose: verbose end end end
true
Other
Homebrew
brew
81939dc496f54f5f1ce390578c17797ce95de4f5.json
Pass `verbose` to unpack strategies.
Library/Homebrew/unpack_strategy/subversion.rb
@@ -13,7 +13,8 @@ def self.can_extract?(path) def extract_to_dir(unpack_dir, basename:, verbose:) system_command! "svn", args: ["export", "--force", ".", unpack_dir], - chdir: path.to_s + chdir: path.to_s, + verbose: verbose end end end
true
Other
Homebrew
brew
81939dc496f54f5f1ce390578c17797ce95de4f5.json
Pass `verbose` to unpack strategies.
Library/Homebrew/unpack_strategy/tar.rb
@@ -35,11 +35,13 @@ def extract_to_dir(unpack_dir, basename:, verbose:) if DependencyCollector.tar_needs_xz_dependency? && Xz.can_extract?(path) tmpdir = Pathname(tmpdir) - Xz.new(path).extract(to: tmpdir) + Xz.new(path).extract(to: tmpdir, verbose: verbose) tar_path = tmpdir.children.first end - system_command! "tar", args: ["xf", tar_path, "-C", unpack_dir] + system_command! "tar", + args: ["xf", tar_path, "-C", unpack_dir], + verbose: verbose end end end
true
Other
Homebrew
brew
81939dc496f54f5f1ce390578c17797ce95de4f5.json
Pass `verbose` to unpack strategies.
Library/Homebrew/unpack_strategy/xar.rb
@@ -15,7 +15,9 @@ def self.can_extract?(path) private def extract_to_dir(unpack_dir, basename:, verbose:) - system_command! "xar", args: ["-x", "-f", path, "-C", unpack_dir] + system_command! "xar", + args: ["-x", "-f", path, "-C", unpack_dir], + verbose: verbose end end end
true
Other
Homebrew
brew
81939dc496f54f5f1ce390578c17797ce95de4f5.json
Pass `verbose` to unpack strategies.
Library/Homebrew/unpack_strategy/xz.rb
@@ -23,7 +23,8 @@ def extract_to_dir(unpack_dir, basename:, verbose:) quiet_flags = verbose ? [] : ["-q"] system_command! "unxz", args: [*quiet_flags, "-T0", "--", unpack_dir/basename], - env: { "PATH" => PATH.new(Formula["xz"].opt_bin, ENV["PATH"]) } + env: { "PATH" => PATH.new(Formula["xz"].opt_bin, ENV["PATH"]) }, + verbose: verbose end end end
true
Other
Homebrew
brew
81939dc496f54f5f1ce390578c17797ce95de4f5.json
Pass `verbose` to unpack strategies.
Library/Homebrew/unpack_strategy/zip.rb
@@ -16,7 +16,9 @@ def self.can_extract?(path) def extract_to_dir(unpack_dir, basename:, verbose:) quiet_flags = verbose ? [] : ["-qq"] - system_command! "unzip", args: [*quiet_flags, path, "-d", unpack_dir] + system_command! "unzip", + args: [*quiet_flags, path, "-d", unpack_dir], + verbose: verbose end end end
true
Other
Homebrew
brew
ee5a073b057724e2cca238050db98d00c78e6c1c.json
Add the SFC PLC to the README and manpage. Let's document these so people know who the leadership team behind the project is.
Library/Homebrew/dev-cmd/man.rb
@@ -68,6 +68,8 @@ def build_man_page readme = HOMEBREW_REPOSITORY/"README.md" variables[:lead_maintainer] = readme.read[/(Homebrew's lead maintainer .*\.)/, 1] .gsub(/\[([^\]]+)\]\([^)]+\)/, '\1') + variables[:leadership] = readme.read[/(Homebrew's project leadership committee .*\.)/, 1] + .gsub(/\[([^\]]+)\]\([^)]+\)/, '\1') variables[:core_maintainer] = readme.read[%r{(Homebrew/homebrew-core's lead maintainer .*\.)}, 1] .gsub(/\[([^\]]+)\]\([^)]+\)/, '\1') variables[:brew_maintainers] = readme.read[%r{(Homebrew/brew's other current maintainers .*\.)}, 1]
true
Other
Homebrew
brew
ee5a073b057724e2cca238050db98d00c78e6c1c.json
Add the SFC PLC to the README and manpage. Let's document these so people know who the leadership team behind the project is.
Library/Homebrew/manpages/brew.1.md.erb
@@ -305,6 +305,8 @@ Homebrew Documentation: <https://docs.brew.sh> <%= lead_maintainer.concat("\n") %> +<%= leadership.concat("\n") %> + <%= core_maintainer.concat("\n") %> <%= brew_maintainers.concat("\n") %>
true
Other
Homebrew
brew
ee5a073b057724e2cca238050db98d00c78e6c1c.json
Add the SFC PLC to the README and manpage. Let's document these so people know who the leadership team behind the project is.
README.md
@@ -38,6 +38,8 @@ Please report security issues to our [HackerOne](https://hackerone.com/homebrew/ ## Who Are You? Homebrew's lead maintainer is [Mike McQuaid](https://github.com/mikemcquaid). +Homebrew's project leadership committee is [Mike McQuaid](https://github.com/mikemcquaid), [ilovezfs](https://github.com/ilovezfs), [JCount](https://github.com/jcount), [Misty De Meo](https://github.com/mistydemeo) and [Markus Reiter](https://github.com/reitermarkus). + Homebrew/homebrew-core's lead maintainer is [ilovezfs](https://github.com/ilovezfs). Homebrew/brew's other current maintainers are [ilovezfs](https://github.com/ilovezfs), [JCount](https://github.com/jcount), [Misty De Meo](https://github.com/mistydemeo), [Gautham Goli](https://github.com/GauthamGoli), [Markus Reiter](https://github.com/reitermarkus) and [William Woodruff](https://github.com/woodruffw).
true
Other
Homebrew
brew
ee5a073b057724e2cca238050db98d00c78e6c1c.json
Add the SFC PLC to the README and manpage. Let's document these so people know who the leadership team behind the project is.
docs/Manpage.md
@@ -1305,6 +1305,8 @@ Homebrew Documentation: <https://docs.brew.sh> Homebrew's lead maintainer is Mike McQuaid. +Homebrew's project leadership committee is Mike McQuaid, ilovezfs, JCount, Misty De Meo and Markus Reiter. + Homebrew/homebrew-core's lead maintainer is ilovezfs. Homebrew/brew's other current maintainers are ilovezfs, JCount, Misty De Meo, Gautham Goli, Markus Reiter and William Woodruff.
true
Other
Homebrew
brew
ee5a073b057724e2cca238050db98d00c78e6c1c.json
Add the SFC PLC to the README and manpage. Let's document these so people know who the leadership team behind the project is.
manpages/brew-cask.1
@@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "BREW\-CASK" "1" "July 2018" "Homebrew" "brew-cask" +.TH "BREW\-CASK" "1" "August 2018" "Homebrew" "brew-cask" . .SH "NAME" \fBbrew\-cask\fR \- a friendly binary installer for macOS
true
Other
Homebrew
brew
ee5a073b057724e2cca238050db98d00c78e6c1c.json
Add the SFC PLC to the README and manpage. Let's document these so people know who the leadership team behind the project is.
manpages/brew.1
@@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "BREW" "1" "July 2018" "Homebrew" "brew" +.TH "BREW" "1" "August 2018" "Homebrew" "brew" . .SH "NAME" \fBbrew\fR \- The missing package manager for macOS @@ -1269,6 +1269,9 @@ Homebrew Documentation: \fIhttps://docs\.brew\.sh\fR Homebrew\'s lead maintainer is Mike McQuaid\. . .P +Homebrew\'s project leadership committee is Mike McQuaid, ilovezfs, JCount, Misty De Meo and Markus Reiter\. +. +.P Homebrew/homebrew\-core\'s lead maintainer is ilovezfs\. . .P
true
Other
Homebrew
brew
85a6d81e2a03421043c4baa40240b4823b8b12c9.json
Make sure download directory exists.
Library/Homebrew/download_strategy.rb
@@ -253,6 +253,8 @@ def _fetch ohai "Downloading from #{url}" end + temporary_path.dirname.mkpath + curl_download resolved_url(url), to: temporary_path end
false
Other
Homebrew
brew
9ffc7dd46516e1d94ca4c386fc6006c61bd0e6ca.json
Use `Resource#downloader` for `BottleLoader`.
Library/Homebrew/formulary.rb
@@ -105,7 +105,7 @@ def initialize(bottle_name) formula_name = File.basename(bottle_name)[/(.+)-/, 1] resource = Resource.new(formula_name) { url bottle_name } resource.specs[:bottle] = true - downloader = CurlDownloadStrategy.new(resource.download_name, resource.version, resource) + downloader = resource.downloader cached = downloader.cached_location.exist? downloader.fetch ohai "Pouring the cached bottle" if cached
true
Other
Homebrew
brew
9ffc7dd46516e1d94ca4c386fc6006c61bd0e6ca.json
Use `Resource#downloader` for `BottleLoader`.
Library/Homebrew/resource.rb
@@ -64,7 +64,9 @@ def escaped_name end def download_name - name.nil? ? owner.name : "#{owner.name}--#{escaped_name}" + return owner.name if name.nil? + return escaped_name if owner.nil? + "#{owner.name}--#{escaped_name}" end def cached_download
true
Other
Homebrew
brew
e2d8e3c6ee2e3d35d808ec5f7a12449118a2306c.json
Remove unneeded RuboCop comment.
Library/Homebrew/utils/fork.rb
@@ -26,11 +26,8 @@ def self.safe_fork(&_block) ignore_interrupts(:quietly) do # the child will receive the interrupt and marshal it back begin socket = server.accept_nonblock - # rubocop:disable Lint/ShadowedException - # FIXME: https://github.com/bbatsov/rubocop/issues/4843 rescue Errno::EAGAIN, Errno::EWOULDBLOCK, Errno::ECONNABORTED, Errno::EPROTO, Errno::EINTR retry unless Process.waitpid(pid, Process::WNOHANG) - # rubocop:enable Lint/ShadowedException else socket.send_io(write) socket.close
false
Other
Homebrew
brew
29182ad0682430f34f65947a38da58dd712efd46.json
Remove non-existent download strategies.
Library/Homebrew/dev-cmd/audit.rb
@@ -982,14 +982,6 @@ def audit_download_strategy return unless using - if using == :ssl3 || \ - (Object.const_defined?("CurlSSL3DownloadStrategy") && using == CurlSSL3DownloadStrategy) - problem "The SSL3 download strategy is deprecated, please choose a different URL" - elsif (Object.const_defined?("CurlUnsafeDownloadStrategy") && using == CurlUnsafeDownloadStrategy) || \ - (Object.const_defined?("UnsafeSubversionDownloadStrategy") && using == UnsafeSubversionDownloadStrategy) - problem "#{using.name} is deprecated, please choose a different URL" - end - if using == :cvs mod = specs[:module]
true
Other
Homebrew
brew
29182ad0682430f34f65947a38da58dd712efd46.json
Remove non-existent download strategies.
Library/Homebrew/download_strategy.rb
@@ -1136,7 +1136,6 @@ def self.detect_from_symbol(symbol) when :bzr then BazaarDownloadStrategy when :svn then SubversionDownloadStrategy when :curl then CurlDownloadStrategy - when :ssl3 then CurlSSL3DownloadStrategy when :cvs then CVSDownloadStrategy when :post then CurlPostDownloadStrategy when :fossil then FossilDownloadStrategy
true
Other
Homebrew
brew
f8dc9eff5898d4b9d75c409954540777ab844c23.json
Move `.tar.xz` logic from `Xz` to `Tar`.
Library/Homebrew/unpack_strategy/tar.rb
@@ -30,7 +30,17 @@ def self.can_extract?(path) private def extract_to_dir(unpack_dir, basename:, verbose:) - system_command! "tar", args: ["xf", path, "-C", unpack_dir] + Dir.mktmpdir do |tmpdir| + tar_path = path + + if DependencyCollector.tar_needs_xz_dependency? && Xz.can_extract?(path) + tmpdir = Pathname(tmpdir) + Xz.new(path).extract(to: tmpdir) + tar_path = tmpdir.children.first + end + + system_command! "tar", args: ["xf", tar_path, "-C", unpack_dir] + end end end end
true
Other
Homebrew
brew
f8dc9eff5898d4b9d75c409954540777ab844c23.json
Move `.tar.xz` logic from `Xz` to `Tar`.
Library/Homebrew/unpack_strategy/xz.rb
@@ -24,19 +24,6 @@ def extract_to_dir(unpack_dir, basename:, verbose:) system_command! "unxz", args: [*quiet_flags, "-T0", "--", unpack_dir/basename], env: { "PATH" => PATH.new(Formula["xz"].opt_bin, ENV["PATH"]) } - extract_nested_tar(unpack_dir) - end - - def extract_nested_tar(unpack_dir) - return unless DependencyCollector.tar_needs_xz_dependency? - return if (children = unpack_dir.children).count != 1 - return if (tar = children.first).extname != ".tar" - - Dir.mktmpdir do |tmpdir| - tmpdir = Pathname(tmpdir) - FileUtils.mv tar, tmpdir/tar.basename - Tar.new(tmpdir/tar.basename).extract(to: unpack_dir) - end end end end
true
Other
Homebrew
brew
04e97e82db43d085bfc73e8e46e52634aabe0d53.json
Use magic number for Adobe Air.
Library/Homebrew/unpack_strategy/air.rb
@@ -5,7 +5,8 @@ class Air using Magic def self.can_extract?(path) - path.extname == ".air" + mime_type = "application/vnd.adobe.air-application-installer-package+zip" + path.magic_number.match?(/.{59}#{Regexp.escape(mime_type)}/) end def dependencies
false
Other
Homebrew
brew
278eace2faae151c753bf1fdfabe3175a23e7c35.json
Reorder unpack strategies again.
Library/Homebrew/unpack_strategy.rb
@@ -5,33 +5,33 @@ module UnpackStrategy def self.strategies @strategies ||= [ - Pkg, - Ttf, - Otf, - Air, - Executable, - Diff, + Air, # needs to be before Zip Jar, # needs to be before Zip LuaRock, # needs to be before Zip MicrosoftOfficeXml, # needs to be before Zip - Zip, - Xar, - Compress, + Zip, # needs to be before Tar + Pkg, # needs to be before Xar + Xar, # needs to be before Tar Tar, # needs to be before Bzip2/Gzip/Xz/Lzma Gzip, Lzma, Xz, Lzip, + Executable, + Diff, Git, Mercurial, Subversion, Cvs, + Ttf, + Otf, Dmg, # needs to be before Bzip2 Bzip2, Fossil, Bazaar, SelfExtractingExecutable, # needs to be before Cab Cab, + Compress, P7Zip, Sit, Rar,
false
Other
Homebrew
brew
7cf8bb4f8c2f4a61da8b555892105f7c82782f3d.json
Add `Diff` unpack strategy.
Library/Homebrew/unpack_strategy.rb
@@ -10,6 +10,7 @@ def self.strategies Otf, Air, Executable, + Diff, Jar, # needs to be before Zip LuaRock, # needs to be before Zip MicrosoftOfficeXml, # needs to be before Zip @@ -126,6 +127,7 @@ def dependencies require "unpack_strategy/cab" require "unpack_strategy/compress" require "unpack_strategy/cvs" +require "unpack_strategy/diff" require "unpack_strategy/directory" require "unpack_strategy/dmg" require "unpack_strategy/executable"
true
Other
Homebrew
brew
7cf8bb4f8c2f4a61da8b555892105f7c82782f3d.json
Add `Diff` unpack strategy.
Library/Homebrew/unpack_strategy/diff.rb
@@ -0,0 +1,9 @@ +require_relative "uncompressed" + +module UnpackStrategy + class Diff < Uncompressed + def self.can_extract?(path:, magic_number:) + magic_number.match?(/\A---\040/n) + end + end +end
true
Other
Homebrew
brew
fc1586576021f20bc87526254044d31908503146.json
Reorder unpack strategies.
Library/Homebrew/unpack_strategy.rb
@@ -10,16 +10,13 @@ def self.strategies Otf, Air, Executable, - SelfExtractingExecutable, - Jar, - LuaRock, - MicrosoftOfficeXml, + Jar, # needs to be before Zip + LuaRock, # needs to be before Zip + MicrosoftOfficeXml, # needs to be before Zip Zip, - Dmg, Xar, Compress, - Tar, - Bzip2, + Tar, # needs to be before Bzip2/Gzip/Xz/Lzma Gzip, Lzma, Xz, @@ -28,8 +25,11 @@ def self.strategies Mercurial, Subversion, Cvs, + Dmg, # needs to be before Bzip2 + Bzip2, Fossil, Bazaar, + SelfExtractingExecutable, # needs to be before Cab Cab, P7Zip, Sit,
false
Other
Homebrew
brew
428bc9c7a3c9b371d304e49b05a4427107b4c593.json
Add `LazyObject` class.
Library/Homebrew/lazy_object.rb
@@ -0,0 +1,14 @@ +class LazyObject < Delegator + def initialize(&callable) + super(callable) + end + + def __getobj__ + return @__delegate__ if defined?(@__delegate__) + @__delegate__ = @__callable__.call + end + + def __setobj__(callable) + @__callable__ = callable + end +end
true
Other
Homebrew
brew
428bc9c7a3c9b371d304e49b05a4427107b4c593.json
Add `LazyObject` class.
Library/Homebrew/test/lazy_object_spec.rb
@@ -0,0 +1,35 @@ +require "lazy_object" + +describe LazyObject do + describe "#initialize" do + it "does not evaluate the block" do + expect { |block| + described_class.new(&block) + }.not_to yield_control + end + end + + describe "when receiving a message" do + it "evaluates the block" do + expect(described_class.new { 42 }.to_s).to eq "42" + end + end + + describe "#!" do + it "delegates to the underlying object" do + expect(!(described_class.new { false })).to be true + end + end + + describe "#!=" do + it "delegates to the underlying object" do + expect(described_class.new { 42 }).not_to eq 13 + end + end + + describe "#==" do + it "delegates to the underlying object" do + expect(described_class.new { 42 }).to eq 42 + end + end +end
true
Other
Homebrew
brew
d14f5dae7eaedc48ca1048c169f54a7cbce5b021.json
Add spec for SVN directory name containing `@`.
Library/Homebrew/test/unpack_strategy/subversion_spec.rb
@@ -1,22 +1,26 @@ require_relative "shared_examples" describe UnpackStrategy::Subversion do - let(:repo) { - mktmpdir.tap do |repo| - system "svnadmin", "create", repo - end - } - let(:working_copy) { - mktmpdir.tap do |working_copy| - system "svn", "checkout", "file://#{repo}", working_copy - - FileUtils.touch working_copy/"test" - system "svn", "add", working_copy/"test" - system "svn", "commit", working_copy, "-m", "Add `test` file." - end - } + let(:repo) { mktmpdir } + let(:working_copy) { mktmpdir } let(:path) { working_copy } + before(:each) do + system "svnadmin", "create", repo + + system "svn", "checkout", "file://#{repo}", working_copy + + FileUtils.touch working_copy/"test" + system "svn", "add", working_copy/"test" + system "svn", "commit", working_copy, "-m", "Add `test` file." + end + include_examples "UnpackStrategy::detect" include_examples "#extract", children: ["test"] + + context "when the directory name contains an '@' symbol" do + let(:working_copy) { mktmpdir(["", "@1.2.3"]) } + + include_examples "#extract", children: ["test"] + end end
false
Other
Homebrew
brew
785ec4ef57677f1b2cf6dc171a5b524faaaaafb4.json
Add tests for `CaskUnreadableError.
Library/Homebrew/test/cask/cask_loader/from__path_loader_spec.rb
@@ -0,0 +1,35 @@ +describe Hbc::CaskLoader::FromPathLoader do + describe "#load" do + context "when the file does not contain a cask" do + let(:path) { + (mktmpdir/"cask.rb").tap do |path| + path.write <<~RUBY + true + RUBY + end + } + + it "raises an error" do + expect { + described_class.new(path).load + }.to raise_error(Hbc::CaskUnreadableError, /does not contain a cask/) + end + end + + context "when the file calls a non-existent method" do + let(:path) { + (mktmpdir/"cask.rb").tap do |path| + path.write <<~RUBY + this_method_does_not_exist + RUBY + end + } + + it "raises an error" do + expect { + described_class.new(path).load + }.to raise_error(Hbc::CaskUnreadableError, /undefined local variable or method/) + end + end + end +end
true
Other
Homebrew
brew
785ec4ef57677f1b2cf6dc171a5b524faaaaafb4.json
Add tests for `CaskUnreadableError.
Library/Homebrew/test/cask/dsl_spec.rb
@@ -46,7 +46,7 @@ let(:token) { "invalid/invalid-header-format" } it "raises an error" do - expect { cask }.to raise_error(SyntaxError) + expect { cask }.to raise_error(Hbc::CaskUnreadableError) end end
true
Other
Homebrew
brew
5a45315349c440241c7a5669a33d2707682d8f82.json
Raise error when file does not contain a cask.
Library/Homebrew/cask/lib/hbc/cask.rb
@@ -17,7 +17,11 @@ def self.each return to_enum unless block_given? Tap.flat_map(&:cask_files).each do |f| - yield CaskLoader::FromTapPathLoader.new(f).load + begin + yield CaskLoader::FromTapPathLoader.new(f).load + rescue CaskUnreadableError => e + opoo e.message + end end end
true
Other
Homebrew
brew
5a45315349c440241c7a5669a33d2707682d8f82.json
Raise error when file does not contain a cask.
Library/Homebrew/cask/lib/hbc/cask_loader.rb
@@ -54,7 +54,15 @@ def load @content = IO.read(path) - instance_eval(content, path) + begin + instance_eval(content, path).tap do |cask| + unless cask.is_a?(Cask) + raise CaskUnreadableError.new(token, "'#{path}' does not contain a cask.") + end + end + rescue NameError, ArgumentError, ScriptError => e + raise CaskUnreadableError.new(token, e.message) + end end private
true
Other
Homebrew
brew
5a45315349c440241c7a5669a33d2707682d8f82.json
Raise error when file does not contain a cask.
Library/Homebrew/cask/lib/hbc/exceptions.rb
@@ -36,6 +36,12 @@ def to_s end end + class CaskUnreadableError < CaskUnavailableError + def to_s + "Cask '#{token}' is unreadable" << (reason.empty? ? "." : ": #{reason}") + end + end + class CaskAlreadyCreatedError < AbstractCaskErrorWithToken def to_s %Q(Cask '#{token}' already exists. Run #{Formatter.identifier("brew cask edit #{token}")} to edit it.)
true
Other
Homebrew
brew
fabb0931e3fc13ad929b88996b9821acdea041d0.json
audit: change the "unstable" spec message to devel/head
Library/Homebrew/dev-cmd/audit.rb
@@ -598,7 +598,7 @@ def audit_specs end if formula.head || formula.devel - unstable_spec_message = "Formulae should not have an unstable spec" + unstable_spec_message = "Formulae should not have a `HEAD` or `devel` spec" if @new_formula new_formula_problem unstable_spec_message elsif formula.versioned_formula?
false
Other
Homebrew
brew
d8624f5fe754b3d3bcbb0836ecd9fdbb974b9ea1.json
Remove `MachO` check for `Executable`.
Library/Homebrew/unpack_strategy/executable.rb
@@ -1,17 +1,9 @@ require_relative "uncompressed" -require "vendor/macho/macho" - module UnpackStrategy class Executable < Uncompressed def self.can_extract?(path:, magic_number:) - return true if magic_number.match?(/\A#!\s*\S+/n) - - begin - path.file? && MachO.open(path).header.executable? - rescue MachO::NotAMachOError - false - end + magic_number.match?(/\A#!\s*\S+/n) end end end
false
Other
Homebrew
brew
7542c4edb73fdfee00070d8dd6980d58141eca48.json
utils/github: remove full stop from the "skipping" comment
Library/Homebrew/utils/github.rb
@@ -308,7 +308,7 @@ def create_issue_comment(body) url = "#{API_URL}/repos/#{user}/#{repo}/issues/#{pr}/comments" data = { "body" => body } if issue_comment_exists?(user, repo, pr, body) - ohai "Skipping: identical comment exists on #{PR_ENV}." + ohai "Skipping: identical comment exists on #{PR_ENV}" return true end
false
Other
Homebrew
brew
b675024ce0bec75c74b46224efb8b38b1576a4ac.json
Add failing test for `DirectoryUnpackStrategy`.
Library/Homebrew/test/unpack_strategy_spec.rb
@@ -90,6 +90,21 @@ strategy.extract(to: unpack_dir) expect(unpack_dir/"symlink").to be_a_symlink end + + it "preserves permissions of contained files" do + FileUtils.chmod 0644, path/"file" + + strategy.extract(to: unpack_dir) + expect((unpack_dir/"file").stat.mode & 0777).to eq 0644 + end + + it "preserves the permissions of the destination directory" do + FileUtils.chmod 0700, path + FileUtils.chmod 0755, unpack_dir + + strategy.extract(to: unpack_dir) + expect(unpack_dir.stat.mode & 0777).to eq 0755 + end end describe UncompressedUnpackStrategy do
false
Other
Homebrew
brew
9bd216725798148a28c0c6fa5422ad12148db799.json
Add quiet flags if not verbose.
Library/Homebrew/unpack_strategy.rb
@@ -164,7 +164,8 @@ def self.can_extract?(path:, magic_number:) private def extract_to_dir(unpack_dir, basename:, verbose:) - safe_system "unzip", "-qq", path, "-d", unpack_dir + quiet_flags = verbose ? [] : ["-qq"] + safe_system "unzip", *quiet_flags, path, "-d", unpack_dir end end @@ -200,7 +201,8 @@ def self.can_extract?(path:, magic_number:) def extract_to_dir(unpack_dir, basename:, verbose:) FileUtils.cp path, unpack_dir/basename, preserve: true - safe_system Formula["xz"].opt_bin/"unxz", "-q", "-T0", unpack_dir/basename + quiet_flags = verbose ? [] : ["-q"] + safe_system Formula["xz"].opt_bin/"unxz", *quiet_flags, "-T0", unpack_dir/basename extract_nested_tar(unpack_dir) end @@ -226,7 +228,8 @@ def self.can_extract?(path:, magic_number:) def extract_to_dir(unpack_dir, basename:, verbose:) FileUtils.cp path, unpack_dir/basename, preserve: true - safe_system "bunzip2", "-q", unpack_dir/basename + quiet_flags = verbose ? [] : ["-q"] + safe_system "bunzip2", *quiet_flags, unpack_dir/basename end end @@ -239,7 +242,8 @@ def self.can_extract?(path:, magic_number:) def extract_to_dir(unpack_dir, basename:, verbose:) FileUtils.cp path, unpack_dir/basename, preserve: true - safe_system "gunzip", "-q", "-N", unpack_dir/basename + quiet_flags = verbose ? [] : ["-q"] + safe_system "gunzip", *quiet_flags, "-N", unpack_dir/basename end end @@ -252,7 +256,8 @@ def self.can_extract?(path:, magic_number:) def extract_to_dir(unpack_dir, basename:, verbose:) FileUtils.cp path, unpack_dir/basename, preserve: true - safe_system Formula["lzip"].opt_bin/"lzip", "-d", "-q", unpack_dir/basename + quiet_flags = verbose ? [] : ["-q"] + safe_system Formula["lzip"].opt_bin/"lzip", "-d", *quiet_flags, unpack_dir/basename end end
false
Other
Homebrew
brew
8666d8fa18494e73713a130378f842959882d1f8.json
Increase spec timeout to 30 seconds I’ve noticed the deadlock test in `cask/system_command_spec.rb` appears to fail spuriously, e. g. in #4529. Details: https://travis-ci.org/Homebrew/brew/jobs/406827725#L297-L318 With the spec taking 2 seconds on average on my 2017 MBP, I feel it’s entirely plausible for the aging test-bot hardware to get knocked by the 15-second timeout. Given that the spec will pass early anyway if it passes, I feel it’s reasonable to bump the timeout to 30 seconds.
Library/Homebrew/test/cask/system_command_spec.rb
@@ -183,7 +183,7 @@ } it "returns without deadlocking" do - wait(15).for { + wait(30).for { described_class.run(command, options) }.to be_a_success end
false
Other
Homebrew
brew
979e6674cf8684ffbf7fbff7c8e2b70043e8c6af.json
Fix JAR detection.
Library/Homebrew/unpack_strategy.rb
@@ -125,8 +125,10 @@ def self.can_extract?(path:, magic_number:) return false unless ZipUnpackStrategy.can_extract?(path: path, magic_number: magic_number) # Check further if the ZIP is a LuaRocks package. - out, _, status = Open3.capture3("zipinfo", "-1", path) - status.success? && out.split("\n").any? { |line| line.match?(%r{\A[^/]+.rockspec\Z}) } + out, = Open3.capture3("zipinfo", "-1", path) + out.encode(Encoding::UTF_8, invalid: :replace) + .split("\n") + .any? { |line| line.match?(%r{\A[^/]+.rockspec\Z}) } end end @@ -135,8 +137,10 @@ def self.can_extract?(path:, magic_number:) return false unless ZipUnpackStrategy.can_extract?(path: path, magic_number: magic_number) # Check further if the ZIP is a JAR/WAR. - out, _, status = Open3.capture3("zipinfo", "-1", path) - status.success? && out.split("\n").include?("META-INF/MANIFEST.MF") + out, = Open3.capture3("zipinfo", "-1", path) + out.encode(Encoding::UTF_8, invalid: :replace) + .split("\n") + .include?("META-INF/MANIFEST.MF") end end
false
Other
Homebrew
brew
ad7be58655e260adda6a9e4d33365148d22463db.json
Use guard clause instead of `||`.
Library/Homebrew/download_strategy.rb
@@ -69,7 +69,8 @@ def clear_cache def safe_system(*args) if @shutup - quiet_system(*args) || raise(ErrorDuringExecution.new(args, status: $CHILD_STATUS)) + return if quiet_system(*args) + raise(ErrorDuringExecution.new(args, status: $CHILD_STATUS)) else super(*args) end
true
Other
Homebrew
brew
ad7be58655e260adda6a9e4d33365148d22463db.json
Use guard clause instead of `||`.
Library/Homebrew/utils.rb
@@ -302,7 +302,8 @@ def run_as_not_developer # Kernel.system but with exceptions def safe_system(cmd, *args, **options) - Homebrew.system(cmd, *args, **options) || raise(ErrorDuringExecution.new([cmd, *args], status: $CHILD_STATUS)) + return if Homebrew.system(cmd, *args, **options) + raise(ErrorDuringExecution.new([cmd, *args], status: $CHILD_STATUS)) end # prints no output
true
Other
Homebrew
brew
fec884d8dac727e4537b2e2f1fae2b5569855b66.json
Add tests for `ErrorDuringExecution`.
Library/Homebrew/test/error_during_execution_spec.rb
@@ -0,0 +1,63 @@ +describe ErrorDuringExecution do + subject(:error) { described_class.new(command, status: status, output: output) } + let(:command) { ["false"] } + let(:status) { instance_double(Process::Status, exitstatus: exitstatus) } + let(:exitstatus) { 1 } + let(:output) { nil } + + describe "#initialize" do + it "fails when only given a command" do + expect { + described_class.new(command) + }.to raise_error(ArgumentError) + end + + it "fails when only given a status" do + expect { + described_class.new(status: status) + }.to raise_error(ArgumentError) + end + + it "does not raise an error when given both a command and a status" do + expect { + described_class.new(command, status: status) + }.not_to raise_error + end + end + + describe "#to_s" do + context "when only given a command and a status" do + its(:to_s) { is_expected.to eq "Failure while executing; `false` exited with 1." } + end + + context "when additionally given the output" do + let(:output) { + [ + [:stdout, "This still worked.\n"], + [:stderr, "Here something went wrong.\n"], + ] + } + + before do + allow($stdout).to receive(:tty?).and_return(true) + end + + its(:to_s) { + is_expected.to eq <<~EOS + Failure while executing; `false` exited with 1. Here's the output: + This still worked. + #{Formatter.error("Here something went wrong.\n")} + EOS + } + end + + context "when command arguments contain special characters" do + let(:command) { ["env", "PATH=/bin", "cat", "with spaces"] } + + its(:to_s) { + is_expected + .to eq 'Failure while executing; `env PATH=/bin cat with\ spaces` exited with 1.' + } + end + end +end
false
Other
Homebrew
brew
2712fcaa6728a5bfbf9a2113bdfd93b52370615b.json
Use interleaved output for `ErrorDuringExecution`.
Library/Homebrew/cask/lib/hbc/system_command.rb
@@ -19,6 +19,7 @@ def self.run!(command, **options) end def run! + @merged_output = [] @processed_output = { stdout: "", stderr: "" } odebug command.shelljoin @@ -27,9 +28,11 @@ def run! when :stdout puts line.chomp if print_stdout? processed_output[:stdout] << line + @merged_output << [:stdout, line] when :stderr $stderr.puts Formatter.error(line.chomp) if print_stderr? processed_output[:stderr] << line + @merged_output << [:stderr, line] end end @@ -85,9 +88,8 @@ def sudo_prefix def assert_success return if processed_status&.success? raise ErrorDuringExecution.new(command, - stdout: processed_output[:stdout], - stderr: processed_output[:stderr], - status: processed_status) + status: processed_status, + output: @merged_output) end def expanded_args
true
Other
Homebrew
brew
2712fcaa6728a5bfbf9a2113bdfd93b52370615b.json
Use interleaved output for `ErrorDuringExecution`.
Library/Homebrew/exceptions.rb
@@ -526,19 +526,21 @@ def initialize(cause) # raised by safe_system in utils.rb class ErrorDuringExecution < RuntimeError - def initialize(cmd, status:, stdout: nil, stderr: nil) + def initialize(cmd, status:, output: nil) s = "Failure while executing; `#{cmd.shelljoin.gsub(/\\=/, "=")}` exited with #{status.exitstatus}." - if stdout - s << "==> Standard Output of failed command:\n" - s << stdout - s << "\n" unless stdout.end_with?("\n") - end + unless [*output].empty? + format_output_line = lambda do |type, line| + if type == :stderr + Formatter.error(line) + else + line + end + end - if stderr - s << "==> Standard Error of failed command:\n" - s << stderr - s << "\n" unless stderr.end_with?("\n") + s << " Here's the output:\n" + s << output.map(&format_output_line).join + s << "\n" unless s.end_with?("\n") end super s
true
Other
Homebrew
brew
2712fcaa6728a5bfbf9a2113bdfd93b52370615b.json
Use interleaved output for `ErrorDuringExecution`.
Library/Homebrew/extend/os/linux/keg_relocate.rb
@@ -21,7 +21,7 @@ def change_rpath(file, old_prefix, new_prefix) # Skip ELF files that do not have a .dynstr section. return if ["cannot find section .dynstr", "strange: no string table"].include?(old_rpath) unless $CHILD_STATUS.success? - raise ErrorDuringExecution.new(cmd_rpath, stdout: old_rpath, status: $CHILD_STATUS) + raise ErrorDuringExecution.new(cmd_rpath, status: $CHILD_STATUS, output: [:stdout, old_rpath]) end rpath = old_rpath
true
Other
Homebrew
brew
3ff9c5335d8c397c2257a4e59c49ad095074b73e.json
Canonicalize `input` in `initialize`.
Library/Homebrew/cask/lib/hbc/system_command.rb
@@ -41,7 +41,7 @@ def initialize(executable, args: [], sudo: false, input: [], print_stdout: false @executable = executable @args = args @sudo = sudo - @input = input + @input = [*input] @print_stdout = print_stdout @print_stderr = print_stderr @must_succeed = must_succeed @@ -116,7 +116,7 @@ def each_output_line(&b) end def write_input_to(raw_stdin) - [*input].each(&raw_stdin.method(:print)) + input.each(&raw_stdin.method(:write)) end def each_line_from(sources)
false
Other
Homebrew
brew
c6fa3fe8b416a41c698188269c3f587c3ad107d1.json
Add test for basename in `#extract_nestedly`.
Library/Homebrew/test/unpack_strategy_spec.rb
@@ -56,6 +56,23 @@ expect(Pathname.glob(unpack_dir/"**/*")).to include unpack_dir/directories end end + + context "when extracting a nested archive" do + let(:basename) { "file.xyz" } + let(:path) { + (mktmpdir/basename).tap do |path| + mktmpdir do |dir| + FileUtils.touch dir/"file.txt" + system "tar", "-c", "-f", path, "-C", dir, "file.txt" + end + end + } + + it "does not pass down the basename of the archive" do + strategy.extract_nestedly(to: unpack_dir) + expect(unpack_dir/"file.txt").to be_a_file + end + end end end
false
Other
Homebrew
brew
f2d823445ec979dd911ce936b4bb96258844057c.json
ruby.sh: remove linkage cache on upgrade. This may not be compatible between portable ruby versions and between portable and system ruby versions. Fixes #4485.
Library/Homebrew/utils/ruby.sh
@@ -47,7 +47,7 @@ setup-ruby-path() { then odie "Failed to install vendor Ruby." fi - rm -rf "$vendor_dir/bundle/ruby" + rm -rf "$vendor_dir/bundle/ruby" "$HOMEBREW_CACHE/linkage.db" HOMEBREW_RUBY_PATH="$vendor_ruby_path" fi fi
false
Other
Homebrew
brew
22ddec85b01d6d2e061b94938a57e2773a5c282b.json
Add failing test.
Library/Homebrew/test/unpack_strategy_spec.rb
@@ -59,6 +59,22 @@ end end +describe DirectoryUnpackStrategy do + let(:path) { + mktmpdir.tap do |path| + FileUtils.touch path/"file" + FileUtils.ln_s "file", path/"symlink" + end + } + subject(:strategy) { described_class.new(path) } + let(:unpack_dir) { mktmpdir } + + it "does not follow symlinks" do + strategy.extract(to: unpack_dir) + expect(unpack_dir/"symlink").to be_a_symlink + end +end + describe UncompressedUnpackStrategy do let(:path) { (mktmpdir/"test").tap do |path|
false
Other
Homebrew
brew
e63d490874dd57d363643e49d6a7ce8fe17818d2.json
formula: handle unavailable missing formulae. Fixes #4494.
Library/Homebrew/formula.rb
@@ -1557,6 +1557,10 @@ def missing_dependencies(hide: nil) runtime_formula_dependencies.select do |f| hide.include?(f.name) || f.installed_prefixes.empty? end + # If we're still getting unavailable formulae at this stage the best we can + # do is just return no results. + rescue FormulaUnavailableError + [] end # @private
false
Other
Homebrew
brew
9e2b14a80d3468a45f153bb09f5a72999ebb46a3.json
Use non-legacy test example in PR template.
.github/PULL_REQUEST_TEMPLATE.md
@@ -1,7 +1,7 @@ - [ ] Have you followed the guidelines in our [Contributing](https://github.com/Homebrew/brew/blob/master/CONTRIBUTING.md) document? - [ ] Have you checked to ensure there aren't other open [Pull Requests](https://github.com/Homebrew/brew/pulls) for the same change? - [ ] Have you added an explanation of what your changes do and why you'd like us to include them? -- [ ] Have you written new tests for your changes? [Here's an example](https://github.com/Homebrew/homebrew/pull/49031). +- [ ] Have you written new tests for your changes? [Here's an example](https://github.com/Homebrew/brew/blob/master/Library/Homebrew/test/PATH_spec.rb). - [ ] Have you successfully run `brew style` with your changes locally? - [ ] Have you successfully run `brew tests` with your changes locally?
false
Other
Homebrew
brew
3fd1e914fd783388e9d59b504cd6a2cd8850c415.json
Fix details in cask command
Library/Homebrew/cask/lib/hbc/artifact/abstract_flight_block.rb
@@ -26,10 +26,6 @@ def uninstall_phase(**) abstract_phase(self.class.uninstall_dsl_key) end - def summarize - directives.keys.map(&:to_s).join(", ") - end - private def class_for_dsl_key(dsl_key) @@ -41,6 +37,10 @@ def abstract_phase(dsl_key) return if (block = directives[dsl_key]).nil? class_for_dsl_key(dsl_key).new(cask).instance_eval(&block) end + + def summarize + directives.keys.map(&:to_s).join(", ") + end end end end
true
Other
Homebrew
brew
3fd1e914fd783388e9d59b504cd6a2cd8850c415.json
Fix details in cask command
Library/Homebrew/cask/lib/hbc/cask.rb
@@ -139,10 +139,10 @@ def to_hash "version" => version, "sha256" => sha256, "artifacts" => artifacts.map do |a| - if a.respond_to? :to_a - a.to_a - elsif a.methods.include? :to_h + if a.respond_to? :to_h a.to_h + elsif a.respond_to? :to_a + a.to_a else a end
true
Other
Homebrew
brew
d069cc2ebce7c33211fd7da31ee7512442c173b8.json
Move error to the right place.
Library/Homebrew/cask/lib/hbc/installer.rb
@@ -152,17 +152,17 @@ def primary_container Container.for_path(@downloaded_path) end - container&.new(@cask, @downloaded_path, @command, verbose: verbose?) + unless container + raise CaskError, "Uh oh, could not figure out how to unpack '#{@downloaded_path}'." + end + + container.new(@cask, @downloaded_path, @command, verbose: verbose?) end end def extract_primary_container odebug "Extracting primary container" - unless primary_container - raise CaskError, "Uh oh, could not figure out how to unpack '#{@downloaded_path}'" - end - odebug "Using container class #{primary_container.class} for #{@downloaded_path}" FileUtils.mkdir_p @cask.staged_path primary_container.extract
false
Other
Homebrew
brew
85f76e312a6171dceab69b1163dede2f903092fa.json
Add spec for nested directories.
Library/Homebrew/test/unpack_strategy_spec.rb
@@ -17,23 +17,44 @@ describe UnpackStrategy do describe "#extract_nestedly" do - let(:file_name) { "file" } - let(:nested_archive) { - dir = mktmpdir + subject(:strategy) { described_class.detect(path) } - (dir/"file").write "This file was inside a GZIP inside a BZIP2." - system "gzip", dir.children.first - system "bzip2", dir.children.first - - dir.children.first - } let(:unpack_dir) { mktmpdir } - subject(:strategy) { described_class.detect(nested_archive) } - it "can extract nested archives" do - strategy.extract_nestedly(to: unpack_dir) + context "when extracting a GZIP nested in a BZIP2" do + let(:file_name) { "file" } + let(:path) { + dir = mktmpdir + + (dir/"file").write "This file was inside a GZIP inside a BZIP2." + system "gzip", dir.children.first + system "bzip2", dir.children.first + + dir.children.first + } + + it "can extract nested archives" do + strategy.extract_nestedly(to: unpack_dir) - expect(File.read(unpack_dir/file_name)).to eq("This file was inside a GZIP inside a BZIP2.") + expect(File.read(unpack_dir/file_name)).to eq("This file was inside a GZIP inside a BZIP2.") + end + end + + context "when extracting a directory with nested directories" do + let(:directories) { "A/B/C" } + let(:path) { + (mktmpdir/"file.tar").tap do |path| + mktmpdir do |dir| + (dir/directories).mkpath + system "tar", "-c", "-f", path, "-C", dir, "A/" + end + end + } + + it "does not recurse into nested directories" do + strategy.extract_nestedly(to: unpack_dir) + expect(Pathname.glob(unpack_dir/"**/*")).to include unpack_dir/directories + end end end end
false
Other
Homebrew
brew
589c5b4e8dc4fab625868672d138e46290b19ecf.json
Add support for nested archives.
Library/Homebrew/test/unpack_strategy_spec.rb
@@ -15,6 +15,29 @@ end end +describe UnpackStrategy do + describe "#extract_nestedly" do + let(:file_name) { "file" } + let(:nested_archive) { + dir = mktmpdir + + (dir/"file").write "This file was inside a GZIP inside a BZIP2." + system "gzip", dir.children.first + system "bzip2", dir.children.first + + dir.children.first + } + let(:unpack_dir) { mktmpdir } + subject(:strategy) { described_class.detect(nested_archive) } + + it "can extract nested archives" do + strategy.extract_nestedly(to: unpack_dir) + + expect(File.read(unpack_dir/file_name)).to eq("This file was inside a GZIP inside a BZIP2.") + end + end +end + describe UncompressedUnpackStrategy do let(:path) { (mktmpdir/"test").tap do |path|
true
Other
Homebrew
brew
589c5b4e8dc4fab625868672d138e46290b19ecf.json
Add support for nested archives.
Library/Homebrew/unpack_strategy.rb
@@ -67,6 +67,30 @@ def extract(to: nil, basename: nil) unpack_dir.mkpath extract_to_dir(unpack_dir, basename: basename) end + + def extract_nestedly(to: nil, basename: nil) + if is_a?(UncompressedUnpackStrategy) + extract(to: to, basename: basename) + return + end + + Dir.mktmpdir do |tmp_unpack_dir| + tmp_unpack_dir = Pathname(tmp_unpack_dir) + + extract(to: tmp_unpack_dir, basename: basename) + + children = tmp_unpack_dir.children + + if children.count == 1 + s = self.class.detect(children.first) + + s.extract_nestedly(to: to, basename: basename) + next + end + + DirectoryUnpackStrategy.new(tmp_unpack_dir).extract(to: to) + end + end end class DirectoryUnpackStrategy < UnpackStrategy @@ -166,7 +190,7 @@ def self.can_extract?(path:, magic_number:) end end -class XzUnpackStrategy < UncompressedUnpackStrategy +class XzUnpackStrategy < UnpackStrategy def self.can_extract?(path:, magic_number:) magic_number.match?(/\A\xFD7zXZ\x00/n) end @@ -192,41 +216,41 @@ def extract_nested_tar(unpack_dir, basename:) end end -class Bzip2UnpackStrategy < UncompressedUnpackStrategy +class Bzip2UnpackStrategy < UnpackStrategy def self.can_extract?(path:, magic_number:) magic_number.match?(/\ABZh/n) end private def extract_to_dir(unpack_dir, basename:) - super + FileUtils.cp path, unpack_dir/basename, preserve: true safe_system "bunzip2", "-q", unpack_dir/basename end end -class GzipUnpackStrategy < UncompressedUnpackStrategy +class GzipUnpackStrategy < UnpackStrategy def self.can_extract?(path:, magic_number:) magic_number.match?(/\A\037\213/n) end private def extract_to_dir(unpack_dir, basename:) - super + FileUtils.cp path, unpack_dir/basename, preserve: true safe_system "gunzip", "-q", "-N", unpack_dir/basename end end -class LzipUnpackStrategy < UncompressedUnpackStrategy +class LzipUnpackStrategy < UnpackStrategy def self.can_extract?(path:, magic_number:) magic_number.match?(/\ALZIP/n) end private def extract_to_dir(unpack_dir, basename:) - super + FileUtils.cp path, unpack_dir/basename, preserve: true safe_system Formula["lzip"].opt_bin/"lzip", "-d", "-q", unpack_dir/basename end end
true
Other
Homebrew
brew
20001bbbdafd51ce94c9c40930582471f86fadc8.json
Handle the case when HOMEBREW_CC = cc
Library/Homebrew/shims/super/cc
@@ -79,8 +79,8 @@ class Cmd "clang++" when /llvm-gcc/ "llvm-g++-4.2" - when /gcc(-\d(\.\d)?)?$/ - "g++" + $1.to_s + when /(g)?cc(-\d(\.\d)?)?$/ + "g++" + $2.to_s end else # Note that this is a universal fallback, so that we'll always invoke
false
Other
Homebrew
brew
2a63d363c2d49c6fbf4f6f5a53cd73701a63e997.json
Add two new unpack strategies.
Library/Homebrew/unpack_strategy.rb
@@ -6,6 +6,8 @@ class UnpackStrategy def self.strategies @strategies ||= [ JarUnpackStrategy, + LuaRockUnpackStrategy, + MicrosoftOfficeXmlUnpackStrategy, ZipUnpackStrategy, XarUnpackStrategy, CompressUnpackStrategy, @@ -87,6 +89,26 @@ def extract_to_dir(unpack_dir, basename:) end end +class MicrosoftOfficeXmlUnpackStrategy < UncompressedUnpackStrategy + def self.can_extract?(path:, magic_number:) + return false unless ZipUnpackStrategy.can_extract?(path: path, magic_number: magic_number) + + # Check further if the ZIP is a Microsoft Office XML document. + magic_number.match?(/\APK\003\004/n) && + magic_number.match?(%r{\A.{30}(\[Content_Types\]\.xml|_rels/\.rels)}n) + end +end + +class LuaRockUnpackStrategy < UncompressedUnpackStrategy + def self.can_extract?(path:, magic_number:) + return false unless ZipUnpackStrategy.can_extract?(path: path, magic_number: magic_number) + + # Check further if the ZIP is a LuaRocks package. + out, _, status = Open3.capture3("zipinfo", "-1", path) + status.success? && out.split("\n").any? { |line| line.match?(%r{\A[^/]+.rockspec\Z}) } + end +end + class JarUnpackStrategy < UncompressedUnpackStrategy def self.can_extract?(path:, magic_number:) return false unless ZipUnpackStrategy.can_extract?(path: path, magic_number: magic_number)
false
Other
Homebrew
brew
82482f4787e61bfb5a9dd0551b8941aef25b9ff0.json
Add support for self-extracting `.exe` archives.
Library/Homebrew/cask/lib/hbc/container.rb
@@ -6,6 +6,7 @@ require "hbc/container/cab" require "hbc/container/criteria" require "hbc/container/dmg" +require "hbc/container/self_extracting_executable" require "hbc/container/executable" require "hbc/container/generic_unar" require "hbc/container/gpg" @@ -32,6 +33,7 @@ def self.autodetect_containers Ttf, Otf, Air, + SelfExtractingExecutable, Cab, Dmg, SevenZip,
true
Other
Homebrew
brew
82482f4787e61bfb5a9dd0551b8941aef25b9ff0.json
Add support for self-extracting `.exe` archives.
Library/Homebrew/cask/lib/hbc/container/self_extracting_executable.rb
@@ -0,0 +1,15 @@ +require "hbc/container/generic_unar" + +module Hbc + class Container + class SelfExtractingExecutable < GenericUnar + def self.can_extract?(path:, magic_number:) + return false unless magic_number.match?(/\AMZ/n) + + SystemCommand.run("file", + args: [path], + print_stderr: false).stdout.include?("self-extracting") + end + end + end +end
true
Other
Homebrew
brew
cab0090048cc0caae1d73a74778f82dcd8ee4b2e.json
formulary: handle missing methods. This makes formulae unreadable. See https://discourse.brew.sh/t/error-in-mpfr-2-formula/2575.
Library/Homebrew/formulary.rb
@@ -24,7 +24,7 @@ def self.load_formula(name, path, contents, namespace) const_set(namespace, mod) begin mod.module_eval(contents, path) - rescue ArgumentError, ScriptError => e + rescue NoMethodError, ArgumentError, ScriptError => e raise FormulaUnreadableError.new(name, e) end class_name = class_s(name)
false
Other
Homebrew
brew
256dfc1af9c3ef8fb09b11bad03f632ac0d94cc7.json
Move methods from FileUtils to Formula These don't need to live on FileUtils and don't really make sense there either.
Library/Homebrew/extend/fileutils.rb
@@ -1,53 +0,0 @@ -require "fileutils" -require "etc" - -# Homebrew extends Ruby's `FileUtils` to make our code more readable. -# @see https://ruby-doc.org/stdlib-2.0.0/libdoc/fileutils/rdoc/FileUtils.html Ruby's FileUtils API -module FileUtils - # @private - alias old_mkdir mkdir - - # A version of mkdir that also changes to that folder in a block. - def mkdir(name, mode: nil, noop: nil, verbose: nil, &_block) - result = mkdir_p(name, mode: mode, noop: noop, verbose: verbose) - return result unless block_given? - chdir name do - yield - end - end - module_function :mkdir - - # Run `scons` using a Homebrew-installed version rather than whatever is in the `PATH`. - def scons(*args) - system Formulary.factory("scons").opt_bin/"scons", *args - end - - # Run `make` 3.81 or newer. - # Uses the system make on Leopard and newer, and the - # path to the actually-installed make on Tiger or older. - def make(*args) - if Utils.popen_read("/usr/bin/make", "--version").match(/Make (\d\.\d+)/)[1] > "3.80" - make_path = "/usr/bin/make" - else - make = Formula["make"].opt_bin/"make" - make_path = make.exist? ? make.to_s : (Formula["make"].opt_bin/"gmake").to_s - end - - if superenv? - make_name = File.basename(make_path) - with_env(HOMEBREW_MAKE: make_name) do - system "make", *args - end - else - system make_path, *args - end - end - - # Run `xcodebuild` without Homebrew's compiler environment variables set. - def xcodebuild(*args) - removed = ENV.remove_cc_etc - system "xcodebuild", *args - ensure - ENV.update(removed) - end -end
true
Other
Homebrew
brew
256dfc1af9c3ef8fb09b11bad03f632ac0d94cc7.json
Move methods from FileUtils to Formula These don't need to live on FileUtils and don't really make sense there either.
Library/Homebrew/formula.rb
@@ -1907,6 +1907,56 @@ def mktemp(prefix = name, opts = {}) end end + # A version of `FileUtils.mkdir` that also changes to that folder in + # a block. + def mkdir(name) + result = FileUtils.mkdir_p(name) + return result unless block_given? + FileUtils.chdir name do + yield + end + end + + # Run `scons` using a Homebrew-installed version rather than whatever is + # in the `PATH`. + def scons(*args) + system Formulary.factory("scons").opt_bin/"scons", *args + end + + # Run `make` 3.81 or newer. + # Uses the system make on Leopard and newer, and the + # path to the actually-installed make on Tiger or older. + def make(*args) + if Utils.popen_read("/usr/bin/make", "--version") + .match(/Make (\d\.\d+)/)[1] > "3.80" + make_path = "/usr/bin/make" + else + make = Formula["make"].opt_bin/"make" + make_path = if make.exist? + make.to_s + else + (Formula["make"].opt_bin/"gmake").to_s + end + end + + if superenv? + make_name = File.basename(make_path) + with_env(HOMEBREW_MAKE: make_name) do + system "make", *args + end + else + system make_path, *args + end + end + + # Run `xcodebuild` without Homebrew's compiler environment variables set. + def xcodebuild(*args) + removed = ENV.remove_cc_etc + system "xcodebuild", *args + ensure + ENV.update(removed) + end + private # Returns the prefix for a given formula version number.
true
Other
Homebrew
brew
256dfc1af9c3ef8fb09b11bad03f632ac0d94cc7.json
Move methods from FileUtils to Formula These don't need to live on FileUtils and don't really make sense there either.
Library/Homebrew/global.rb
@@ -33,7 +33,7 @@ HOMEBREW_BOTTLE_DOMAIN = ENV["HOMEBREW_BOTTLE_DOMAIN"] || HOMEBREW_BOTTLE_DEFAULT_DOMAIN -require "extend/fileutils" +require "fileutils" module Homebrew extend FileUtils
true
Other
Homebrew
brew
256dfc1af9c3ef8fb09b11bad03f632ac0d94cc7.json
Move methods from FileUtils to Formula These don't need to live on FileUtils and don't really make sense there either.
Library/Homebrew/resource.rb
@@ -182,6 +182,14 @@ def patch(strip = :p1, src = nil, &block) patches << p end + protected + + def mktemp(prefix) + Mktemp.new(prefix).run do |staging| + yield staging + end + end + private def detect_version(val) @@ -196,12 +204,6 @@ def detect_version(val) end end - def mktemp(prefix) - Mktemp.new(prefix).run do |staging| - yield staging - end - end - class Go < Resource def stage(target) super(target/name)
true
Other
Homebrew
brew
256dfc1af9c3ef8fb09b11bad03f632ac0d94cc7.json
Move methods from FileUtils to Formula These don't need to live on FileUtils and don't really make sense there either.
Library/Homebrew/test/formula_spec.rb
@@ -1303,6 +1303,17 @@ def reset_outdated_kegs end end + describe "#mkdir" do + let(:dst) { mktmpdir } + + it "creates intermediate directories" do + f.mkdir dst/"foo/bar/baz" do + expect(dst/"foo/bar/baz").to exist, "foo/bar/baz was not created" + expect(dst/"foo/bar/baz").to be_a_directory, "foo/bar/baz was not a directory structure" + end + end + end + describe "with changed version scheme" do let(:f) do formula "testball" do
true
Other
Homebrew
brew
256dfc1af9c3ef8fb09b11bad03f632ac0d94cc7.json
Move methods from FileUtils to Formula These don't need to live on FileUtils and don't really make sense there either.
Library/Homebrew/test/pathname_spec.rb
@@ -289,16 +289,3 @@ end end end - -describe FileUtils do - let(:dst) { mktmpdir } - - describe "#mkdir" do - it "creates intermediate directories" do - described_class.mkdir dst/"foo/bar/baz" do - expect(dst/"foo/bar/baz").to exist, "foo/bar/baz was not created" - expect(dst/"foo/bar/baz").to be_a_directory, "foo/bar/baz was not a directory structure" - end - end - end -end
true
Other
Homebrew
brew
bb1bb5130908381e91106ae1312d4dced780a011.json
requirement: add mktemp function. Addresses comments in #4465.
Library/Homebrew/requirement.rb
@@ -116,6 +116,12 @@ def display_s name end + def mktemp + Mktemp.new(name).run do |staging| + yield staging + end + end + private def infer_name
false
Other
Homebrew
brew
92c6e72a4a5d339e3fec5dfa881facfc2b3572e9.json
hardware: add dodeca-core for 2018 MBPs
Library/Homebrew/hardware.rb
@@ -137,6 +137,7 @@ def self.cores_as_words when 4 then "quad" when 6 then "hexa" when 8 then "octa" + when 12 then "dodeca" else Hardware::CPU.cores end
false
Other
Homebrew
brew
e1eb7dd3e32f48c95d9c820e72e66fdd3cc53f37.json
Use Ruby 2.3.7 Fixes #4459.
Library/Homebrew/cmd/vendor-install.sh
@@ -13,22 +13,17 @@ if [[ -n "$HOMEBREW_MACOS" ]] then if [[ "$HOMEBREW_PROCESSOR" = "Intel" ]] then - ruby_URL="$HOMEBREW_BOTTLE_DOMAIN/bottles-portable-ruby/portable-ruby-2.3.3_2.leopard_64.bottle.tar.gz" - ruby_URL2="https://github.com/Homebrew/homebrew-portable-ruby/releases/download/2.3.3_2/portable-ruby-2.3.3_2.leopard_64.bottle.tar.gz" - ruby_SHA="f1db8863543d256e6a8e704bf618025030b3d22a7a6b19749d19f599b5554212" + ruby_URL="$HOMEBREW_BOTTLE_DOMAIN/bottles-portable-ruby/portable-ruby-2.3.7.leopard_64.bottle.tar.gz" + ruby_URL2="https://github.com/Homebrew/homebrew-portable-ruby/releases/download/2.3.7/portable-ruby-2.3.7.leopard_64.bottle.tar.gz" + ruby_SHA="033ac518bb14abdb1bb47d968dc9e967c3ae2035499383a21a79b49d523065d1" fi elif [[ -n "$HOMEBREW_LINUX" ]] then case "$HOMEBREW_PROCESSOR" in x86_64) - ruby_URL="$HOMEBREW_BOTTLE_DOMAIN/bottles-portable-ruby/portable-ruby-2.3.3_2.x86_64_linux.bottle.tar.gz" - ruby_URL2="https://github.com/Homebrew/homebrew-portable-ruby/releases/download/2.3.3_2/portable-ruby-2.3.3_2.x86_64_linux.bottle.tar.gz" - ruby_SHA="b5c320c1bc2c4d42d4674643855c582ba2772fc951689d298ee079b74bac29a7" - ;; - armv[67]*) - ruby_URL="$HOMEBREW_BOTTLE_DOMAIN/bottles-portable-ruby/portable-ruby-2.3.3_2.armv6_linux.bottle.tar.gz" - ruby_URL2="https://github.com/Homebrew/homebrew-portable-ruby/releases/download/2.3.3_2/portable-ruby-2.3.3_2.armv6_linux.bottle.tar.gz" - ruby_SHA="6ac992c4620912b50b3c74f2d4447d541bac4f1839e557c3edcfdebb141c9802" + ruby_URL="$HOMEBREW_BOTTLE_DOMAIN/bottles-portable-ruby/portable-ruby-2.3.7.x86_64_linux.bottle.tar.gz" + ruby_URL2="https://github.com/Homebrew/homebrew-portable-ruby/releases/download/2.3.7/portable-ruby-2.3.7.x86_64_linux.bottle.tar.gz" + ruby_SHA="9df214085a0e566a580eea3dd9eab14a2a94930ff74fbf97fb1284e905c8921d" ;; esac fi
true
Other
Homebrew
brew
e1eb7dd3e32f48c95d9c820e72e66fdd3cc53f37.json
Use Ruby 2.3.7 Fixes #4459.
Library/Homebrew/extend/os/mac/diagnostic.rb
@@ -165,7 +165,7 @@ def check_for_other_package_managers end def check_ruby_version - ruby_version = "2.3.3" + ruby_version = "2.3.7" return if RUBY_VERSION == ruby_version return if ARGV.homebrew_developer? && OS::Mac.prerelease?
true
Other
Homebrew
brew
e1eb7dd3e32f48c95d9c820e72e66fdd3cc53f37.json
Use Ruby 2.3.7 Fixes #4459.
Library/Homebrew/utils/ruby.sh
@@ -3,7 +3,7 @@ setup-ruby-path() { local vendor_ruby_current_version local vendor_ruby_path local ruby_version_new_enough - local minimum_ruby_version="2.3.3" + local minimum_ruby_version="2.3.7" vendor_dir="$HOMEBREW_LIBRARY/Homebrew/vendor" vendor_ruby_current_version="$vendor_dir/portable-ruby/current"
true
Other
Homebrew
brew
e1eb7dd3e32f48c95d9c820e72e66fdd3cc53f37.json
Use Ruby 2.3.7 Fixes #4459.
Library/Homebrew/vendor/portable-ruby-version
@@ -1 +1 @@ -2.3.3_2 +2.3.7
true
Other
Homebrew
brew
4fe0adf587d8f9cc751fd991ab3370fe3ce9d49a.json
shared: fix HOMEBREW_CCCFG reference.
Library/Homebrew/extend/ENV/shared.rb
@@ -55,7 +55,7 @@ def remove_from_cflags(val) end def append_to_cccfg(value) - append(HOMEBREW_CCCFG, value, "") + append("HOMEBREW_CCCFG", value, "") end def append(keys, value, separator = " ")
false
Other
Homebrew
brew
1b688a3a25fa4ca077de88e2177241b6cb76a5f6.json
Relocate bottles on Linux using patchelf Ensure patchelf is installed to pour bottles and build bottles.
Library/Homebrew/dev-cmd/bottle.rb
@@ -87,11 +87,20 @@ def bottle end return merge if args.merge? + ensure_relocation_formulae_installed! ARGV.resolved_formulae.each do |f| bottle_formula f end end + def ensure_relocation_formulae_installed! + Keg.relocation_formulae.each do |f| + next if Formula[f].installed? + ohai "Installing #{f}..." + safe_system HOMEBREW_BREW_FILE, "install", f + end + end + def keg_contain?(string, keg, ignores) @put_string_exists_header, @put_filenames = nil
true