mirror of
git://projects.qi-hardware.com/ben-wpan.git
synced 2024-11-26 09:01:53 +02:00
schhist2web: use a cache by default and give the user control over it.
- scripts/schhist2web (THUMB_OPTS): make shared pixels in thumbnails a bit darker - scripts/schhist2web (usage): described the arguments - scripts/schhist2web: new option -c dir to set the cache directory - scripts/schhist2web: new option -n to remake the cache - scripts/schhist2web: path name in new file detection was incorrect - scripts/schhist2web: use "$index" instead of open-coding "$out/index.html" - scripts/gitsch2ppm: changed temp directory name from _schdiff_a to _gitsch2ppm
This commit is contained in:
parent
0d537612c3
commit
099b62649b
@ -81,7 +81,7 @@ fi
|
|||||||
[ "$commit" != HEAD -o -f "$dir/$schem" ] || usage
|
[ "$commit" != HEAD -o -f "$dir/$schem" ] || usage
|
||||||
[ -d "$dir/.git" ] || usage
|
[ -d "$dir/.git" ] || usage
|
||||||
|
|
||||||
tmp="$dir/../_schdiff_a"
|
tmp="$dir/../_gitsch2ppm"
|
||||||
sch="$tmp/$sdir"
|
sch="$tmp/$sdir"
|
||||||
|
|
||||||
rm -rf "$tmp"
|
rm -rf "$tmp"
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
THUMB_OPTS="-w 3 -d 60 -n 1,1,0"
|
OUTDIR=_out
|
||||||
|
THUMB_OPTS="-w 3 -d 60 -c 0.5,0.5,0.5 -n 1,1,0"
|
||||||
|
|
||||||
|
|
||||||
shrink()
|
shrink()
|
||||||
@ -26,11 +27,31 @@ pngdiff()
|
|||||||
|
|
||||||
usage()
|
usage()
|
||||||
{
|
{
|
||||||
echo "usage: $0 [top-dir] [top-schem] [outdir]" 2>&1
|
cat <<EOF 2>&1
|
||||||
|
usage: $0 [-c cache-dir] [-n] [top-dir] [top-schem] [out-dir]
|
||||||
|
|
||||||
|
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)
|
||||||
|
-n don't use previous cache content (rebuild the cache)
|
||||||
|
-c cache-dir cache directory (default: same as out-dir)
|
||||||
|
EOF
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
no_cache=false
|
||||||
|
while true; do
|
||||||
|
case "$1" in
|
||||||
|
-n) no_cache=true;;
|
||||||
|
-c) [ -z "$1" ] && usage
|
||||||
|
cache="$1"
|
||||||
|
shift;;
|
||||||
|
-*) usage;;
|
||||||
|
*) break;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
if [ ! -z "$1" -a -d "$1/.git" ]; then
|
if [ ! -z "$1" -a -d "$1/.git" ]; then
|
||||||
dir="$1"
|
dir="$1"
|
||||||
shift
|
shift
|
||||||
@ -43,6 +64,7 @@ else
|
|||||||
fi
|
fi
|
||||||
dir=$dir/..
|
dir=$dir/..
|
||||||
done
|
done
|
||||||
|
echo "found top-dir: $dir" 1>&2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -z "$1" -a -f "$dir/$1" -a \
|
if [ ! -z "$1" -a -f "$dir/$1" -a \
|
||||||
@ -62,14 +84,16 @@ else
|
|||||||
echo "no candidate for top-level .sch file found" 1>&2
|
echo "no candidate for top-level .sch file found" 1>&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
echo "found root sheet: $sch" 1>&2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -z "$1" ] && [ ! -e "$1" ] || [ -d "$1" -a ! -d "$1"/.git ]; then
|
if [ ! -z "$1" ] && [ ! -e "$1" ] || [ -d "$1" -a ! -d "$1"/.git ]; then
|
||||||
out="$1"
|
out="$1"
|
||||||
shift
|
shift
|
||||||
else
|
else
|
||||||
out=_out
|
out=$OUTDIR
|
||||||
fi
|
fi
|
||||||
|
[ -z "$cache" ] && cache="$out"
|
||||||
|
|
||||||
[ -z "$1" ] || usage
|
[ -z "$1" ] || usage
|
||||||
|
|
||||||
@ -77,38 +101,39 @@ 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'`
|
||||||
|
|
||||||
# @@@ POOR MAN'S CACHE
|
rm -rf "$out/diff_*" "$out/thumb_*" "$out/names"
|
||||||
if true; then
|
|
||||||
|
|
||||||
rm -rf "$out"
|
|
||||||
mkdir -p "$out/names"
|
mkdir -p "$out/names"
|
||||||
|
$no_cache && rm -rf "$cache"
|
||||||
|
mkdir -p "$cache"
|
||||||
|
|
||||||
for n in $first `git rev-list --reverse $first..HEAD`; do
|
for n in $first `git rev-list --reverse $first..HEAD`; do
|
||||||
echo Processing $n
|
echo Processing $n
|
||||||
new=`gitenealogy "$dir/$sch" | sed "/^$n /s///p;d"`
|
new=`gitenealogy "$dir/$sch" | sed "/^$n /s///p;d"`
|
||||||
if [ ! -z "$new" ]; then
|
if [ ! -z "$new" ]; then
|
||||||
echo Name change $schname to $new
|
echo Name change $schname to $new 1>&2
|
||||||
schname="$new"
|
schname="$new"
|
||||||
fi
|
fi
|
||||||
mkdir "$out/ppm_$n"
|
if [ ! -d "$cache/ppm_$n" ]; then
|
||||||
gitsch2ppm "$dir" "$schname" $n "$out/ppm_$n" || exit
|
rm -rf "$cache/ppm_$n"
|
||||||
|
mkdir "$cache/ppm_$n"
|
||||||
|
gitsch2ppm "$dir" "$schname" $n "$cache/ppm_$n" || exit
|
||||||
gitsch2ppm -w 500 "$dir" "$schname" $n "$out/fat_$n" || exit
|
gitsch2ppm -w 500 "$dir" "$schname" $n "$out/fat_$n" || exit
|
||||||
for m in "$out/ppm_$n/"*; do
|
fi
|
||||||
[ "$m" = "$out/ppm_$n/*" ] && break
|
for m in "$cache/ppm_$n/"*; do
|
||||||
|
[ "$m" = "$cache/ppm_$n/*" ] && break
|
||||||
touch "$out/names/"`basename "$m" .ppm`
|
touch "$out/names/"`basename "$m" .ppm`
|
||||||
done
|
done
|
||||||
done
|
done
|
||||||
|
|
||||||
fi
|
index="$out/index.html"
|
||||||
|
cat <<EOF >"$index"
|
||||||
cat <<EOF >"$out/index.html"
|
|
||||||
<HTML>
|
<HTML>
|
||||||
<BODY>
|
<BODY>
|
||||||
<TABLE bgcolor="#f0f0ff" callpadding=1>
|
<TABLE bgcolor="#f0f0ff" callpadding=1>
|
||||||
<TR>
|
<TR>
|
||||||
EOF
|
EOF
|
||||||
for m in `ls -1 "$out/names"`; do
|
for m in `ls -1 "$out/names"`; do
|
||||||
echo "<TD><B>$m</B>" >>"$out/index.html"
|
echo "<TD><B>$m</B>" >>"$index"
|
||||||
done
|
done
|
||||||
|
|
||||||
head=`git rev-list HEAD~1..HEAD`
|
head=`git rev-list HEAD~1..HEAD`
|
||||||
@ -118,10 +143,10 @@ for n in `git rev-list $first..HEAD~1` $first; do
|
|||||||
s="<TR><TR>"
|
s="<TR><TR>"
|
||||||
mkdir -p "$out/diff_$next" "$out/thumb_$next"
|
mkdir -p "$out/diff_$next" "$out/thumb_$next"
|
||||||
for m in `ls -1 "$out/names"`; do
|
for m in `ls -1 "$out/names"`; do
|
||||||
a="$out/ppm_$n/$m.ppm"
|
a="$cache/ppm_$n/$m.ppm"
|
||||||
fat_a="$out/fat_$n/$m.ppm"
|
fat_a="$cache/fat_$n/$m.ppm"
|
||||||
b="$out/ppm_$next/$m.ppm"
|
b="$cache/ppm_$next/$m.ppm"
|
||||||
fat_b="$out/fat_$next/$m.ppm"
|
fat_b="$cache/fat_$next/$m.ppm"
|
||||||
diff="$out/diff_$next/$m.png"
|
diff="$out/diff_$next/$m.png"
|
||||||
thumb="$out/thumb_$next/$m.png"
|
thumb="$out/thumb_$next/$m.png"
|
||||||
|
|
||||||
@ -135,7 +160,7 @@ for n in `git rev-list $first..HEAD~1` $first; do
|
|||||||
pngdiff cat "$diff" -f -c 1,0,0 "$a" "$a" || exit
|
pngdiff cat "$diff" -f -c 1,0,0 "$a" "$a" || exit
|
||||||
pngdiff shrink "$thumb" -f -c 1,0,0 $THUMB_OPTS "$fat_a" "$fat_a" \
|
pngdiff shrink "$thumb" -f -c 1,0,0 $THUMB_OPTS "$fat_a" "$fat_a" \
|
||||||
|| exit
|
|| exit
|
||||||
elif [ -f "$out/$next/$m.ppm" ]; then
|
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 "$b" "$b" || exit
|
||||||
pngdiff shrink "$thumb" -f -c 0,1,0 $THUMB_OPTS "$fat_b" "$fat_b" \
|
pngdiff shrink "$thumb" -f -c 0,1,0 $THUMB_OPTS "$fat_b" "$fat_b" \
|
||||||
@ -144,10 +169,10 @@ for n in `git rev-list $first..HEAD~1` $first; do
|
|||||||
s="$s<TD>"
|
s="$s<TD>"
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
echo "$s" >>"$out/index.html"
|
echo "$s" >>"$index"
|
||||||
s=
|
s=
|
||||||
empty=false
|
empty=false
|
||||||
echo "<A href=\"diff_$next/$m.png\"><IMG src=\"thumb_$next/$m.png\"></A>" >>"$out/index.html"
|
echo "<A href=\"diff_$next/$m.png\"><IMG src=\"thumb_$next/$m.png\"></A>" >>"$index"
|
||||||
done
|
done
|
||||||
if ! $empty; then
|
if ! $empty; then
|
||||||
(
|
(
|
||||||
@ -159,10 +184,10 @@ EOF
|
|||||||
echo "<PRE>"
|
echo "<PRE>"
|
||||||
git log --pretty=short $n..$next
|
git log --pretty=short $n..$next
|
||||||
echo "</PRE>"
|
echo "</PRE>"
|
||||||
) >>"$out/index.html"
|
) >>"$index"
|
||||||
fi
|
fi
|
||||||
next=$n
|
next=$n
|
||||||
done
|
done
|
||||||
|
|
||||||
echo "</TABLE>" >>"$out/index.html"
|
echo "</TABLE>" >>"$index"
|
||||||
exit 1
|
exit 1
|
||||||
|
Loading…
Reference in New Issue
Block a user