1
0
mirror of git://projects.qi-hardware.com/eda-tools.git synced 2024-12-22 18:28:59 +02:00

Environment variable SCHHIST_ADDLIBS to force libraries to be present.

- schhist/sanitize-profile: ensure that the libraries listed in
  SCHHIST_ADDLIBS are present in the profile
- schhist/Makefile (board-qi-avt2): use SCHHIST_ADDLIBS to add the "device"
  library
This commit is contained in:
Werner Almesberger 2010-10-04 03:04:35 -03:00
parent 7b1d3fd4d2
commit 4d28daf6a0
2 changed files with 22 additions and 2 deletions

View File

@ -102,6 +102,7 @@ board-qi-avt2:
SCHHIST_TITLE="AVT2" \
SCHHIST_HOME_URL=http://projects.qi-hardware.com/index.php/p/board-qi-avt2/ \
SCHHIST_COMMIT_TEMPLATE='http://projects.qi-hardware.com/index.php/p/board-qi-avt2/source/commit/{}/' \
SCHHIST_ADDLIBS=device \
./schhist2web -S ../../board-qi-avt2 \
main/Qi_AVT2.sch _avt2

View File

@ -22,6 +22,7 @@ sub rewrite
return $s if $section ne "eeschema/libraries";
return $s unless /^LibName(\d+)=(.*)\s*$/;
my $lib = $2;
delete $add{$lib};
if ($1 == $in_lib) {
$in_lib++;
} else {
@ -42,6 +43,17 @@ sub rewrite
}
sub complement
{
for (sort keys %add) {
print STDERR "adding $_\n";
$out_lib++;
push(@f, "LibName$out_lib=$_\n");
delete $add{$_};
}
}
sub usage
{
print STDERR "usage: $0 file.pro [outfile]\n";
@ -49,6 +61,10 @@ sub usage
}
for (split(",", $ENV{"SCHHIST_ADDLIBS"})) {
$add{$_} = 1 if $_ ne "";
}
($file, $out) = @ARGV;
&usage if $#ARGV > 1;
@ -58,11 +74,13 @@ $dir = "." if $dir eq "";
open(FILE, $file) || die "$file: $!";
while (<FILE>) {
if (/^\[(\S+)\]/) {
$section = $1;
if ($section eq "eeschema/libraries") {
if ($1 eq "eeschema/libraries") {
$in_lib = 1;
$out_lib = 0;
} else {
&complement if $section eq "eeschema/libraries";
}
$section = $1;
}
if ($section eq "eeschema") {
$libdir = $1 if /^LibDir=(.*)\s*$/;
@ -71,6 +89,7 @@ while (<FILE>) {
push(@f, $s) if defined $s;
}
close FILE;
&complement;
if (!defined $out) {
rename($file, "$file.bak");