1
0
mirror of git://projects.qi-hardware.com/ben-wpan.git synced 2025-02-16 23:14:43 +02:00

Run eeschema only once (not twice) per commit. 20% speed improvement.

- scripts/gitsch2ppm: new option -k to keep checked-out tree
- scripts/gitsch2ppm: new option -c to reuse Postscript files from -k run
- scripts/gitsch2ppm: removed C-style use of "break" from "case"
- scripts/schhist2web: use gitsch2ppm -k and -c to half number of
  eeschema runs
This commit is contained in:
Werner Almesberger 2010-08-27 14:31:05 -03:00
parent 43d512c30a
commit a241265aaf
2 changed files with 24 additions and 16 deletions

View File

@ -40,6 +40,8 @@ usage()
cat <<EOF 1>&2 cat <<EOF 1>&2
usage: $0 [options] top-dir top-schem [commit] outdir usage: $0 [options] top-dir top-schem [commit] outdir
-c use cached Postscript files (from previous run, with -k)
-k keep checked-out tree (for immediate reuse with -c)
-r XxY image resolution (default: $RES) -r XxY image resolution (default: $RES)
-w points Postscript line width (default: $LINEWIDTH) -w points Postscript line width (default: $LINEWIDTH)
EOF EOF
@ -47,16 +49,20 @@ EOF
} }
cache=false
keep=false
while true; do while true; do
case "$1" in case "$1" in
-c) cache=true
shift;;
-k) keep=true
shift;;
-r) [ -z "$2" ] && usage -r) [ -z "$2" ] && usage
RES="$2" RES="$2"
shift 2 shift 2;;
break;;
-w) [ -z "$2" ] && usage -w) [ -z "$2" ] && usage
LINEWIDTH="$2" LINEWIDTH="$2"
shift 2 shift 2;;
break;;
-*) -*)
usage;; usage;;
*) *)
@ -84,7 +90,9 @@ fi
tmp="$dir/../_gitsch2ppm" tmp="$dir/../_gitsch2ppm"
sch="$tmp/$sdir" sch="$tmp/$sdir"
if ! $cache; then
rm -rf "$tmp" rm -rf "$tmp"
rm -rf "$outdir"
git clone -s -n "$dir/.git" "$tmp" || exit git clone -s -n "$dir/.git" "$tmp" || exit
( cd "$tmp" && git checkout -q "$commit"; ) || exit ( cd "$tmp" && git checkout -q "$commit"; ) || exit
@ -95,14 +103,14 @@ if [ ! -f "$tmp/$schem" ]; then
fi fi
( cd "$sch" && rm -f *.ps *.ppm && eeschema --plot "$tmp/$schem"; ) || exit ( cd "$sch" && rm -f *.ps *.ppm && eeschema --plot "$tmp/$schem"; ) || exit
fi
for n in "$sch"/*.ps; do for n in "$sch"/*.ps; do
ps2ppm "$n" ps2ppm "$n"
done done
rm -rf "$outdir"
mkdir -p "$outdir" mkdir -p "$outdir"
mv "$sch"/*.ppm "$outdir" mv "$sch"/*.ppm "$outdir"
rm -rf "$tmp" $keep || rm -rf "$tmp"

View File

@ -136,8 +136,8 @@ for n in $first `git rev-list --reverse $first..HEAD`; do
if [ ! -d "$cache/ppm_$n" ]; then if [ ! -d "$cache/ppm_$n" ]; then
rm -rf "$cache/ppm_$n" rm -rf "$cache/ppm_$n"
mkdir "$cache/ppm_$n" mkdir "$cache/ppm_$n"
gitsch2ppm "$dir" "$schname" $n "$cache/ppm_$n" || exit gitsch2ppm -k "$dir" "$schname" $n "$cache/ppm_$n" || exit
gitsch2ppm -w 500 "$dir" "$schname" $n "$cache/fat_$n" || exit gitsch2ppm -c -w 500 "$dir" "$schname" $n "$cache/fat_$n" || exit
fi fi
for m in "$cache/ppm_$n/"*; do for m in "$cache/ppm_$n/"*; do
[ "$m" = "$cache/ppm_$n/*" ] && break [ "$m" = "$cache/ppm_$n/*" ] && break