This is the mail archive of the ecos-patches@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Using ecosadmin.tcl with the latest Cygwin Tcl shell


This patch modifies all .tcl files in the eCos repository which use
#! magic such that they can be invoked directly from a shell prompt
under both Linux and Cygwin including recent Cygwin installations
featuring the tclsh83.exe Tcl shell.

In addition, ecosadmin.tcl is modified to accept UNIX-style paths
to .epk files on a Cygwin host.

John Dallaway

--cut here--

Index: ChangeLog
===================================================================
RCS file: /cvs/ecos/ecos/packages/ChangeLog,v
retrieving revision 1.94
diff -u -5 -r1.94 ChangeLog
--- ChangeLog	24 Jan 2003 18:47:53 -0000	1.94
+++ ChangeLog	29 Jan 2003 10:27:07 -0000
@@ -1,5 +1,13 @@
+2003-01-29  John Dallaway  <jld@ecoscentric.com>
+
+	* ecosadmin.tcl: Accommodate UNIX-style paths under Cygwin when
+	adding packages.
+
+	* pkgconf/fixhtml.tcl: Accommodate latest Cygwin Tcl shell
+	(tclsh83.exe)
+
 2003-01-24  Knud Woehler <knud.woehler@microplex.de>
 2003-01-24  Mark Salter  <msalter@redhat.com>

 	* ecos.db: Add packages for XScale PXA2x0/MPC50.

Index: ecosadmin.tcl
===================================================================
RCS file: /cvs/ecos/ecos/packages/ecosadmin.tcl,v
retrieving revision 1.11
diff -u -5 -r1.11 ecosadmin.tcl
--- ecosadmin.tcl	24 Jan 2003 16:58:47 -0000	1.11
+++ ecosadmin.tcl	29 Jan 2003 10:27:12 -0000
@@ -1,17 +1,11 @@
-#!/bin/sh
-# these lines restart using the tcl shell \
-  exec sh -c "if ( echo | tclsh ) 2>/dev/null ; then \
-      exec tclsh \"${0}\" ${1+${*}} ; \
-    elif ( echo | tclsh83 ) 2>/dev/null ; then \
-      exec tclsh83 \"${0}\" ${1+${*}} ; \
-    elif ( echo | cygtclsh80 ) 2>/dev/null ; then \
-      exec cygtclsh80 \"${0}\" ${1+${*}} ; \
-    else \
-      echo Could not find TCL interpreter ; \
-      exit 1 ; \
-    fi"
+#!/bin/bash
+# restart using a Tcl shell \
+    exec sh -c 'for tclshell in tclsh tclsh83 cygtclsh80 ; do \
+            ( echo | $tclshell ) 2> /dev/null && exec $tclshell "`( cygpath -w \"$0\" ) 2> /dev/null || echo $0`" "$@" ; \
+        done ; \
+        echo "ecosadmin.tcl: cannot find Tcl shell" ; exit 1' "$0" "$@"

 # {{{  Banner

 #===============================================================================
 #
@@ -465,16 +459,13 @@
 			# An unrecognised argument.
 			fatal_error "invalid argument $args($i)"
 		}
 	}

-	# Under Windows it is desirable to do some checking on any directories that
-	# have been provided. Some cygwin pathnames that a user might supply are
-	# not acceptable to Tcl.
-	if { $ecosadmin::windows_host } {
-		set ecosadmin::component_repository [get_pathname_for_tcl $ecosadmin::component_repository]
-	}
+	# Convert user-specified UNIX-style Cygwin pathnames to Windows Tcl-style as necessary
+	set ecosadmin::component_repository [get_pathname_for_tcl $ecosadmin::component_repository]
+	set ecosadmin::add_package [get_pathname_for_tcl $ecosadmin::add_package]
 }
 
 #
 # Display help information if the user has typed --help, -H, --H, or -help.
 # The help text uses two hyphens for consistency with configure.
Index: fs/rom/current/ChangeLog
===================================================================
RCS file: /cvs/ecos/ecos/packages/fs/rom/current/ChangeLog,v
retrieving revision 1.7
diff -u -5 -r1.7 ChangeLog
--- fs/rom/current/ChangeLog	23 May 2002 23:01:39 -0000	1.7
+++ fs/rom/current/ChangeLog	29 Jan 2003 10:27:29 -0000
@@ -1,5 +1,10 @@
+2003-01-29  John Dallaway  <jld@ecoscentric.com>
+
+	* support/file2c.tcl: Accommodate latest Cygwin Tcl shell
+	(tclsh83.exe)
+
 2002-04-15  Bart Veer  <bartv@redhat.com>

 	* support/file2c.tcl:
 	Do not use an alignment attribute, since it is not honoured on
 	all targets.
Index: fs/rom/current/support/file2c.tcl
===================================================================
RCS file: /cvs/ecos/ecos/packages/fs/rom/current/support/file2c.tcl,v
retrieving revision 1.3
diff -u -5 -r1.3 file2c.tcl
--- fs/rom/current/support/file2c.tcl	23 May 2002 23:01:40 -0000	1.3
+++ fs/rom/current/support/file2c.tcl	29 Jan 2003 10:27:30 -0000
@@ -1,15 +1,11 @@
-#!/bin/sh
-# these lines restart using the tcl shell \
-  exec sh -c "if ( echo | tclsh ) 2>/dev/null ; then \
-      exec tclsh \"${0}\" ${1+${*}} ; \
-    elif ( echo | cygtclsh80 ) 2>/dev/null ; then \
-      exec cygtclsh80 \"${0}\" ${1+${*}} ; \
-    else \
-      echo Could not find TCL interpreter ; \
-      exit 1 ; \
-    fi"
+#!/bin/bash
+# restart using a Tcl shell \
+    exec sh -c 'for tclshell in tclsh tclsh83 cygtclsh80 ; do \
+            ( echo | $tclshell ) 2> /dev/null && exec $tclshell "`( cygpath -w \"$0\" ) 2> /dev/null || echo $0`" "$@" ; \
+        done ; \
+        echo "file2c.tcl: cannot find Tcl shell" ; exit 1' "$0" "$@"
 
 #===============================================================================
 #
 #    file2c.tcl
 #
Index: hal/arm/aeb/current/ChangeLog
===================================================================
RCS file: /cvs/ecos/ecos/packages/hal/arm/aeb/current/ChangeLog,v
retrieving revision 1.27
diff -u -5 -r1.27 ChangeLog
--- hal/arm/aeb/current/ChangeLog	23 May 2002 23:01:40 -0000	1.27
+++ hal/arm/aeb/current/ChangeLog	29 Jan 2003 10:27:32 -0000
@@ -1,5 +1,10 @@
+2003-01-29  John Dallaway  <jld@ecoscentric.com>
+
+	* src/flash_cksum.tcl: Accommodate latest Cygwin Tcl shell
+	(tclsh83.exe)
+
 2002-05-23  Jesper Skov  <jskov@redhat.com>

 	* cdl/hal_arm_aeb.cdl: Don't run cache tests.

 2002-05-13  Jesper Skov  <jskov@redhat.com>
Index: hal/arm/aeb/current/src/flash_cksum.tcl
===================================================================
RCS file: /cvs/ecos/ecos/packages/hal/arm/aeb/current/src/flash_cksum.tcl,v
retrieving revision 1.7
diff -u -5 -r1.7 flash_cksum.tcl
--- hal/arm/aeb/current/src/flash_cksum.tcl	23 May 2002 23:01:41 -0000	1.7
+++ hal/arm/aeb/current/src/flash_cksum.tcl	29 Jan 2003 10:27:33 -0000
@@ -1,15 +1,11 @@
-#!/bin/sh
-# these lines restart using the tcl shell \
-  exec sh -c "if ( echo | tclsh ) 2>/dev/null ; then \
-      exec tclsh \"${0}\" ${1+${*}} ; \
-    elif ( echo | cygtclsh80 ) 2>/dev/null ; then \
-      exec cygtclsh80 \"${0}\" ${1+${*}} ; \
-    else \
-      echo Could not find TCL interpreter ; \
-      exit 1 ; \
-    fi"
+#!/bin/bash
+# restart using a Tcl shell \
+    exec sh -c 'for tclshell in tclsh tclsh83 cygtclsh80 ; do \
+            ( echo | $tclshell ) 2> /dev/null && exec $tclshell "`( cygpath -w \"$0\" ) 2> /dev/null || echo $0`" "$@" ; \
+        done ; \
+        echo "flash_cksum.tcl: cannot find Tcl shell" ; exit 1' "$0" "$@"

 #===============================================================================
 #
 #    flash_cksum.tcl
 #
Index: hal/arm/e7t/current/ChangeLog
===================================================================
RCS file: /cvs/ecos/ecos/packages/hal/arm/e7t/current/ChangeLog,v
retrieving revision 1.7
diff -u -5 -r1.7 ChangeLog
--- hal/arm/e7t/current/ChangeLog	5 Nov 2002 02:31:11 -0000	1.7
+++ hal/arm/e7t/current/ChangeLog	29 Jan 2003 10:27:36 -0000
@@ -1,5 +1,10 @@
+2003-01-29  John Dallaway  <jld@ecoscentric.com>
+
+	* src/flash_cksum.tcl: Accommodate latest Cygwin Tcl shell
+	(tclsh83.exe)
+
 2002-10-19  Jonathan Larmour  <jifl@eCosCentric.com>

 	* include/hal_platform_setup.h (PLATFORM_SETUP1): Only define if
 	ROM or ROMRAM, not if STUBS which can be RAM.
 
Index: hal/arm/e7t/current/src/flash_cksum.tcl
===================================================================
RCS file: /cvs/ecos/ecos/packages/hal/arm/e7t/current/src/flash_cksum.tcl,v
retrieving revision 1.3
diff -u -5 -r1.3 flash_cksum.tcl
--- hal/arm/e7t/current/src/flash_cksum.tcl	23 May 2002 23:01:54 -0000	1.3
+++ hal/arm/e7t/current/src/flash_cksum.tcl	29 Jan 2003 10:27:37 -0000
@@ -1,15 +1,11 @@
-#!/bin/sh
-# these lines restart using the tcl shell \
-  exec sh -c "if ( echo | tclsh ) 2>/dev/null ; then \
-      exec tclsh \"${0}\" ${1+${*}} ; \
-    elif ( echo | cygtclsh80 ) 2>/dev/null ; then \
-      exec cygtclsh80 \"${0}\" ${1+${*}} ; \
-    else \
-      echo Could not find TCL interpreter ; \
-      exit 1 ; \
-    fi"
+#!/bin/bash
+# restart using a Tcl shell \
+    exec sh -c 'for tclshell in tclsh tclsh83 cygtclsh80 ; do \
+            ( echo | $tclshell ) 2> /dev/null && exec $tclshell "`( cygpath -w \"$0\" ) 2> /dev/null || echo $0`" "$@" ; \
+        done ; \
+        echo "flash_cksum.tcl: cannot find Tcl shell" ; exit 1' "$0" "$@"

 #===============================================================================
 #
 #    flash_cksum.tcl
 #
Index: hal/mips/ref4955/current/ChangeLog
===================================================================
RCS file: /cvs/ecos/ecos/packages/hal/mips/ref4955/current/ChangeLog,v
retrieving revision 1.6
diff -u -5 -r1.6 ChangeLog
--- hal/mips/ref4955/current/ChangeLog	6 Aug 2002 16:00:15 -0000	1.6
+++ hal/mips/ref4955/current/ChangeLog	29 Jan 2003 10:27:50 -0000
@@ -1,5 +1,10 @@
+2003-01-29  John Dallaway  <jld@ecoscentric.com>
+
+	* misc/slow_cat.tcl, misc/swap4.tcl:
+	Accommodate latest Cygwin Tcl shell (tclsh83.exe)
+
 2002-08-06  Gary Thomas  <gary@chez-thomas.org>
 2002-08-06  Motoya Kurotsu <kurotsu@allied-telesis.co.jp>	

 	* src/pc87338.c: I/O channel data can't be constant - contains
 	timeout information which can be changed.
Index: hal/mips/ref4955/current/misc/slow_cat.tcl
===================================================================
RCS file: /cvs/ecos/ecos/packages/hal/mips/ref4955/current/misc/slow_cat.tcl,v
retrieving revision 1.1
diff -u -5 -r1.1 slow_cat.tcl
--- hal/mips/ref4955/current/misc/slow_cat.tcl	3 Nov 2000 21:17:42 -0000	1.1
+++ hal/mips/ref4955/current/misc/slow_cat.tcl	29 Jan 2003 10:27:50 -0000
@@ -1,15 +1,11 @@
-#!/bin/sh
-# these lines restart using the tcl shell \
-  exec sh -c "if ( echo | tclsh ) 2>/dev/null ; then \
-      exec tclsh \"${0}\" ${1+${*}} ; \
-    elif ( echo | cygtclsh80 ) 2>/dev/null ; then \
-      exec cygtclsh80 \"${0}\" ${1+${*}} ; \
-    else \
-      echo Could not find TCL interpreter ; \
-      exit 1 ; \
-    fi"
+#!/bin/bash
+# restart using a Tcl shell \
+    exec sh -c 'for tclshell in tclsh tclsh83 cygtclsh80 ; do \
+            ( echo | $tclshell ) 2> /dev/null && exec $tclshell "`( cygpath -w \"$0\" ) 2> /dev/null || echo $0`" "$@" ; \
+        done ; \
+        echo "slow_cat.tcl: cannot find Tcl shell" ; exit 1' "$0" "$@"

 # Can be used like this:
 #  Get flash ready for programming using Minicom or similar
 #   [o (Option menu), a (flAsh menu), b (Boot write)]
 # Then execute the following
Index: hal/mips/ref4955/current/misc/swap4.tcl
===================================================================
RCS file: /cvs/ecos/ecos/packages/hal/mips/ref4955/current/misc/swap4.tcl,v
retrieving revision 1.1
diff -u -5 -r1.1 swap4.tcl
--- hal/mips/ref4955/current/misc/swap4.tcl	3 Nov 2000 21:17:42 -0000	1.1
+++ hal/mips/ref4955/current/misc/swap4.tcl	29 Jan 2003 10:27:50 -0000
@@ -1,15 +1,11 @@
-#!/bin/sh
-# these lines restart using the tcl shell \
-  exec sh -c "if ( echo | tclsh ) 2>/dev/null ; then \
-      exec tclsh \"${0}\" ${1+${*}} ; \
-    elif ( echo | cygtclsh80 ) 2>/dev/null ; then \
-      exec cygtclsh80 \"${0}\" ${1+${*}} ; \
-    else \
-      echo Could not find TCL interpreter ; \
-      exit 1 ; \
-    fi"
+#!/bin/bash
+# restart using a Tcl shell \
+    exec sh -c 'for tclshell in tclsh tclsh83 cygtclsh80 ; do \
+            ( echo | $tclshell ) 2> /dev/null && exec $tclshell "`( cygpath -w \"$0\" ) 2> /dev/null || echo $0`" "$@" ; \
+        done ; \
+        echo "swap4.tcl: cannot find Tcl shell" ; exit 1' "$0" "$@"
 
 proc filter { input_file output_file } {
     set input_fd [open $input_file  "r"]
     set output_fd  [open $output_file "w"]
 
Index: pkgconf/fixhtml.tcl
===================================================================
RCS file: /cvs/ecos/ecos/packages/pkgconf/fixhtml.tcl,v
retrieving revision 1.10
diff -u -5 -r1.10 fixhtml.tcl
--- pkgconf/fixhtml.tcl	15 Sep 2002 21:44:55 -0000	1.10
+++ pkgconf/fixhtml.tcl	29 Jan 2003 10:28:15 -0000
@@ -1,8 +1,11 @@
-#!/bin/sh
-# the next line restarts using tclsh \
- exec tclsh "$0" ${1+"$@"}
+#!/bin/bash
+# restart using a Tcl shell \
+    exec sh -c 'for tclshell in tclsh tclsh83 cygtclsh80 ; do \
+            ( echo | $tclshell ) 2> /dev/null && exec $tclshell "`( cygpath -w \"$0\" ) 2> /dev/null || echo $0`" "$@" ; \
+        done ; \
+        echo "fixhtml.tcl: cannot find Tcl shell" ; exit 1' "$0" "$@"

 #===============================================================================
 #
 #    fixhtml.tcl
 #
Index: services/memalloc/common/current/ChangeLog
===================================================================
RCS file: /cvs/ecos/ecos/packages/services/memalloc/common/current/ChangeLog,v
retrieving revision 1.24
diff -u -5 -r1.24 ChangeLog
--- services/memalloc/common/current/ChangeLog	23 May 2002 23:08:42 -0000	1.24
+++ services/memalloc/common/current/ChangeLog	29 Jan 2003 10:28:22 -0000
@@ -1,5 +1,10 @@
+2003-01-29  John Dallaway  <jld@ecoscentric.com>
+
+	* src/heapgen.tcl: Accommodate latest Cygwin Tcl shell
+	(tclsh83.exe)
+
 2002-05-10  Jonathan Larmour  <jlarmour@redhat.com>
 
 	* tests/heaptest.c (test_pat): Make failure messages clearer.
 	(cyg_start): Output what failures mean.

Index: services/memalloc/common/current/src/heapgen.tcl
===================================================================
RCS file: /cvs/ecos/ecos/packages/services/memalloc/common/current/src/heapgen.tcl,v
retrieving revision 1.6
diff -u -5 -r1.6 heapgen.tcl
--- services/memalloc/common/current/src/heapgen.tcl	23 May 2002 23:08:44 -0000	1.6
+++ services/memalloc/common/current/src/heapgen.tcl	29 Jan 2003 10:28:23 -0000
@@ -1,18 +1,11 @@
-#!/bin/sh
-# these lines restart using the tcl shell \
-    exec sh -c "if ( echo | cygtclsh80 ) 2>/dev/null ; then \
-      exec cygtclsh80 \"${0}\" \"\`echo \\\"\\\`cygpath -w \\\"${1}\\\" \\\`\\\" |sed 's#\\\\\\\\#/#g'\`\" \"\`echo \\\"\\\`cygpath -w \\\"${2}\\\" \\\`\\\" |sed 's#\\\\\\\\#/#g'\`\" ; \
-    elif ( echo | tclsh ) 2>/dev/null ; then \
-      exec tclsh \"${0}\" ${1+${*}} ; \
-    else \
-      echo Could not find TCL interpreter ; \
-      exit 1 ; \
-    fi"
-
-#FIXMEFIXMEFIXME the above should use cygpath -ws, not cygpath -w but we
-#can't rely on everyone having up-to-date cygwin tools (1.1.5+)
+#!/bin/bash
+# restart using a Tcl shell \
+    exec sh -c 'for tclshell in tclsh tclsh83 cygtclsh80 ; do \
+            ( echo | $tclshell ) 2> /dev/null && exec $tclshell "`( cygpath -w \"$0\" ) 2> /dev/null || echo $0`" "$@" ; \
+        done ; \
+        echo "heapgen.tcl: cannot find Tcl shell" ; exit 1' "$0" "$@"

 #===============================================================================
 #
 #    heapgen.tcl
 #


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]