2010-09-07 23:03:19 +03:00
|
|
|
#!/bin/bash
|
|
|
|
#
|
|
|
|
# schhist2web - Web-browseable graphical revision history of schematics
|
|
|
|
#
|
2012-05-11 07:45:07 +03:00
|
|
|
# Written 2010, 2012 by Werner Almesberger
|
|
|
|
# Copyright 2010, 2012 Werner Almesberger
|
2010-09-07 23:03:19 +03:00
|
|
|
#
|
|
|
|
# This program is free software; you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation; either version 2 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
|
|
|
|
|
|
|
|
|
|
|
OUTDIR=_out
|
|
|
|
THUMB_OPTS="-w 3 -d 60 -c 0.5,0.5,0.5 -n 1,1,0"
|
|
|
|
BG_COLOR="f0f0ff"
|
|
|
|
FNAME_COLOR="#b0f0ff"
|
|
|
|
SEP_COLOR="#000000"
|
2012-05-11 07:45:07 +03:00
|
|
|
CUTOFF=300
|
2010-09-07 23:03:19 +03:00
|
|
|
|
|
|
|
|
|
|
|
shrink()
|
|
|
|
{
|
|
|
|
pnmscale -width 120 "$@" || exit
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
pngdiff()
|
|
|
|
{
|
|
|
|
# pngdiff preproc outfile arg ...
|
|
|
|
pp="$1"
|
|
|
|
of="$2"
|
|
|
|
shift 2
|
|
|
|
if ! PATH=$PATH:`dirname $0`/ppmdiff ppmdiff "$@" "$out/_tmp"; then
|
|
|
|
rm -f "$out/_tmp"
|
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
$pp "$out/_tmp" | pnmtopng >"$of"
|
|
|
|
rm "$out/_tmp"
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
symlink()
|
|
|
|
{
|
|
|
|
local old=$1 new=$2
|
|
|
|
local src=`dirname "$new"`/$old
|
|
|
|
|
|
|
|
if [ -L "$src" ]; then
|
|
|
|
ln -sf "`readlink \"$src\"`" "$new"
|
|
|
|
else
|
|
|
|
ln -sf "$old" "$new"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
commit_entry()
|
|
|
|
{
|
|
|
|
# usage: commit_entry <base-dir> <commit>
|
|
|
|
# note: the repository's base in $dir must be provided by the caller
|
|
|
|
|
|
|
|
local dir=$1 next=$2
|
|
|
|
|
|
|
|
cat <<EOF
|
|
|
|
<TABLE bgcolor="$SEP_COLOR" cellspacing=0 width="100%"><TR><TD></TABLE>
|
|
|
|
EOF
|
|
|
|
echo "<PRE>"
|
|
|
|
( cd "$dir" && git show \
|
2010-10-12 11:50:47 +03:00
|
|
|
--pretty=format:"%aN <%aE>%n %ad%n%n %s" \
|
2012-12-05 05:41:40 +02:00
|
|
|
--quiet $next; ) | sed '/^diff /Q' |
|
|
|
|
sed '/\(.\{'$CUTOFF'\}\).*/s//\1.../' |
|
2010-09-07 23:03:19 +03:00
|
|
|
sed 's/&/&/g;s/</\</g;s/>/\>/g' |
|
|
|
|
if [ -z "$SCHHIST_COMMIT_TEMPLATE" ]; then
|
|
|
|
cat
|
|
|
|
else
|
|
|
|
url=`echo "$SCHHIST_COMMIT_TEMPLATE" | sed "s/{}/$next/g"`
|
|
|
|
sed "1s|^|<A href=\"$url\"><B>\>\>\></B></a> |"
|
|
|
|
fi
|
|
|
|
echo "</PRE>"
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
wrapped_png()
|
|
|
|
{
|
|
|
|
local dir=$1 commit=$2 file=$3
|
|
|
|
|
|
|
|
mkdir -p "$dir/$commit/html"
|
|
|
|
echo "<A href=\"$commit/html/$file.html\"><IMG src=\"$commit/thumb/$file.png\"></A>"
|
|
|
|
cat <<EOF >"$dir/$commit/html/$file.html"
|
|
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
|
|
<HTML>
|
|
|
|
<TITLE>$file</TITLE>
|
|
|
|
<BODY>
|
|
|
|
<A href="../pdf/$file.pdf"><IMG src="../diff/$file.png"></A>
|
|
|
|
</BODY>
|
|
|
|
EOF
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-05-11 08:47:18 +03:00
|
|
|
#
|
|
|
|
# Add extra : for :name: and :name= because they consume the leading : while
|
|
|
|
# =name: and =name= don't and would therefore be placed one position later.
|
|
|
|
#
|
2010-09-22 16:14:38 +03:00
|
|
|
ordered_names()
|
|
|
|
{
|
|
|
|
ls -1 "$out/names" | (
|
|
|
|
while read n; do
|
2012-05-11 08:47:18 +03:00
|
|
|
if [ "${order%%:$n=*}" != "$order" ]; then
|
|
|
|
echo "${order%%:$n=*}":
|
|
|
|
elif [ "${order%%=$n:*}" != "$order" ]; then
|
|
|
|
echo "${order%%=$n:*}"
|
|
|
|
elif [ "${order%%=$n=*}" != "$order" ]; then
|
2012-05-11 09:18:33 +03:00
|
|
|
echo "${order%%=$n=*}"
|
2012-05-11 08:47:18 +03:00
|
|
|
else
|
|
|
|
echo "${order%%:$n:*}":
|
|
|
|
fi | tr -cd : | wc -c | tr '\n' ' '
|
2010-09-22 16:14:38 +03:00
|
|
|
echo "$n"
|
|
|
|
done; ) |
|
|
|
|
sort -n -s | sed 's/^[^ ]* //'
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-09-07 23:03:19 +03:00
|
|
|
usage()
|
|
|
|
{
|
|
|
|
cat <<EOF 2>&1
|
2010-10-06 09:35:46 +03:00
|
|
|
usage: $0 [options] [top-dir] [top-schem] [out-dir]
|
2010-09-07 23:03:19 +03:00
|
|
|
|
|
|
|
top-dir top-level directory of the git archive (default: locate it)
|
|
|
|
top-schem root sheet of the schematics (default: locate it in top-dir)
|
|
|
|
out-dir output directory (default: $OUTDIR)
|
|
|
|
-c cache-dir cache directory (default: same as out-dir)
|
2010-09-22 15:36:00 +03:00
|
|
|
-f identify sheets by their file name, not the sheet name
|
2010-09-07 23:03:19 +03:00
|
|
|
-n don't use previous cache content (rebuild the cache)
|
2010-10-06 09:35:46 +03:00
|
|
|
-D debug mode: make temporary work trees unique and keep them
|
2010-10-01 13:50:47 +03:00
|
|
|
-S sanitize KiCad profile and top-level sheet
|
2010-10-06 09:55:51 +03:00
|
|
|
-T tmp-dir use the specified temporary directory instead of _schhist
|
2010-09-07 23:03:19 +03:00
|
|
|
EOF
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
# --- Parse command-line options ----------------------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
no_cache=false
|
|
|
|
sanitize=
|
2010-09-22 15:36:00 +03:00
|
|
|
use_sch_name=false
|
2010-10-06 09:35:46 +03:00
|
|
|
debug=false
|
|
|
|
debug_opt=
|
2010-10-06 09:55:51 +03:00
|
|
|
tmp=`pwd`/_schhist2web
|
2010-09-07 23:03:19 +03:00
|
|
|
|
|
|
|
while true; do
|
|
|
|
case "$1" in
|
|
|
|
-n) no_cache=true
|
|
|
|
shift;;
|
2010-10-01 11:56:28 +03:00
|
|
|
-c) [ -z "$2" ] && usage
|
2010-10-06 09:55:51 +03:00
|
|
|
cache=$2
|
2010-09-07 23:03:19 +03:00
|
|
|
shift 2;;
|
2010-09-22 15:36:00 +03:00
|
|
|
-f) use_sch_name=true
|
|
|
|
shift;;
|
2010-10-06 09:35:46 +03:00
|
|
|
-D) debug=true
|
|
|
|
debug_opt=-D
|
|
|
|
shift;;
|
2010-09-07 23:03:19 +03:00
|
|
|
-S) sanitize=-S
|
|
|
|
shift;;
|
2010-10-06 09:55:51 +03:00
|
|
|
-T) [ -z "$2" ] && usage
|
|
|
|
tmp=$2
|
|
|
|
shift 2;;
|
2010-09-07 23:03:19 +03:00
|
|
|
-*) usage;;
|
|
|
|
*) break;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
|
|
|
|
|
|
|
# --- Interpret the command-line arguments ------------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
if [ ! -z "$1" -a -d "$1/.git" ]; then
|
|
|
|
dir="$1"
|
|
|
|
shift
|
|
|
|
else
|
|
|
|
dir=.
|
|
|
|
while [ ! -d $dir/.git ]; do
|
|
|
|
if [ $dir -ef $dir/.. ]; then
|
|
|
|
echo "no .git/ directory found in hierarchy" 1>&2
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
dir=$dir/..
|
|
|
|
done
|
|
|
|
echo "found top-dir: $dir" 1>&2
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ ! -z "$1" -a -f "$dir/$1" -a \
|
|
|
|
-f "$dir/${1%.sch}.pro" ]; then
|
|
|
|
sch="$1"
|
|
|
|
shift
|
|
|
|
else
|
|
|
|
for n in "$dir"/*.sch; do
|
|
|
|
[ -f "${n%.sch}.pro" ] || continue
|
|
|
|
if [ ! -z "$sch" ]; then
|
|
|
|
echo "multiple choices for top-level .sch file" 1>&2
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
sch="$n"
|
|
|
|
done
|
|
|
|
if [ -z "$sch" -o "$sch" = "$dir/*.sch" ]; then
|
|
|
|
echo "no candidate for top-level .sch file found" 1>&2
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
echo "found root sheet: $sch" 1>&2
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ ! -z "$1" ] && [ ! -e "$1" ] || [ -d "$1" -a ! -d "$1"/.git ]; then
|
|
|
|
out="$1"
|
|
|
|
shift
|
|
|
|
else
|
|
|
|
out=$OUTDIR
|
|
|
|
fi
|
|
|
|
[ -z "$cache" ] && cache="$out"
|
|
|
|
|
|
|
|
[ -z "$1" ] || usage
|
|
|
|
|
|
|
|
|
|
|
|
# --- Set up some variables and the directories for cache and output ----------
|
|
|
|
|
|
|
|
|
|
|
|
PATH=`dirname "$0"`:"$PATH"
|
|
|
|
first=`gitenealogy "$dir" "$sch" | sed '$s/ .*//p;d'`
|
|
|
|
schname=`gitenealogy "$dir" "$sch" | sed '$s/^.* //p;d'`
|
2012-05-11 08:47:18 +03:00
|
|
|
order=:$SCHHIST_ORDER:
|
2010-09-07 23:03:19 +03:00
|
|
|
|
|
|
|
rm -rf "$out/*/"{diff,thumb,html,pdf} "$out/names"
|
|
|
|
$no_cache && rm -rf "$cache"
|
|
|
|
mkdir -p "$out/names"
|
|
|
|
mkdir -p "$cache"
|
|
|
|
|
|
|
|
ppmmake '#e0e0e0' 5 30 | pnmtopng >"$out"/unchanged.png
|
|
|
|
|
|
|
|
|
|
|
|
# --- Generate/update the cache -----------------------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
head=
|
|
|
|
for n in $first `cd "$dir" && git rev-list --reverse $first..HEAD`; do
|
|
|
|
( cd "$dir" && git show --pretty=format:'' --name-only $n; ) |
|
|
|
|
egrep -q '\.sch$|\.pro$|\.lib$' || continue
|
|
|
|
echo Processing $n
|
|
|
|
new=`gitenealogy "$dir" "$sch" | sed "/^$n /s///p;d"`
|
|
|
|
if [ ! -z "$new" ]; then
|
|
|
|
echo Name change $schname to $new 1>&2
|
|
|
|
schname="$new"
|
|
|
|
fi
|
|
|
|
trap "rm -rf \"$cache/$n/ps\" \"$cache/$n/ppm0\" \"$cache/$n/ppm1\" \
|
|
|
|
\"$cache/$n/ppm2\" \"$tmp\"" 0
|
|
|
|
if [ ! -d "$cache/$n/ppm2" ]; then
|
|
|
|
rm -rf "$cache/$n/"{ps,ppm0,ppm1,ppm2}
|
|
|
|
mkdir -p "$cache/$n/"{ps,ppm0,ppm1,ppm2}
|
|
|
|
#
|
|
|
|
# potential optimization here: remember Postscript files from previous
|
|
|
|
# run (or their md5sum) and check if they have changed. If not, skip
|
|
|
|
# the ghostscript run and just put a symlink, replacing the less
|
|
|
|
# efficient optimization below.
|
|
|
|
#
|
2010-10-06 09:35:46 +03:00
|
|
|
tmp2=`gitsch2ps -k $sanitize $debug_opt "$dir" "$schname" $n "$tmp"` ||
|
|
|
|
exit
|
2010-09-07 23:03:19 +03:00
|
|
|
for m in "$tmp"/*.ps; do
|
2010-10-04 06:28:28 +03:00
|
|
|
[ "$m" = "$tmp/*.ps" ] && break
|
2010-09-22 15:36:00 +03:00
|
|
|
# call sub-sheets by their own name, without prepending the
|
|
|
|
# top-level sheet's name
|
|
|
|
name=`basename "$m" .ps`
|
|
|
|
name=${name#`basename "$schname" .sch`-}
|
|
|
|
|
|
|
|
#
|
|
|
|
# short-cut for $schname: since it's derived from the present $sch,
|
|
|
|
# we can just update it without further ado.
|
|
|
|
#
|
|
|
|
if [ "$name" = "`basename \"$schname\" .sch`" ]; then
|
|
|
|
name=`basename "$sch" .sch`
|
|
|
|
elif $use_sch_name &&
|
|
|
|
path=`subschname2file "$tmp2/$schname" "$name"`; then
|
|
|
|
name=`basename "$path" .sch`
|
|
|
|
#
|
|
|
|
# if the file is easily located, also track any future name
|
|
|
|
# changes
|
|
|
|
#
|
|
|
|
path=`dirname "$schname"`/$path
|
|
|
|
if [ -f "$tmp2/$path" ]; then
|
|
|
|
name=`gitwhoareyounow "$tmp2" "$path"`
|
|
|
|
name=`basename "$name" .sch`
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2010-09-07 23:03:19 +03:00
|
|
|
# Postscript, for making PDFs later
|
2010-09-22 15:36:00 +03:00
|
|
|
ps="$cache/$n/ps/$name.ps"
|
2010-09-07 23:03:19 +03:00
|
|
|
normalizeschps "$m" "$ps" || exit
|
|
|
|
|
|
|
|
# Unadorned pixmap, for comparison
|
2010-09-22 15:36:00 +03:00
|
|
|
ppm="$cache/$n/ppm0/$name.ppm"
|
2010-09-07 23:03:19 +03:00
|
|
|
schps2ppm -n "$ps" "$ppm" || exit
|
|
|
|
|
|
|
|
# Pixmap with thin lines, for the detail views
|
2010-09-22 15:36:00 +03:00
|
|
|
ppm="$cache/$n/ppm1/$name.ppm"
|
2010-09-07 23:03:19 +03:00
|
|
|
normalizeschps -w 120 "$m" | schps2ppm - "$ppm" || exit
|
|
|
|
|
|
|
|
# Pixmap with thick lines, for the thumbnails
|
2010-09-22 15:36:00 +03:00
|
|
|
ppm="$cache/$n/ppm2/$name.ppm"
|
2010-09-07 23:03:19 +03:00
|
|
|
normalizeschps -w 500 "$m" | schps2ppm - "$ppm" || exit
|
|
|
|
done
|
2010-10-06 09:35:46 +03:00
|
|
|
rm -rf "$tmp"
|
|
|
|
$debug || rm -rf "$tmp2"
|
2010-09-07 23:03:19 +03:00
|
|
|
fi
|
|
|
|
for m in "$cache/$n/ppm0/"*; do
|
|
|
|
[ "$m" = "$cache/$n/ppm0/*" ] && break
|
|
|
|
if [ ! -z "$head" ]; then
|
|
|
|
prev="$cache/$head/ppm0/${m##*/}"
|
|
|
|
if [ -r "$prev" ] && cmp -s "$prev" "$m"; then
|
|
|
|
for d in ppm0 ppm1 ppm2; do
|
|
|
|
symlink "../../$head/$d/${m##*/}" "$cache/$n/$d/${m##*/}"
|
|
|
|
done
|
|
|
|
m_ps=${m%.ppm}.ps
|
|
|
|
symlink "../../$head/ps/${m_ps##*/}" "$cache/$n/ps/${m_ps##*/}"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
touch "$out/names/`basename \"$m\" .ppm`"
|
|
|
|
done
|
|
|
|
trap 0
|
|
|
|
head=$n
|
|
|
|
done
|
|
|
|
|
|
|
|
if [ -z "$head" ]; then
|
|
|
|
echo "no usable head found" 2>&1
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
# --- Title of the Web page and table header ----------------------------------
|
|
|
|
|
|
|
|
|
2010-10-06 13:28:01 +03:00
|
|
|
index="$out/_index.html"
|
|
|
|
index_final="$out/index.html"
|
2010-09-07 23:03:19 +03:00
|
|
|
all=
|
|
|
|
{
|
|
|
|
cat <<EOF
|
|
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
|
|
<HTML>
|
|
|
|
EOF
|
|
|
|
if [ ! -z "$SCHHIST_TITLE" ]; then
|
|
|
|
echo "<TITLE>$SCHHIST_TITLE</TITLE>"
|
|
|
|
fi
|
|
|
|
echo "<BODY>"
|
|
|
|
if [ ! -z "$SCHHIST_TITLE" ]; then
|
|
|
|
echo "<H1>"
|
|
|
|
[ -z "$SCHHIST_HOME_URL" ] || echo "<A href=\"$SCHHIST_HOME_URL\">"
|
|
|
|
echo "$SCHHIST_TITLE"
|
|
|
|
[ -z "$SCHHIST_HOME_URL" ] || echo "</A>"
|
|
|
|
echo "</H1>"
|
|
|
|
fi
|
|
|
|
cat <<EOF
|
|
|
|
<TABLE bgcolor="$BG_COLOR" callpadding=1>
|
|
|
|
<TR bgcolor="$FNAME_COLOR">
|
|
|
|
EOF
|
|
|
|
while read m; do
|
2012-05-11 08:47:18 +03:00
|
|
|
[ "${order%%=$m[:=]*}" = "$order" ] || continue
|
2010-09-07 23:03:19 +03:00
|
|
|
ps="$cache/$head/ps/$m.ps"
|
|
|
|
if [ -r "$ps" ]; then
|
|
|
|
#
|
|
|
|
# Note: we read from variable ps_$head but we write to constant
|
|
|
|
# pdf_head. We can't use pdf_$head here, because that may just be a
|
|
|
|
# commit with a change and we thus generate a delta PDF below.
|
|
|
|
#
|
|
|
|
mkdir -p "$out/pdf_head"
|
|
|
|
schps2pdf -o "$out/pdf_head/$m.pdf" "$ps" || exit
|
|
|
|
all="$all \"$ps\""
|
|
|
|
echo "<TD><A href=\"pdf_head/$m.pdf\"><B>$m</B></A>"
|
|
|
|
else
|
|
|
|
echo "<TD><B>$m</B>"
|
|
|
|
fi
|
2010-09-22 16:14:38 +03:00
|
|
|
done < <(ordered_names)
|
2010-09-07 23:03:19 +03:00
|
|
|
proj=`basename "$sch" .sch`
|
|
|
|
eval schps2pdf -t \""$proj-"\" -o \""$out/pdf_$proj.pdf"\" $all
|
|
|
|
echo "<TD><A href=\"pdf_$proj.pdf\">All sheets</A>"
|
|
|
|
} >"$index"
|
|
|
|
|
|
|
|
|
|
|
|
# --- Diff all the revisions, newest to oldest --------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
next="$head"
|
|
|
|
for n in `cd "$dir" && git rev-list $first..HEAD~1` $first; do
|
|
|
|
[ -d "$cache/$n/ppm0" ] || continue
|
|
|
|
empty=true
|
|
|
|
s="<TR>"
|
2012-05-23 06:50:19 +03:00
|
|
|
td=false
|
2010-09-07 23:03:19 +03:00
|
|
|
mkdir -p "$out/$next/"{diff,thumb,html,pdf}
|
|
|
|
while read m; do
|
|
|
|
a0="$cache/$n/ppm0/$m.ppm"
|
|
|
|
a1="$cache/$n/ppm1/$m.ppm"
|
|
|
|
a2="$cache/$n/ppm2/$m.ppm"
|
|
|
|
aps="$cache/$n/ps/$m.ps"
|
|
|
|
|
|
|
|
b0="$cache/$next/ppm0/$m.ppm"
|
|
|
|
b1="$cache/$next/ppm1/$m.ppm"
|
|
|
|
b2="$cache/$next/ppm2/$m.ppm"
|
|
|
|
bps="$cache/$next/ps/$m.ps"
|
|
|
|
|
|
|
|
diff="$out/$next/diff/$m.png"
|
|
|
|
thumb="$out/$next/thumb/$m.png"
|
|
|
|
pdf="$out/$next/pdf/$m.pdf"
|
|
|
|
|
2012-05-11 08:47:18 +03:00
|
|
|
if [ "${order%%=$m[:=]*}" = "$order" ]; then
|
2012-05-12 04:07:10 +03:00
|
|
|
$td && s="$s<TD>"
|
2012-05-11 08:47:18 +03:00
|
|
|
td=true
|
|
|
|
fi
|
|
|
|
|
2010-09-07 23:03:19 +03:00
|
|
|
if [ -f "$a0" -a -f "$b0" ]; then
|
|
|
|
if ! pngdiff cat "$diff" "$a1" "$b1" "$a0" "$b0"; then
|
2012-05-12 04:07:10 +03:00
|
|
|
$td && s="$s<TD align=\"center\" valign=\"middle\">"
|
|
|
|
td=false
|
2011-10-01 15:49:31 +03:00
|
|
|
s="$s<IMG src=\"unchanged.png\">"
|
2010-09-07 23:03:19 +03:00
|
|
|
continue
|
|
|
|
fi
|
|
|
|
pngdiff shrink "$thumb" -f $THUMB_OPTS "$a2" "$b2" "$a0" "$b0" ||
|
|
|
|
exit
|
|
|
|
schps2pdf -T BEFORE -T AFTER -o "$pdf" "$aps" "$bps" || exit
|
|
|
|
elif [ -f "$a0" ]; then
|
|
|
|
pngdiff cat "$diff" -f -c 1,0,0 "$a1" "$a1" || exit
|
|
|
|
pngdiff shrink "$thumb" -f $THUMB_OPTS -c 1,0,0 "$a2" "$a2" ||
|
|
|
|
exit
|
|
|
|
schps2pdf -T DELETED -o "$pdf" "$aps" || exit
|
|
|
|
elif [ -f "$b0" ]; then
|
|
|
|
pngdiff cat "$diff" -f -c 0,1,0 "$b1" "$b1" || exit
|
|
|
|
pngdiff shrink "$thumb" -f $THUMB_OPTS -c 0,1,0 "$b2" "$b2" ||
|
|
|
|
exit
|
|
|
|
schps2pdf -T NEW -o "$pdf" "$bps" || exit
|
|
|
|
else
|
|
|
|
continue
|
|
|
|
fi
|
2012-05-23 06:50:19 +03:00
|
|
|
$td && s="$s<TD>"
|
|
|
|
td=false
|
2010-09-07 23:03:19 +03:00
|
|
|
echo "$s"
|
|
|
|
s=
|
|
|
|
wrapped_png "$out" "$next" "$m"
|
|
|
|
empty=false
|
2010-09-22 16:14:38 +03:00
|
|
|
done < <(ordered_names)
|
2010-09-07 23:03:19 +03:00
|
|
|
if ! $empty; then
|
2012-05-23 06:50:19 +03:00
|
|
|
$td && s="$s<TD>"
|
2010-09-07 23:03:19 +03:00
|
|
|
echo "$s<TD valign=\"middle\">"
|
|
|
|
commit_entry "$dir" $next
|
|
|
|
fi
|
|
|
|
next=$n
|
|
|
|
done >>"$index"
|
|
|
|
|
|
|
|
|
|
|
|
# --- Add creation entries for all files in the first commit ------------------
|
|
|
|
|
|
|
|
|
|
|
|
if [ -d "$cache/$next/ppm0" ]; then # could this ever be false ?
|
|
|
|
empty=true
|
|
|
|
echo "<TR>"
|
|
|
|
mkdir -p "$out/$next/"{diff,thumb,html,pdf}
|
|
|
|
while read m; do
|
|
|
|
p1="$cache/$next/ppm1/$m.ppm"
|
|
|
|
p2="$cache/$next/ppm2/$m.ppm"
|
|
|
|
ps="$cache/$next/ps/$m.ps"
|
|
|
|
diff="$out/$next/diff/$m.png"
|
|
|
|
thumb="$out/$next/thumb/$m.png"
|
|
|
|
pdf="$out/$next/pdf/$m.pdf"
|
|
|
|
|
2012-05-11 08:47:18 +03:00
|
|
|
[ "${order%%=$m[:=]*}" = "$order" ] && echo "<TD>"
|
2010-09-07 23:03:19 +03:00
|
|
|
[ -f "$p1" ] || continue
|
|
|
|
pngdiff cat "$diff" -f -c 0,1,0 "$p1" "$p1" || exit
|
|
|
|
pngdiff shrink "$thumb" -f $THUMB_OPTS -c 0,1,0 "$p2" "$p2" ||
|
|
|
|
exit
|
|
|
|
schps2pdf -T NEW -o "$pdf" "$ps" || exit
|
|
|
|
wrapped_png "$out" "$next" "$m"
|
|
|
|
empty=false
|
2010-09-22 16:14:38 +03:00
|
|
|
done < <(ordered_names)
|
2010-09-07 23:03:19 +03:00
|
|
|
if ! $empty; then
|
|
|
|
echo "<TD valign=\"middle\">"
|
|
|
|
commit_entry "$dir" $next
|
|
|
|
fi
|
|
|
|
fi >>"$index"
|
|
|
|
|
|
|
|
|
|
|
|
# --- Finish ------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
cat <<EOF >>"$index"
|
|
|
|
</TABLE>
|
|
|
|
<HR>
|
|
|
|
`date -u '+%F %X'` UTC
|
|
|
|
</BODY>
|
|
|
|
</HTML>
|
|
|
|
EOF
|
2010-10-06 13:28:01 +03:00
|
|
|
|
|
|
|
mv "$index" "$index_final"
|