info-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: verifymsg: How to pass log message (check-in comments)?


From: Todd Denniston
Subject: Re: verifymsg: How to pass log message (check-in comments)?
Date: Wed, 15 Oct 2008 12:37:17 -0400
User-agent: Thunderbird 2.0.0.16 (X11/20080707)

Grey-Cells wrote, On 10/15/2008 10:21 AM:
I want to verify whether the check-in comments are not null or are in
a certain format. I had figured out that verifymsg does the thing for
me. I had written a script that will do the necessary checks, but some
how I cant get the log message (check-in comments) passed to the
script.

The entry in the verifymsg looks like this:
testcvsmodule/* perl -S verify.pl %l %p %r ${USER}

I tried various version of it ..
testcvsmodule/* perl -S verify.pl
testcvsmodule/* perl -S verify.pl %1
testcvsmodule/* perl -S verify.pl %l %p %r ${USER}
testcvsmodule/* perl -S verify.pl ${l} ${USER}
testcvsmodule/* perl -S verify.pl %{$sV}

But unable to pass the required parameter.

May be I am missing something very simple.
Any help would be appreciated.
Thanks
Amol.


If it was being done in bash:
$CVSROOT/CVSROOT/verifymsg contains:
testcvsmodule /myscripts/verify.sh


/myscripts/verify.sh contains:
#! /bin/bash
#$1 will be the name of the comment file
if head -2 < $1 | tail -1 | grep "PCR#:" > /dev/null;
then
  echo "I am analysing your PCR#"
else
  echo " "
  echo "Not using the form I see."
  echo " "
  exit 1
fi

so in perl I would think:

$CVSROOT/CVSROOT/verifymsg contains:
testcvsmodule /myscripts/verify.pl

/myscripts/verify.pl contains:
#! /usr/bin/perl
$PATH_AND_FILENAME="$ARGV[0]";
open (SOURCE_FILE,$PATH_AND_FILENAME) || die "Unable to open $PATH_AND_FILENAME for input.\nerror indicated was ($!).\n";
$MYCOUNTER=0;
while ($LINE = <SOURCE_FILE>)
  {
    $MYCOUNTER=$MYCOUNTER+1;
    $START_INDEX = index($LINE,"PCR#:");
    if ($MYCOUNTER == 2)
    {
        if ($START_INDEX != -1)
         {
                print "I am analysing your PCR#\n";
         }
        else
         {
                print " \n";
                print "Not using the form I see.\n";
                print " \n";
                exit 1;
         }
     }
 }

does the same thing.

of course I assume someone has done
chmod +x /myscripts/verify.pl /myscripts/verify.sh

--
Todd Denniston
Crane Division, Naval Surface Warfare Center (NSWC Crane)
Harnessing the Power of Technology for the Warfighter




reply via email to

[Prev in Thread] Current Thread [Next in Thread]