os/mac/xquartz: fix handling of XQuartz 2.8.0+

This commit is contained in:
Bo Anderson 2021-09-23 14:24:16 +01:00
parent 1f0ed9ddf6
commit ab455d1f38
No known key found for this signature in database
GPG Key ID: 3DB94E204E137D65

View File

@ -11,7 +11,8 @@ module OS
module_function module_function
DEFAULT_BUNDLE_PATH = Pathname("Applications/Utilities/XQuartz.app").freeze DEFAULT_BUNDLE_PATH = Pathname("/Applications/Utilities/XQuartz.app").freeze
NEW_BUNDLE_PKG_ID = "org.xquartz.X11"
FORGE_BUNDLE_ID = "org.macosforge.xquartz.X11" FORGE_BUNDLE_ID = "org.macosforge.xquartz.X11"
FORGE_PKG_ID = "org.macosforge.xquartz.pkg" FORGE_PKG_ID = "org.macosforge.xquartz.pkg"
@ -73,7 +74,7 @@ module OS
# Ask Spotlight where XQuartz is. If the user didn't install XQuartz # Ask Spotlight where XQuartz is. If the user didn't install XQuartz
# in the conventional place, this is our only option. # in the conventional place, this is our only option.
MacOS.app_with_bundle_id(FORGE_BUNDLE_ID) MacOS.app_with_bundle_id(NEW_BUNDLE_PKG_ID, FORGE_BUNDLE_ID)
end end
def version_from_mdls(path) def version_from_mdls(path)
@ -86,8 +87,12 @@ module OS
# Upstream XQuartz *does* have a pkg-info entry, so if we can't get it # 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. # from mdls, we can try pkgutil. This is very slow.
def version_from_pkgutil def version_from_pkgutil
str = MacOS.pkgutil_info(FORGE_PKG_ID)[/version: (\d\.\d\.\d+)$/, 1] [NEW_BUNDLE_PKG_ID, FORGE_PKG_ID].each do |id|
PKGINFO_VERSION_MAP.fetch(str, str) str = MacOS.pkgutil_info(id)[/version: (\d\.\d\.\d+)$/, 1]
return PKGINFO_VERSION_MAP.fetch(str, str) if str
end
nil
end end
def prefix def prefix