info-cvs
[Top][All Lists]
Advanced

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

Re: Problems with Trigger Scripts and CVS Pre-Commit Hooks


From: Yaron Yogev
Subject: Re: Problems with Trigger Scripts and CVS Pre-Commit Hooks
Date: Tue, 27 Jul 2010 02:59:14 -0700 (PDT)
User-agent: G2/1.0

On Jul 27, 12:51 pm, Traiano Welcome
<address@hidden> wrote:
> No luck, from the debug below, I see "%{s}" being interpreted literally:
>
> ---
>
> address@hidden ~/cvswork/ZONES]$ cvs commit DB.evasive.org.za
>
> + echo %{s}
> + cut -d . -f 2,3,4,5,6
> + ZONE=%{s}
> + ZONE_FILE=DB.%{s}
> + named-checkzone %{s} DB.%{s}
>
> zone %{s}/IN: loading from master file DB.%{s} failed: file not found
>
> cvs commit: Pre-commit check failed
> cvs [commit aborted]: correct above errors first!
>
> ----
>
> On 2010/07/27 10:42 AM, "Yaron Yogev" <address@hidden> wrote:
>
>
>
>
>
> > Hi,
>
> > change %s --> %{s}
>
> > Yaron
>
> > On Jul 27, 10:24 am, Traiano Welcome
> > <address@hidden> wrote:
> >> Hi Yaron
>
> >> The specific line is as follows:
>
> >>  ---
> >> named.data/ZONES/* /usr/local/bin/checkzone %s
> >>  ---
>
> >> This line is preceded by:
>
> >> ---
> >> ALL            $CVSROOT/CVSROOT/checkscript
> >> ---
>
> >> Which is a script run on all files commited.
>
> >> Traiano
>
> >> On 2010/07/26 9:31 AM, "Yaron Yogev" <address@hidden> wrote:
>
> >> Hi,
>
> >> Could you post the relevant line from the commitinfo file in CVSROOT
> >> directory your repository ?
>
> >> I have a similar case, and the commitinfo line looks like this:
> >> ALL /usr/local/bin/cvs_commit_verify  %r %p %m %{s}
>
> >> - ALL: means the script is called for any commit
> >> - /usr/local/bin/cvs_commit_verify: the name of the script to run
> >> (the rest of the explanations I just copied from the commitinfo
> >> header)
> >> - %r = repository (path portion of $CVSROOT)
> >> - %p = path relative to repository
> >> - %m = log message
> >> - %{s} = file name, file name, ...
>
> >> Yaron
>
> >> On Jul 24, 12:50 pm, Traiano Welcome
>
> >> <address@hidden> wrote:
> >>> Hi List
>
> >>> I use cvs to manage BIND9 DNS zone files, and would like to create a
> >>> pre-commit hook that will run a syntax checker on the zone file before 
> >>> it's
> >>> committed. To do this, I have a shell wrapper that takes the name of the
> >>> zone file as an argument and formats a command for the syntax checker. The
> >>> shell wrapper is called from the commitinfo file as follows:
>
> >>> ---
> >>> named.data/ZONES/* /usr/local/bin/checkzone %s
> >>> ---
>
> >>> And "%s" is supposed to be expanded to the name of the zone file when any
> >>> file under " named.data/ZONES/" is committed. The checkzone script is as
> >>> follows:
>
> >>> ---
> >>> #!/bin/sh -x
> >>> ZONE=`echo $1 | cut -d "." -f  2,3,4,5,6`
> >>> ZONE_FILE=DB.$ZONE
> >>> named-checkzone $ZONE $ZONE_FILE
> >>> ---
>
> >>> However, when I run the commit, the debug information shows the "%s"
> >>> variable is not being expanded to the name of the file, consequently the
> >>> shell script does not get the correct argument and the commit fails:
>
> >>> ---
> >>> address@hidden ~/named.data/ZONES]$ cvs commit  DB.evasive.co.za
>
> >>> + cut -d . -f 2,3,4,5,6
> >>> + echo %s
> >>> + ZONE=%s
> >>> + ZONE_FILE=DB.%s
> >>> + named-checkzone %s DB.%s
>
> >>> zone %s/IN: loading from master file DB.%s failed: file not found
>
> >>> cvs commit: Pre-commit check failed
> >>> cvs [commit aborted]: correct above errors first!
>
> >>> ---
>
> >>> Please could someone help me shed some light on this for me? I suspect 
> >>> it's
> >>> somehow related to the environment the script is being run in, but the
> >>> details escape me, and why "%s" is not being expanded is also beyond me at
> >>> the moment :-P
>
> >>> Thanks in Advance,
> >>> Traiano Welcome
>

Try adding a simple debug line in commitinfo, something like:
ALL echo got pre-commit of files: %{s} >> /tmp/pre_commit_log.txt

See if the contents of /tmp/pre_commit_log.txt contain the correct
file name(s).

Yaron


reply via email to

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