Merge "Add P4Plugin M1 Oxygen Status"
[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 "     - PTL Name"
36     echo "     - PTL Email"
37     echo "     - PTL IRC"
38     echo "     - Committers Updated"
39
40     files=($(find release-process/milestone-readouts/m0 -type f | sort))
41     for f in ${files[@]}; do
42         project="$(basename $f | awk -F. '{print $1}')"
43         offset=$(grep 'Project Offset:' "$f" | awk -F: '{print $2}' | trim_leading_and_trailing_whitespace)
44         category=$(grep 'Project Category:' "$f" | awk -F: '{print $2}' | trim_leading_and_trailing_whitespace)
45         labels=$(grep 'Project Labels:' "$f" | awk -F: '{print $2}' | trim_leading_and_trailing_whitespace)
46         ptl=$(grep 'Project PTL:' "$f" | awk -F: '{print $2}' | trim_leading_and_trailing_whitespace)
47         ptl_name=$(echo $ptl | awk -F, '{print $1}' | trim_leading_and_trailing_whitespace)
48         ptl_email=$(echo $ptl | awk -F, '{print $2}' | trim_leading_and_trailing_whitespace)
49         ptl_irc=$(echo $ptl | awk -F, '{print $3}' | trim_leading_and_trailing_whitespace)
50         updated_committers=$(grep 'Project Committers is updated and accurate?' "$f" \
51             | awk -F'?' '{print $2}' | trim_leading_and_trailing_whitespace)
52
53         echo "   * - $project" | trim_trailing_whitespace
54         echo "     - $offset" | trim_trailing_whitespace
55         echo "     - $category" | trim_trailing_whitespace
56         echo "     - $labels" | trim_trailing_whitespace
57         echo "     - $ptl_name" | trim_trailing_whitespace
58         echo "     - $ptl_email" | trim_trailing_whitespace
59         echo "     - $ptl_irc" | trim_trailing_whitespace
60         echo "     - $updated_committers" | trim_trailing_whitespace
61     done
62 } > "$MILESTONE_STATUS_DIR/m0.rst"