commit | author | age
|
f67cd3
|
1 |
# |
MT |
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 |
|
5 |
# 1.0 of the CDDL. |
|
6 |
# |
|
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. |
|
10 |
# |
|
11 |
|
|
12 |
# |
|
13 |
# Copyright 2023 Marcel Telka |
|
14 |
# |
|
15 |
|
|
16 |
%patch% 02-selinux.patch |
9cfccb
|
17 |
%patch% 03-test-disable-plugins.patch |
f67cd3
|
18 |
%patch% 05-wcwidth.patch |
MT |
19 |
%patch% 06-dev-null.patch |
16bdf3
|
20 |
%patch% 07-test_importlib_resources.patch |
f67cd3
|
21 |
|
MT |
22 |
%include-2% |
|
23 |
# ansible-core >= 2.14.0 requires Python >= 3.9 |
d0dd84
|
24 |
UNSUPPORTED_PYTHON_VERSIONS = |
f67cd3
|
25 |
PYTHON_VERSIONS := $(filter-out $(UNSUPPORTED_PYTHON_VERSIONS), $(PYTHON_VERSIONS)) |
MT |
26 |
|
|
27 |
# ansible-core use custom testing (see below) |
|
28 |
TEST_STYLE = custom |
|
29 |
%include-3% |
|
30 |
# Make sure the unversioned generic package depends on unsupported versioned package(s) too. |
|
31 |
$(BUILD_DIR)/mkgeneric-python: PYTHON_VERSIONS := $(UNSUPPORTED_PYTHON_VERSIONS) $(PYTHON_VERSIONS) |
|
32 |
|
|
33 |
# custom testing |
|
34 |
# https://docs.ansible.com/ansible/latest/dev_guide/testing_running_locally.html#testing-ansible-core |
|
35 |
COMPONENT_TEST_CMD = bin/ansible-test |
|
36 |
COMPONENT_TEST_ARGS = |
|
37 |
COMPONENT_TEST_ARGS += units |
|
38 |
COMPONENT_TEST_ARGS += --python $(PYTHON_VERSION) |
|
39 |
COMPONENT_TEST_ARGS += --python-interpreter $(PYTHON) |
|
40 |
COMPONENT_TEST_ARGS += --local |
|
41 |
COMPONENT_TEST_ARGS += --color no |
|
42 |
COMPONENT_TEST_ARGS += --verbose |
|
43 |
COMPONENT_TEST_TARGETS = |
|
44 |
|
22f007
|
45 |
# This project does not support tox so we need to provide test requirements |
MT |
46 |
# manually. |
|
47 |
TEST_REQUIREMENTS += test/lib/ansible_test/_data/requirements/units.txt |
|
48 |
|
f67cd3
|
49 |
# testing fails without HOME environment variable |
MT |
50 |
COMPONENT_TEST_ENV += HOME=/tmp |
|
51 |
|
|
52 |
# The ansible-test is running pytest several times in a row with pytest-xdist |
|
53 |
# plugin enabled. This is hard to normalize properly, so we just pick most |
|
54 |
# important lines from the test log and normalize them. |
|
55 |
COMPONENT_TEST_TRANSFORMS = \ |
|
56 |
"-n -e '/^\[gw/p' \ |
|
57 |
| $(COMPONENT_TEST_TRANSFORMER) \ |
|
58 |
-e 's/^\[gw.\] \[...%\] //' \ |
|
59 |
-e 's/\([^ ]\{1,\}\) \(.*\)$$/\2 \1/' \ |
|
60 |
-e 's/\(test_distribution_version\[stdin\)[0-9]*/\1/' \ |
30ca6b
|
61 |
-e 's|$(@D)|\$$(@D)|g' \ |
f67cd3
|
62 |
| $(SORT) \ |
MT |
63 |
| $(COMPONENT_TEST_TRANSFORMER) -e ''" |
|
64 |
%hook-no-license% |
|
65 |
# https://github.com/ansible/ansible/pull/80385 |
|
66 |
LICENSE="GPL-3.0-only" |
|
67 |
%hook-manifest% |
|
68 |
# To make sure ansible-core binaries are available when the python mediator is |
|
69 |
# set to an usupported Python version we need fake versioned ansible-core |
|
70 |
# package(s). We do not use SINGLE_PYTHON_VERSION for ansible-core because |
|
71 |
# ansible depends on ansible-core and with SINGLE_PYTHON_VERSION here the |
|
72 |
# switch of ansible/ansible-core pair to newer Python version would be a bit |
|
73 |
# harder. |
|
74 |
UNSUPPORTED_PYTHON_VERSIONS=$($GMAKE print-value-UNSUPPORTED_PYTHON_VERSIONS) |
|
75 |
PYTHON_VERSION=$($GMAKE print-value-PYTHON_VERSION) |
|
76 |
for ver in $UNSUPPORTED_PYTHON_VERSIONS ; do |
|
77 |
v=${ver//.} |
|
78 |
sed -e '/path=usr\/lib/,$d' \ |
|
79 |
-e 's/^file \(path=usr\/bin\/\)\(.*\)-\$(PYVER)$/link mediator=python mediator-version='"$ver"' \1\2 target=\2-'"$PYTHON_VERSION"'/' \ |
|
80 |
-e 's/\$(PYV)/'"$v"'/' < "$DISTRIBUTION-PYVER.p5m" > "$DISTRIBUTION-$v.p5m" |
|
81 |
printf "\ndepend type=require fmri=library/python/ansible-core-${PYTHON_VERSION//.}\n" >> "$DISTRIBUTION-$v.p5m" |
|
82 |
git add "$DISTRIBUTION-$v.p5m" |
|
83 |
done |