[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

gEDA-cvs: gaf.git: branch: master updated (1.5.0-20080706-324-g1d6a204)



The branch, master has been updated
       via  1d6a2045f618cb2441d386811a49fc3c1686ff13 (commit)
      from  5bf126369c5f5a60f5ae039170c33ff4c767a4ee (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


=========
 Summary
=========

 gnetlist/acinclude.m4                            |   83 ++++++++++++++++++++++
 gnetlist/scripts/{annotate.sh => annotate.sh.in} |   71 +++++++++++-------
 gnetlist/scripts/bom_xref.sh.in                  |   10 +++
 gnetlist/scripts/{bompp.sh => bompp.sh.in}       |    6 +-
 4 files changed, 139 insertions(+), 31 deletions(-)
 create mode 100644 gnetlist/acinclude.m4
 copy gnetlist/scripts/{annotate.sh => annotate.sh.in} (57%)
 create mode 100755 gnetlist/scripts/bom_xref.sh.in
 copy gnetlist/scripts/{bompp.sh => bompp.sh.in} (90%)


=================
 Commit Messages
=================

commit 1d6a2045f618cb2441d386811a49fc3c1686ff13
Author: Dan McMahill <dan@xxxxxxxxxxxx>
Date:   Sat Nov 29 20:54:19 2008 -0500

    General portability cleanup of scripts.
    
    Expand the autoconf tests for awk to make sure that we have picked up and
    awk that is good enough for the scripts that use them.  Now use this result
    in various scripts instead of hard coding 'gawk' (not available on all systems)
    or 'awk' (picks up the original awk which is not sufficiently advanced on solaris).
    
    Also avoid calling out /bin/bash on scripts for which /bin/sh (even on solaris) should
    be sufficient.  Not all systems have /bin/bash.
    
    Finally, improve temp file usage in shell scripts for improved security.

:000000 100644 0000000... 66be5b7... A	gnetlist/acinclude.m4
:000000 100755 0000000... 7cbed5d... A	gnetlist/scripts/annotate.sh.in
:000000 100755 0000000... 4d3308f... A	gnetlist/scripts/bom_xref.sh.in
:000000 100755 0000000... 4ab9696... A	gnetlist/scripts/bompp.sh.in

=========
 Changes
=========

commit 1d6a2045f618cb2441d386811a49fc3c1686ff13
Author: Dan McMahill <dan@xxxxxxxxxxxx>
Date:   Sat Nov 29 20:54:19 2008 -0500

    General portability cleanup of scripts.
    
    Expand the autoconf tests for awk to make sure that we have picked up and
    awk that is good enough for the scripts that use them.  Now use this result
    in various scripts instead of hard coding 'gawk' (not available on all systems)
    or 'awk' (picks up the original awk which is not sufficiently advanced on solaris).
    
    Also avoid calling out /bin/bash on scripts for which /bin/sh (even on solaris) should
    be sufficient.  Not all systems have /bin/bash.
    
    Finally, improve temp file usage in shell scripts for improved security.

diff --git a/gnetlist/acinclude.m4 b/gnetlist/acinclude.m4
new file mode 100644
index 0000000..66be5b7
--- /dev/null
+++ b/gnetlist/acinclude.m4
@@ -0,0 +1,83 @@
+
+
+#-------------------------------------------------------------------------- 
+#
+# Various awk checks
+#
+
+dnl This is just like the AC_PROG_AWK that comes with autoconf
+dnl except it gets the path as well.  Note that we go ahead and
+dnl say that we provide AC_PROG_AWK since we did one better.
+AC_DEFUN([AC_PATH_AWK],
+  [AC_PATH_PROGS(AWK, mawk gawk nawk awk, )
+  AC_PROVIDE([AC_PROG_AWK])dnl
+])
+
+dnl Now for various awk checks.
+dnl
+
+dnl AC_TRY_AWK(PROGRAM, [ACTION-IF-TRUE [, ACTION-IF-FALSE]])
+AC_DEFUN([AC_TRY_AWK],
+[AC_REQUIRE([AC_PROG_AWK])dnl
+cat > conftest.awk <<EOF
+[#]line __oline__ "configure"
+[$1]
+EOF
+cat > conftest.txt <<EOF
+foo bar
+EOF
+if ($AWK -f conftest.awk conftest.txt >/dev/null; exit) 2>&AC_FD_CC
+then
+dnl
+  AC_MSG_RESULT(yes)
+  ifelse([$2], , :, [$2])
+else
+  AC_MSG_RESULT(no)
+  echo "configure:__oline__: $AWK -f conftest.awk conftest.txt" >&AC_FD_CC
+  echo "configure:__oline__: failed program was:" >&AC_FD_CC
+  cat conftest.awk >&AC_FD_CC
+  echo "configure:__oline__: failed input file was:" >&AC_FD_CC
+  cat conftest.txt >&AC_FD_CC
+ifelse([$3], , , [  rm -fr conftest*
+  $3
+])dnl
+fi
+rm -fr conftest*])
+
+# see if AWK has the 'gensub' function
+# AC_AWK_GENSUB(ACTION-IF-TRUE [, ACTION-IF-FALSE])
+#
+AC_DEFUN([AC_AWK_GENSUB],
+[AC_MSG_CHECKING([whether awk ($AWK) has gensub])
+AC_TRY_AWK([{gensub(/foo/,"bar","g");}] ,[$1] ,[$2])
+])dnl
+
+# see if AWK has the 'gsub' function
+# AC_AWK_GSUB(ACTION-IF-TRUE [, ACTION-IF-FALSE])
+#
+AC_DEFUN([AC_AWK_GSUB],
+[AC_MSG_CHECKING([whether awk ($AWK) has gsub])
+AC_TRY_AWK([{gsub(/foo/,"bar");}] ,[$1] ,[$2])
+])dnl
+
+# see if AWK has the 'strftime' function
+# AC_AWK_STRFTIME(ACTION-IF-TRUE [, ACTION-IF-FALSE])
+#
+AC_DEFUN([AC_AWK_STRFTIME],
+[AC_MSG_CHECKING([whether awk ($AWK) has strftime])
+AC_TRY_AWK([{print strftime()}] ,[$1] ,[$2])
+])dnl
+
+# see if AWK has the 'toupper' function
+# AC_AWK_TOUPPER(ACTION-IF-TRUE [, ACTION-IF-FALSE])
+#
+AC_DEFUN([AC_AWK_TOUPPER],
+[AC_MSG_CHECKING([whether awk ($AWK) has toupper])
+AC_TRY_AWK([{print toupper("test")}] ,[$1] ,[$2])
+])dnl
+
+
+#
+#-------------------------------------------------------------------------- 
+
+
diff --git a/gnetlist/scripts/annotate.sh.in b/gnetlist/scripts/annotate.sh.in
new file mode 100755
index 0000000..7cbed5d
--- /dev/null
+++ b/gnetlist/scripts/annotate.sh.in
@@ -0,0 +1,107 @@
+#!/bin/sh
+
+# 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.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+#------------------------------------------------------------------
+#--------------------------------JM Routoure-----------------------
+#---------------------------------28/02/2000-----------------------
+#------------------------------------------------------------------
+
+if [ -z "$1" ]; then
+	echo "No sch file indicated"
+	echo "usage:"
+	echo "annotate file"
+	echo "	file is generated by gschem"
+	exit 1
+fi 
+
+# create a secure temp directory
+tmpd=${TMP:-/tmp}/annotate.$$
+mkdir -m 0700 ${tmpd}
+rc=$?
+if test $rc -ne 0 ; then
+	cat << EOF
+
+$0:  ERROR -- failed to securily create ${tmpd}
+Check to make sure that the directory does not already
+exist and that you have sufficient permissions to create it.
+
+mkdir returned $rc.
+
+EOF
+	exit 1
+fi
+
+# Determine the different refdes=?
+
+list=`@AWK@ '/^refdes=[A-Z]+\?/ {
+		A=$1; gsub(/refdes=/,"",A)
+		gsub(/\?/,"",A)
+		print A}' $1 | sort | @AWK@ 'BEGIN {if (NR==1) {A=$1} }{if (A !=$1) print ; A=$1}' - `
+
+
+if [ -z "$list" ]; then
+	echo "No new devices found!"
+	exit 0
+fi	
+
+# make a copy of the current schematics
+
+cp $1 $1.sauv
+
+# Replace the ? by a number 
+sc=${tmpd}/sc.awk
+
+for f in  $list; do 
+    # creation du script gawk 1 
+    echo "BEGIN {R=0}" >${sc}
+    echo "/^refdes=$f[0-9]+/ {B=\$1" >>${sc}
+    echo "gsub(/refdes=[A-Z]+/,\"\",B)" >>${sc}
+    echo "if (B>R) {R=B}" >>${sc}
+    echo "}" >>${sc}
+    echo "END {printf(\"%d\",R)}" >>${sc}
+    # execution des scripts
+    
+    IMAX=`@AWK@ -f ${sc} $1`
+    echo "Numbering of $f will start at $IMAX"
+    
+    # creation du script gawk 2 
+    
+    echo "BEGIN {R=MAX} ">${sc}
+    echo "{if (match(\$1,/^refdes=$f\?/)!=0) {" >>${sc}
+    echo "R=R+1" >>${sc}
+    echo "sub(/\?/,R,\$1)" >>${sc}
+    echo "print \$1 } " >>${sc}
+    echo "else {print \$0}}">>${sc}
+    
+    #echo "OK=1" >>${sc}
+    #echo "LL=NR}" >>${sc}
+    #echo "{" >>${sc}
+    #echo "if ((OK==1)&&(NR==LL+1)) {print \$1\" \"\$2\" \"\$3\" \"\$4\" \"\$5\" \"1\" \"\$7\" \"\$8 }" >>${sc}
+    #echo "if (NR==LL+2) {OK=0} " >>${sc}
+    #echo "if (OK==0) {print \$0} " >>${sc}
+    #echo "}" >>${sc}
+    
+    #execute the second script
+    
+    cat $1 | @AWK@ -v MAX=$IMAX -f ${sc}  - > $1.tmp
+    mv $1.tmp $1
+    
+done
+    
+# clean !
+
+rm  -fr ${tmpd}
+
diff --git a/gnetlist/scripts/bom_xref.sh.in b/gnetlist/scripts/bom_xref.sh.in
new file mode 100755
index 0000000..4d3308f
--- /dev/null
+++ b/gnetlist/scripts/bom_xref.sh.in
@@ -0,0 +1,10 @@
+#!/bin/sh
+# ha ha
+
+if [ -z "$1" ] ; then
+    echo "usage $0 geda-bom  # output on stdout"
+    exit -1
+fi    
+cat $1 | sort -k1,1 |\
+@AWK@ '!/device/{printf("%-5s %-20s %-20s %-20s\n", toupper($1), toupper($2), toupper($3), toupper($4));} /device/{}'
+
diff --git a/gnetlist/scripts/bompp.sh.in b/gnetlist/scripts/bompp.sh.in
new file mode 100755
index 0000000..4ab9696
--- /dev/null
+++ b/gnetlist/scripts/bompp.sh.in
@@ -0,0 +1,52 @@
+#!/bin/sh
+# ha ha
+
+if [ -z "$1" ] ; then
+    echo "usage $0 geda-bom  # output on stdout"
+    exit -1
+fi    
+cat $1 | @AWK@ '{print toupper($2)" "toupper($3)" "toupper($4)" "toupper($1)}'\
+| sort +0 | @AWK@ '\
+BEGIN {\
+f1="";f2="";f3="";\
+format1="%3d %-19s %-10s %-10s ";\
+format4="%-46s";\
+format2="%s, ";\
+format3="%s\n";\
+format5="%s,\n";\
+urefsperline=5;\
+printf(format1 format3, 0, "Device", "Value", "Footprint", "Urefs");\
+}\
+/^DEVICE/{}\
+!/^DEVICE/{\
+    if($1==f1 && $2==f2 && $3==f3) {\
+        array[ct++]=$4;\
+    } else {\
+        if(f1!="" && f2!="" && f3!="") { \
+            printf(format1, ct, f1, f2, f3);\
+	    for(i=0; i<ct-1; i++) {\
+	        if((i+1)%urefsperline) {\
+		    printf(format2, array[i]);\
+		} else {\
+		    printf(format5 format4, array[i], "");\
+		}\
+	    }\
+	    printf(format3, array[i]);\
+        }\
+        f1=$1;f2=$2;f3=$3;ct=0;array[ct++]=$4;\
+    }\
+}\
+END{\
+    if(f1!="" && f2!="" && f3!="") { \
+        printf(format1, ct, f1, f2, f3);\
+	for(i=0; i<ct-1; i++) {\
+	    if((i+1)%urefsperline) {\
+	    printf(format2, array[i]);\
+	} else {\
+	    printf(format5 format4, array[i], "");\
+	}\
+    }\
+    printf(format3, array[i]);\
+}\
+}'
+




_______________________________________________
geda-cvs mailing list
geda-cvs@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-cvs