]> git.deb.at Git - deb/packages.git/blob - bin/extract_changelogs
Update .pot files and merge to .po files
[deb/packages.git] / bin / extract_changelogs
1 #!/bin/bash
2
3 . `dirname $0`/../config.sh
4  
5 if test -z "${localdir}"; then
6     echo skipping due to missing local archive
7     exit 1
8 fi
9
10 #set -e
11
12 NOCPY_TEMPLATE=$topdir/etc/copyright_error
13 NOCPY_BIN_TEMPLATE=$topdir/etc/copyright_error_bin
14
15 logs="$topdir/files/logs"
16 log="${logs}/changelogs.log"
17
18 test -d "$logs" || mkdir -p "$logs"
19 test -d "$tmpdir" || mkdir -p "$tmpdir"
20
21 if [ -s "$log" ]
22 then
23     savelog -c 14 "$log" > /dev/null
24 fi
25
26 (
27 date
28
29 successful=1
30 for part in $parts; do
31     time "${bindir}/extract_files" -v -d "${localdir}/pool/$part/" \
32         -t "${htmldir}/changelogs/pool/$part/" \
33         -c "$configdir" -w "$tmpdir" \
34         --dumpfile "${filesdir}/changelogs.$part.dump" \
35         --cachefile "${filesdir}/changelogs.cache" --debug
36     if [ $? -ne 0 ]; then
37         echo program exited with non-zero exitcode: $? >&2
38         successful=0
39     fi
40 done
41
42 if [ "$successful" -eq 1 ]; then
43     find -H "${htmldir}/changelogs/" -name log -cmin +14440 \
44      | while read logfile; do
45         dir=$(dirname "$logfile")
46         echo deleting $dir
47         rm -r "$dir"
48         rmdir --ignore-fail-on-non-empty $(dirname "$dir")
49     done
50     cdir=$(pwd)
51     find -H "${htmldir}/changelogs/" -name current -not -xtype d \
52      | while read link; do
53         dir=$(dirname "$link")
54         echo repairing current link $link
55         rm -v "$link"
56         target=$(ls -t1 "$dir" | tail -n1)
57         if [ -n "$target" ]; then
58                 cd $dir && ln -sv $target current
59                 cd $cdir
60         else
61                 rmdir -v $dir
62         fi
63     done
64
65 else
66     echo clean-up skipped because at least one of the extraction runs failed >&2
67 fi
68 date
69 ) > $log 2>&1