pkg on Mac OSX: Support full package names

This makes _verify_install ignore everything up to and including the
final slash in a package name on Mac OSX, if that is necessary to find
the correct package.

This allows specifications to be prefixed with a tap name, like
"homebrew/science/a5".
This commit is contained in:
Score_Under 2016-10-07 14:55:07 +01:00
parent 10601528ea
commit 04d209bfa8

View File

@ -625,11 +625,15 @@ def _verify_install(desired, new_pkgs, ignore_epoch=False):
ok = []
failed = []
for pkgname, pkgver in desired.items():
# FreeBSD pkg supports `openjdk` and `java/openjdk7` package names
origin = bool(re.search('/', pkgname))
# FreeBSD pkg supports `openjdk` and `java/openjdk7` package names.
# Homebrew for Mac OSX does something similar with tap names
# prefixing package names, separated with a slash.
has_origin = '/' in pkgname
if __grains__['os'] == 'FreeBSD' and origin:
if __grains__['os'] == 'FreeBSD' and has_origin:
cver = [k for k, v in six.iteritems(new_pkgs) if v['origin'] == pkgname]
elif __grains__['os'] == 'MacOS' and has_origin:
cver = new_pkgs.get(pkgname, new_pkgs.get(pkgname.split('/')[-1]))
elif __grains__['os'] == 'OpenBSD':
cver = new_pkgs.get(pkgname.split('%')[0])
elif __grains__['os_family'] == 'Debian':