Репозиторий ALT Linux backports/2.4
Последнее обновление: 9 июля 2008 | Пакетов: 497 | Посещений: 1574268
 поиск   регистрация   авторизация 
 
Группа :: Базы Данных
Пакет: postgresql

 Главная   Изменения   Спек   Патчи   Загрузить   Bugs and FR 

# -*- rpm-spec -*-
# $Id: postgresql,v 1.13 2002/10/08 10:33:00 lioka Exp $
%def_with devel
%def_without jdbc

Name: postgresql
Version: 7.4.8
Release: alt4.M24.2

%define PGSQL pgsql
%define ROOT %_localstatedir/%PGSQL-root

%define libpq_major    3
%define libecpg_major  4
%define libpgtcl_major 2

%define libpq_name    libpq%libpq_major
%define libecpg_name  libecpg%libecpg_major
%define libpgtcl_name libpgtcl%libpgtcl_major

Summary: PostgreSQL client programs and libraries
License: BSD
Group: Databases
Url: http://www.%name.org/

Packager: Denis Smirnov <mithraen at altlinux.ru>

Source: ftp://ftp.%name.org/pub/source/v%version/%name-%version.tar.bz2
Source1: %name.init
Source2: %name.chroot.lib
Source3: %name.chroot.conf
Source4: %name.chroot.all
Source5: %name.chroot.bin
Source6: %name.README.ALT

Source8: pg-migration-scripts-7.2.tar.bz2
Source12: %name-dump.1
Source13: pg_options-7.2

Source30: http://jdbc.%name.org/download/pg73jdbc1.jar
Source31: http://jdbc.%name.org/download/pg73jdbc2.jar
Source32: http://jdbc.%name.org/download/pg73jdbc3.jar

Source40: upgrade_tips_7.3
Source41: ftp.postgresql.org:/pub/binary/v7.2/RPMS/README.rpm-dist
Source42: http://www.rbt.ca/postgresql/upgrade/upgrade.pl

Patch0: %name-7.2-include.patch
Patch1: %name-7.4-alt-chroot.patch
Patch2: %name-7.2.1-tinfo.patch
Patch3: %name-7.4-pgtcl.patch
Patch4: %name-7.4.6-alt-python64.patch

#Patch10: %name-gram.y.diff


# Rename locale files

Patch20: %name-bindtext.patch

BuildPreReq: /usr/bin/mksock perl-DBD-Pg perl-DBI perl-Pg

Requires: %libpq_name = %version-%release

# Automatically added by buildreq on Wed Dec 22 2004

BuildRequires: OpenSP docbook-dtds docbook-style-dsssl flex hostinfo libpam-devel libreadline-devel libssl-devel openjade perl-SGMLSpm perl-devel pmake python-base python-dev python-modules-encodings sgml-common tcl-devel xml-common zlib-devel

%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). The
postgresql package includes the client programs and libraries that
you'll need to access a PostgreSQL DBMS server.  These PostgreSQL
client programs are programs that directly manipulate the internal
structure of PostgreSQL databases on a PostgreSQL server. These client
programs can be located on the same machine with the PostgreSQL
server, or may be on a remote machine which accesses a PostgreSQL
server over a network connection. This package contains the docs
in HTML for the whole package, as well as command-line utilities for
managing PostgreSQL databases on a PostgreSQL server.

If you want to manipulate a PostgreSQL database on a remote PostgreSQL
server, you need this package. You also need to install this package
if you're installing the postgresql-server package.

%package -n %libpq_name
Summary: The shared libraries required for any PostgreSQL clients
Group: Databases

%description -n %libpq_name
C and C++ libraries to enable user programs to communicate with the
PostgreSQL database backend. The backend can be on another machine and
accessed through TCP/IP.

%if_with devel
%package -n %libpq_name-devel
Summary: Development shared library for %libpq_name
Group: Development/Databases
Requires: %libpq_name = %version-%release

%description -n %libpq_name-devel
Development shared library for %libpq_name

%package -n %libpq_name-devel-static
Summary: Development static library for %libpq_name
Group: Development/Databases
Requires: %libpq_name-devel = %version-%release

%description -n %libpq_name-devel-static
Development static library for %libpq_name
%endif

%package -n %libecpg_name
Summary: Shared library %libecpg_name for PostgreSQL
Group: Databases

%description -n %libecpg_name
%libecpg_name is used by programs built with ecpg (Embedded PostgreSQL for C)
Use postgresql-dev to develop such programs.

%if_with devel
%package -n %libecpg_name-devel
Summary: Development shared library to %libecpg_name
Group: Development/Databases
Requires: %libecpg_name = %version-%release
Conflicts: libecpg3-devel

%description -n %libecpg_name-devel
Development shared library for %libecpg_name and the ecpg Embedded C
Postgres preprocessor.

%package -n %libecpg_name-devel-static
Summary: Development static library to %libecpg_name
Group: Development/Databases
Requires: %libecpg_name-devel = %version-%release

%description -n %libecpg_name-devel-static
Development static library to %libecpg_name
%endif

%package -n %libpgtcl_name
Summary: Tcl/Tk library and front-end for PostgreSQL
Group: Databases
Requires: tcl >= 8.4.0-alt1

%description -n %libpgtcl_name
The postgresql-tcl package contains the pg-enhanced pgtclsh and the library
to enable Tcl/Tk scripts to communicate with the PostgreSQL database backend.

%package docs
Summary: Extra documentation for PostgreSQL
Group: Databases

%description docs
The postgresql-docs package includes the SGML source for the documentation
as well as the documentation in other formats, and some extra documentation.
Install this package if you want to help with the PostgreSQL documentation
project, or if you want to generate printed documentation.

%package contrib
Summary: Contributed source and binaries distributed with PostgreSQL
Group: Databases
Requires: %name = %version-%release

%description contrib
The postgresql-contrib package includes the contrib tree distributed with
the PostgreSQL tarball.  Selected contrib modules are prebuilt.

%package server
Summary: The programs needed to create and run a PostgreSQL server
Group: Databases
PreReq: shadow-utils, syslogd-daemon, grep, %__subst, chrooted
Requires: %name = %version-%release

%description server
The postgresql-server package 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-server if you want to create and maintain your own
PostgreSQL databases and/or your own PostgreSQL server. You also need
to install the postgresql package.

%if_with devel
%package devel
Summary: PostgreSQL development header files
Group: Development/Databases
Requires: %libpq_name-devel = %version-%release, %libecpg_name-devel = %version-%release

%description devel
The postgresql-devel package contains the header files needed to compile applications
which will directly interact with a PostgreSQL database management server.
You need to install this package if you want to develop applications which will interact
with a PostgreSQL server.
%endif

%package tcl
Summary: The PL/Tcl procedural language for PostgreSQL
Group: Databases
Requires: %name = %version-%release tcl >= 8.4.0-alt1

%description tcl
PostgreSQL is an advanced Object-Relational database management
system.  The postgresql-tcl package contains the PL/Tcl procedural language
for the backend.

%package perl
Summary: The PL/Perl procedural language for PostgreSQL
Group: Databases
Requires: %name = %version-%release
AutoReqProv: yes, perl

%description perl
PostgreSQL is an advanced Object-Relational database management
system.  The postgresql-perl package contains the PL/Perl procedural
language for the backend.

%package python
Summary: Development module for Python code to access a PostgreSQL DB
Group: Databases
Requires: %name = %version-%release, python >= %__python_version, egenix-mx-base >= 2.0.3

%description python
PostgreSQL is an advanced Object-Relational database management
system.  The postgresql-python package includes a module for
developers to use when writing Python code for accessing a PostgreSQL
database.

%if_with jdbc
%package jdbc
Summary: Files needed for Java programs to access a PostgreSQL database
Group: Databases
Requires: %name = %version-%release

%description jdbc
PostgreSQL is an advanced Object-Relational database management
system. The postgresql-jdbc package includes the .jar file needed for
Java programs to access a PostgreSQL database.
%endif

%prep
%setup -q
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
#patch10 -p1
%patch20 -p1
%patch4

%build
autoreconf -fisv
./configure %_target_platform \
--prefix=%prefix \
--libdir=%_libdir \
--mandir=%_mandir \
--docdir=%_docdir \
--includedir=%_includedir/%PGSQL \
--sysconfdir=%_sysconfdir/%PGSQL \
--datadir=%_datadir/%PGSQL \
--localstatedir=%_localstatedir \
--enable-hba \
--enable-recode \
--enable-multibyte \
--enable-nls \
--without-tk \
--with-pam \
--with-openssl \
--with-CXX \
--with-perl \
--with-x \
--enable-odbc \
--with-tcl --with-tclconfig=%_libdir \
--with-readline \
--with-python \
--disable-rpath

%_make_bin pkglibdir=%_libdir/%PGSQL

pushd contrib
%_make_bin all libdir=%_datadir/%PGSQL/contrib
popd

%install
%make_build install DESTDIR=$RPM_BUILD_ROOT pkglibdir=%_libdir/%PGSQL
%make_build install-all-headers DESTDIR=$RPM_BUILD_ROOT pkglibdir=%_libdir/%PGSQL

# the postgresql-dump manpage.....

%__cp %SOURCE12 $RPM_BUILD_ROOT%_man1dir/

# copy over Makefile.global & Makefile.port to the include dir....

%__install -m644 src/Makefile.global $RPM_BUILD_ROOT%_includedir/%PGSQL
%__install -m644 src/Makefile.port $RPM_BUILD_ROOT%_includedir/%PGSQL

# Java/JDBC

# The user will have to set a CLASSPATH to find it here, but not sure where else to put it...
# JDBC jars
%__install -m 755 %SOURCE30 $RPM_BUILD_ROOT%_datadir/%PGSQL
%__install -m 755 %SOURCE31 $RPM_BUILD_ROOT%_datadir/%PGSQL
%__install -m 755 %SOURCE32 $RPM_BUILD_ROOT%_datadir/%PGSQL

%__install -m 755 %SOURCE42 $RPM_BUILD_ROOT%_datadir/%PGSQL/upgrade.pl

# The sysconfig directory

%__install -d -m 700 $RPM_BUILD_ROOT%_sysconfdir/%PGSQL

# The initscripts....

%__install -p -m755 -D %SOURCE1 $RPM_BUILD_ROOT%_initdir/%name
%__install -p -m750 -D %SOURCE2 $RPM_BUILD_ROOT%_sysconfdir/chroot.d/%name.lib
%__install -p -m750 -D %SOURCE3 $RPM_BUILD_ROOT%_sysconfdir/chroot.d/%name.conf
%__install -p -m750 -D %SOURCE4 $RPM_BUILD_ROOT%_sysconfdir/chroot.d/%name.all
%__install -p -m750 -D %SOURCE5 $RPM_BUILD_ROOT%_sysconfdir/chroot.d/%name.bin

%__subst -p 's|CHROOTDIR|%ROOT|g' $RPM_BUILD_ROOT%_initdir/%name
pushd $RPM_BUILD_ROOT%_sysconfdir/chroot.d
for f in %name.*; do
if [ -f "$f" ]; then
  %__subst -p 's|CHROOTDIR|%ROOT|g' $f
fi
done
popd

# PGDATA needs removal of group and world permissions due to pg_pwd hole.

%__install -d -m700 $RPM_BUILD_ROOT%_localstatedir/%PGSQL/data

# backups of data go here...

%__install -d -m700 $RPM_BUILD_ROOT%_localstatedir/%PGSQL/backups

# Initial pg_options

%__install -p -m600 %SOURCE13 $RPM_BUILD_ROOT%_localstatedir/%PGSQL/data/pg_options

# Upgrade scripts.

%__tar xjf %SOURCE8 -C $RPM_BUILD_ROOT

# Fix a dangling symlink

%__mkdir_p $RPM_BUILD_ROOT%_includedir/%PGSQL/port
%__cp src/include/port/linux.h $RPM_BUILD_ROOT%_includedir/%PGSQL/port/
%__ln_s port/linux.h $RPM_BUILD_ROOT%_includedir/%PGSQL/os.h

# Chrooted environment

%__mkdir_p $RPM_BUILD_ROOT%ROOT/{bin,dev,lib,tmp,%_sysconfdir/%PGSQL,%_localstatedir,%_libdir/%PGSQL,%_libdir/locale}

mksock $RPM_BUILD_ROOT%ROOT/dev/log
%__mkdir_p -m700 $RPM_BUILD_ROOT%_sysconfdir/syslog.d
%__ln_s %ROOT/dev/log $RPM_BUILD_ROOT%_sysconfdir/syslog.d/%name

%__mv $RPM_BUILD_ROOT%_localstatedir/%PGSQL $RPM_BUILD_ROOT%ROOT/%_localstatedir/%PGSQL
%__ln_s %ROOT%_localstatedir/%PGSQL $RPM_BUILD_ROOT%_localstatedir/%PGSQL

%__cp -a contrib $RPM_BUILD_ROOT%_datadir/%PGSQL/
pushd $RPM_BUILD_ROOT%_datadir/%PGSQL/contrib
%__rm -rf start-scripts
%__rm -f */*.o */*.a

for p in *; do
if [ -d "$p" ]; then
  pushd $p
   curdir=`pwd`
   filelist=`find $curdir -name "*.sql" -print`
    for f in $filelist; do
     if [ -f "$f" ]; then
%__subst -p "s|\$libdir|/lib/$p|g" $f
     fi
    done
  popd
fi
done
popd

%define docdir %_docdir/%name-%version
# Package docs
%__rm -rf $RPM_BUILD_ROOT%docdir
%__mkdir_p $RPM_BUILD_ROOT%docdir

%__cp -a COPYRIGHT README HISTORY %SOURCE40 %SOURCE41 \
doc/{FAQ,KNOWN_BUGS,MISSING_FEATURES,TODO,FAQ_russian,bug.template} \
$RPM_BUILD_ROOT%docdir/

%__install -p -m644 src/interfaces/jdbc/README  $RPM_BUILD_ROOT%docdir/README.jdbc

%__bzip2 $RPM_BUILD_ROOT%docdir/FAQ*
%__mv $RPM_BUILD_ROOT%_docdir/%name/html $RPM_BUILD_ROOT%_docdir/%name-docs-%version

%find_lang libpq-3
%find_lang pg_dump
%find_lang postgres
%find_lang psql
%find_lang pg_resetxlog
%find_lang pg_controldata
%find_lang pgscripts

%__cat psql.lang pg_dump.lang pgscripts.lang> main.lang
%__cat postgres.lang pg_resetxlog.lang pg_controldata.lang > server.lang

%__chmod a-x $RPM_BUILD_ROOT%_datadir/pgsql/contrib/oracle/*

# README.ALT

%__install -p -m 644 -D %SOURCE6 $RPM_BUILD_ROOT%docdir/README.ALT

%pre
# Need to make backups of some executables if an upgrade
# They will be needed to do a dump of the old version's database.
# All output redirected to /dev/null.
exec &>/dev/null
if [ $1 -gt 1 -a -d %_libdir/%PGSQL ]
then
   if [ ! -d %_libdir/%PGSQL/backup ]; then
%__mkdir_p %_libdir/%PGSQL/backup
   fi
   cd %_bindir
   %__cp -fp pg_dump pg_dumpall psql %_libdir/%PGSQL/backup || :
fi

%pre server
exec &>/dev/null
/usr/sbin/groupadd -g 46 postgres || :
/usr/sbin/groupadd psqluser || :
/usr/sbin/useradd -M -o -r -d %_localstatedir/%PGSQL -s /dev/null \
-c "PostgreSQL Server" -u 46 postgres -g postgres || :

if [ $1 -gt 1 ]
then
  if [ ! -d %_libdir/%PGSQL/backup ]; then
      %__mkdir_p %_libdir/%PGSQL/backup
  fi
  cd %_bindir
  %__cp -fp postmaster postgres %_libdir/%PGSQL/backup
fi

%pre -n %libpq_name
exec &>/dev/null
if [ $1 -gt 1 -a -d %_libdir/%PGSQL ]
then
   if [ ! -d %_libdir/%PGSQL/backup ]; then
%__mkdir_p %_libdir/%PGSQL/backup
   fi
   cd %_libdir > /dev/null
   %__cp -fp libpq.* %_libdir/%PGSQL/backup
fi

%post server
echo PGLIB=%_datadir/%PGSQL >> ~postgres/.bash_profile
echo PGDATA=%_localstatedir/%PGSQL/data >> ~postgres/.bash_profile
echo export PGLIB PGDATA >> ~postgres/.bash_profile
%__chown postgres:postgres ~postgres/.bash_profile

SYSLOGD_SCRIPT=/etc/init.d/syslogd
SYSLOGD_CONFIG=/etc/sysconfig/syslogd
if %__grep -qs '^SYSLOGD_OPTIONS=.*-a %ROOT/dev/log' "$SYSLOGD_CONFIG"; then
%__subst 's|^\(SYSLOGD_OPTIONS=.*\) \?-a %ROOT/dev/log|\1|' "$SYSLOGD_CONFIG"
if [ -x "$SYSLOGD_SCRIPT" ]; then
"$SYSLOGD_SCRIPT" condreload ||:
fi
fi

%_sysconfdir/chroot.d/%name.all force

%post_service %name

/sbin/service %name stop
rm /var/lib/pgsql-root/var/lib/pgsql/data/postmaster.pid
/sbin/service %name start

%preun server
%preun_service %name
%post -p %post_ldconfig     -n %libpq_name
%postun -p %postun_ldconfig -n %libpq_name

%post -p %post_ldconfig     -n %libecpg_name
%postun -p %postun_ldconfig -n %libecpg_name

%post -p %post_ldconfig     -n %libpgtcl_name
%postun -p %postun_ldconfig -n %libpgtcl_name

%files -f main.lang
%_bindir/clusterdb
%_bindir/createdb
%_bindir/createlang
%_bindir/createuser
%_bindir/dropdb
%_bindir/droplang
%_bindir/dropuser
%_bindir/pg_dump
%_bindir/pg_dumpall
%_bindir/pg_encoding
%_bindir/pg_id
%_bindir/pg_restore
%_bindir/psql
%_bindir/vacuumdb
%_man1dir/clusterdb.1*
%_man1dir/createdb.1*
%_man1dir/createlang.1*
%_man1dir/createuser.1*
%_man1dir/dropdb.1*
%_man1dir/droplang.1*
%_man1dir/dropuser.1*
%_man1dir/pg_dump.1*
%_man1dir/pg_restore.1*
%_man1dir/pg_dumpall.1*
%_man1dir/psql.1*
%_man1dir/vacuumdb.1*
%_man7dir/*
%dir %docdir
%docdir/FAQ.bz2
%docdir/KNOWN_BUGS
%docdir/MISSING_FEATURES
%docdir/TODO
%docdir/FAQ_russian.bz2
%docdir/COPYRIGHT
%docdir/README
%docdir/HISTORY
%docdir/bug.template
%docdir/README.rpm-dist
%docdir/upgrade_tips_7.3

%files docs
%dir %_docdir/%name-docs-%version
%_docdir/%name-docs-%version/*.html
%_docdir/%name-docs-%version/*.css

%files contrib
%_datadir/%PGSQL/contrib
%exclude %_datadir/%PGSQL/contrib/oracle

%files -f libpq-3.lang -n %libpq_name
%_libdir/libpq.so.%libpq_major
%_libdir/libpq.so.%libpq_major.*

%files -n %libecpg_name
%_libdir/libecpg.so.%libecpg_major
%_libdir/libecpg.so.%libecpg_major.*
%_libdir/libecpg_compat.so.*
%_libdir/libpgtypes.so.*

%files -n %libpgtcl_name
%_tcldatadir/pgtcl2.4
%_datadir/%PGSQL/unknown.pltcl
%_tcllibdir/libpgtcl.so.%libpgtcl_major
%_tcllibdir/libpgtcl.so.%libpgtcl_major.*
%_tcllibdir/libpgtcl.so

%files -f server.lang server
%config %_initdir/%name
%config %_sysconfdir/chroot.d/%name.*
%_bindir/initdb
%_bindir/initlocation
%_bindir/ipcclean
%_bindir/pg_controldata
%_bindir/pg_ctl
%_bindir/pg_resetxlog
%_bindir/postgres
%_bindir/postmaster
%_bindir/%name-dump

%_man1dir/initdb.1*
%_man1dir/initlocation.1*
%_man1dir/ipcclean.1*
%_man1dir/pg_controldata.1
%_man1dir/pg_resetxlog.1*
%_man1dir/pg_ctl.1*
%_man1dir/postgres.1*
%_man1dir/postmaster.1*
%_man1dir/%name-dump.1*
%dir %_sysconfdir/%PGSQL
%dir %_libdir/%PGSQL
%_libdir/%PGSQL/plpgsql.so
%_libdir/%PGSQL/*_and_*.so
%dir %_datadir/%PGSQL
%dir %_datadir/%PGSQL/backup
%_datadir/%PGSQL/postgres.bki
%_datadir/%PGSQL/postgres.description
%_datadir/%PGSQL/*.sample
%_datadir/%PGSQL/backup/pg_dumpall_new
%_datadir/%PGSQL/conversion_create.sql
%_datadir/%PGSQL/upgrade.pl
%_datadir/%PGSQL/information_schema.sql
%_datadir/%PGSQL/sql_features.txt
%_localstatedir/%PGSQL
%_sysconfdir/syslog.d/%name

%attr(751,root,root)  %dir %ROOT
%attr(751,root,root)  %dir %ROOT/bin
%attr(751,root,root)  %dir %ROOT/etc
%attr(751,root,root)  %dir %ROOT/etc/%PGSQL
%attr(751,root,root)  %dir %ROOT/dev
%attr(751,root,root)  %dir %ROOT/lib
%attr(1777,root,root) %dir %ROOT/tmp
%attr(751,root,root)  %dir %ROOT/usr
%attr(751,root,root)  %dir %ROOT/var
%attr(751,root,root)  %dir %ROOT%_libdir
%attr(751,root,root)  %dir %ROOT%_libdir/%PGSQL
%attr(751,root,root)  %dir %ROOT%_libdir/locale
%attr(751,root,root)  %dir %ROOT%_localstatedir
%attr(700,postgres,postgres)  %dir %ROOT%_localstatedir/%PGSQL
%attr(700,postgres,postgres)  %dir %ROOT%_localstatedir/%PGSQL/backups
%attr(700,postgres,postgres)  %dir %ROOT%_localstatedir/%PGSQL/data
%attr(666,root,root) %ghost %ROOT/dev/log

%if_with devel
%files devel
%_includedir/%PGSQL
%_bindir/pg_config
%_man1dir/pg_config.*

%files -n %libpq_name-devel
%_libdir/libpq*.so

%files -n %libecpg_name-devel
%_bindir/ecpg
%_libdir/libecpg*.so
%_libdir/libpgtypes.so
%_man1dir/ecpg.*

%files -n %libpq_name-devel-static
%_libdir/libpq*.a

%files -n %libecpg_name-devel-static
%_libdir/libecpg*.a
%_libdir/libpgtypes.a
%endif

%files tcl
%_bindir/pltcl_delmod
%_bindir/pltcl_listmod
%_bindir/pltcl_loadmod
%_libdir/%PGSQL/pltcl.so

%files perl
%_libdir/%PGSQL/plperl.so

%files python
%dir %docdir
%_libdir/%PGSQL/plpython.so

%if_with jdbc
%files jdbc
%dir %docdir
%docdir/README.jdbc
%_datadir/%PGSQL/pg73jdbc1.jar
%_datadir/%PGSQL/pg73jdbc2.jar
%_datadir/%PGSQL/pg73jdbc3.jar
%endif

%changelog

Полный changelog можно просмотреть здесь

 
design & coding: Vladimir Lettiev aka crux © 2004-2005