2 # This file and its contents are supplied under the terms of the
3 # Common Development and Distribution License ("CDDL"), version 1.0.
4 # You may only use this file in accordance with the terms of version
7 # A full copy of the text of the CDDL should have accompanied this
8 # source. A copy of the CDDL is also available via the Internet at
9 # http://www.illumos.org/license/CDDL.
13 # Copyright 2023 Marcel Telka
17 COMPONENT_FMRI = system/management/ansible
18 COMPONENT_CLASSIFICATION = System/Administration and Configuration
20 # This project is a collection of other projects (see tags.yaml), each with its
21 # own test requirements. We do not support testing of that (yet).
24 # This is a standalone application. Since no other Python project depends on
25 # it we just provide single unversioned package.
26 SINGLE_PYTHON_VERSION = yes
28 # https://github.com/ansible/ansible/pull/80385
29 LICENSE="GPL-3.0-only"
31 # Do not generate dependencies for usr/bin/ansible-community on
32 # ansible_collections/__init__.py. This file does not exist, but pkgdepend
33 # suggests for unknown reason it is needed.
34 printf '<transform file path=usr/bin/ansible-community$ -> add pkg.depend.bypass-generate .*/ansible_collections/__init__\\.py>\n' >> "$DISTRIBUTION.p5m"
37 # Some Ansible files are technically broken since they use Python shebang but
38 # they are not valid Python executable files. Such files confuses pkgdepend so
39 # it fails. Unfortunately, the default bypass transform in transforms/python
40 # is not enough to make pkgdepend happy, so we need to use a bit bigger hammer
41 # to completely skip pkgdepend for affected files.
44 # https://docs.ansible.com/ansible/latest/dev_guide/testing/sanity/shebang.html
45 # https://github.com/vultr/ansible-collection-vultr/issues/81
47 cat <<-"EOF" >> "$DISTRIBUTION.p5m"
49 # Completely skip pkgdepend for few invalid Python files
50 <transform file path=usr/lib/python3\.\d+/vendor-packages/ansible_collections/cloudscale_ch/cloud/plugins/modules/ -> add pkg.depend.bypass-generate .* >
51 <transform file path=usr/lib/python3\.\d+/vendor-packages/ansible_collections/community/sap_libs/plugins/modules/sap_pyrfc\.py$ -> add pkg.depend.bypass-generate .* >
52 <transform file path=usr/lib/python3\.\d+/vendor-packages/ansible_collections/containers/podman/plugins/modules/ -> add pkg.depend.bypass-generate .* >
53 <transform file path=usr/lib/python3\.\d+/vendor-packages/ansible_collections/ngine_io/vultr/plugins/modules/ -> add pkg.depend.bypass-generate .* >
54 <transform file path=usr/lib/python3\.\d+/vendor-packages/ansible_collections/ngine_io/exoscale/plugins/modules/ -> add pkg.depend.bypass-generate .* >
55 <transform file path=usr/lib/python3\.\d+/vendor-packages/ansible_collections/sensu/sensu_go/plugins/modules/ -> add pkg.depend.bypass-generate .* >
56 <transform file path=usr/lib/python3\.\d+/vendor-packages/ansible_collections/vultr/cloud/ -> add pkg.depend.bypass-generate .* >
60 # This project is a collection of other projects (see tags.yaml), each with its
61 # own runtime requirements usually specified in separate requirements.txt file.
62 printf '\n# Automatically generated per collection dependencies and transforms\n' >> "$DISTRIBUTION.p5m"
63 cat "$SOURCE_DIR/tags.yaml" | egrep -v '^(#| )' | sed -e 's/:$//' | tr '.' '/' | while read d ; do
64 # Get collection requirements
65 DEPS=$(find "$SOURCE_DIR/ansible_collections/$d/" \
67 -o \( -name requirements-test.txt -o -name requirements-dev.txt \) -prune \
68 -o \( -type f -name requirements*.txt -o -name ee-requirements.txt \) -exec cat {} \; -exec echo \; \
69 | "$WS_TOP/tools/python-requires" - | grep -v '^ansible$' \
70 | sed -e 's|^|/library/python/|' | LC_ALL=C sort -u)
71 [[ -n "$DEPS" ]] || continue
74 if pkg list -q -a $DEPS ; then
76 printf 'depend type=require fmri=%s-$(PYV)\n' "${pkg#/}"
79 printf '# Missing dependencies for %s:' "$(printf '%s' "$d" | tr '/' '.')" >> "$DISTRIBUTION.p5m"
81 pkg list -q -a $pkg || printf ' %s' "${pkg##*/}" >> "$DISTRIBUTION.p5m"
83 printf '\n<transform file path=.*/vendor-packages/ansible_collections/%s/ -> drop>\n' "$d" >> "$DISTRIBUTION.p5m"
85 done | LC_ALL=C sort -u >> "$DISTRIBUTION.p5m"