package init
This commit is contained in:
parent
bbbfd5f20e
commit
b60ecf8a30
194
0001-Changes-to-support-building-docs-with-old-jinja2.patch
Normal file
194
0001-Changes-to-support-building-docs-with-old-jinja2.patch
Normal file
@ -0,0 +1,194 @@
|
|||||||
|
From e348dc28e922c29e0ab1fd61be24ecc6616e34ed Mon Sep 17 00:00:00 2001
|
||||||
|
From: Toshio Kuratomi <a.badger@gmail.com>
|
||||||
|
Date: Mon, 25 Jun 2018 11:27:15 -0700
|
||||||
|
Subject: [PATCH] Changes to support building docs with old jinja2
|
||||||
|
|
||||||
|
This commit: fa5c0282a4816c4dd48e80b983ffc1e14506a1f5 relied upon
|
||||||
|
features present in Jinja-2.10 and above. The changes here allow us to
|
||||||
|
build the *rst* with older versions of jinja2.
|
||||||
|
---
|
||||||
|
docs/bin/plugin_formatter.py | 30 +++++++++++++++++
|
||||||
|
docs/templates/plugin.rst.j2 | 80 ++++++++++++++++++++++----------------------
|
||||||
|
2 files changed, 70 insertions(+), 40 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/docs/bin/plugin_formatter.py b/docs/bin/plugin_formatter.py
|
||||||
|
index 5df8b3d86e..330a7540ab 100755
|
||||||
|
--- a/docs/bin/plugin_formatter.py
|
||||||
|
+++ b/docs/bin/plugin_formatter.py
|
||||||
|
@@ -85,6 +85,28 @@ pp = PrettyPrinter()
|
||||||
|
display = Display()
|
||||||
|
|
||||||
|
|
||||||
|
+# kludge_ns gives us a kludgey way to set variables inside of loops that need to be visible outside
|
||||||
|
+# the loop. We can get rid of this when we no longer need to build docs with less than Jinja-2.10
|
||||||
|
+# http://jinja.pocoo.org/docs/2.10/templates/#assignments
|
||||||
|
+# With Jinja-2.10 we can use jinja2's namespace feature, restoring the namespace template portion
|
||||||
|
+# of: fa5c0282a4816c4dd48e80b983ffc1e14506a1f5
|
||||||
|
+NS_MAP = {}
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+def to_kludge_ns(key, value):
|
||||||
|
+ NS_MAP[key] = value
|
||||||
|
+ return ""
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+def from_kludge_ns(key):
|
||||||
|
+ return NS_MAP[key]
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+# The max filter was added in Jinja2-2.10. Until we can require that version, use this
|
||||||
|
+def do_max(seq):
|
||||||
|
+ return max(seq)
|
||||||
|
+
|
||||||
|
+
|
||||||
|
def rst_ify(text):
|
||||||
|
''' convert symbols like I(this is in italics) to valid restructured text '''
|
||||||
|
|
||||||
|
@@ -298,6 +320,14 @@ def jinja2_environment(template_dir, typ, plugin_type):
|
||||||
|
trim_blocks=True)
|
||||||
|
env.globals['xline'] = rst_xline
|
||||||
|
|
||||||
|
+ # Can be removed (and template switched to use namespace) when we no longer need to build
|
||||||
|
+ # with <Jinja-2.10
|
||||||
|
+ env.globals['to_kludge_ns'] = to_kludge_ns
|
||||||
|
+ env.globals['from_kludge_ns'] = from_kludge_ns
|
||||||
|
+ if 'max' not in env.filters:
|
||||||
|
+ # Jinja < 2.10
|
||||||
|
+ env.filters['max'] = do_max
|
||||||
|
+
|
||||||
|
templates = {}
|
||||||
|
if typ == 'rst':
|
||||||
|
env.filters['convert_symbols_to_format'] = rst_ify
|
||||||
|
diff --git a/docs/templates/plugin.rst.j2 b/docs/templates/plugin.rst.j2
|
||||||
|
index dcd43171e7..d3ebc7c560 100644
|
||||||
|
--- a/docs/templates/plugin.rst.j2
|
||||||
|
+++ b/docs/templates/plugin.rst.j2
|
||||||
|
@@ -88,21 +88,21 @@ Parameters
|
||||||
|
.. raw:: html
|
||||||
|
|
||||||
|
<table border=0 cellpadding=0 class="documentation-table">
|
||||||
|
- {# Pre-compute the nesting depth to allocate columns #}
|
||||||
|
- {% set ns = namespace(maxdepth=1) %}
|
||||||
|
- {% for key, value in options|dictsort recursive %}
|
||||||
|
- {% set ns.maxdepth = [loop.depth, ns.maxdepth] | max %}
|
||||||
|
- {% if value.suboptions %}
|
||||||
|
- {% if value.suboptions.items %}
|
||||||
|
- @{ loop(value.suboptions.items()) }@
|
||||||
|
- {% elif value.suboptions[0].items %}
|
||||||
|
- @{ loop(value.suboptions[0].items()) }@
|
||||||
|
- {% endif %}
|
||||||
|
- {% endif %}
|
||||||
|
- {% endfor %}
|
||||||
|
- {# Header of the documentation #}
|
||||||
|
+ {# Pre-compute the nesting depth to allocate columns -#}
|
||||||
|
+ @{ to_kludge_ns('maxdepth', 1) -}@
|
||||||
|
+ {% for key, value in options|dictsort recursive -%}
|
||||||
|
+ @{ to_kludge_ns('maxdepth', [loop.depth, from_kludge_ns('maxdepth')] | max) -}@
|
||||||
|
+ {% if value.suboptions -%}
|
||||||
|
+ {% if value.suboptions.items -%}
|
||||||
|
+ @{ loop(value.suboptions.items()) -}@
|
||||||
|
+ {% elif value.suboptions[0].items -%}
|
||||||
|
+ @{ loop(value.suboptions[0].items()) -}@
|
||||||
|
+ {% endif -%}
|
||||||
|
+ {% endif -%}
|
||||||
|
+ {% endfor -%}
|
||||||
|
+ {# Header of the documentation -#}
|
||||||
|
<tr>
|
||||||
|
- <th colspan="@{ ns.maxdepth }@">Parameter</th>
|
||||||
|
+ <th colspan="@{ from_kludge_ns('maxdepth') }@">Parameter</th>
|
||||||
|
<th>Choices/<font color="blue">Defaults</font></th>
|
||||||
|
{% if plugin_type != 'module' %}
|
||||||
|
<th>Configuration</th>
|
||||||
|
@@ -116,7 +116,7 @@ Parameters
|
||||||
|
<td class="elbow-placeholder"></td>
|
||||||
|
{% endfor %}
|
||||||
|
{# parameter name with required and/or introduced label #}
|
||||||
|
- <td colspan="@{ ns.maxdepth - loop.depth0 }@">
|
||||||
|
+ <td colspan="@{ from_kludge_ns('maxdepth') - loop.depth0 }@">
|
||||||
|
<b>@{ key }@</b>
|
||||||
|
{% if value.get('required', False) %}<br/><div style="font-size: small; color: red">required</div>{% endif %}
|
||||||
|
{% if value.version_added %}<br/><div style="font-size: small; color: darkgreen">(added in @{value.version_added}@)</div>{% endif %}
|
||||||
|
@@ -246,19 +246,19 @@ Facts returned by this module are added/updated in the ``hostvars`` host facts a
|
||||||
|
|
||||||
|
<table border=0 cellpadding=0 class="documentation-table">
|
||||||
|
{# Pre-compute the nesting depth to allocate columns #}
|
||||||
|
- {% set ns = namespace(maxdepth=1) %}
|
||||||
|
+ @{ to_kludge_ns('maxdepth', 1) -}@
|
||||||
|
{% for key, value in returnfacts|dictsort recursive %}
|
||||||
|
- {% set ns.maxdepth = [loop.depth, ns.maxdepth] | max %}
|
||||||
|
- {% if value.contains %}
|
||||||
|
- {% if value.contains.items %}
|
||||||
|
- @{ loop(value.contains.items()) }@
|
||||||
|
- {% elif value.contains[0].items %}
|
||||||
|
- @{ loop(value.contains[0].items()) }@
|
||||||
|
- {% endif %}
|
||||||
|
- {% endif %}
|
||||||
|
- {% endfor %}
|
||||||
|
+ @{ to_kludge_ns('maxdepth', [loop.depth, from_kludge_ns('maxdepth')] | max) -}@
|
||||||
|
+ {% if value.contains -%}
|
||||||
|
+ {% if value.contains.items -%}
|
||||||
|
+ @{ loop(value.contains.items()) -}@
|
||||||
|
+ {% elif value.contains[0].items -%}
|
||||||
|
+ @{ loop(value.contains[0].items()) -}@
|
||||||
|
+ {% endif -%}
|
||||||
|
+ {% endif -%}
|
||||||
|
+ {% endfor -%}
|
||||||
|
<tr>
|
||||||
|
- <th colspan="@{ ns.maxdepth }@">Fact</th>
|
||||||
|
+ <th colspan="@{ from_kludge_ns('maxdepth') }@">Fact</th>
|
||||||
|
<th>Returned</th>
|
||||||
|
<th width="100%">Description</th>
|
||||||
|
</tr>
|
||||||
|
@@ -267,7 +267,7 @@ Facts returned by this module are added/updated in the ``hostvars`` host facts a
|
||||||
|
{% for i in range(1, loop.depth) %}
|
||||||
|
<td class="elbow-placeholder"></td>
|
||||||
|
{% endfor %}
|
||||||
|
- <td colspan="@{ ns.maxdepth - loop.depth0 }@" colspan="@{ ns.maxdepth - loop.depth0 }@">
|
||||||
|
+ <td colspan="@{ from_kludge_ns('maxdepth') - loop.depth0 }@" colspan="@{ from_kludge_ns('maxdepth') - loop.depth0 }@">
|
||||||
|
<b>@{ key }@</b>
|
||||||
|
<br/><div style="font-size: small; color: red">@{ value.type }@</div>
|
||||||
|
</td>
|
||||||
|
@@ -317,19 +317,19 @@ Common return values are documented :ref:`here <common_return_values>`, the foll
|
||||||
|
.. raw:: html
|
||||||
|
|
||||||
|
<table border=0 cellpadding=0 class="documentation-table">
|
||||||
|
- {% set ns = namespace(maxdepth=1) %}
|
||||||
|
- {% for key, value in returndocs|dictsort recursive %}
|
||||||
|
- {% set ns.maxdepth = [loop.depth, ns.maxdepth] | max %}
|
||||||
|
- {% if value.contains %}
|
||||||
|
- {% if value.contains.items %}
|
||||||
|
- @{ loop(value.contains.items()) }@
|
||||||
|
- {% elif value.contains[0].items %}
|
||||||
|
- @{ loop(value.contains[0].items()) }@
|
||||||
|
- {% endif %}
|
||||||
|
- {% endif %}
|
||||||
|
- {% endfor %}
|
||||||
|
+ @{ to_kludge_ns('maxdepth', 1) -}@
|
||||||
|
+ {% for key, value in returndocs|dictsort recursive -%}
|
||||||
|
+ @{ to_kludge_ns('maxdepth', [loop.depth, from_kludge_ns('maxdepth')] | max) -}@
|
||||||
|
+ {% if value.contains -%}
|
||||||
|
+ {% if value.contains.items -%}
|
||||||
|
+ @{ loop(value.contains.items()) -}@
|
||||||
|
+ {% elif value.contains[0].items -%}
|
||||||
|
+ @{ loop(value.contains[0].items()) -}@
|
||||||
|
+ {% endif -%}
|
||||||
|
+ {% endif -%}
|
||||||
|
+ {% endfor -%}
|
||||||
|
<tr>
|
||||||
|
- <th colspan="@{ ns.maxdepth }@">Key</th>
|
||||||
|
+ <th colspan="@{ from_kludge_ns('maxdepth') }@">Key</th>
|
||||||
|
<th>Returned</th>
|
||||||
|
<th width="100%">Description</th>
|
||||||
|
</tr>
|
||||||
|
@@ -338,7 +338,7 @@ Common return values are documented :ref:`here <common_return_values>`, the foll
|
||||||
|
{% for i in range(1, loop.depth) %}
|
||||||
|
<td class="elbow-placeholder"> </td>
|
||||||
|
{% endfor %}
|
||||||
|
- <td colspan="@{ ns.maxdepth - loop.depth0 }@">
|
||||||
|
+ <td colspan="@{ from_kludge_ns('maxdepth') - loop.depth0 }@">
|
||||||
|
<b>@{ key }@</b>
|
||||||
|
<br/><div style="font-size: small; color: red">@{ value.type }@</div>
|
||||||
|
</td>
|
||||||
|
--
|
||||||
|
2.14.4
|
||||||
|
|
||||||
BIN
ansible-2.5.5.tar.gz
Normal file
BIN
ansible-2.5.5.tar.gz
Normal file
Binary file not shown.
14
ansible-newer-jinja.patch
Normal file
14
ansible-newer-jinja.patch
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
diff -Nur ansible-2.4.1.0.orig/requirements.txt ansible-2.4.1.0/requirements.txt
|
||||||
|
--- ansible-2.4.1.0.orig/requirements.txt 2017-10-25 16:05:04.000000000 -0700
|
||||||
|
+++ ansible-2.4.1.0/requirements.txt 2017-10-30 14:41:31.202896847 -0700
|
||||||
|
@@ -3,8 +3,8 @@
|
||||||
|
# packages. Thus, this should be the loosest set possible (only required
|
||||||
|
# packages, not optional ones, and with the widest range of versions that could
|
||||||
|
# be suitable)
|
||||||
|
-jinja2
|
||||||
|
+jinja2 >= 2.6
|
||||||
|
PyYAML
|
||||||
|
paramiko
|
||||||
|
-cryptography
|
||||||
|
+pycrypto >= 2.6
|
||||||
|
setuptools
|
||||||
127
ansible.spec
Normal file
127
ansible.spec
Normal file
@ -0,0 +1,127 @@
|
|||||||
|
%global with_docs 0
|
||||||
|
%global with_python3 1
|
||||||
|
Name: ansible
|
||||||
|
Summary: SSH-based configuration management, deployment, and task execution system
|
||||||
|
Version: 2.5.5
|
||||||
|
Release: 1
|
||||||
|
License: Python-2.0 and MIT and GPL+
|
||||||
|
Url: http://ansible.com
|
||||||
|
Source0: https://releases.ansible.com/ansible/%{name}-%{version}.tar.gz
|
||||||
|
Patch0: 0001-Changes-to-support-building-docs-with-old-jinja2.patch
|
||||||
|
Patch100: ansible-newer-jinja.patch
|
||||||
|
BuildArch: noarch
|
||||||
|
Provides: ansible-fireball = %{version}-%{release}
|
||||||
|
Obsoletes: ansible-fireball < 1.2.4
|
||||||
|
BuildRequires: python3-jinja2 python3-devel python3-packaging python3-pyyaml
|
||||||
|
Requires: python3-PyYAML python3-crypto python3-paramiko python3-keyczar
|
||||||
|
Requires: python3-setuptools python3-six sshpass python3-httplib2
|
||||||
|
Requires: python3-jmespath python3-jinja2
|
||||||
|
Recommends: %{name}-help = %{version}-%{release}
|
||||||
|
%description
|
||||||
|
Ansible is a radically simple model-driven configuration management,
|
||||||
|
multi-node deployment, and remote task execution system. Ansible works
|
||||||
|
over SSH and does not require any software or daemons to be installed
|
||||||
|
on remote nodes. Extension modules can be written in any language and
|
||||||
|
are transferred to managed machines automatically.
|
||||||
|
%if 0%{?with_python3}
|
||||||
|
Provides: ansible-python3 = %{version}-%{release}
|
||||||
|
Obsoletes: ansible-python3 < %{version}-%{release}
|
||||||
|
BuildRequires: python3-devel python3-setuptools
|
||||||
|
BuildRequires: python3-PyYAML python3-paramiko python3-crypto python3-packaging
|
||||||
|
BuildRequires: python3-pexpect python3-winrm
|
||||||
|
BuildRequires: git-core
|
||||||
|
%if %with_docs
|
||||||
|
BuildRequires: python3-sphinx python3-sphinx-theme-alabaster asciidoc
|
||||||
|
%endif
|
||||||
|
BuildRequires: python3-six python3-nose python3-pytest python3-pytest-xdist
|
||||||
|
BuildRequires: python3-pytest-mock python3-requests python3-coverage python3-mock
|
||||||
|
BuildRequires: python3-boto3 python3-botocore python3-passlib python3-jinja2
|
||||||
|
Requires: python3-PyYAML python3-paramiko python3-crypto python3-setuptools python3-six
|
||||||
|
Requires: python3-jinja2 sshpass python3-jmespath
|
||||||
|
%description
|
||||||
|
Ansible is a radically simple model-driven configuration management,
|
||||||
|
multi-node deployment, and remote task execution system. Ansible works
|
||||||
|
over SSH and does not require any software or daemons to be installed
|
||||||
|
on remote nodes. Extension modules can be written in any language and
|
||||||
|
are transferred to managed machines automatically.
|
||||||
|
This package installs versions of ansible that execute on Python3.
|
||||||
|
%endif
|
||||||
|
|
||||||
|
%package -n ansible-help
|
||||||
|
Summary: Documentation for Ansible
|
||||||
|
Provides: %{name}-doc = %{name}-%{release}
|
||||||
|
Obsoletes: %{name}-doc < %{name}-%{release}
|
||||||
|
%description -n ansible-help
|
||||||
|
Ansible is a radically simple model-driven configuration management,
|
||||||
|
multi-node deployment, and remote task execution system. Ansible works
|
||||||
|
over SSH and does not require any software or daemons to be installed
|
||||||
|
on remote nodes. Extension modules can be written in any language and
|
||||||
|
are transferred to managed machines automatically.
|
||||||
|
This package installs extensive documentation for ansible
|
||||||
|
|
||||||
|
%prep
|
||||||
|
%setup -q
|
||||||
|
%patch0 -p1
|
||||||
|
%patch100 -p1
|
||||||
|
%if 0%{?with_python3}
|
||||||
|
rm -rf %{py3dir}
|
||||||
|
cp -a . %{py3dir}
|
||||||
|
%endif
|
||||||
|
|
||||||
|
%build
|
||||||
|
%if 0%{?with_python3}
|
||||||
|
pushd %{py3dir}
|
||||||
|
%py3_build
|
||||||
|
%if %with_docs
|
||||||
|
pathfix.py -i %{__python3} -p docs/bin test/runner
|
||||||
|
make PYTHON=/usr/bin/python3 SPHINXBUILD=sphinx-build-3 webdocs
|
||||||
|
%endif
|
||||||
|
popd
|
||||||
|
%endif
|
||||||
|
|
||||||
|
%install
|
||||||
|
%if 0%{?with_python3}
|
||||||
|
pushd %{py3dir}
|
||||||
|
%{__python3} setup.py install --root=$RPM_BUILD_ROOT
|
||||||
|
popd
|
||||||
|
for i in $RPM_BUILD_ROOT/%{_bindir}/ansible* ; do
|
||||||
|
if [ $(basename $i) = "ansible-connection" -o $(basename $i) = "ansible" ] ; then
|
||||||
|
ln -s $(basename $i) $i-%{python3_version}
|
||||||
|
ln -s %{_bindir}/$(basename $i)-%{python3_version} $i-3
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
%endif
|
||||||
|
mkdir -p $RPM_BUILD_ROOT/etc/ansible/
|
||||||
|
mkdir -p $RPM_BUILD_ROOT/etc/ansible/roles/
|
||||||
|
cp examples/hosts $RPM_BUILD_ROOT/etc/ansible/
|
||||||
|
cp examples/ansible.cfg $RPM_BUILD_ROOT/etc/ansible/
|
||||||
|
mkdir -p $RPM_BUILD_ROOT/%{_mandir}/man1
|
||||||
|
cp -v docs/man/man1/*.1 $RPM_BUILD_ROOT/%{_mandir}/man1/
|
||||||
|
cp -pr docs/docsite/rst .
|
||||||
|
%if %with_docs
|
||||||
|
pushd %{py3dir}
|
||||||
|
cp -pr docs/docsite/_build/html %{_builddir}/%{name}-%{version}/html
|
||||||
|
popd
|
||||||
|
%endif
|
||||||
|
|
||||||
|
%check
|
||||||
|
|
||||||
|
%files
|
||||||
|
%defattr(-,root,root)
|
||||||
|
%{_bindir}/ansible*
|
||||||
|
%config(noreplace) %{_sysconfdir}/ansible/
|
||||||
|
%doc README.rst PKG-INFO COPYING changelogs/CHANGELOG-v2.5.rst
|
||||||
|
%doc %{_mandir}/man1/ansible*
|
||||||
|
%if 0%{?with_python3}
|
||||||
|
%{python3_sitelib}/ansible*
|
||||||
|
%endif
|
||||||
|
|
||||||
|
%files -n ansible-help
|
||||||
|
%doc rst
|
||||||
|
%if %with_docs
|
||||||
|
%doc html
|
||||||
|
%endif
|
||||||
|
|
||||||
|
%changelog
|
||||||
|
* Tue Jan 12 2021 yanan li <liyanan32@huawei.com> - 2.5.5-1
|
||||||
|
- Package init
|
||||||
4
ansible.yaml
Normal file
4
ansible.yaml
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
version_control: NA
|
||||||
|
src_repo: NA
|
||||||
|
tag_prefix: NA
|
||||||
|
separator: NA
|
||||||
Loading…
x
Reference in New Issue
Block a user