From f6a39501796c954a1adff013257c102230a16d44 Mon Sep 17 00:00:00 2001 From: Stephen Finucane Date: Tue, 25 Sep 2018 16:07:10 +0100 Subject: [PATCH] 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 --- .../source/rst-conv/profiling.rst | 63 ++------------ .../source/rst-conv/rst2bash.rst | 10 --- tools/split_platforms.py | 85 ------------------- tools/split_platforms.sh | 36 -------- 4 files changed, 8 insertions(+), 186 deletions(-) delete mode 100644 tools/split_platforms.py delete mode 100755 tools/split_platforms.sh diff --git a/doc/doc-contrib-guide/source/rst-conv/profiling.rst b/doc/doc-contrib-guide/source/rst-conv/profiling.rst index 436791466a..e5fa8d72ad 100644 --- a/doc/doc-contrib-guide/source/rst-conv/profiling.rst +++ b/doc/doc-contrib-guide/source/rst-conv/profiling.rst @@ -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 -`_. + Previously, ``.. only`` directives were used to generate conditional output. + This required multiple builds and has since been phased out. diff --git a/doc/doc-contrib-guide/source/rst-conv/rst2bash.rst b/doc/doc-contrib-guide/source/rst-conv/rst2bash.rst index 739326940c..f485f52d1d 100644 --- a/doc/doc-contrib-guide/source/rst-conv/rst2bash.rst +++ b/doc/doc-contrib-guide/source/rst-conv/rst2bash.rst @@ -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 diff --git a/tools/split_platforms.py b/tools/split_platforms.py deleted file mode 100644 index cc84b58326..0000000000 --- a/tools/split_platforms.py +++ /dev/null @@ -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) diff --git a/tools/split_platforms.sh b/tools/split_platforms.sh deleted file mode 100755 index f225b1ee0c..0000000000 --- a/tools/split_platforms.sh +++ /dev/null @@ -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