Remove remnants of conditional build infrastructure

We no longer build multiple conditional builds. Remove all the tooling
that enabled this along with references to said tooling.

Change-Id: Iea75f686797ab379c235ddbfb2f881b3f6376814
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
This commit is contained in:
Stephen Finucane 2018-09-25 16:07:10 +01:00
parent 2250b193e4
commit f6a3950179
4 changed files with 8 additions and 186 deletions

View File

@ -1,15 +1,13 @@
===============================
Profiling (conditional content)
===============================
=========
Profiling
=========
Installation Guides has content that depends upon the operating
systems.
Use the ``only`` directive to specify the content that is operating-system
specific. Define one or several tags depending on the operating system
the content belongs to. Make sure to close the ``only`` tag with ``endonly``.
The valid tags for the ``only`` directive are:
Use separate files to specify content that is operating-system specific. Each
file should have the same name but for an addition suffix. The following
suffixes should be used:
* ``ubuntu`` for Ubuntu
* ``debian`` for Debian
@ -18,50 +16,5 @@ The valid tags for the ``only`` directive are:
.. note::
The ``endonly`` tag allows the parser to identify the distro-specific blocks.
For more information, refer to the :doc:`rst2bash` section. These
changes are mandatory only for the installation guides.
**Input**
.. code-block:: none
Install the NTP service
-----------------------
.. only:: ubuntu or debian
.. code-block:: console
# apt-get install chrony
.. endonly
.. only:: rdo
.. code-block:: console
# yum install chrony
.. endonly
.. only:: obs
On openSUSE:
.. code-block:: console
# zypper addrepo http://download.opensuse.org/repositories/network:time/openSUSE_13.2/network:time.repo
...
On SLES:
.. code-block:: console
# zypper addrepo http://download.opensuse.org/repositories/network:time/SLE_12/network:time.repo
...
.. endonly
For more details refer to `Including content based on tags
<http://sphinx.readthedocs.org/en/latest/markup/misc.html?highlight=only%20directive#including-content-based-on-tags>`_.
Previously, ``.. only`` directives were used to generate conditional output.
This required multiple builds and has since been phased out.

View File

@ -53,13 +53,3 @@ syntax format.
[DEFAULT]
...
debug = True
* The ``only`` tags should be closed with ``endonly``.
.. code-block:: rst
.. only:: ubuntu or debian
All related content.
.. endonly

View File

@ -1,85 +0,0 @@
#!/usr/bin/env python3
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
import argparse
import os
def do_one(base, out_dir, filename, tag):
outname = filename[:-4] + '-' + tag + '.rst'
print(outname, tag)
inside_only = None
prefix_len = None
output = []
num_only_blocks = 0
with open(filename, 'r', encoding='utf-8') as inf:
for line in inf:
if '.. only::' in line:
print(line.rstrip())
inside_only = line
num_only_blocks += 1
prefix_len = None
continue
elif '.. endonly' in line:
inside_only = None
prefix_len = None
continue
elif inside_only:
if line.lstrip() == line and line.strip():
# The line has content and is flush left, so the
# existing inside block was not closed with the
# comment.
inside_only = None
prefix_len = None
print('copying %r' % line)
output.append(line)
elif tag in inside_only:
if not line.strip():
# blank line, include it but do not use it to find
# the prefix len
output.append('\n')
continue
if prefix_len is None:
# Determine how much this block is indented.
prefix_len = len(line) - len(line.lstrip())
print('prefix length:', prefix_len)
output.append(line[prefix_len:])
print('ONLY:', repr(line[prefix_len:]))
else:
print('IGNORE:', repr(line))
else:
print('copying %r' % line)
output.append(line)
if inside_only:
raise RuntimeError('unclosed only block in %s' % filename)
if num_only_blocks:
with open(outname, 'w', encoding='utf-8') as outf:
outf.writelines(output)
parser = argparse.ArgumentParser()
parser.add_argument('base')
parser.add_argument('outdir')
parser.add_argument('tag', nargs='+')
args = parser.parse_args()
base = args.base.rstrip('/') + '/'
for dir_name, sub_dirs, files in os.walk(base):
for f in files:
if not f.endswith('.rst'):
continue
for tag in args.tag:
do_one(base, args.outdir, os.path.join(dir_name, f), tag)

View File

@ -1,36 +0,0 @@
#!/bin/bash
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
toolsdir=$(dirname $0)
install_guide=doc/install-guide/source
python3 $toolsdir/split_platforms.py doc/install-guide/source doc/install-guide \
rdo obs ubuntu debian
# $ git grep 'only::' | cut -f2- -d: | sed 's/.*:: //g' | sort -ur
# ubuntu or debian
# ubuntu
# rdo or ubuntu or debian or obs
# rdo or ubuntu or debian
# rdo or ubuntu
# rdo or obs or ubuntu
# rdo or obs
# rdo or debian or obs
# rdo
# obs or ubuntu
# obs or rdo or ubuntu
# obs or rdo
# obs or debian
# obs
# debian or ubuntu
# debian