~ubuntu-langpack/langpack-o-matic/main

487 by Martin Pitt
add script to fetch ubuntu touch upstream translations and update language-pack-touch-* with them
1
#!/bin/sh
2
set -eu
3
4
PROJECTS="
509 by Martin Pitt
merge-touch-upstream-translations: pull translations from libusermetrics
5
libusermetrics
487 by Martin Pitt
add script to fetch ubuntu touch upstream translations and update language-pack-touch-* with them
6
"
7
8
[ -d "${1:-}" ] || {
9
    echo "Usage: $0 <sources-touch dir>" >&2
10
    exit 1
11
}
12
13
SOURCEDIR="$1"
14
15
WORKDIR=$(mktemp -d --tmpdir langpack-o-matic.fetch.XXXX)
16
trap "rm -rf $WORKDIR" EXIT TERM INT QUIT PIPE
17
18
for project in $PROJECTS; do
19
    echo "== fetching $project =="
20
    bzr checkout --lightweight lp:$project $WORKDIR/$project
21
done
22
23
changed=""
24
25
for potfile in $WORKDIR/*/po/*.pot; do
26
    podir=${potfile%/*}
27
    domain=${potfile##*/}
28
    domain=${domain%.pot}
29
    echo "== installing domain $domain =="
30
    for pack_locale_dir in $SOURCEDIR/language-pack-touch*/data/*; do
31
        pack_locale=${pack_locale_dir##*/}
32
        src=$podir/${pack_locale}.po
33
        if [ -e "$src" ]; then
34
            dest=$pack_locale_dir/LC_MESSAGES/${domain}.po
35
            changed="$changed\n$(dirname $(dirname $pack_locale_dir))"
36
            echo "  $dest"
37
            cp "$src" "$dest"
38
        fi
39
    done
40
done
41
42
changed=$(/bin/echo -e "$changed" | sort -u)
43
493 by Martin Pitt
merge-touch-upstream-translations: skip debian changelog updating with $NO_CHANGELOG
44
[ -z "$NO_CHANGELOG" ] || exit 0
45
487 by Martin Pitt
add script to fetch ubuntu touch upstream translations and update language-pack-touch-* with them
46
# adjust changelogs and build updated packages
47
cwd=`pwd`
48
for pkg in $changed; do
49
    cd $pkg
50
    v=$(dpkg-parsechangelog --show-field Version)
491 by Martin Pitt
merge-touch-upstream-translations: fix debian version number if there is already a .N suffix
51
    if [ "${v%.[0-9]}" != "$v" ]; then
52
        dch -iU 'Update translations from Ubuntu Touch trunks'
53
    else
54
        dch -v ${v}.1 'Update translations from Ubuntu Touch trunks'
55
    fi
487 by Martin Pitt
add script to fetch ubuntu touch upstream translations and update language-pack-touch-* with them
56
    dch -rm ''
57
    dpkg-buildpackage -S
58
    cd $cwd
59
done