mirror of
git://projects.qi-hardware.com/ben-wpan.git
synced 2024-11-29 11:47:11 +02:00
Reorganized cache and output directory structure. Some code cleanup.
- scripts/schhist2web: changed cache and output directory structure from $dir/$type_$commit/$file to $dir/$commit/$type/$file - scripts/schhist2web: renamed directory types as follows: "ppm" to "ppm1", "fat" to "ppm2", and "hard" to "ppm0" - scripts/schhist2web: replaced `basename $x` with ${x##*/} wherever this makes sense - scripts/schhist2web: use {a,b,...} where is makes things clearer - scripts/schhist2web: changed ... \\n || exit to ... ||\n exit - scripts/schhist2web: symlinking of unchanged files was only done for "ppm" (now "ppm1") and "fat" (now "ppm2"), not for "ppm2" and "ps" - scripts/schhist2web: composition of path names in the output generator is now more systematic and avoids ad hoc compositions - scripts/schhist2web: mkdir -p "$out/pdf_$next" at the beginning, not each time we write a PDF
This commit is contained in:
parent
6260614015
commit
a3aac7e80b
@ -82,14 +82,14 @@ wrapped_png()
|
|||||||
{
|
{
|
||||||
local dir=$1 commit=$2 file=$3
|
local dir=$1 commit=$2 file=$3
|
||||||
|
|
||||||
mkdir -p "$dir/html_$commit"
|
mkdir -p "$dir/$commit/html"
|
||||||
echo "<A href=\"html_$commit/$file.html\"><IMG src=\"thumb_$commit/$file.png\"></A>"
|
echo "<A href=\"$commit/html/$file.html\"><IMG src=\"$commit/thumb/$file.png\"></A>"
|
||||||
cat <<EOF >"$dir/html_$commit/$file.html"
|
cat <<EOF >"$dir/$commit/html/$file.html"
|
||||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||||
<HTML>
|
<HTML>
|
||||||
<TITLE>$file</TITLE>
|
<TITLE>$file</TITLE>
|
||||||
<BODY>
|
<BODY>
|
||||||
<A href="../pdf_$commit/$file.pdf"><IMG src="../diff_$commit/$file.png"></A>
|
<A href="../pdf/$file.pdf"><IMG src="../diff/$file.png"></A>
|
||||||
</BODY>
|
</BODY>
|
||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
@ -188,7 +188,7 @@ PATH=`dirname "$0"`:"$PATH"
|
|||||||
first=`gitenealogy "$dir" "$sch" | sed '$s/ .*//p;d'`
|
first=`gitenealogy "$dir" "$sch" | sed '$s/ .*//p;d'`
|
||||||
schname=`gitenealogy "$dir" "$sch" | sed '$s/^.* //p;d'`
|
schname=`gitenealogy "$dir" "$sch" | sed '$s/^.* //p;d'`
|
||||||
|
|
||||||
rm -rf "$out/diff_*" "$out/thumb_*" "$out/html_*" "$out/pdf_*" "$out/names"
|
rm -rf "$out/*/"{diff,thumb,html,pdf} "$out/names"
|
||||||
$no_cache && rm -rf "$cache"
|
$no_cache && rm -rf "$cache"
|
||||||
mkdir -p "$out/names"
|
mkdir -p "$out/names"
|
||||||
mkdir -p "$cache"
|
mkdir -p "$cache"
|
||||||
@ -210,11 +210,11 @@ for n in $first `cd "$dir" && git rev-list --reverse $first..HEAD`; do
|
|||||||
schname="$new"
|
schname="$new"
|
||||||
fi
|
fi
|
||||||
tmp=`pwd`/_schhist2web
|
tmp=`pwd`/_schhist2web
|
||||||
trap "rm -rf \"$cache/ppm_$n\" \"$cache/fat_$n\" \"$cache/ps_$n\" \
|
trap "rm -rf \"$cache/$n/ps\" \"$cache/$n/ppm0\" \"$cache/$n/ppm1\" \
|
||||||
\"$cache/hard_$n\" \"$tmp\"" 0
|
\"$cache/$n/ppm2\" \"$tmp\"" 0
|
||||||
if [ ! -d "$cache/ppm_$n" ]; then
|
if [ ! -d "$cache/$n/ppm2" ]; then
|
||||||
rm -rf "$cache/ppm_$n" "$cache/fat_$n" "$cache/ps_$n" "$cache/hard_$n"
|
rm -rf "$cache/$n/"{ps,ppm0,ppm1,ppm2}
|
||||||
mkdir "$cache/ppm_$n" "$cache/fat_$n" "$cache/ps_$n" "$cache/hard_$n"
|
mkdir -p "$cache/$n/"{ps,ppm0,ppm1,ppm2}
|
||||||
#
|
#
|
||||||
# potential optimization here: remember Postscript files from previous
|
# potential optimization here: remember Postscript files from previous
|
||||||
# run (or their md5sum) and check if they have changed. If not, skip
|
# run (or their md5sum) and check if they have changed. If not, skip
|
||||||
@ -224,31 +224,33 @@ for n in $first `cd "$dir" && git rev-list --reverse $first..HEAD`; do
|
|||||||
gitsch2ps $sanitize "$dir" "$schname" $n "$tmp" || exit
|
gitsch2ps $sanitize "$dir" "$schname" $n "$tmp" || exit
|
||||||
for m in "$tmp"/*.ps; do
|
for m in "$tmp"/*.ps; do
|
||||||
# Postscript, for making PDFs later
|
# Postscript, for making PDFs later
|
||||||
ps="$cache/ps_$n/`basename "$m"`"
|
ps="$cache/$n/ps/`basename "$m"`"
|
||||||
normalizeschps "$m" "$ps" || exit
|
normalizeschps "$m" "$ps" || exit
|
||||||
|
|
||||||
# Unadorned pixmap, for comparison
|
# Unadorned pixmap, for comparison
|
||||||
ppm="$cache/hard_$n/`basename "$m" .ps`.ppm"
|
ppm="$cache/$n/ppm0/`basename "$m" .ps`.ppm"
|
||||||
schps2ppm -n "$ps" "$ppm" || exit
|
schps2ppm -n "$ps" "$ppm" || exit
|
||||||
|
|
||||||
# Pixmap with thin lines, for the detail views
|
# Pixmap with thin lines, for the detail views
|
||||||
ppm="$cache/ppm_$n/`basename "$m" .ps`.ppm"
|
ppm="$cache/$n/ppm1/`basename "$m" .ps`.ppm"
|
||||||
normalizeschps -w 120 "$m" | schps2ppm - "$ppm" || exit
|
normalizeschps -w 120 "$m" | schps2ppm - "$ppm" || exit
|
||||||
|
|
||||||
# Pixmap with thick lines, for the thumbnails
|
# Pixmap with thick lines, for the thumbnails
|
||||||
ppm="$cache/fat_$n/`basename "$m" .ps`.ppm"
|
ppm="$cache/$n/ppm2/`basename "$m" .ps`.ppm"
|
||||||
normalizeschps -w 500 "$m" | schps2ppm - "$ppm" || exit
|
normalizeschps -w 500 "$m" | schps2ppm - "$ppm" || exit
|
||||||
done
|
done
|
||||||
rm -rf "$tmp"
|
rm -rf "$tmp"
|
||||||
fi
|
fi
|
||||||
for m in "$cache/ppm_$n/"*; do
|
for m in "$cache/$n/ppm0/"*; do
|
||||||
[ "$m" = "$cache/ppm_$n/*" ] && break
|
[ "$m" = "$cache/$n/ppm0/*" ] && break
|
||||||
if [ ! -z "$head" ]; then
|
if [ ! -z "$head" ]; then
|
||||||
prev="$cache/ppm_$head"/`basename "$m"`
|
prev="$cache/$head/ppm0/${m##*/}"
|
||||||
if [ -r "$prev" ] && cmp -s "$prev" "$m"; then
|
if [ -r "$prev" ] && cmp -s "$prev" "$m"; then
|
||||||
symlink "../ppm_$head/`basename \"$m\"`" "$m"
|
for d in ppm0 ppm1 ppm2; do
|
||||||
symlink "../fat_$head/`basename \"$m\"`" \
|
symlink "../../$head/$d/${m##*/}" "$cache/$n/$d/${m##*/}"
|
||||||
"$cache/fat_$n/`basename \"$m\"`"
|
done
|
||||||
|
m_ps=${m%.ppm}.ps
|
||||||
|
symlink "../../$head/$d/${m_ps##*/}" "$cache/$n/$d/${m_ps##*/}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
touch "$out/names/`basename \"$m\" .ppm`"
|
touch "$out/names/`basename \"$m\" .ppm`"
|
||||||
@ -289,7 +291,7 @@ EOF
|
|||||||
<TR bgcolor="$FNAME_COLOR">
|
<TR bgcolor="$FNAME_COLOR">
|
||||||
EOF
|
EOF
|
||||||
while read m; do
|
while read m; do
|
||||||
ps="$cache/ps_$head/$m.ps"
|
ps="$cache/$head/ps/$m.ps"
|
||||||
if [ -r "$ps" ]; then
|
if [ -r "$ps" ]; then
|
||||||
#
|
#
|
||||||
# Note: we read from variable ps_$head but we write to constant
|
# Note: we read from variable ps_$head but we write to constant
|
||||||
@ -315,55 +317,54 @@ EOF
|
|||||||
|
|
||||||
next="$head"
|
next="$head"
|
||||||
for n in `cd "$dir" && git rev-list $first..HEAD~1` $first; do
|
for n in `cd "$dir" && git rev-list $first..HEAD~1` $first; do
|
||||||
[ -d "$cache/ppm_$n" ] || continue
|
[ -d "$cache/$n/ppm0" ] || continue
|
||||||
empty=true
|
empty=true
|
||||||
s="<TR>"
|
s="<TR>"
|
||||||
mkdir -p "$out/diff_$next" "$out/thumb_$next"
|
mkdir -p "$out/$next/"{diff,thumb,html,pdf}
|
||||||
while read m; do
|
while read m; do
|
||||||
a="$cache/ppm_$n/$m.ppm"
|
a0="$cache/$n/ppm0/$m.ppm"
|
||||||
fat_a="$cache/fat_$n/$m.ppm"
|
a1="$cache/$n/ppm1/$m.ppm"
|
||||||
hard_a="$cache/hard_$n/$m.ppm"
|
a2="$cache/$n/ppm2/$m.ppm"
|
||||||
b="$cache/ppm_$next/$m.ppm"
|
aps="$cache/$n/ps/$m.ps"
|
||||||
fat_b="$cache/fat_$next/$m.ppm"
|
|
||||||
hard_b="$cache/hard_$next/$m.ppm"
|
|
||||||
diff="$out/diff_$next/$m.png"
|
|
||||||
thumb="$out/thumb_$next/$m.png"
|
|
||||||
|
|
||||||
if [ -f "$a" -a -f "$b" ]; then
|
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"
|
||||||
|
|
||||||
|
if [ -f "$a0" -a -f "$b0" ]; then
|
||||||
s="$s<TD align=\"center\" valign=\"middle\">"
|
s="$s<TD align=\"center\" valign=\"middle\">"
|
||||||
if ! pngdiff cat "$diff" "$a" "$b" "$hard_a" "$hard_b"; then
|
if ! pngdiff cat "$diff" "$a1" "$b1" "$a0" "$b0"; then
|
||||||
s="$s<IMG src=\"unchanged.png\""
|
s="$s<IMG src=\"unchanged.png\""
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
pngdiff shrink "$thumb" -f $THUMB_OPTS "$fat_a" "$fat_b" \
|
pngdiff shrink "$thumb" -f $THUMB_OPTS "$a2" "$b2" "$a0" "$b0" ||
|
||||||
"$hard_a" "$hard_b" || exit
|
exit
|
||||||
mkdir -p "$out/pdf_$next"
|
schps2pdf -T BEFORE -T AFTER -o "$pdf" "$aps" "$bps" || exit
|
||||||
schps2pdf -T BEFORE -T AFTER -o "$out/pdf_$next/$m.pdf" \
|
elif [ -f "$a0" ]; then
|
||||||
"$cache/ps_$n/$m.ps" "$cache/ps_$next/$m.ps" || exit
|
|
||||||
elif [ -f "$a" ]; then
|
|
||||||
s="$s<TD>"
|
s="$s<TD>"
|
||||||
pngdiff cat "$diff" -f -c 1,0,0 "$a" "$a" || exit
|
pngdiff cat "$diff" -f -c 1,0,0 "$a1" "$a1" || exit
|
||||||
pngdiff shrink "$thumb" -f $THUMB_OPTS -c 1,0,0 "$fat_a" "$fat_a" \
|
pngdiff shrink "$thumb" -f $THUMB_OPTS -c 1,0,0 "$a2" "$a2" ||
|
||||||
|| exit
|
exit
|
||||||
mkdir -p "$out/pdf_$next"
|
schps2pdf -T DELETED -o "$pdf" "$aps" || exit
|
||||||
schps2pdf -T DELETED -o "$out/pdf_$next/$m.pdf" \
|
elif [ -f "$b0" ]; then
|
||||||
"$cache/ps_$n/$m.ps" || exit
|
|
||||||
elif [ -f "$b" ]; then
|
|
||||||
s="$s<TD>"
|
s="$s<TD>"
|
||||||
pngdiff cat "$diff" -f -c 0,1,0 "$b" "$b" || exit
|
pngdiff cat "$diff" -f -c 0,1,0 "$b1" "$b1" || exit
|
||||||
pngdiff shrink "$thumb" -f $THUMB_OPTS -c 0,1,0 "$fat_b" "$fat_b" \
|
pngdiff shrink "$thumb" -f $THUMB_OPTS -c 0,1,0 "$b2" "$b2" ||
|
||||||
|| exit
|
exit
|
||||||
mkdir -p "$out/pdf_$next"
|
schps2pdf -T NEW -o "$pdf" "$bps" || exit
|
||||||
schps2pdf -T NEW -o "$out/pdf_$next/$m.pdf" \
|
|
||||||
"$cache/ps_$next/$m.ps" || exit
|
|
||||||
else
|
else
|
||||||
s="$s<TD>"
|
s="$s<TD>"
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
echo "$s"
|
echo "$s"
|
||||||
s=
|
s=
|
||||||
empty=false
|
|
||||||
wrapped_png "$out" "$next" "$m"
|
wrapped_png "$out" "$next" "$m"
|
||||||
|
empty=false
|
||||||
done < <(ls -1 "$out/names")
|
done < <(ls -1 "$out/names")
|
||||||
if ! $empty; then
|
if ! $empty; then
|
||||||
echo "$s<TD valign=\"middle\">"
|
echo "$s<TD valign=\"middle\">"
|
||||||
@ -376,26 +377,26 @@ done >>"$index"
|
|||||||
# --- Add creation entries for all files in the first commit ------------------
|
# --- Add creation entries for all files in the first commit ------------------
|
||||||
|
|
||||||
|
|
||||||
if [ -d "$cache/ppm_$next" ]; then # could this ever be false ?
|
if [ -d "$cache/$next/ppm0" ]; then # could this ever be false ?
|
||||||
empty=true
|
empty=true
|
||||||
echo "<TR>"
|
echo "<TR>"
|
||||||
mkdir -p "$out/diff_$next" "$out/thumb_$next"
|
mkdir -p "$out/$next/"{diff,thumb,html,pdf}
|
||||||
while read m; do
|
while read m; do
|
||||||
ppm="$cache/ppm_$next/$m.ppm"
|
p1="$cache/$next/ppm1/$m.ppm"
|
||||||
fat="$cache/fat_$next/$m.ppm"
|
p2="$cache/$next/ppm2/$m.ppm"
|
||||||
diff="$out/diff_$next/$m.png"
|
ps="$cache/$next/ps/$m.ps"
|
||||||
thumb="$out/thumb_$next/$m.png"
|
diff="$out/$next/diff/$m.png"
|
||||||
|
thumb="$out/$next/thumb/$m.png"
|
||||||
|
pdf="$out/$next/pdf/$m.pdf"
|
||||||
|
|
||||||
echo "<TD>"
|
echo "<TD>"
|
||||||
[ -f "$ppm" ] || continue
|
[ -f "$p1" ] || continue
|
||||||
pngdiff cat "$diff" -f -c 0,1,0 "$ppm" "$ppm" || exit
|
pngdiff cat "$diff" -f -c 0,1,0 "$p1" "$p1" || exit
|
||||||
pngdiff shrink "$thumb" -f $THUMB_OPTS -c 0,1,0 "$fat" "$fat" \
|
pngdiff shrink "$thumb" -f $THUMB_OPTS -c 0,1,0 "$p2" "$p2" ||
|
||||||
|| exit
|
exit
|
||||||
empty=false
|
schps2pdf -T NEW -o "$pdf" "$ps" || exit
|
||||||
mkdir -p "$out/pdf_$next"
|
|
||||||
schps2pdf -T NEW -o "$out/pdf_$next/$m.pdf" \
|
|
||||||
"$cache/ps_$next/$m.ps" || exit
|
|
||||||
wrapped_png "$out" "$next" "$m"
|
wrapped_png "$out" "$next" "$m"
|
||||||
|
empty=false
|
||||||
done < <(ls -1 "$out/names")
|
done < <(ls -1 "$out/names")
|
||||||
if ! $empty; then
|
if ! $empty; then
|
||||||
echo "<TD valign=\"middle\">"
|
echo "<TD valign=\"middle\">"
|
||||||
|
Loading…
Reference in New Issue
Block a user