info-cvs
[Top][All Lists]
Advanced

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

Re: "notify" file


From: Derek R. Price
Subject: Re: "notify" file
Date: Thu, 07 Dec 2000 10:19:14 -0500

Laird Nelson wrote:

> How about take a chapter out of the CGI/web book and shove all
> parameters in url-encoded form on STDIN?  Then people can use existing
> code libraries/snippets to parse this string into name/value pairs.
> Just like an HTTP POST form submission.  Then you don't have to remember
> which 2037 arguments to add to the script invocation in the *info file,
> and the script's environment isn't filled up unless the script wants it
> to be.

CGI data comes in on STDIN?  Huh.  I programmed them for a year or so using the 
Perl libraries and never
realized that.  Let's hear it for high-level languages.  :)


> So here's an example (the following would show up on stdin of the
> commitinfo program, let's say):
>
> dir=foo&filespec=a%7c1.2%7c1.3%7cOLD_TAG&filespec=b%7c1.1%7c1.2%7cOLD_TAG&cvsroot=wherever
>
> Running this through a standard URL unescaper (perl -MCGI -e 'print
> unescape("dir=foo&filespec=a%7c1.2%7c1.3%7cOLD_TAG&filespec=b%7c1.1%7c1.2%7cOLD_TAG&cvsroot=wherever");')
> yields:

Hmm.  Two things:

1)  I think XML might still be preferable to CGI.  It would provide a more 
expandable way to encapsulate the
data.  For example, even though the script was set up to handle a single 
directory at a time, a change in
the CVS source (and perhaps a switch in a config file) could start passing data 
on multiple directories
without changing the DTD and maybe not changing the hung script.

2)  CGI or XML, it's also going to drastically increase the cost of entry of 
creating a new script to hang
as I'm not familiar with any CGI or XML libraries written in/for Bourne shells. 
 I _do_think there is a
simple solution to this, which is to write a simple sourcable one ourselves and 
install it into
$CVSROOT/CVSROOT.  Then a minimal Bourne shell script that wanted to use any 
data passed by CVS would look
something like (I'm using callbacks since I think it's more expandable):

    #!/bin/sh
    # an example commitinfo script
    . some_access_functions
    do_file()
    {
        if user_has_access checkin $repository $directory $file; then
            :
        else
            exit 1
        fi
    }
    . $CVSROOT/CVSROOT/get_data_and_run

I suppose get_data_and_run wouldn't have to use callback hooks, but I like that 
model better.

Derek

--
Derek Price                      CVS Solutions Architect ( http://CVSHome.org )
mailto:address@hidden     OpenAvenue ( http://OpenAvenue.com )
--
One woman has hurt you and you'll take it out on the rest of the world?  You're
a coward and a weakling!

                - Ingrid Bergman as Elsa, _Casablanca_






reply via email to

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