From mboxrd@z Thu Jan 1 00:00:00 1970 From: Doug Fraser To: sourcenav@sourceware.cygnus.com Subject: RE: SN 5.0 html docs Date: Thu, 06 Sep 2001 04:52:00 -0000 Message-id: X-SW-Source: 2001-q3/msg00139.html Hello, Attached below is a simple shell script and a description of a file list that it uses to generate 'import' files that can be used to manage pseudo projects that can be stored in CVS. It allows developers to share a common files list with relative paths and generates full local paths useable by snavigator. Enjoy. Embellishments and feedback welcome. Send it to the whole group. Doug > -----Original Message----- > From: Peter Milne [ mailto:peter@remware.demon.co.uk ] > Sent: Wednesday, September 05, 2001 4:30 PM > To: Doug Fraser > Cc: sourcenav@sourceware.cygnus.com > Subject: Re: SN 5.0 html docs > > > Doug Fraser wrote: > > > > > > >Another thing, I have a method of collecting file > >path names into a text file, and a shell script that > >filters those relative path names into a temp file > >as full path names and starting source navigator > >using the created temp file as an import file. > >It works okay and lets us set up pseudo-projects > >that can be stored in CVS and shared between > >developers. If anyone is interested in the shell > >script I will attach it to the list. Sure, it could > >have been prettier in TCL, but I don't know TCL..... > > > Script sounds great. Please let us see it. > Having a project with full path names is no good when you > want to use it from different work areas. So, our source tree is broken up into subdirectories that support individual targets (boards), with each subdirectory broken into at the least; src, include, drv, and build The relative tree might look like this: ./product/board1 ./product/board2 ./product/board3 and a given board would look like: ./product/board1/src ./product/board1/drv ./product/board1/include ./product/board1/build and we also have a common area for shared headers and build scripts ./common/include We added a subdirectory to each board, named snlst. It holds one or more files that list the source and include files used to create a process that runs on that board. So add another directory ./product/board1/snlst The contents and format of that file are as follows: src/ThisClass.cc src/ThatClass.cc src/AnotherClass.cc src/SomeClient.cc src/BigServer.cc ../common/include/BaseClass.h include/ThisClass.h include/ThatClass.h include/AnotherClass.h include/SomeClient.h include/BigServer.h If you are currently in the board directory (for example, ./product/board1), you can run the following script (I call it snrun), and it will display a menu listing the files that you have created in the snlst directory, and if you select a valid file, it creates a /tmp/file (unique) that provides full path names to your source suitable for snavigator. It then starts snavigator with a temporary project file. When you close out the session, all the files are removed. This script is written in KSH, that is what I use, but should port easily to other shells as well. #!/bin/ksh if [ ! -d snlst ] then echo No snlst directory in this node. exit fi PS3="select product> " FILELST=`find snlst -maxdepth 1 -type f -print` select PRODUCT in $FILELST do case $PRODUCT in $FILELST) break ;; *) ;; esac if [ ! -d $PRODUCT ] then PRODUCT=`basename $PRODUCT` break fi done print "You selected $REPLY ) $PRODUCT" HERE=`pwd`/ TMP=/tmp/snrun # create and chmod the tmp dir. Redirect to /dev/null if it # already exists.... mkdir ${TMP} > /dev/null 2>&1 chmod 777 ${TMP} > /dev/null 2>&1 IMPORT=${TMP}/${PRODUCT}$$.import PROJ=${TMP}/${PRODUCT}$$.proj LIST=${HERE}/snlst/${PRODUCT} trap "rm ${IMPORT} ${PROJ} > /dev/null 2>&1" EXIT INT TERM QUIT # Yup. That is a magic sed script. The contents of the first [] pair # is a tab and a space sed -e 's/^[ ]*//' -e '/^$/d' -e "s?^?${HERE}?" ${LIST} | while read F do if [ -f ${F} ] then print ${F} fi done > ${IMPORT} snavigator -import ${IMPORT} ${PROJ} src/ThisClass.cc src/ThatClass.cc src/AnotherClass.cc src/SomeClient.cc src/BigServer.cc ../common/include/BaseClass.h inc/ThisClass.h inc/ThatClass.h inc/AnotherClass.h inc/SomeClient.h inc/BigServer.h