Re: RPMs (was Pronunciation of "PostgreSQL") - Mailing list pgsql-hackers

From Thomas Lockhart
Subject Re: RPMs (was Pronunciation of "PostgreSQL")
Date
Msg-id 37AF9D06.A5896F93@alumni.caltech.edu
Whole thread Raw
In response to Re: Pronunciation of "PostgreSQL" (was: Re: [HACKERS] New man pages)  (Peter Eisentraut <peter@pathwaynet.com>)
List pgsql-hackers
> I have done some tests on
> the RPM-packaged perl client, with great success.

That's building the client into the distro-specific directories for
perl? Great...

> I am also
> experimenting with my new (3lo) RPM's, which are the first try to
> package the regression tests.  Now to see if they run ;-/  As soon as
> the RedHat 5.2 machine (a creaky 486-100 w/16MB) finishes a good build,
> I'll post.  Although, I am hitting snags -- the regression tests have
> some strange requirements -- ie, the resulting regress.so in the package
> is built to require /usr/local/bin/perl, and /usr/local/bin/python.....
> Oh well; I'll slog through it.

Keep on patching. It's pretty convenient for stuff like this...

> Now to learn enough python to be dangerous...

Dangerous doesn't take very long. I haven't progressed past that yet,
at least for python (others may suggest other topics too ;)

I was just rebuilding the plain RPMs to include the .a forms of the
libraries, and noticed problems with:

1) naming the programming language shared libraries (not libpltcl.so
but pltcl.so, etc)

2) finding bin/pgaccess/README.pga (it is obsolete)
2a) bin/pgaccess/README should be included in the pgaccess docs target

Here is the spec file for you to compare to previous versions; perhaps
you can forward your spec file so I don't have to download an entire
-src.rpm to start scoping it out?

                         - Thomas

--
Thomas Lockhart                lockhart@alumni.caltech.edu
South Pasadena, CaliforniaSummary: The Postgres SQL database package.
Name: postgresql
Version: 6.5.1
Release: 2
Copyright: BSD
Group: Applications/Databases
Source0: ftp://ftp.postgresql.org/pub/postgresql-%{version}.tar.gz
Source1: ftp://www.flex.ro/pub/pgaccess/pgaccess-0.96.tar.gz
Source2: http://www.retep.org.uk/postgres/jdbc6.5-1.1.jar
Source3: postgresql.init
Source4: pgsql-Database-HOWTO-html.tar.gz
Buildroot: /var/tmp/pgsql-root
Prefix: /usr
Prereq: /sbin/chkconfig /sbin/ldconfig /usr/sbin/useradd
Vendor: The PostgreSQL Global Development Group
Packager: Thomas Lockhart <lockhart@alumni.caltech.edu>
Url: http://www.postgresql.org/
ExcludeArch: alpha armv4l
Conflicts: postgresql-clients

%description
PostgreSQL is an advanced Object-Relational database management system
(DBMS) that supports almost all SQL constructs (including transactions,
subselects and user-defined types and functions).
postgresql includes the client programs and client libraries
that you'll need to access a PostgreSQL database management system
server.  This package contains the client libraries for C, and C++,
as well as command-line utilities for managing PostgreSQL databases on a
remote server. If you just want to connect to an existing remote
PostgreSQL server, this package is all you need.

You should install postgresql if you're installing postgresql-server.

%package server
Summary: The programs needed for a PostgreSQL server.
Group: Applications/Databases
Requires: postgresql = %{version}

%description server
postgresql-server includes the programs needed to create and run a PostgreSQL
server, which will in turn allow you to create and maintain PostgreSQL
databases.  PostgreSQL is an advanced Object-Relational database
management system (DBMS) that supports almost all SQL constructs
(including transactions, subselects and user-defined types and
functions).

You should install postgresql if you want to create and maintain your
own PostgreSQL databases and/or your own PostgreSQL server.

%package devel
Summary: PostgreSQL development header files and libraries.
Group: Development/Libraries

%description devel
This package contains the header files and libraries needed to
compile C or C++ applications which will directly interact with
a PostgreSQL server. It include the ecpg Embedded C Postgres
preprocessor.

Install this package if you want to develop applications which will
interact with a PostgreSQL server.

%package tcl
Summary: The tcl-based client programs needed for accessing a PostgreSQL server.
Group: Applications/Databases
Requires: tcl >= 8.0, tk >= 8.0

%description tcl
postgresql-tcl includes the tcl-based client programs and client libraries
that you'll need to access a PostgreSQL database management system
server.  This package contains the tcl client libraries,
as well as pgaccess, a wish-based utility for manipulating PostgreSQL databases.

%package odbc
Summary: The ODBC driver needed for accessing a PostgreSQL server.
Group: Applications/Databases

%description odbc
Postgresql-odbc includes the odbc driver and sample configuration files
that you'll need to access a PostgreSQL database management system
server.

%package perl
Summary: The perl-based client programs needed for accessing a PostgreSQL server.
Group: Applications/Databases
Requires: perl >= 5.004-4

%description perl
postgresql-perl includes the perl-based client programs and client libraries
that you'll need to access a PostgreSQL database management system
server.

%package python
Summary: The python-based client programs needed for accessing a PostgreSQL server.
Group: Applications/Databases
Requires: python >= 1.5

%description python
postgresql-python includes the python-based client programs and client libraries
that you'll need to access a PostgreSQL database management system
server.

%package jdbc
Summary: The java-based client programs needed for accessing a PostgreSQL server.
Group: Applications/Databases

%description jdbc
postgresql-jdbc includes the jar file that you'll need to access a PostgreSQL
database management system server.

%prep
%setup -q
cd src/bin
gzip -dc $RPM_SOURCE_DIR/pgaccess-0.96.tar.gz | tar -xvvf -

%build
pushd src
CFLAGS="$RPM_OPT_FLAGS" ./configure --prefix=/usr \
    --enable-hba --enable-locale \
    --with-perl \
    --with-tcl --with-tk --with-x \
    --with-odbc --with-java \
    --with-python
make all
pushd interfaces/python
cp /usr/lib/python1.5/config/Makefile.pre.in .
echo *shared* > Setup
echo _pg pgmodule.c -I../../include -I../libpq -L../libpq -lpq -lcrypt >> Setup
make -f Makefile.pre.in boot
make
popd
popd

make all PGDOCS=unpacked -C doc

%install
rm -rf $RPM_BUILD_ROOT
mkdir -p $RPM_BUILD_ROOT/usr/{include/pgsql,lib,bin}
mkdir -p $RPM_BUILD_ROOT/usr/lib/perl5/site_perl/%{buildarch}-linux/auto/Pg
make POSTGRESDIR=$RPM_BUILD_ROOT/usr PREFIX=$RPM_BUILD_ROOT/usr -C src install
make POSTGRESDIR=$RPM_BUILD_ROOT/usr PREFIX=$RPM_BUILD_ROOT/usr -C src/man install
make POSTGRESDIR=$RPM_BUILD_ROOT/usr PREFIX=$RPM_BUILD_ROOT/usr -C src/interfaces/perl5 install
# Get rid of the packing list generated by the perl Makefile, and build my own...
find $RPM_BUILD_ROOT/usr/lib/perl5 -name .packlist -exec rm -f {} \;
find $RPM_BUILD_ROOT/usr/lib/perl5 -type f -print | \
    sed -e "s|$RPM_BUILD_ROOT/|/|g" > perlfiles.list
find $RPM_BUILD_ROOT/usr/lib/perl5 -type d -name Pg -print | \
    sed -e "s|$RPM_BUILD_ROOT/|%dir /|g" >> perlfiles.list
make -C doc

# Move all includes beneath /usr/include/pgsql.
pushd $RPM_BUILD_ROOT/usr/include
rm -rf include
for f in *.h access commands executor lib libpq libpq++ port utils ; do
    mv $f pgsql
done
popd

# Move all templates/examples beneath /usr/lib/pgsql
pushd $RPM_BUILD_ROOT/usr/lib
mkdir -p pgsql
mv *source *sample pgsql
popd

# TCL/TK
install -m 0755 src/bin/pgaccess/pgaccess.tcl $RPM_BUILD_ROOT/usr/bin/pgaccess

# Perl
# No need to do anything right now. But later, we will try building everything
# on the target machine to use the architecture-specific installation features
# in the perl installation.
#pushd src/interfaces/perl5
#mkdir -p $RPM_BUILD_ROOT/usr/lib/pgsql/perl5
#cp Pg.pm $RPM_BUILD_ROOT/usr/lib/pgsql/perl5
#pushd blib/arch/auto/Pg
#cp Pg.so Pg.bs $RPM_BUILD_ROOT/usr/lib/pgsql/perl5
#popd
#popd

# Python
pushd src/interfaces/python
# Makefile.pre.in doesn't yet support .py files anyway, so we stick to a manual installation
mkdir -p $RPM_BUILD_ROOT/usr/lib/python1.5/site-packages
install -m 644 _pgmodule.so *.py $RPM_BUILD_ROOT/usr/lib/python1.5/site-packages/
popd

# Java/JDBC
# We know that JDK1.2 is pre-beta at this time, so just install the JDK1.1-compatible driver.
# The user will have to set a CLASSPATH to find it here, but not sure where else to put it...
install -m 755 $RPM_SOURCE_DIR/jdbc6.5-1.1.jar $RPM_BUILD_ROOT/usr/lib/pgsql

chmod 644 $RPM_BUILD_ROOT/usr/man/*/*
install -d $RPM_BUILD_ROOT/etc/rc.d/init.d
install -m 755 $RPM_SOURCE_DIR/postgresql.init $RPM_BUILD_ROOT/etc/rc.d/init.d/postgresql
for I in 3 5; do
    install -d $RPM_BUILD_ROOT/etc/rc.d/rc$I.d
    pushd $RPM_BUILD_ROOT/etc/rc.d/rc$I.d
    ln -s ../init.d/postgresql S99postgresql
    popd
done

## Create sample database
## Disabled because an in-place upgrade using rpm only is probably not the right thing to do.
## Also, it is a PITA; should let the user decide how to coordinate dump and reload if necessary.
mkdir -p $RPM_BUILD_ROOT/var/lib/pgsql
#PATH=/usr/sbin:$PATH useradd -M -r -d /var/lib/pgsql -s /bin/bash \
#    -c "PostgreSQL Server" postgres || :
#chown -R postgres.postgres $RPM_BUILD_ROOT/var/lib/pgsql
#export PATH=$PATH:$RPM_BUILD_ROOT/usr/bin
#[ ! -f $RPM_BUILD_ROOT/usr/lib/libpq.so.1 ] && ln -sf libpq.so $RPM_BUILD_ROOT/usr/lib/libpq.so.1
#unset ENV || :
#su postgres -c "LD_LIBRARY_PATH=$RPM_BUILD_ROOT/usr/lib \
#  $RPM_BUILD_ROOT/usr/bin/initdb --pgdata=$RPM_BUILD_ROOT/var/lib/pgsql \
#        --pglib=$RPM_BUILD_ROOT/usr/lib/pgsql"
#[ -L $RPM_BUILD_ROOT/usr/lib/libpq.so.1 ] && rm -f $RPM_BUILD_ROOT/usr/lib/libpq.so.1
## this was a good one
#chmod 640 $RPM_BUILD_ROOT/var/lib/pgsql/pg_pwd

mkdir -p howto
tar xzf $RPM_SOURCE_DIR/pgsql-Database-HOWTO-html.tar.gz -C howto
mkdir -p pgaccess
cp src/bin/pgaccess/README pgaccess
cp src/bin/pgaccess/*.html pgaccess
cp src/bin/pgaccess/*.sql pgaccess

# Strip 'em all
strip $RPM_BUILD_ROOT/usr/bin/* || :

%pre server
useradd -M -o -r -d /var/lib/pgsql -s /bin/bash \
    -c "PostgreSQL Server" postgres >/dev/null 2>&1 || :

%post -p /sbin/ldconfig

%post -p /sbin/ldconfig server

%post perl
# We *should* use the architecture-specific area to hold our perl interface.
# For now, we will use the architecture-neutral areas, and prebuild everything.
#PerlTarget=`perl -MConfig -e 'print $Config{archlib}'`
#pushd /usr/lib/pgsql/perl5
#mv Pg.pm $PerlTarget/
#mv Pg.so Pg.bs $PerlTarget/auto/Pg/
#popd

%post -p /sbin/ldconfig odbc

%post -p /sbin/ldconfig tcl

%preun
if [ $1 = 0 ] ; then
    chkconfig --del postgresql
fi

%postun -p /sbin/ldconfig

%postun server
/sbin/ldconfig
if [ $1 = 0 ] ; then
    userdel postgres >/dev/null 2>&1 || :
fi

%postun -p /sbin/ldconfig odbc

%postun -p /sbin/ldconfig tcl

%clean
rm -rf $RPM_BUILD_ROOT
rm -f perlfiles.list
rm -rf howto

%files
%defattr(-,root,root)
%doc doc/FAQ doc/FAQ_Linux doc/README*
%doc COPYRIGHT README HISTORY doc/bug.template
%doc contrib doc/unpacked/*
%doc doc/*.ps.gz
%doc howto
%doc pgaccess
%attr(755,root,root) /usr/lib/*.a
%attr(755,root,root) /usr/lib/libpq.so*
%attr(755,root,root) /usr/lib/libecpg.so*
%attr(755,root,root) /usr/lib/libpq++.so*
/usr/man/manl/*
/usr/bin/createdb
/usr/bin/createuser
/usr/bin/destroydb
/usr/bin/destroyuser
/usr/bin/pg_dump
/usr/bin/pg_dumpall
/usr/bin/pg_id
/usr/bin/psql
/usr/man/man1/createdb.1
/usr/man/man1/createuser.1
/usr/man/man1/destroydb.1
/usr/man/man1/destroyuser.1
/usr/man/man1/pg_dump.1
/usr/man/man1/pg_dumpall.1
/usr/man/man1/psql.1
/usr/man/man1/vacuumdb.1


%files server
%defattr(-,root,root)
%config /etc/rc.d/*
%attr(755,root,root) /usr/lib/plpgsql.so*
%attr(755,root,root) /usr/lib/pltcl.so*
/usr/man/man5/*
/usr/bin/cleardbdir
/usr/bin/initdb
/usr/bin/initlocation
/usr/bin/pg_passwd
/usr/bin/pg_version
/usr/bin/postgres
/usr/bin/postmaster
/usr/man/man1/cleardbdir.1
/usr/man/man1/initdb.1
/usr/man/man1/initlocation.1
/usr/man/man1/ipcclean.1
/usr/man/man1/pg_passwd.1
#/usr/man/man1/pgadmin.1
/usr/man/man1/postgres.1
/usr/man/man1/postmaster.1
%attr(-,postgres,postgres) %dir /var/lib/pgsql

%files devel
%defattr(-,root,root)
/usr/lib/pgsql
/usr/include/pgsql
/usr/man/man3/*
/usr/bin/ecpg
/usr/man/man1/ecpg.1

%files tcl
%defattr(-,root,root)
%attr(755,root,root) /usr/lib/libpgtcl.so*
/usr/man/man1/pgaccess.1
#/usr/man/man1/pgtclsh.1
#/usr/man/man1/pgtksh.1
/usr/bin/pgaccess
/usr/bin/pgtclsh
/usr/bin/pgtksh

%files odbc
%defattr(-,root,root)
%attr(755,root,root) /usr/lib/libpsqlodbc.so*

%files -f perlfiles.list perl
%dir /usr/lib/perl5/site_perl/%{buildarch}-linux/auto

%files python
%defattr(-,root,root)
/usr/lib/python1.5/site-packages/_pgmodule.so
/usr/lib/python1.5/site-packages/*.py

%files jdbc
%defattr(-,root,root)
/usr/lib/pgsql/jdbc6.5-1.1.jar

%changelog
* Tue Jul 27 1999 Thomas Lockhart <lockhart@alumni.caltech.edu>
- version 6.5.1

* Sat Jun 19 1999 Thomas Lockhart <lockhart@alumni.caltech.edu>
- deprecate clients rpm, and define a server rpm for the backend
- version 6.5
- updated pgaccess to version 0.96
- build ODBC interface library
- split tcl and ODBC packages into separate binary rpms

* Sat Apr 17 1999 Jeff Johnson <jbj@redhat.com>
- exclude alpha for Red Hat 6.0.

* Sun Mar 21 1999 Cristian Gafton <gafton@redhat.com>
- auto rebuild in the new build environment (release 2)

* Wed Feb 03 1999 Cristian Gafton <gafton@redhat.com>
- version 6.4.2
- get rid of the -data package (shipping it was a BAD idea)

* Sat Oct 10 1998 Cristian Gafton <gafton@redhat.com>
- strip all binaries
- use defattr in all packages
- updated pgaccess to version 0.90
- /var/lib/pgsql/pg_pwd should not be 666

* Sun Jun 21 1998 Jeff Johnson <jbj@redhat.com>
- create /usr/lib/pgsql (like /usr/include/pgsql)
- resurrect libpq++.so*
- fix name problem in startup-script (problem #533)

* Fri Jun 19 1998 Jeff Johnson <jbj@redhat.com>
- configure had "--prefix=$RPM_BUILD_ROOT/usr"
- move all include files below /usr/include/pgsql.
- resurrect perl client file lists.

* Tue May 05 1998 Prospector System <bugs@redhat.com>
- translations modified for de, fr, tr

* Tue May 05 1998 Cristian Gafton <gafton@redhat.com>
- build on alpha

* Sat May 02 1998 Cristian Gafton <gafton@redhat.com>
- enhanced initscript

* Tue Apr 21 1998 Cristian Gafton <gafton@redhat.com>
- finally v6.3.2 is here !

* Wed Apr 15 1998 Cristian Gafton <gafton@redhat.com>
- added the include files in the devel package

* Wed Apr 01 1998 Cristian Gafton <gafton@redhat.com>
- finally managed to get a patch for 6.3.1 to make it install corectly. Boy,
  what a mess ! ;-(

* Tue Mar 03 1998 Cristian Gafton <gafton@redhat.com>
- upgraded tp 6.3 release

* Sat Feb 28 1998 Cristian Gafton <gafton@redhat.com>
- upgraded to the latest snapshot
- splitted yet one more subpackage: clients

* Tue Jan 20 1998 Cristian Gafton <gafton@redhat.com>
- the installed devel-library is no longer stripped (duh!)
- added the 7 patches found on the ftp.postgresql.org site
- corrected the -rh patch to patch configure.in rather than configure; we
  now use autoconf
- added a patch to fix the broken psort function
- build TCL and C++ libraries as well
- updated pgaccess to version 0.76

* Thu Oct 23 1997 Cristian Gafton <gafton@redhat.com>
- cleaned up the spec file for version 6.2.1
- splited devel subpackage
- added chkconfig support in %preun and %post
- added optional data package

* Mon Oct 13 1997 Elliot Lee <sopwith@cuc.edu> 6.2-3
- Fixed lots of bung-ups in the spec file, made it FSSTND compliant, etc.
- Removed jdbc package, jdk isn't stable yet as far as what goes where.
- Updated to v 6.2.1

* Thu Oct  9 1997 10:58:14 dan
- on pre-installation script now the `data' dir is renamed to
  `data.rpmorig' (no more wild deletions!).
- added `postgresql-jdbc' sub-package.
- postgresql.sh script: defined function `add_to_path()' and
  changed the location of postgresql.jar in the CLASSPATH.

* Sat Oct  4 1997 10:27:43 dan
- updated to version 6.2.
- added auto installation's scripts (pre, post, preun, postun)

pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: [ANNOUNCE] New man pages
Next
From: lamar.owen@wgcr.org
Date:
Subject: Re: RPMs (was Pronunciation of "PostgreSQL")