Reformat PTL columns to be one column
[docs.git] / docs / generate-milestone-status.sh
1 #!/bin/bash
2 # @License EPL-1.0 <http://spdx.org/licenses/EPL-1.0>
3 ##############################################################################
4 # Copyright (c) 2017 The Linux Foundation and others.
5 #
6 # All rights reserved. This program and the accompanying materials
7 # are made available under the terms of the Eclipse Public License v1.0
8 # which accompanies this distribution, and is available at
9 # http://www.eclipse.org/legal/epl-v10.html
10 ##############################################################################
11
12 MILESTONE_STATUS_DIR="release-process/milestone-readouts/status"
13 mkdir -p "$MILESTONE_STATUS_DIR"
14
15 trim_trailing_whitespace() {
16     sed -e 's/[[:space:]]*$//'
17 }
18
19 trim_leading_and_trailing_whitespace() {
20     sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//'
21 }
22
23 {
24     echo "Milestone 0 Status"
25     echo "=================="
26     echo
27     echo ".. list-table:: Milestone 0 Status"
28     echo "   :widths: auto"
29     echo "   :header-rows: 1"
30     echo
31     echo "   * - Project ID"
32     echo "     - Offset"
33     echo "     - Category"
34     echo "     - Labels"
35     echo "     - Project Technical Lead"
36     echo "     - Committers Updated"
37
38     files=($(find release-process/milestone-readouts/m0 -type f | sort))
39     for f in ${files[@]}; do
40         project="$(basename $f | awk -F. '{print $1}')"
41         offset=$(grep 'Project Offset:' "$f" | awk -F: '{print $2}' | trim_leading_and_trailing_whitespace)
42         category=$(grep 'Project Category:' "$f" | awk -F: '{print $2}' | trim_leading_and_trailing_whitespace)
43         labels=$(grep 'Project Labels:' "$f" | awk -F: '{print $2}' | trim_leading_and_trailing_whitespace)
44         ptl=$(grep 'Project PTL:' "$f" | awk -F: '{print $2}' | trim_leading_and_trailing_whitespace)
45         ptl_name=$(echo $ptl | awk -F, '{print $1}' | trim_leading_and_trailing_whitespace)
46         ptl_email=$(echo $ptl | awk -F, '{print $2}' | trim_leading_and_trailing_whitespace)
47         ptl_irc=$(echo $ptl | awk -F, '{print $3}' | trim_leading_and_trailing_whitespace)
48         updated_committers=$(grep 'Project Committers is updated and accurate?' "$f" \
49             | awk -F'?' '{print $2}' | trim_leading_and_trailing_whitespace)
50
51         echo "   * - $project" | trim_trailing_whitespace
52         echo "     - $offset" | trim_trailing_whitespace
53         echo "     - $category" | trim_trailing_whitespace
54         echo "     - $labels" | trim_trailing_whitespace
55         echo "     - :name: $ptl_name" | trim_trailing_whitespace
56         echo "       :email: $ptl_email" | trim_trailing_whitespace
57         echo "       :irc: $ptl_irc" | trim_trailing_whitespace
58         echo "     - $updated_committers" | trim_trailing_whitespace
59     done
60 } > "$MILESTONE_STATUS_DIR/m0.rst"