Clint Adams | 4fd874b | 2016-01-19 18:17:49 -0500 | [diff] [blame^] | 1 | #!/bin/bash -ex |
| 2 | |
| 3 | # Copyright 2016 Hewlett Packard Enterprise Development Company, L.P. |
| 4 | # |
| 5 | # Licensed under the Apache License, Version 2.0 (the "License"); you may |
| 6 | # not use this file except in compliance with the License. You may obtain |
| 7 | # a copy of the License at |
| 8 | # |
| 9 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | # |
| 11 | # Unless required by applicable law or agreed to in writing, software |
| 12 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| 13 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| 14 | # License for the specific language governing permissions and limitations |
| 15 | # under the License. |
| 16 | |
| 17 | # This script is intended to be run as a periodic proposal bot job |
| 18 | # in OpenStack infrastructure, though you can run it as a one-off. |
| 19 | # |
| 20 | # In order to function correctly, the environment in which the |
| 21 | # script runs must have |
| 22 | # * git |
| 23 | # * all git repos meant to be searched for plugins cloned and |
| 24 | # at the desired level of up-to-datedness |
| 25 | # * a writable doc/source directory relative to the current |
| 26 | # working directory |
| 27 | # |
| 28 | # If a file named data/devstack-plugins-registry.header or |
| 29 | # data/devstack-plugins-registry.footer is found relative to the |
| 30 | # current working directory, it will be prepended or appended to |
| 31 | # the generated reStructuredText plugins table respectively. |
| 32 | |
| 33 | ( |
| 34 | declare -A plugins |
| 35 | |
| 36 | test -r data/devstack-plugins-registry.header && cat data/devstack-plugins-registry.header |
| 37 | |
| 38 | pushd ${git_dir:-/opt/openstack} >/dev/null |
| 39 | for i in *; do |
| 40 | pushd ${i} >/dev/null |
| 41 | if output="$(git log --diff-filter=A --format='%cd' --date=short -1 -- devstack/plugin.sh)"; then |
| 42 | test -n "$output" && plugins[$i]=${output} |
| 43 | fi |
| 44 | popd >/dev/null |
| 45 | done |
| 46 | popd >/dev/null |
| 47 | |
| 48 | sorted_plugins=( $(for k in "${!plugins[@]}"; do echo "$k"; done | sort)) |
| 49 | |
| 50 | for k in "${sorted_plugins[@]}"; do |
| 51 | project=${k:0:18} |
| 52 | giturl="git://git.openstack.org/openstack/${k:0:26}" |
| 53 | pdate="${plugins[$k]}" |
| 54 | printf "|%-18s|%-60s|%-12s|\n" "${project}" "${giturl}" "${pdate}" |
| 55 | printf "+------------------+------------------------------------------------------------+------------+\n" |
| 56 | done |
| 57 | |
| 58 | test -r data/devstack-plugins-registry.footer && cat data/devstack-plugins-registry.footer |
| 59 | ) > doc/source/plugin-registry.rst |