1
0
mirror of git://projects.qi-hardware.com/eda-tools.git synced 2024-12-22 23:26:47 +02:00

Option -D to keep temporary work trees for analysis/debugging.

- schhist/gitsch2ps: option -D to give _gitsch2ps a unique name, to copy
  the Postscript files instead of moving them, and to refrain from deleting
  _gitsch2ps
- schhist/schhist2web: option -D to refrain from deleting _gitsch2ps and
  to pass -D to gitsch2ps
This commit is contained in:
Werner Almesberger 2010-10-06 03:35:46 -03:00
parent 4d28daf6a0
commit f68e5a58b6
2 changed files with 27 additions and 6 deletions

View File

@ -19,6 +19,7 @@ usage: $0 [options] top-dir top-schem [commit] outdir
-c keep .lib.cache (default: delete it)
-k keep the temporary directory and print its name
-D debug mode: make temporary work tree unique and keep it
-S sanitize the KiCad profile and the top-level sheet
EOF
exit 1
@ -29,12 +30,16 @@ sanitize_profile=true
sanitize_schem=true
keep=false
cache=false
debug=false
while true; do
case "$1" in
-c) cache=true
shift;;
-k) keep=true
shift;;
-D) debug=true;
shift;;
-S) sanitize_profile=`PATH="$PATH":\`dirname "$0"\` which sanitize-profile`
[ "$sanitize_profile" = "${sanitize_profile#/}" ] &&
sanitize_profile=`pwd`/"$sanitize_profile"
@ -66,7 +71,11 @@ fi
[ "$commit" != HEAD -o -f "$dir/$schem" ] || usage
[ -d "$dir/.git" ] || usage
tmp="$dir/../_gitsch2ps"
if $debug; then
tmp="$dir/../_gitsch2ps_$$"
else
tmp="$dir/../_gitsch2ps"
fi
sch="$tmp/$sdir"
rm -rf "$tmp"
@ -111,10 +120,14 @@ fi
) || exit
mkdir -p "$outdir"
mv "$sch"/*.ps "$outdir"
if $debug; then
cp "$sch"/*.ps "$outdir"
else
mv "$sch"/*.ps "$outdir"
fi
if $keep; then
echo "$tmp"
else
rm -rf "$tmp"
$debug || rm -rf "$tmp"
fi

View File

@ -110,7 +110,7 @@ ordered_names()
usage()
{
cat <<EOF 2>&1
usage: $0 [-c cache-dir] [-f] [-n] [-S] [top-dir] [top-schem] [out-dir]
usage: $0 [options] [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)
@ -118,6 +118,7 @@ usage: $0 [-c cache-dir] [-f] [-n] [-S] [top-dir] [top-schem] [out-dir]
-c cache-dir cache directory (default: same as out-dir)
-f identify sheets by their file name, not the sheet name
-n don't use previous cache content (rebuild the cache)
-D debug mode: make temporary work trees unique and keep them
-S sanitize KiCad profile and top-level sheet
EOF
exit 1
@ -130,6 +131,8 @@ EOF
no_cache=false
sanitize=
use_sch_name=false
debug=false
debug_opt=
while true; do
case "$1" in
@ -140,6 +143,9 @@ while true; do
shift 2;;
-f) use_sch_name=true
shift;;
-D) debug=true
debug_opt=-D
shift;;
-S) sanitize=-S
shift;;
-*) usage;;
@ -237,7 +243,8 @@ for n in $first `cd "$dir" && git rev-list --reverse $first..HEAD`; do
# the ghostscript run and just put a symlink, replacing the less
# efficient optimization below.
#
tmp2=`gitsch2ps -k $sanitize "$dir" "$schname" $n "$tmp"` || exit
tmp2=`gitsch2ps -k $sanitize $debug_opt "$dir" "$schname" $n "$tmp"` ||
exit
for m in "$tmp"/*.ps; do
[ "$m" = "$tmp/*.ps" ] && break
# call sub-sheets by their own name, without prepending the
@ -281,7 +288,8 @@ for n in $first `cd "$dir" && git rev-list --reverse $first..HEAD`; do
ppm="$cache/$n/ppm2/$name.ppm"
normalizeschps -w 500 "$m" | schps2ppm - "$ppm" || exit
done
rm -rf "$tmp" "$tmp2"
rm -rf "$tmp"
$debug || rm -rf "$tmp2"
fi
for m in "$cache/$n/ppm0/"*; do
[ "$m" = "$cache/$n/ppm0/*" ] && break