Andrew Dunstan wrote:
What makes you think this isn't possible to run pgindent? There are no
secret incantations.
The first hit newbies find looking for info about pgident is
http://blog.hagander.net/archives/185-pgindent-vs-dash.html which sure
looks like secret incantations to me. The documentation
src/tools/pgindent/README reads like a magic spell too:
find . -name '*.[ch]' -type f -print | \
egrep -v -f src/tools/pgindent/exclude_file_patterns | \
xargs -n100 pgindent src/tools/pgindent/typedefs.list
And it doesn't actually work as written unless you've installed
pgindent, entab/detab, and the specially patched NetBSD indent into the
system PATH somewhere--unreasonable given that this may be executing on
a source only tree that has never been installed.. The fact that the
documention is only in the README and not with the rest of the code
conventions isn't helping either.
The last time I tried to do this a few years ago I failed miserably and
never came back. I know way more about building software now though,
and just got this to work for the first time. Attached is a WIP wrapper
script for running pgident that builds all the requirements into
temporary directories, rather than expecting you to install anything
system-wide or into a PostgreSQL destination directory. Drop this into
src/tools/pgindent, make it executable, and run it from that directory.
Should do the right thing on any system that has "make" as an alias for
"gmake" (TODO to be better about that in the file, with some other
nagging things).
When I just ran it against master I got a bunch of modified files, but
most of them look like things that have been touched recently so I think
it did the right thing. A test of my work here from someone who isn't
running this for the first time would be helpful. If this works well
enough, I think it would make a good helper script to include in the
distribution. The loose ends to fix I can take care of easily enough
once basic validation is finished.
--
Greg Smith 2ndQuadrant US g...@2ndquadrant.com Baltimore, MD
PostgreSQL Training, Services, and 24x7 Support www.2ndQuadrant.us
#!/bin/bash -ex
# Presume that we're in the pgindent directory at the start.
# TODO this should switch to the directory where this script is located at,
# in case someone calls src/tools/pgident/run-pgident
# Back to the base directory
pushd ../../..
# Sanity check we're in the right place
if [ ! -d src/tools/pgindent ] ; then
echo run-pgindent can only be run from within the src/tools/pgindent
directory, aborting
popd
exit 1
fi
echo pgindent setting up environment
wget ftp://ftp.postgresql.org/pub/dev/indent.netbsd.patched.tgz
mkdir -p indent
cd indent
zcat ../indent.netbsd.patched.tgz | tar xvf -
rm -f indent.netbsd.patched.tgz
make
INDENT_DIR=`pwd`
cd ..
pushd src/tools/entab directory
make
ln -s entab detab
ENTAB_DIR=`pwd`
popd
export PATH="$INDENT_DIR:$ENTAB_DIR:$PATH"
wget -O src/tools/pgindent/typedefs.list
http://buildfarm.postgresql.org/cgi-bin/typedefs.pl
# This cleanup can only happen if there is already a makefile; assume
# that if there's isn't, this tree is clean enough
if [ -f GNUmakefile ] ; then
# TODO this may need to be "gmake" on some systems instead
make maintainer-clean
fi
echo pgindent starting run
find . -name '*.[ch]' -type f -print | \
egrep -v -f src/tools/pgindent/exclude_file_patterns | \
xargs -n100 src/tools/pgindent/pgindent src/tools/pgindent/typedefs.list
# Cleanup of utilities built temporarily here
unlink src/tools/entab/detab
rm -rf indent
popd
echo pgindent run complete
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers