r5830 - in trunk/gta02-core/bom: . fic

werner at docs.openmoko.org werner at docs.openmoko.org
Sun Feb 7 17:07:09 CET 2010


Author: werner
Date: 2010-02-07 17:07:09 +0100 (Sun, 07 Feb 2010)
New Revision: 5830

Modified:
   trunk/gta02-core/bom/Makefile
   trunk/gta02-core/bom/fic/Makefile
   trunk/gta02-core/bom/fic/fic2inv
Log:
FIC's inventory can be interpreted optimistically or pessimistically.
Depending on which viewpoint we choose, we can now "make pessimist" or
"make optimist".

- bom/Makefile (show-dk): print the total cost at the end
- bom/fic/fic2inv: added option --optimist to consider the real stock to be 
  "Demand Q'ty" plus "Usable Q'ty"
- bom/Makefile: targets "optimist" and "pessimist" to obtain optimistic and
  pessimistic interpretation of FIC's inventory



Modified: trunk/gta02-core/bom/Makefile
===================================================================
--- trunk/gta02-core/bom/Makefile	2010-02-07 16:02:00 UTC (rev 5829)
+++ trunk/gta02-core/bom/Makefile	2010-02-07 16:07:09 UTC (rev 5830)
@@ -9,11 +9,21 @@
 CHR=darfon.chr ralec.chr avx.chr acx.chr misc.chr
 SCH=audio bt cpu-power cpu gps io lcm memory modem pmu sd-sim usb wlan
 
-.PHONY:		all spotless show-dup show-missing show-dk
+.PHONY:		all optimist pessimist spotless show-dup show-missing show-dk
 .PHONY:		ann sch gen generate gv xpdf upload
 
 all:		gta02-core.ord
 
+optimist:
+		$(MAKE) spotless
+		$(MAKE) -C fic INTERPRETATION=--optimistic
+		$(MAKE) all
+
+pessimist:
+		$(MAKE) spotless
+		$(MAKE) -C fic
+		$(MAKE) all
+
 gta02-core.ord:	gta02-core.par $(INV) $(EQU)
 		$(BOOM) part2order $(KITS) \
 		  $(INV) $(EQU) gta02-core.par >$@ || \
@@ -62,7 +72,8 @@
 show-dk:
 		(echo '#ORD'; grep DIGI-KEY gta02-core.ord ; ) | \
 		  $(BOOM) prettyord - digi-key.dsc | \
-		  sed 's/^...  //'
+		  sed 's/^...  //' | \
+		  awk '{ s += $$(NF); print; } END { print "USD", s }'
 
 #ANN = pmu
 ANN = audio

Modified: trunk/gta02-core/bom/fic/Makefile
===================================================================
--- trunk/gta02-core/bom/fic/Makefile	2010-02-07 16:02:00 UTC (rev 5829)
+++ trunk/gta02-core/bom/fic/Makefile	2010-02-07 16:07:09 UTC (rev 5830)
@@ -10,7 +10,8 @@
 		perl fic2vendor $(INV) >$@ || { rm -f $@; exit 1; }
 
 fic.inv:	fic2inv $(INV)
-		perl fic2inv $(INV) >$@ || { rm -f $@; exit 1; }
+		perl fic2inv $(INTERPRETATION) $(INV) >$@ || \
+		  { rm -f $@; exit 1; }
 
 fic.dsc:	fic2dsc $(INV)
 		perl fic2dsc $(INV) >$@ || { rm -f $@; exit 1; }

Modified: trunk/gta02-core/bom/fic/fic2inv
===================================================================
--- trunk/gta02-core/bom/fic/fic2inv	2010-02-07 16:02:00 UTC (rev 5829)
+++ trunk/gta02-core/bom/fic/fic2inv	2010-02-07 16:07:09 UTC (rev 5830)
@@ -1,8 +1,37 @@
 #!/usr/bin/perl
 
+# pessimistic: assume the "Q'ty in stock" column is right
+# optimistic: assume the real stock is the sum of "Usable Q'ty" and "Demand
+#             Q'ty"
+
+sub usage
+{
+    print STDERR "$0 [--optimistic|--pessimistic]\n";
+    exit(1);
+}
+
+
+if ($ARGV[0] eq "--optimistic") {
+    $opt = 1;
+    shift @ARGV;
+}
+if ($ARGV[0] eq "--pessimistic") {
+    $opt = 0;
+    shift @ARGV;
+}
+&usage if $ARGV[0] =~ /^-/;
+
 print "#INV\n";
 while (<>) {
     chop;
-    next unless /^\d*,"(\S+)\s*",.*,"(\d+)\s*"(,-?\d+)?$/;
-    print "FIC $1 $2 USD 1 0\n";
+    if ($opt) {
+	next unless /^\d*,"(\S+)\s*",.*,"(\d+)\s*","(\d+)\s*",(-?\d+)?$/;
+	$q = $2+$4;
+	die "$1: $2+$4 < $3" if $q < $3;
+	die "$1: $2+$4 < 0" if $q < 0;
+	print "FIC $1 $q USD 1 0\n";
+    } else {
+	next unless /^\d*,"(\S+)\s*",.*,"(\d+)\s*",(-?\d+)?$/;
+	print "FIC $1 $2 USD 1 0\n";
+    }
 }




More information about the commitlog mailing list