Show contained files of PKGs when version detection fails.
This commit is contained in:
parent
4f3bfd1d58
commit
96bbf1ac15
@ -83,7 +83,7 @@ module Homebrew
|
|||||||
ohai "Checking #{cask.full_name}"
|
ohai "Checking #{cask.full_name}"
|
||||||
|
|
||||||
unless single_app_cask?(cask) || single_pkg_cask?(cask)
|
unless single_app_cask?(cask) || single_pkg_cask?(cask)
|
||||||
opoo "Skipping, cask #{cask} it not a single-app or PKG cask."
|
opoo "Skipping, not a single-app or PKG cask."
|
||||||
next
|
next
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -202,26 +202,36 @@ module Homebrew
|
|||||||
.map { |package| package.fetch("Package") }
|
.map { |package| package.fetch("Package") }
|
||||||
.uniq
|
.uniq
|
||||||
|
|
||||||
if packages.count == 1
|
Dir.mktmpdir do |extract_dir|
|
||||||
Dir.mktmpdir do |extract_dir|
|
extract_dir = Pathname(extract_dir)
|
||||||
extract_dir = Pathname(extract_dir)
|
FileUtils.rmdir extract_dir
|
||||||
FileUtils.rmdir extract_dir
|
|
||||||
|
|
||||||
|
begin
|
||||||
system_command! "pkgutil", args: ["--expand-full", pkg_path, extract_dir]
|
system_command! "pkgutil", args: ["--expand-full", pkg_path, extract_dir]
|
||||||
|
rescue => e
|
||||||
|
onoe "Failed to extract #{pkg_path.basename}: #{e}"
|
||||||
|
next
|
||||||
|
end
|
||||||
|
|
||||||
|
if packages.count == 1
|
||||||
package_info_path = extract_dir/"PackageInfo"
|
package_info_path = extract_dir/"PackageInfo"
|
||||||
if package_info_path.exist?
|
if package_info_path.exist?
|
||||||
if (version = version_from_package_info(package_info_path))
|
if (version = version_from_package_info(package_info_path))
|
||||||
return version
|
return version
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
onoe "#{pkg_path.basename} does not contain a `PackageInfo` file."
|
onoe "#{pkg_path.basename} does not contain a `PackageInfo` file:"
|
||||||
|
$stderr.puts Pathname.glob(extract_dir/"**/*")
|
||||||
next
|
next
|
||||||
end
|
end
|
||||||
|
else
|
||||||
|
opoo "Skipping, #{pkg_path.basename} contains multiple packages (#{packages.join(", ")}):"
|
||||||
|
$stderr.puts Pathname.glob(extract_dir/"**/*")
|
||||||
|
next
|
||||||
end
|
end
|
||||||
else
|
ensure
|
||||||
opoo "Skipping, #{pkg_path.basename} contains multiple packages."
|
Cask::Utils.gain_permissions_remove(extract_dir)
|
||||||
next
|
extract_dir.mkpath
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -254,7 +264,6 @@ module Homebrew
|
|||||||
.returns(T.nilable(String))
|
.returns(T.nilable(String))
|
||||||
end
|
end
|
||||||
def self.decide_between_versions(short_version, version)
|
def self.decide_between_versions(short_version, version)
|
||||||
|
|
||||||
return short_version if short_version == version
|
return short_version if short_version == version
|
||||||
|
|
||||||
short_version_match = short_version&.match?(/\A\d+(\.\d+)+\Z/)
|
short_version_match = short_version&.match?(/\A\d+(\.\d+)+\Z/)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user