Re: RPM source files should be in CVS (was Re: [GENERAL] psql -l) - Mailing list pgsql-hackers

From Thomas Lockhart
Subject Re: RPM source files should be in CVS (was Re: [GENERAL] psql -l)
Date
Msg-id 3B58CD77.C99254A8@alumni.caltech.edu
Whole thread Raw
In response to Re: RPM source files should be in CVS (was Re: [GENERAL] psql -l)  (Lamar Owen <lamar.owen@wgcr.org>)
List pgsql-hackers
> > On to the next batch....  There are a few perl and python scripts shipped as
> > examples -- every last one of them shebangs to '/usr/local/perl' or
> > '/usr/local/python' -- to make them usable, I patch this to '/usr/bin/perl'
> > or python, as appropriate.
> Hmm.  Given that they're only examples, and are clearly going to be
> broken until hand-edited on many systems not only RedHat, it's not clear
> that this is worth your worrying about.

Ack! There is a way to write this stuff to be portable. The tricks
change a bit depending on the scripting language you are using, but for
perl this is how the header should look:

#!/bin/sh
# -*- perl -*-
# the line above helps with emacs, and put other comments here...

eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}'   & eval 'exec perl -S $0 $argv:q'   if 0;

# real perl code follows...


There is no reason to have a dependency on anything but the location of
sh, which is much more reliable than locations for perl, tcl, etc etc.
Not sure the exact form of this technique for python (maybe the same as
above) but there is a similar but not identical form for tcl code
(examples available on request; the above for perl is demonstrated in
contrib/rserv/*.in).
                        - Thomas


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Re: RPM source files should be in CVS (was Re: [GENERAL] psql -l)
Next
From: Sean Chittenden
Date:
Subject: IDEA: Multi-master replication possible through spread (or even master-slave)...