File: precommit-testvoc.sh

package info (click to toggle)
apertium-swe-nor 0.4.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, sid, trixie
  • size: 59,792 kB
  • sloc: xml: 828; sh: 711; makefile: 378; awk: 250; python: 108
file content (40 lines) | stat: -rwxr-xr-x 1,243 bytes parent folder | download | duplicates (3)
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
#!/bin/bash

set -u

lang1=swe
lang2="$1"

basename=apertium-$lang1-nor

vc=svn
if [[ -d "$(dirname "$0")"/../.git ]]; then
    vc=git
fi

cd "$(dirname $0)/.."

make -j4 langs

echo "Translating changes from $vc diff:"

declare -i e=0

eval $(grep ^AP_SRC config.log)

$vc diff $AP_SRC1/apertium-$lang1.$lang1.dix | awk -F'lm="|"' '$2{print $2}' | apertium -d . $lang1-$lang2 | grep '[#@/]' && (( e++ ))
case "${lang2}" in
    nno) AP_SRC2=$AP_SRC2n;;
    nob) AP_SRC2=$AP_SRC2b;;
    *) echo pass either nob or nno as arg 1 &>2; exit 1;;
esac
$vc diff $AP_SRC2/apertium-$lang2.$lang2.dix | awk -F'lm="|"' '$2{print $2}' | apertium -d . $lang2-$lang1 | grep '[#@/]' && (( e++ ))
$vc diff $basename.$lang1-nor.dix | awk -F'<l>|</l>' '{gsub(/<s [^>]*>/,"")} $2{print $2}' | apertium -d . $lang1-$lang2 | grep '[#@/]' && (( e++ ))
$vc diff $basename.$lang1-nor.dix | awk -F"<r>|</r>" '{gsub(/<s [^>]*>/,"")} $2{print $2}' | apertium -d . $lang2-$lang1 | grep '[#@/]' && (( e++ ))


if [[ $e -eq 0 ]]; then
    echo "Uncommitted changes to $lang1.dix, $lang2.dix and $lang1-nor.dix appear testvoc clean; go ahead and commit."
else
    echo "Uh-oh, there appear to be inconsistencies in your uncommitted changes. Please fix before committing."
fi