r5866 - trunk/gta02-core/bom/dk

werner at docs.openmoko.org werner at docs.openmoko.org
Wed Mar 31 22:59:34 CEST 2010


Author: werner
Date: 2010-03-31 22:59:34 +0200 (Wed, 31 Mar 2010)
New Revision: 5866

Modified:
   trunk/gta02-core/bom/dk/Makefile
   trunk/gta02-core/bom/dk/digi-key.equ
   trunk/gta02-core/bom/dk/dk-db.pl
Log:
When adding new components to the Digi-Key equivalences list, the entire
cache was updated. This makes progress slow and fires a lot of unnecessary
queries at Digi-Key's server. dk-db.pl now has the option to load an
existing cache and to skip any parts already mentioned there.

- bom/dk/dk-db.pl: in query mode, the cache can be grown incrementally with the
  -i option
- bom/dk/Makefile: use incremental mode
- bom/dk/digi-key.equ: added some more resistors



Modified: trunk/gta02-core/bom/dk/Makefile
===================================================================
--- trunk/gta02-core/bom/dk/Makefile	2010-03-31 20:25:35 UTC (rev 5865)
+++ trunk/gta02-core/bom/dk/Makefile	2010-03-31 20:59:34 UTC (rev 5866)
@@ -6,7 +6,10 @@
 
 $(CACHE):	digi-key.equ
 		awk '/^DIGI-KEY / { print $$2 }' digi-key.equ | \
-		  perl ./dk-db.pl query >$@ || { rm -f $@; exit 1; }
+		  perl ./dk-db.pl query \
+		  `[ -r $(CACHE) ] && echo '' -i $(CACHE)` >_$@ || \
+		  { rm -f $@ _$@; exit 1; }
+		mv _$@ $@
 
 digi-key.dsc:	$(CACHE)
 		perl ./dk-db.pl dsc $(CACHE) >$@ || { rm -f $@; exit 1; }
@@ -22,7 +25,7 @@
 		$(MAKE) all
 
 clean:
-		rm -f $(CACHE)
+		rm -f $(CACHE) _$(CACHE)
 
 #
 # we don't do a "make clean" on "make spotless", so that things like "make
@@ -30,4 +33,4 @@
 #
 
 spotless:
-		rm -f digi-key.dsc digi-key.inv
+		rm -f digi-key.dsc digi-key.inv _$(CACHE)

Modified: trunk/gta02-core/bom/dk/digi-key.equ
===================================================================
--- trunk/gta02-core/bom/dk/digi-key.equ	2010-03-31 20:25:35 UTC (rev 5865)
+++ trunk/gta02-core/bom/dk/digi-key.equ	2010-03-31 20:59:34 UTC (rev 5866)
@@ -30,8 +30,11 @@
 DIGI-KEY NTGD1100LT1GOSCT-ND		ON-SEMI NTGD1100L
 
 DIGI-KEY RMCF1/16S0RCT-ND		STACKPOLE RMCF1/16S0R
+DIGI-KEY RMCF1/16S33JRCT-ND		STACKPOLE RMCF1/16S335%R
 DIGI-KEY RMCF1/16S150FRCT-ND		STACKPOLE RMCF1/16S1501%R
 DIGI-KEY RMCF1/16S220JR-ND		STACKPOLE RMCF1/16S2205%R
+DIGI-KEY RMCF1/16S1KJRCT-ND		STACKPOLE RMCF1/16S1K5%R
+DIGI-KEY RMCF1/16S10KJRCT-ND		STACKPOLE RMCF1/16S10K5%R
 DIGI-KEY RMCF1/16S100KJRCT-ND		STACKPOLE RMCF1/16S100K5%R
 
 DIGI-KEY 311-220JRCT-ND			YAGEO RC0402JR-07220RL

Modified: trunk/gta02-core/bom/dk/dk-db.pl
===================================================================
--- trunk/gta02-core/bom/dk/dk-db.pl	2010-03-31 20:25:35 UTC (rev 5865)
+++ trunk/gta02-core/bom/dk/dk-db.pl	2010-03-31 20:59:34 UTC (rev 5866)
@@ -28,7 +28,7 @@
 
 sub usage
 {
-    print STDERR "usage: $0 (query|dsc|inv) [file ...]\n";
+    print STDERR "usage: $0 (query [-i cache_file] | dsc | inv) [file ...]\n";
     exit(1);
 }
 
@@ -37,23 +37,33 @@
 &usage unless $mode eq "query" || $mode eq "dsc" || $mode eq "inv";
 
 if ($mode eq "query") {
+    if ($ARGV[0] eq "-i") {
+	shift @ARGV;
+	$name = shift @ARGV;
+	open(OLD, $name) || die "$name: $!";
+	$q = join("", <OLD>);
+	($old = $q) =~ tr/\r\n//d;
+	close OLD;
+    }
+
     while (<>) {
 	chop;
 	s/#.*//;
 	next if /^\s*$/;
 	next if /^\s/;
 	s/\s.*//;
+	next if $old =~ m#align=right>Digi-Key Part Number</th><td>$_</td#;
 	push(@pn, $_);
     }
 
-    exit unless 0+ at pn;
+    if (0+ at pn) {
+	$cmd = "wget -nv -O - ".join(" ",
+	  map
+	  "http://search.digikey.com/scripts/DkSearch/dksus.dll?Detail\\&name=$_",
+	  @pn);
+	$q .= `$cmd`;
+    }
 
-    $cmd = "wget -nv -O - ".join(" ",
-      map
-      "http://search.digikey.com/scripts/DkSearch/dksus.dll?Detail\\&name=$_",
-      @pn);
-    $q = `$cmd`;
-
     print $q;
     exit;
 }




More information about the commitlog mailing list