Experimental Physics and Industrial Control System
Glad to see folks using CVS. We've solved the links problem quite effectively
with some simple scripts that create and delete links based on a text link
sourcefile. This proves to be a more convenient way to manage links than
usual since once they are laid out in a textfile it is easy to reorganize
them and make improvements - like making all links in a tree work via a
'release' link in the root directory of the tree - making changing versions
a single link change rather than a mess. Below I'm including some examples
of the technique. Once the links have been moved into the textfile 'getrel'
is no longer used.
Alan K Biocca
ALS Control Systems Group
=========================================================================
The following was done for the Gammasphere EPICS based liquid nitrogen
filling system and has been used in a number of projects since..
-------------------------------------------------------
Example of a link definition textfile. This is the file checked into
CVS to define the links within the tree:
# links for lnfiller under R3.12 (Loren Shalz)
# epics
base -> /vxboot/epics/R3.12B9-LBL/base/
ascii -> base/src/ascii/
config -> /vxboot/epics/R3.12B9-LBL/config/
extensions -> /vxboot/epics/R3.12B9-LBL/extensions
default.dctsdr -> base/rec/default.dctsdr
default.sdrSum -> base/rec/default.sdrSum
include -> base/include/
dl/dm -> ../.epicsUnix/sun4/bin/dm
dl/edd -> ../.epicsUnix/sun4/bin/edd
dl/getempmon.dl -> /vxboot/lnfill/dl/getempmon.dl
dl/getemptot.dl -> /vxboot/lnfill/dl/getemptot.dl
# vxworks
vw -> /home/epics/devel/vxWorks/vxw_5.1.1/
targetmv167 -> base/bin/mv167/
startup.cmd -> startup.prod
--------------------------------------------------
Script to make links from textfile:
#!/bin/gawk -f
# mk_links <linkfile> make links
# 930518 Alan K Biocca
{
if ($1 ~ /^#/) next # ignore comment lines
if ($1 == "") next # ignore blank lines
if ($2 == "->") # if valid link line format
{
print " linking",$1,"->",$3
system("rm -f "$1)
system("ln -s "$3" "$1)
}
else print "mk_links didn't understand:",$0
}
----------------------------------------------------
Script to remove links specified from textfile:
#!/bin/gawk -f
# rm_links <linkfile> remove links
# 930518 Alan K Biocca
{
if ($1 ~ /^#/) next
if ($1 == "") next
if ($2 == "->")
{
# print " removing",$1
system("rm -f "$1)
}
else print "rm_links didn't understand:",$0
}
-----------------------------------------------------
Script to list all links in subtree in compatible text format:
#!/bin/gawk -f
# ls_links lists existing links
# 930518 Alan K Biocca
BEGIN {
cmd = "find . -type l -ls"
while ((cmd | getline) > 0)
{
sub("./","",$11)
print $11,$12,$13
}
}
-------------------------------------------------------
Makefile section that handles links (after cvs checkout do 'make links').
This is part of the makefile in the top level directory. It builds
all the links in the whole tree from the 'links' definition in the
tools directory and the programs there. It then creates a 'links'
touchfile in the top level directory to compare with the 'tools/links'
link definition file. Whenever this definition file is updated the links
are out of date and make will rebuild them.. It functions just like other
source-object file relations that make handles. 'Make rm-links'
unconditionally removes only those links that are represented in the
link definition file. Thus after doing this an 'ls_links' command
will show those that are not specified in the link definition file.
links: tools/links
@echo "making links"
@tools/mk_links tools/links
@touch links
rm-links::
@echo "removing links"
@tools/rm_links tools/links
@rm -f links
- Navigate by Date:
- Prev:
Re: application directories and CVS, GNU make etc Nick Rees
- Next:
Re: application directories and CVS, GNU make etc William Lupton
- Index:
1994
<1995>
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
- Navigate by Thread:
- Prev:
Re: application directories and CVS, GNU make etc Marty Kraimer
- Next:
free_gdct. Am I missing a resources file?? 415
- Index:
1994
<1995>
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024