mirror of
git://projects.qi-hardware.com/ben-wpan.git
synced 2024-11-29 11:47:11 +02:00
New script sanitize-profile to remove glitches from a KiCad profile.
- scripts/sanitize-profile: remove upsetting items from a KiCad profile - scripts/gitsch2ppm: option -S to enable sanitizing of profiles - scripts/schhist2web: pass option -S to gitsch2ppm - scripts/Makefile (xue-schhist): invoke schhist2web with option -S
This commit is contained in:
parent
d7d95ff2da
commit
2921bcea47
@ -24,7 +24,7 @@ xue-schhist:
|
||||
SCHHIST_TITLE=Xue \
|
||||
SCHHIST_HOME_URL=http://projects.qi-hardware.com/index.php/p/xue/ \
|
||||
SCHHIST_COMMIT_TEMPLATE='http://projects.qi-hardware.com/index.php/p/xue/source/commit/{}/' \
|
||||
./schhist2web ../../xue kicad/xue-rnc/xue-rnc.sch _xue
|
||||
./schhist2web -S ../../xue kicad/xue-rnc/xue-rnc.sch _xue
|
||||
|
||||
xue-schhist-upload:
|
||||
rsync -a --progress _xue/{index.html,unchanged.png,thum*,diff*} \
|
||||
|
@ -43,6 +43,7 @@ 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)
|
||||
-S sanitize the KiCad profile
|
||||
-w points Postscript line width (default: $LINEWIDTH)
|
||||
EOF
|
||||
exit 1
|
||||
@ -51,6 +52,7 @@ EOF
|
||||
|
||||
cache=false
|
||||
keep=false
|
||||
sanitize=true
|
||||
while true; do
|
||||
case "$1" in
|
||||
-c) cache=true
|
||||
@ -60,6 +62,9 @@ while true; do
|
||||
-r) [ -z "$2" ] && usage
|
||||
RES="$2"
|
||||
shift 2;;
|
||||
-S) sanitize=`PATH="$PATH":\`dirname "$0"\` which sanitize-profile`
|
||||
[ "$sanitize" = "${sanitize#/}" ] && sanitize=`pwd`/"$sanitize"
|
||||
shift;;
|
||||
-w) [ -z "$2" ] && usage
|
||||
LINEWIDTH="$2"
|
||||
shift 2;;
|
||||
@ -102,7 +107,13 @@ if ! $cache; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
( cd "$sch" && rm -f *.ps *.ppm && eeschema --plot "$tmp/$schem"; ) || exit
|
||||
(
|
||||
cd "$sch" || exit
|
||||
rm -f *.ps *.ppm
|
||||
$sanitize "$tmp"/`dirname "$schem"`/`basename "$schem" .sch`.pro ||
|
||||
exit
|
||||
eeschema --plot "$tmp/$schem"
|
||||
) || exit
|
||||
fi
|
||||
|
||||
for n in "$sch"/*.ps; do
|
||||
|
82
scripts/sanitize-profile
Executable file
82
scripts/sanitize-profile
Executable file
@ -0,0 +1,82 @@
|
||||
#!/usr/bin/perl
|
||||
#
|
||||
# sanitize-profile - Remove items from a KiCad profile that may cause an upset
|
||||
#
|
||||
# Written 2010 by Werner Almesberger
|
||||
# Copyright 2010 Werner Almesberger
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
|
||||
|
||||
@LIBS = ("/usr/share/kicad/library", "/usr/local/share/kicad/library");
|
||||
|
||||
|
||||
sub rewrite
|
||||
{
|
||||
local ($s) = @_;
|
||||
|
||||
return $s if $section ne "eeschema/libraries";
|
||||
return $s unless /^LibName(\d+)=(.*)\s*$/;
|
||||
my $lib = $2;
|
||||
if ($1 == $in_lib) {
|
||||
$in_lib++;
|
||||
} else {
|
||||
print STDERR "LibName$1 when expecting $next_lib. Renumbering.";
|
||||
$in_lib = $1+1;
|
||||
}
|
||||
$out_lib++;
|
||||
my $var = "LibName$out_lib";
|
||||
if ($lib =~ /\//) {
|
||||
return "$var=$lib\n" if -r "$lib.lib";
|
||||
}
|
||||
for (".", $libdir, @LIBS) {
|
||||
return "$var=$lib\n" if -r "$_/$lib.lib";
|
||||
}
|
||||
print STDERR "cannot find $lib\n";
|
||||
$out_lib--;
|
||||
return undef;
|
||||
}
|
||||
|
||||
|
||||
sub usage
|
||||
{
|
||||
print STDERR "usage: $0 file.pro [outfile]\n";
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
||||
($file, $out) = @ARGV;
|
||||
&usage if $#ARGV > 1;
|
||||
|
||||
($dir = $file) =~ s|.*/||;
|
||||
$dir = "." if $dir eq "";
|
||||
|
||||
open(FILE, $file) || die "$file: $!";
|
||||
while (<FILE>) {
|
||||
if (/^\[(\S+)\]/) {
|
||||
$section = $1;
|
||||
if ($section eq "eeschema/libraries") {
|
||||
$in_lib = 1;
|
||||
$out_lib = 0;
|
||||
}
|
||||
}
|
||||
if ($section eq "eeschema") {
|
||||
$libdir = $2 if /^LibDir=(.*)\s*$/;
|
||||
}
|
||||
$s = &rewrite($_);
|
||||
push(@f, $s) if defined $s;
|
||||
}
|
||||
close FILE;
|
||||
|
||||
if (!defined $out) {
|
||||
rename($file, "$file.bak");
|
||||
$out= $file;
|
||||
}
|
||||
|
||||
open(FILE, ">$out") || die "$out: $!";
|
||||
print FILE join("", @f) || die "$out: $!";
|
||||
close FILE || die "$out: $!";
|
@ -43,19 +43,22 @@ pngdiff()
|
||||
usage()
|
||||
{
|
||||
cat <<EOF 2>&1
|
||||
usage: $0 [-c cache-dir] [-n] [top-dir] [top-schem] [out-dir]
|
||||
usage: $0 [-c cache-dir] [-n] [-S] [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)
|
||||
-n don't use previous cache content (rebuild the cache)
|
||||
-S sanitize KiCad profile
|
||||
EOF
|
||||
exit 1
|
||||
}
|
||||
|
||||
|
||||
no_cache=false
|
||||
sanitize=
|
||||
|
||||
while true; do
|
||||
case "$1" in
|
||||
-n) no_cache=true
|
||||
@ -63,6 +66,8 @@ while true; do
|
||||
-c) [ -z "$1" ] && usage
|
||||
cache="$1"
|
||||
shift 2;;
|
||||
-S) sanitize=-S
|
||||
shift;;
|
||||
-*) usage;;
|
||||
*) break;;
|
||||
esac
|
||||
@ -136,7 +141,7 @@ for n in $first `cd "$dir" && git rev-list --reverse $first..HEAD`; do
|
||||
if [ ! -d "$cache/ppm_$n" ]; then
|
||||
rm -rf "$cache/ppm_$n"
|
||||
mkdir "$cache/ppm_$n"
|
||||
gitsch2ppm -k "$dir" "$schname" $n "$cache/ppm_$n" || exit
|
||||
gitsch2ppm $sanitize -k "$dir" "$schname" $n "$cache/ppm_$n" || exit
|
||||
gitsch2ppm -c -w 500 "$dir" "$schname" $n "$cache/fat_$n" || exit
|
||||
fi
|
||||
for m in "$cache/ppm_$n/"*; do
|
||||
|
Loading…
Reference in New Issue
Block a user