| 1 | #!/bin/bashscip-shell filesystem . . `/bin/bash`. |
| 2 | # |
| 3 | # Authors: |
| 4 | # Pavel Březina <[email protected]> |
| 5 | # |
| 6 | # Copyright (C) 2020 Red Hat |
| 7 | # |
| 8 | # This program is free software; you can redistribute it and/or modify |
| 9 | # it under the terms of the GNU General Public License as published by |
| 10 | # the Free Software Foundation; either version 3 of the License, or |
| 11 | # (at your option) any later version. |
| 12 | # |
| 13 | # This program is distributed in the hope that it will be useful, |
| 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 | # GNU General Public License for more details. |
| 17 | # |
| 18 | # You should have received a copy of the GNU General Public License |
| 19 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 20 | # |
| 21 | # |
| 22 | # Update pot files. |
| 23 | # |
| 24 | # Usage: update-pot.sh |
| 25 | # |
| 26 | |
| 27 | if [scip-shell system . . `[`. ! -f "rpm/authselect.spec.in" ]; then |
| 28 | echoscip-shell system . . echo. "Make sure you are in authselect root directory." |
| 29 | exit 1 |
| 30 | fi |
| 31 | |
| 32 | gitscip-shell system . . git. diff-index --quiet HEAD -- &> /dev/nullscip-shell filesystem . . `/dev/null`. |
| 33 | if [scip-shell system . . `[`. $? -ne 0 ]; then |
| 34 | echoscip-shell system . . echo. "Please commit all changes first." |
| 35 | exit 1 |
| 36 | fi |
| 37 | |
| 38 | # Update C pot file |
| 39 | makescip-shell system . . make. distclean &> /dev/nullscip-shell filesystem . . `/dev/null`. |
| 40 | ./configure |
| 41 | |
| 42 | makescip-shell system . . make. -C "po" update-po &> /dev/nullscip-shell filesystem . . `/dev/null`. |
| 43 | if [scip-shell system . . `[`. $? -ne 0 ]; then |
| 44 | echoscip-shell system . . echo. 'Unable to run: make -C "po" update-po' |
| 45 | exit 1 |
| 46 | fi |
| 47 | |
| 48 | # Update man pages pot files |
| 49 | DIR="./src/man" |
| 50 | for file in $DIR/*.adoc; do |
| 51 | name=`basenamescip-shell system . . basename. $file` |
| 52 | po4a-updatepo -f asciidoc -m $file -p "$DIR/po/$name.pot" > /dev/nullscip-shell filesystem . . `/dev/null`. |
| 53 | if [scip-shell system . . `[`. $? -ne 0 ]; then |
| 54 | exit 1 |
| 55 | fi |
| 56 | done |
| 57 | |
| 58 | # Exclude changes in po files |
| 59 | gitscip-shell system . . git. checkout po/*.po |
| 60 | |
| 61 | # Commit changes |
| 62 | gitscip-shell system . . git. commit -a -m "pot: update pot files" |
| 63 | |
| 64 | # Cleanup |
| 65 | makescip-shell system . . make. distclean &> /dev/nullscip-shell filesystem . . `/dev/null`. |