1
0
mirror of git://projects.qi-hardware.com/eda-tools.git synced 2024-11-26 07:02:29 +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) -c keep .lib.cache (default: delete it)
-k keep the temporary directory and print its name -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 -S sanitize the KiCad profile and the top-level sheet
EOF EOF
exit 1 exit 1
@ -29,12 +30,16 @@ sanitize_profile=true
sanitize_schem=true sanitize_schem=true
keep=false keep=false
cache=false cache=false
debug=false
while true; do while true; do
case "$1" in case "$1" in
-c) cache=true -c) cache=true
shift;; shift;;
-k) keep=true -k) keep=true
shift;; shift;;
-D) debug=true;
shift;;
-S) sanitize_profile=`PATH="$PATH":\`dirname "$0"\` which sanitize-profile` -S) sanitize_profile=`PATH="$PATH":\`dirname "$0"\` which sanitize-profile`
[ "$sanitize_profile" = "${sanitize_profile#/}" ] && [ "$sanitize_profile" = "${sanitize_profile#/}" ] &&
sanitize_profile=`pwd`/"$sanitize_profile" sanitize_profile=`pwd`/"$sanitize_profile"
@ -66,7 +71,11 @@ 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/../_gitsch2ps" if $debug; then
tmp="$dir/../_gitsch2ps_$$"
else
tmp="$dir/../_gitsch2ps"
fi
sch="$tmp/$sdir" sch="$tmp/$sdir"
rm -rf "$tmp" rm -rf "$tmp"
@ -111,10 +120,14 @@ fi
) || exit ) || exit
mkdir -p "$outdir" mkdir -p "$outdir"
mv "$sch"/*.ps "$outdir" if $debug; then
cp "$sch"/*.ps "$outdir"
else
mv "$sch"/*.ps "$outdir"
fi
if $keep; then if $keep; then
echo "$tmp" echo "$tmp"
else else
rm -rf "$tmp" $debug || rm -rf "$tmp"
fi fi

View File

@ -110,7 +110,7 @@ ordered_names()
usage() usage()
{ {
cat <<EOF 2>&1 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-dir top-level directory of the git archive (default: locate it)
top-schem root sheet of the schematics (default: locate it in top-dir) 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) -c cache-dir cache directory (default: same as out-dir)
-f identify sheets by their file name, not the sheet name -f identify sheets by their file name, not the sheet name
-n don't use previous cache content (rebuild the cache) -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 -S sanitize KiCad profile and top-level sheet
EOF EOF
exit 1 exit 1
@ -130,6 +131,8 @@ EOF
no_cache=false no_cache=false
sanitize= sanitize=
use_sch_name=false use_sch_name=false
debug=false
debug_opt=
while true; do while true; do
case "$1" in case "$1" in
@ -140,6 +143,9 @@ while true; do
shift 2;; shift 2;;
-f) use_sch_name=true -f) use_sch_name=true
shift;; shift;;
-D) debug=true
debug_opt=-D
shift;;
-S) sanitize=-S -S) sanitize=-S
shift;; shift;;
-*) usage;; -*) 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 # the ghostscript run and just put a symlink, replacing the less
# efficient optimization below. # 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 for m in "$tmp"/*.ps; do
[ "$m" = "$tmp/*.ps" ] && break [ "$m" = "$tmp/*.ps" ] && break
# call sub-sheets by their own name, without prepending the # 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" ppm="$cache/$n/ppm2/$name.ppm"
normalizeschps -w 500 "$m" | schps2ppm - "$ppm" || exit normalizeschps -w 500 "$m" | schps2ppm - "$ppm" || exit
done done
rm -rf "$tmp" "$tmp2" rm -rf "$tmp"
$debug || rm -rf "$tmp2"
fi fi
for m in "$cache/$n/ppm0/"*; do for m in "$cache/$n/ppm0/"*; do
[ "$m" = "$cache/$n/ppm0/*" ] && break [ "$m" = "$cache/$n/ppm0/*" ] && break