This file is indexed.

/usr/bin/python2-doc-tools-build-rst is in python-openstack-doc-tools 0.34.0-2.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
#!/bin/bash -e
#
# 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.

DIRECTORY=$1

if [ -z "$DIRECTORY" ] ; then
    echo "usage $0 DIRECTORY options"
    echo "Options are:"
    echo "--glossary: Build glossary"
    echo "--tag TAG: Use given tag for building"
    echo "--target TARGET: Copy files to publish-docs/$TARGET"
    echo "--build BUILD: Name of build directory"
    echo "--linkcheck: Check validity of links instead of building"
    exit 1
fi

GLOSSARY=0
TARGET=""
TAG=""
TAG_OPT=""
BUILD=""
LINKCHECK=""

while [[ $# > 0 ]] ; do
    option="$1"
    case $option in
        --build)
            BUILD="$2"
            shift
            ;;
        --linkcheck)
            LINKCHECK=1
            ;;
        --glossary)
            GLOSSARY=1
            ;;
        --tag)
            TAG="$2"
            TAG_OPT="-t $2"
            shift
            ;;
        --target)
            TARGET="$2"
            shift
            ;;
    esac
    shift
done


if [ "$GLOSSARY" -eq "1" ] ; then
    echo "Generating Glossary"
    # Use "common" directory as common if exists while migration
    if [[ -e doc/common/conventions.rst ]] ; then
        COMMON="common"
    else
        COMMON="common-rst"
    fi
    tools/glossary2rst.py doc/${COMMON}/glossary.rst
fi

if [ -z "$BUILD" ] ; then
    if [ -z "$TAG" ] ; then
        BUILD_DIR="$DIRECTORY/build/html"
    else
        BUILD_DIR="$DIRECTORY/build-${TAG}/html"
    fi
else
    BUILD_DIR="$DIRECTORY/$BUILD/html"
fi

DOCTREES="${BUILD_DIR}.doctrees"

if [ -z "$TAG" ] ; then
    echo "Checking $DIRECTORY..."
else
    echo "Checking $DIRECTORY with tag $TAG..."
fi

if [ "$LINKCHECK" = "1" ] ; then
    # Show sphinx-build invocation for easy reproduction
    set -x
    sphinx-build -E -W -d $DOCTREES -b linkcheck \
        $TAG_OPT $DIRECTORY/source $BUILD_DIR
    set +x
else
    # Show sphinx-build invocation for easy reproduction
    set -x
    sphinx-build -E -W -d $DOCTREES -b html \
        $TAG_OPT $DIRECTORY/source $BUILD_DIR
    set +x

    # Copy RST
    if [ "$TARGET" != "" ] ; then
        mkdir -p publish-docs/$TARGET
        rsync -a $BUILD_DIR/ publish-docs/$TARGET/
        # Remove unneeded build artefact
        rm -f publish-docs/$TARGET/.buildinfo
    fi
fi