LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 11-17-2004, 10:34 AM   #1
alex.e.c
LQ Newbie
 
Registered: Aug 2003
Location: London, Engerland
Distribution: Debian (kernel 2.6.0)
Posts: 14

Rep: Reputation: 0
tla hooking for cvs ids


I want to get tla to write the archive and revision of the file into the file on commit in a similar way that cvs does with the $Id$ feature. I have a vague idea that this should be possible using a hook. Any ideas. Do hook occur prior or post the commit?

So far I have

tla-hook-cvs-ids

Code:
#!/bin/bash

ACTION=$1

case $ACTION in
	commit)
		tla-cvs-ids
			VER="$ARCH_ARCHIVE $ARCH_CATEGORY--$ARCH_BRANCH--$ARCH_VERSION--$ARCH_REVISION"
			find . -exec tla-cvs-id {} "$VER" \;
        ;;
esac
tla-cvs-id

Code:
#! /bin/bash

usage="$0 filename ?version?
  
  This will replace \$Id\$ with the tla version and branch
"

if [ $# = 0 ]; then
	echo $usage > /dev/stderr
	exit 1
fi

FILE=$1
VER=$2

TMP=/tmp/tla-cvs-ids.$$
rm -Rf $TMP
mkdir $TMP

tla file-find $FILE > $TMP/tla-file-find

#./L/++pristine-trees/unlocked/C/C--B/C--B--V/A/C--B--V--P/N

if [ "$VER" == "" ]; then
# get the version
	VER=`sed 's/.\/[^\/]*\/[^\/]*\/[^\/]*\/[^\/]*\/[^\/]*\/[^\/]*\/\([^\/]*\)\/\([^\/]*\)\/.*/\1 \2/' $TMP/tla-file-find`
fi

echo $VER

# get the tail of the file name
echo $FILE > $TMP/filename
FILETAIL=`sed 's/^.*\/\(.*\)$/\1/' $TMP/filename`

# generate the sed to replace the information
SED="s/\\\$Id[^\$]*\\\$/\\\$Id tla $VER $FILETAIL \\\$/"

cp $FILE $TMP/filecontent

# replace the id with the current one
sed "$SED" $TMP/filecontent > $TMP/newfilecontent

# copy the new file into place
cp $TMP/newfilecontent $FILE

# remove temp
rm -R $TMP
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
interrupt hooking in linux fuzzyBuzz Programming 1 09-21-2005 07:20 PM
Hooking two computers up to each other possible? Devbmx Linux - Networking 14 03-01-2005 06:45 PM
Hooking a TV as a monitor SimpleLinuxuser Linux - Hardware 2 02-05-2005 05:16 PM
Hooking up Linux to Cable Surfin'Gumby Linux - Networking 10 05-25-2004 08:32 AM
hooking up to internet w/ LAN studpenguin Linux - Newbie 6 12-18-2003 04:25 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 04:31 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration