git: 92939bfde271 - main - Add USES=ansible for Ansible ports
Mateusz Piotrowski
0mp at FreeBSD.org
Mon May 17 13:38:42 UTC 2021
The branch main has been updated by 0mp:
URL: https://cgit.FreeBSD.org/ports/commit/?id=92939bfde271f881e76fdb94ee5047271d2d1b43
commit 92939bfde271f881e76fdb94ee5047271d2d1b43
Author: Mateusz Piotrowski <0mp at FreeBSD.org>
AuthorDate: 2021-05-17 11:51:15 +0000
Commit: Mateusz Piotrowski <0mp at FreeBSD.org>
CommitDate: 2021-05-17 13:38:41 +0000
Add USES=ansible for Ansible ports
The purpose of this new USES file is to provide a central place for
setting Ansible paths for modules and plugins. Perhaps in the future we
will extend to reduce boilerplate code in existing Ansible-related
ports.
PR: 255920
Reported by: lcook
Reviewed by: madpilot
Differential Revision: https://reviews.freebsd.org/D30312
---
Mk/Uses/ansible.mk | 74 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 74 insertions(+)
diff --git a/Mk/Uses/ansible.mk b/Mk/Uses/ansible.mk
new file mode 100644
index 000000000000..f4dd11b3e587
--- /dev/null
+++ b/Mk/Uses/ansible.mk
@@ -0,0 +1,74 @@
+# Shared namespace for Ansible-related ports.
+#
+# Feature: ansible
+# Usage: USES=ansible:ARGS
+# Valid ARGS: env, module, plugin
+#
+# env The port does not depend on Ansible but needs some Ansible
+# variables set.
+# module The port is an Ansible module. (*)
+# plugin The port is an Ansible plugin. (*)
+#
+# (*) See Ansible documentation to learn about the difference
+# between a module and a plugin:
+# https://docs.ansible.com/ansible/latest/dev_guide/developing_locally.html
+#
+# Variables for ports:
+#
+# ANSIBLE_CMD - Path to the ansible program.
+# ANSIBLE_DOC_CMD - Path to the ansible-doc program.
+# ANSIBLE_RUN_DEPENDS - RUN_DEPENDS with the Ansible port.
+#
+# ANSIBLE_DATADIR - Path to the root of the directory structure where all
+# Ansible's modules and plugins are stored.
+# ANSIBLE_PLUGINS_PREFIX
+# - Path to the "plugins" directory
+# within ${ANSIBLE_DATADIR}.
+# ANSIBLE_MODULESDIR - Path to the directory for local Ansible modules.
+# ANSIBLE_PLUGINSDIR - Path to the directory for local Ansible plugins.
+# ANSIBLE_PLUGIN_TYPE - Ansible plugin type (e.g., "connection", "inventory",
+# or "vars").
+#
+# Other information:
+# - USES=ansible implies USES=python:env automatically is no USES=python has
+# been specified yet.
+#
+# MAINTAINER: ports at FreeBSD.org
+
+.if !defined(_INCLUDE_USES_ANSIBLE_Mk)
+_INCLUDE_USES_ANSIBLE_Mk= yes
+
+.if empty(ansible_ARGS)
+IGNORE= no arguments specified to USES=ansible
+.elif ${ansible_ARGS} == "env"
+.elif ${ansible_ARGS} == "module"
+.elif ${ansible_ARGS} == "plugin"
+.else
+IGNORE= uses unknown USES=ansible arguments: ${ansible_ARGS}
+.endif
+
+.if !${USES:Mpython*}
+python_ARGS= env
+_USES_POST+= python:env
+.include "${USESDIR}/python.mk"
+.endif
+
+ANSIBLE_CMD?= ${LOCALBASE}/bin/ansible
+ANSIBLE_DOC_CMD?= ${LOCALBASE}/bin/ansible-doc
+ANSIBLE_RUN_DEPENDS?= ${ANSIBLE_CMD}:sysutils/ansible@${PY_FLAVOR}
+
+ANSIBLE_DATADIR?= ${PREFIX}/share/${PYTHON_PKGNAMEPREFIX}ansible
+ANSIBLE_PLUGINS_PREFIX?= ${ANSIBLE_DATADIR}/plugins
+.if ${ansible_ARGS} == "module"
+ANSIBLE_MODULESDIR?= ${ANSIBLE_PLUGINS_PREFIX}/modules
+.elif ${ansible_ARGS} == "plugin"
+. if empty(ANSIBLE_PLUGIN_TYPE)
+IGNORE= ANSIBLE_PLUGIN_TYPE must be set
+. endif
+ANSIBLE_PLUGINSDIR?= ${ANSIBLE_PLUGINS_PREFIX}/${ANSIBLE_PLUGIN_TYPE}
+.endif
+
+.if ${ansible_ARGS} == "module" || ${ansible_ARGS} == "plugin"
+RUN_DEPENDS+= ${ANSIBLE_RUN_DEPENDS}
+.endif
+.endif
More information about the dev-commits-ports-all
mailing list