X-Git-Url: https://git.deb.at/?p=deb%2Fpackages.git;a=blobdiff_plain;f=bin%2Fextract_changelogs;h=9a85a7dc51e8f41f6f28aead28fd549b1fa48381;hp=08be087d36fadde7f5a6cbbf05e7c702a4374e07;hb=HEAD;hpb=e869cc49fe3143487be56136b0b25904ac2ee154 diff --git a/bin/extract_changelogs b/bin/extract_changelogs index 08be087..9a85a7d 100755 --- a/bin/extract_changelogs +++ b/bin/extract_changelogs @@ -26,21 +26,44 @@ fi ( date +successful=1 for part in $parts; do time "${bindir}/extract_files" -v -d "${localdir}/pool/$part/" \ -t "${htmldir}/changelogs/pool/$part/" \ -c "$configdir" -w "$tmpdir" \ --dumpfile "${filesdir}/changelogs.$part.dump" \ - --cachefile "${filesdir}/changelogs.cache" + --cachefile "${filesdir}/changelogs.cache" --debug + if [ $? -ne 0 ]; then + echo program exited with non-zero exitcode: $? >&2 + successful=0 + fi done -find "${htmldir}/changelogs/" -name log -cmin +7200 \ - | while read logfile; do - dir=$(dirname "$logfile") +if [ "$successful" -eq 1 ]; then + find -H "${htmldir}/changelogs/" -name log -cmin +14440 \ + | while read logfile; do + dir=$(dirname "$logfile") echo deleting $dir rm -r "$dir" rmdir --ignore-fail-on-non-empty $(dirname "$dir") -done + done + cdir=$(pwd) + find -H "${htmldir}/changelogs/" -name current -not -xtype d \ + | while read link; do + dir=$(dirname "$link") + echo repairing current link $link + rm -v "$link" + target=$(ls -t1 "$dir" | tail -n1) + if [ -n "$target" ]; then + cd $dir && ln -sv $target current + cd $cdir + else + rmdir -v $dir + fi + done +else + echo clean-up skipped because at least one of the extraction runs failed >&2 +fi date ) > $log 2>&1