diff options
| author | Jack Nagel | 2013-07-21 19:11:05 -0500 |
|---|---|---|
| committer | Jack Nagel | 2013-07-22 11:25:11 -0500 |
| commit | 1a54e6a4495505044970c5bfa86c24f64bdbda29 (patch) | |
| tree | e85c95f41039c2f6fe405a96fcca4a8f243e9f23 /Library | |
| parent | c32552031644a5036b7925301260608d14ab61ca (diff) | |
| download | brew-1a54e6a4495505044970c5bfa86c24f64bdbda29.tar.bz2 | |
Extract version_from_pkgutil
Diffstat (limited to 'Library')
| -rw-r--r-- | Library/Homebrew/os/mac/xquartz.rb | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/Library/Homebrew/os/mac/xquartz.rb b/Library/Homebrew/os/mac/xquartz.rb index 221bf7719..108ac1e60 100644 --- a/Library/Homebrew/os/mac/xquartz.rb +++ b/Library/Homebrew/os/mac/xquartz.rb @@ -14,9 +14,7 @@ module MacOS::XQuartz extend self elsif prefix.to_s == "/usr/X11" guess_system_version else - # Finally, try to find it via pkgutil. This is slow, and only works - # for the upstream XQuartz package, so use it as a last resort. - MacOS.pkgutil_info(FORGE_PKG_ID)[/version: (\d\.\d\.\d).+$/, 1] + version_from_pkgutil end end end @@ -45,6 +43,14 @@ module MacOS::XQuartz extend self end end + # Upstream XQuartz *does* have a pkg-info entry, so if we can't get it + # from mdls, we can try pkgutil. This is very slow. + # NOTE: this sacrifices correctness, as it returns an internal version + # that may not always match the "user-facing" version string. + def version_from_pkgutil + MacOS.pkgutil_info(FORGE_PKG_ID)[/version: (\d\.\d\.\d).+$/, 1] + end + def provided_by_apple? [FORGE_BUNDLE_ID, APPLE_BUNDLE_ID].find do |id| MacOS.app_with_bundle_id(id) |
