Support for MacPorts under macOS.
This module has some caveats.
1. Updating the database of available ports is quite resource-intensive. However, refresh=True is the default for all operations that need an up-to-date copy of available ports. Consider refresh=False when you are sure no db update is needed.
2. In some cases MacPorts doesn't always realize when another copy of itself is running and will gleefully tromp all over the available ports database. This makes MacPorts behave in undefined ways until a fresh complete copy is retrieved.
Because of 1 and 2 it is possible to get the salt-minion into a state where salt mac-machine pkg./something/ won't want to return. Use
salt-run jobs.active
on the master to check for potentially long-running calls to port.
Finally, ports database updates are always handled with port selfupdate as opposed to port sync. This makes sense in the MacPorts user community but may confuse experienced Linux admins as Linux package managers don't upgrade the packaging software when doing a package database update. In other words salt mac-machine pkg.refresh_db is more like apt-get update; apt-get upgrade dpkg apt-get than simply apt-get update.
This function is an alias of latest_version
.
Return the latest version of the named package available for upgrade or installation
Options:
- refresh
Update ports with
port selfupdate
CLI Example:
salt '*' pkg.latest_version <package name> salt '*' pkg.latest_version <package1> <package2> <package3>
Install the passed package(s) with port install
The name of the formula to be installed. Note that this parameter is ignored if "pkgs" is passed.
CLI Example:
salt '*' pkg.install <package name>
Specify a version to pkg to install. Ignored if pkgs is specified.
CLI Example:
salt '*' pkg.install <package name>
salt '*' pkg.install git-core version='1.8.5.5'
Specify a variant to pkg to install. Ignored if pkgs is specified.
CLI Example:
salt '*' pkg.install <package name>
salt '*' pkg.install git-core version='1.8.5.5' variant='+credential_osxkeychain+doc+pcre'
Multiple Package Installation Options:
A list of formulas to install. Must be passed as a python list.
CLI Example:
salt '*' pkg.install pkgs='["foo","bar"]'
salt '*' pkg.install pkgs='["foo@1.2","bar"]'
salt '*' pkg.install pkgs='["foo@1.2+ssl","bar@2.3"]'
Returns a dict containing the new package names and versions:
{'<package>': {'old': '<old-version>',
'new': '<new-version>'}}
CLI Example:
salt '*' pkg.install 'package package package'
Return the latest version of the named package available for upgrade or installation
Options:
Update ports with port selfupdate
CLI Example:
salt '*' pkg.latest_version <package name>
salt '*' pkg.latest_version <package1> <package2> <package3>
List the packages currently installed in a dict:
{'<package_name>': '<version>'}
CLI Example:
salt '*' pkg.list_pkgs
Check whether or not an upgrade is available for all packages
Options:
Update ports with port selfupdate
CLI Example:
salt '*' pkg.list_upgrades
Update ports with port selfupdate
CLI Example:
salt mac pkg.refresh_db
Removes packages with port uninstall
.
The name of the package to be deleted.
Multiple Package Options:
A list of packages to delete. Must be passed as a python list. The
name
parameter will be ignored if this option is passed.
New in version 0.16.0.
Returns a dict containing the changes.
CLI Example:
salt '*' pkg.remove <package name>
salt '*' pkg.remove <package1>,<package2>,<package3>
salt '*' pkg.remove pkgs='["foo", "bar"]'
Run a full upgrade using MacPorts 'port upgrade outdated'
Options:
Update ports with port selfupdate
Returns a dictionary containing the changes:
{'<package>': {'old': '<old-version>',
'new': '<new-version>'}}
CLI Example:
salt '*' pkg.upgrade
Check whether or not an upgrade is available for a given package
CLI Example:
salt '*' pkg.upgrade_available <package name>
Returns a string representing the package version or an empty string if not installed. If more than one package name is specified, a dict of name/version pairs is returned.
CLI Example:
salt '*' pkg.version <package name>
salt '*' pkg.version <package1> <package2> <package3>