Page MenuHomeFreeBSD

Add USES=ansible for Ansible ports
ClosedPublic

Authored by 0mp on May 17 2021, 11:56 AM.

Details

Summary

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

Diff Detail

Repository
rP FreeBSD ports repository
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 39242
Build 36131: arc lint + arc unit

Event Timeline

0mp requested review of this revision.May 17 2021, 11:56 AM

Note: I've thought about integrating a simple target as well, but I'm not sure if that's really helpful. Nevertheless, here's the testing part of the patch I skipped:

ANSIBLE_TEST?=		yes

.if ${ANSIBLE_TEST:tl} != "no"
.  if ${ansible_ARGS} == "module"
.    if empty(ANSIBLE_MODULE)
IGNORE=	ANSIBLE_MODULE must be set
.    endif
.  elif ${ansible_ARGS} == "plugin"
.    if empty(ANSIBLE_PLUGIN)
IGNORE=	ANSIBLE_PLUGIN must be set
.    endif
.  endif

TEST_ENV+=	PAGER=cat
.endif


.if !target(do-test) && ${ANSIBLE_TEST:tl} != "no"
.  if ${ansible_ARGS} == "module"
do-test:
	${SETENV} ${TEST_ENV} ${ANSIBLE_CMD} \
		--module-path ${STAGEDIR}${ANSIBLE_MODULESDIR} \
		--module-name ${ANSIBLE_MODULE} \
		--syntax-check \
		localhost
.  elif ${ansible_ARGS} == "plugin"
do-test:
	${SETENV} ${TEST_ENV} ${ANSIBLE_DOC_CMD} \
		--module-path ${STAGEDIR}${ANSIBLE_PLUGINSDIR} \
		--type ${ANSIBLE_PLUGIN_TYPE} \
		${ANSIBLE_PLUGIN} | ${GREP} -q .
.  endif
.endif

I think this is fine. It would simplify module/plugin ports and move some common code where it belongs.

A test target can be added later anyway.

This revision was not accepted when it landed; it landed in state Needs Review.May 17 2021, 1:39 PM
This revision was automatically updated to reflect the committed changes.
arrowd added inline comments.
Mk/Uses/ansible.mk
43

What about

_valid_ARGS=    env module plugin

.  for arg in ${ansible_ARGS}
.    if !${_valid_ARGS:M${arg}}
IGNORE=		USES=ansible: invalid arguments: ${arg}
.    endif
.  endfor

instead of these .else clauses?

0mp marked an inline comment as done.May 17 2021, 4:30 PM
0mp added inline comments.
Mk/Uses/ansible.mk
43