Sync from SUSE:SLFO:Main postgresql revision a427e9d9df95f3ee138800a465992a09

This commit is contained in:
Adrian Schröter 2024-05-03 19:33:50 +02:00
commit b5b0df5773
13 changed files with 1345 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

6
postgresql-bashprofile Normal file
View File

@ -0,0 +1,6 @@
# Get PGDATA from /etc/sysconfig/postgresql
if test -f /etc/sysconfig/postgresql; then
eval eval $(sed -n '/^POSTGRES_DATADIR=/s//PGDATA=/p' /etc/sysconfig/postgresql)
export PGDATA
fi

View File

@ -0,0 +1,53 @@
#
# License AGPL-3.0
#
# keep in sync with the postgresqlXY packages
#
%pg_config_bindir %(pg_config --bindir)
%pg_config_docdir %(pg_config --docdir)
%pg_config_htmldir %(pg_config --htmldir)
%pg_config_includedir %(pg_config --includedir)
%pg_config_pkgincludedir %(pg_config --pkgincludedir)
%pg_config_includedir_server %(pg_config --includedir-server)
%pg_config_libdir %(pg_config --libdir)
%pg_config_pkglibdir %(pg_config --pkglibdir)
%pg_config_localedir %(pg_config --localedir)
%pg_config_mandir %(pg_config --mandir)
%pg_config_sharedir %(pg_config --sharedir)
%pg_config_sysconfdir %(pg_config --sysconfdir)
%pg_config_pgxs %(pg_config --pgxs)
%pg_config_configure %(pg_config --configure)
%pg_config_cc %(pg_config --cc)
%pg_config_cppflags %(pg_config --cppflags)
%pg_config_cflags %(pg_config --cflags)
%pg_config_cflags_sl %(pg_config --cflags_sl)
%pg_config_ldflags %(pg_config --ldflags)
%pg_config_ldflags_ex %(pg_config --ldflags_ex)
%pg_config_ldflags_sl %(pg_config --ldflags_sl)
%pg_config_libs %(pg_config --libs)
%make_pgxs \
make USE_PGXS=1 %{?_smp_mflags} \
%nil
%make_pgxs_install \
%make_install USE_PGXS=1 \
%nil
%pg_obsolete_llvm_subpackage \
Provides: %{pg_name}-%{ext_name}-llvmjit = %{version}-%{release} \
Obsoletes: %{pg_name}-%{ext_name}-llvmjit < %{version}-%{release} \
%nil
%pg_server_requires \
%{requires_eq %{pg_name}-server} \
%if %{postgresql_has_llvm} \
Recommends: %{pg_name}-llvmjit \
%pg_obsolete_llvm_subpackage \
%endif \
%nil
%pg_version_from_name %define pg_version %( echo %{?pg_name} | sed -e 's|^postgresql||g' )%{nil}
%postgresql_has_llvm (0%{?suse_version} >= 1500 && "%{_target_cpu}" != "riscv64" && 0%{?pg_version} >= 11 && 0%{?pg_version} < 90)

4
postgresql-firewall Normal file
View File

@ -0,0 +1,4 @@
## Name: PostgreSQL Server
## Description: Opens TCP port 5432 to allow remote connections to the PostgreSQL server.
TCP="5432"

198
postgresql-init Normal file
View File

@ -0,0 +1,198 @@
#!/bin/sh
# Copyright (c) 1995-2004 SUSE Linux AG, Nuernberg, Germany.
# All rights reserved.
#
# System startup script for PostgreSQL
#
# LSB compatible service control script; see http://www.linuxbase.org/spec/
#
### BEGIN INIT INFO
# Provides: postgresql
# Required-Start: $network $remote_fs
# Required-Stop: $network $remote_fs
# Default-Start: 3 5
# Default-Stop:
# Description: Start the PostgreSQL master daemon
### END INIT INFO
# Source SuSE config
PG_SYSCONFIG=/etc/sysconfig/postgresql
test -f $PG_SYSCONFIG && . $PG_SYSCONFIG
# Shell functions sourced from /etc/rc.status:
# rc_check check and set local and overall rc status
# rc_status check and set local and overall rc status
# rc_status -v ditto but be verbose in local rc status
# rc_status -v -r ditto and clear the local rc status
# rc_failed set local and overall rc status to failed
# rc_reset clear local rc status (overall remains)
# rc_exit exit appropriate to overall rc status
. /etc/rc.status
eval DATADIR=${POSTGRES_DATADIR:-~postgres/data}
OPTIONS=${POSTGRES_OPTIONS}
PIDFILE=$DATADIR/postmaster.pid
# The echo return value for success (defined in /etc/rc.config).
rc_reset
# Return values acc. to LSB for all commands but status:
# 0 - success
# 1 - generic or unspecified error
# 2 - invalid or excess argument(s)
# 3 - unimplemented feature (e.g. "reload")
# 4 - insufficient privilege
# 5 - program is not installed
# 6 - program is not configured
# 7 - program is not running
#
# Note that starting an already running service, stopping
# or restarting a not-running service as well as the restart
# with force-reload (in case signalling is not supported) are
# considered a success.
#
if test -r $DATADIR/PG_VERSION ; then
DATA_VERSION=$(cat $DATADIR/PG_VERSION)
POSTGRES=/usr/lib/postgresql${DATA_VERSION/./}/bin/postgres
fi
if test -x /usr/bin/postgres; then
ACTIVE=$(readlink -q -f /usr/bin/postgres)
test -z "$POSTGRES" && POSTGRES="$ACTIVE"
fi
if test -z "$POSTGRESQL_QUIET"; then
export POSTGRESQL_QUIET=1
if test -n "$DATA_VERSION"; then
if test -z "$ACTIVE" -o "$ACTIVE" != "$POSTGRES"; then
echo " Your database files were created by PostgreSQL version $DATA_VERSION."
if test -x "$POSTGRES"; then
echo " Using the executables in $(dirname $POSTGRES)."
else
echo " Could not find executables for this version."
echo " Please install the PostgreSQL server package for version $DATA_VERSION."
fi
fi
elif test -z "$ACTIVE"; then
echo " Cannot find an active PostgreSQL server binary. Please install one of the PostgreSQL"
echo " server packages or activate an already installed version using update-alternatives."
fi
fi
if test ! -x "$POSTGRES"; then
test "$1" = "stop" && exit 0 || exit 5
fi
BINDIR=$(dirname $POSTGRES)
VERSION=$($POSTGRES --version|awk '{print $NF}')
LOGFILE=$DATADIR/postmaster.log
pg_ctl () {
CMD="$BINDIR/pg_ctl ${POSTGRES_TIMEOUT:+-t $POSTGRES_TIMEOUT} $@"
su - postgres -c "$CMD"
}
case "$1" in
start)
if [ ! -f $DATADIR/PG_VERSION ]; then
echo -n "Initializing PostgreSQL $VERSION at location ${DATADIR}"
LANG_SYSCONFIG=/etc/sysconfig/language
test -f "$LANG_SYSCONFIG" && . $LANG_SYSCONFIG
LANG=${POSTGRES_LANG:-$RC_LANG}
INITDB=/usr/bin/initdb
V=$(printf "%02d%02d" $(echo $VERSION|awk -F. '{print $1, $2}'))
AUTH="ident"; test $V -lt 0804 && AUTH="ident sameuser"
su - postgres -c \
"$INITDB --locale=$LANG --auth=\"$AUTH\" $DATADIR &> initlog" ||
rc_failed
rc_status -v
rc_status || {
echo "You can find a log of the initialisation in ~postgres/initlog ."
rc_exit
}
fi
echo -n "Starting PostgreSQL $VERSION "
if pg_ctl status -s -D $DATADIR >/dev/null
then
rc_failed 0
else
set -o pipefail
pg_ctl start -s -w -D $DATADIR -l $LOGFILE -o "\"$OPTIONS\""
fi
rc_status -v
;;
stop)
echo -n "Shutting down PostgreSQL $VERSION "
if pg_ctl status -s -D $DATADIR >/dev/null
then
pg_ctl stop -s -D $DATADIR -m fast &> /dev/null
else
rc_failed 0
fi
rc_status -v
;;
try-restart|condrestart)
## Do a restart only if the service was active before.
## Note: try-restart is now part of LSB (as of 1.9).
## RH has a similar command named condrestart.
if test "$1" = "condrestart"; then
echo "${attn} Use try-restart ${done}(LSB)${attn} rather than condrestart ${warn}(RH)${norm}"
fi
$0 status
if test $? = 0; then
$0 restart
else
rc_reset # Not running is not a failure.
fi
# Remember status and be quiet
rc_status
;;
restart)
## Stop the service and regardless of whether it was
## running or not, start it again.
$0 stop
$0 start
rc_status
;;
force-reload | reload)
echo -n "Reloading configuration for PostgreSQL $VERSION "
pg_ctl reload -s -D $DATADIR
rc_status -v
;;
status)
echo -n "Checking for PostgreSQL $VERSION: "
## Check status with checkproc(8), if process is running
## checkproc will return with exit status 0.
# Status has a slightly different for the status command:
# 0 - service running
# 1 - service dead, but /var/run/ pid file exists
# 2 - service dead, but /var/lock/ lock file exists
# 3 - service not running
# NOTE: checkproc returns LSB compliant status values.
if ! pg_ctl status -s -D $DATADIR >/dev/null
then
if test -f $DATADIR/postmaster.pid; then
rc_failed 1
else
rc_failed 3
fi
fi
rc_status -v
;;
probe)
rc_failed 3
rc_status -v
;;
*)
echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload|probe}"
exit 1
;;
esac
# Inform the caller not only verbosely and set an exit status.
rc_exit

View File

@ -0,0 +1,36 @@
#!/bin/bash
shopt -s nullglob
if test "$#" -ne 1; then
echo "usage: $0 pgversion" 1>&2
exit 1
fi
PRIO=$1
case "$PRIO" in
postgresql*)
PRIO="${PRIO##postgresql}"
;;
esac
PGBASEDIR=/usr/lib/postgresql$PRIO
if [ $PRIO -lt 80 ] ; then
PRIO="${PRIO}0"
fi
PGBINDIR=$PGBASEDIR/bin
for FILE in $PGBINDIR/*; do
NAME=$(basename $FILE)
DIR=/usr/bin
SLAVES="$SLAVES --slave $DIR/$NAME $NAME $FILE"
done
if test -n "$SLAVES"; then
update-alternatives --quiet --install \
/usr/lib/postgresql postgresql $PGBASEDIR $PRIO \
$SLAVES
else
update-alternatives --remove postgresql $PGBASEDIR
fi

72
postgresql-script Normal file
View File

@ -0,0 +1,72 @@
#!/bin/sh
PG_SYSCONFIG=/etc/sysconfig/postgresql
test -f $PG_SYSCONFIG && . $PG_SYSCONFIG
eval DATADIR=${POSTGRES_DATADIR:-~postgres/data}
OPTIONS=${POSTGRES_OPTIONS}
PIDFILE=$DATADIR/postmaster.pid
#
if test -r $DATADIR/PG_VERSION ; then
DATA_VERSION=$(cat $DATADIR/PG_VERSION)
POSTGRES=/usr/lib/postgresql$(echo -n $DATA_VERSION | tr -d .)/bin/postgres
fi
if test -x /usr/bin/postgres; then
ACTIVE=$(readlink -q -f /usr/bin/postgres)
test -z "$POSTGRES" && POSTGRES="$ACTIVE"
fi
if test -n "$DATA_VERSION"; then
if test -z "$ACTIVE" -o "$ACTIVE" != "$POSTGRES"; then
echo " Your database files were created by PostgreSQL version $DATA_VERSION."
if test -x "$POSTGRES"; then
echo " Using the executables in $(dirname $POSTGRES)."
else
echo " Could not find executables for this version."
echo " Please install the PostgreSQL server package for version $DATA_VERSION."
fi
fi
elif test -z "$ACTIVE"; then
echo " Cannot find an active PostgreSQL server binary. Please install one of the PostgreSQL"
echo " server packages or activate an already installed version using update-alternatives."
fi
if test ! -x "$POSTGRES"; then
exit 1
fi
BINDIR=$(dirname $POSTGRES)
# Avoiding the use of awk to get the last word
# in the line, which is the version number
VERSION=$($POSTGRES --version)
VERSION=${VERSION##* }
pg_ctl () {
$BINDIR/pg_ctl -s -D $DATADIR ${POSTGRES_TIMEOUT:+-t $POSTGRES_TIMEOUT} "$@"
}
cd ~
case "$1" in
start)
if [ ! -f $DATADIR/PG_VERSION ]; then
test -n "$POSTGRES_LANG" && export LC_ALL="$POSTGRES_LANG"
install -d -m 700 ${DATADIR} &&
echo "Initializing PostgreSQL $VERSION at location ${DATADIR}"
/usr/bin/initdb --auth=ident $DATADIR > initlog 2>&1 || {
echo "Initialisation failed. See $PWD/initlog ."
exit 1
}
fi
pg_ctl start -w ${OPTIONS:+-o "$OPTIONS"}
;;
stop)
pg_ctl stop -m fast
;;
reload)
pg_ctl reload
;;
*)
echo "Usage: $0 {start|stop|reload}"
exit 1
;;
esac

51
postgresql-sysconfig Normal file
View File

@ -0,0 +1,51 @@
## Path: Applications/PostgreSQL
## Description: The PostgreSQL Database System
## Type: string()
## Default: "~postgres/data"
## ServiceRestart: postgresql
#
# In which directory should the PostgreSQL database reside?
#
POSTGRES_DATADIR="~postgres/data"
## Path: Applications/PostgreSQL
## Description: The PostgreSQL Database System
## Type: string()
## Default: ""
## ServiceRestart: postgresql
#
# The options that are given to the PostgreSQL master daemon on startup.
# See the manual pages for postmaster and postgres for valid options.
#
# Don't put "-D datadir" here since it is set by the startup script
# based on the variable POSTGRES_DATADIR above.
#
POSTGRES_OPTIONS=""
## Path: Applications/PostgreSQL
## Description: The PostgreSQL Database System
## Type: string()
## Default: "600"
## ServiceRestart: postgresql
#
# This value controls how many seconds the pg_ctl helper program waits
# for the startup or shutdown of the PostgreSQL server to complete.
#
POSTGRES_TIMEOUT="600"
## Path: Applications/PostgreSQL
## Description: The PostgreSQL Database System
## Type: string()
## Default: "C"
## ServiceRestart: ""
#
# Specifies the locale under which the PostgreSQL database location
# should be initialized and run. If needed, it has to be changed
# before PostgreSQL is started for the first time. To change the
# locale of an existsing PostgreSQL database location, it must be
# dumped, removed and initialized from scratch using the new locale.
#
# If unset or empty $RC_LANG from /etc/sysconfig/language is used.
#
POSTGRES_LANG=""

3
postgresql-tmpfiles.conf Normal file
View File

@ -0,0 +1,3 @@
# For the PostgreSQL server's unix domain socket
d /run/postgresql 1775 postgres postgres - -
C /var/lib/pgsql/.bash_profile 0640 postgres postgres - /usr/share/postgresql/bash_profile

350
postgresql.changes Normal file
View File

@ -0,0 +1,350 @@
-------------------------------------------------------------------
Mon Jan 9 09:22:55 UTC 2023 - Reinhard Max <max@suse.com>
- bsc#1206796: Refine the distinction of where to use sysusers and
use bcond to have the expression only in one place.
-------------------------------------------------------------------
Thu Sep 22 14:23:49 UTC 2022 - Andreas Schwab <schwab@suse.de>
- riscv64 does not have llvm support yet,
adapt the %postgresql_has_llvm macro accordingly.
-------------------------------------------------------------------
Mon Sep 5 13:12:41 UTC 2022 - Dirk Müller <dmueller@suse.com>
- avoid bashisms in /bin/sh based startup script
-------------------------------------------------------------------
Sat May 21 15:11:15 UTC 2022 - Marcus Rueckert <mrueckert@suse.de>
- Bump to postgresql 15
-------------------------------------------------------------------
Wed Mar 16 14:50:22 UTC 2022 - Callum Farmer <gmbr3@opensuse.org>
- Change to systemd-sysusers
-------------------------------------------------------------------
Thu Feb 10 10:35:57 UTC 2022 - Reinhard Max <max@suse.com>
- Fix the pg_server_requires macro on older rpm versions (SLE-12).
-------------------------------------------------------------------
Fri Jan 28 15:26:21 UTC 2022 - Reinhard Max <max@suse.com>
- Avoid a dependency on awk in postgresql-script.
-------------------------------------------------------------------
Thu Dec 2 14:08:12 UTC 2021 - Reinhard Max <max@suse.com>
- Move the dependency of llvmjit-devel on clang and llvm to the
implementation packages where we can depend on the correct
versions.
-------------------------------------------------------------------
Thu Dec 2 11:45:03 UTC 2021 - Marcus Rueckert <mrueckert@suse.de>
- fix postgresql_has_llvm usage
-------------------------------------------------------------------
Mon Nov 15 12:09:10 UTC 2021 - Marcus Rueckert <mrueckert@suse.de>
- First round of changes to make it easier to build extensions for
- add postgresql-llvmjit-devel subpackage:
This package will pull in clang and llvm if the distro has a
recent enough version, otherwise it will just pull
postgresql-server-devel.
- add postgresql macros to the postgresql-server-devel package
those cover all the variables from pg_config and some macros
to remove repitition from the spec files
-------------------------------------------------------------------
Tue Oct 5 14:03:55 UTC 2021 - Reinhard Max <max@suse.com>
- Bump version to 14.
- Bump default to 14 on Factory and future SPs.
-------------------------------------------------------------------
Tue May 18 13:43:45 UTC 2021 - Reinhard Max <max@suse.com>
- Re-enable build of the llvmjit subpackage on SLE, but it will
only be delivered on PackageHub for now (boo#1183118).
-------------------------------------------------------------------
Mon Jan 25 08:56:54 UTC 2021 - Reinhard Max <max@suse.com>
- Bump default version to 13 for SLE-15-SP3.
-------------------------------------------------------------------
Fri Sep 25 07:58:58 UTC 2020 - Reinhard Max <max@suse.com>
- Bump major version to 13.
- Bump default version to 13 in OBS.
-------------------------------------------------------------------
Thu Aug 13 08:22:16 UTC 2020 - Reinhard Max <max@suse.com>
- We also transfer PostgreSQL 9.4.26 to the new package layout in
SLE12-SP2 and newer. Reflect this in the conflict with
postgresql94.
-------------------------------------------------------------------
Fri Jun 26 13:49:21 UTC 2020 - Reinhard Max <max@suse.com>
- Also conflict with PostgreSQL versions before 9.
- Conflicting with older versions is not limited to SLE.
-------------------------------------------------------------------
Tue Jun 16 12:17:33 UTC 2020 - Reinhard Max <max@suse.com>
- Bump version to 12.0.1, so that the binary packages also have
a cut-point to conflict with.
-------------------------------------------------------------------
Wed Jun 3 08:17:46 UTC 2020 - Reinhard Max <max@suse.com>
- Disable LLVM on SLE (bsc#1172274).
- Conflict with versions of the binary packages prior to the
May 2020 update, because we changed the package layout at that
point and need a clean cutover.
-------------------------------------------------------------------
Tue Mar 24 10:45:25 UTC 2020 - Reinhard Max <max@suse.com>
- Bump package version to 12, but leave default at 10 for
SLE-15 and SLE-15-SP1.
-------------------------------------------------------------------
Tue Dec 17 10:27:02 UTC 2019 - Reinhard Max <max@suse.com>
- Fix a mistake in the creation of /var/lib/pgsql/.bash_profile
with the tmpfiles mechanism (bsc#1159335).
-------------------------------------------------------------------
Thu Nov 14 12:36:59 UTC 2019 - Reinhard Max <max@suse.com>
- Sync ownership of /run/postgresql in the file list with tmpfiles.
-------------------------------------------------------------------
Tue Oct 22 13:08:50 UTC 2019 - Marcus Rueckert <mrueckert@suse.de>
- bump to 12
-------------------------------------------------------------------
Mon Oct 7 08:26:39 UTC 2019 - Reinhard Max <max@suse.com>
- Use the correct content for .bash_profile (boo#1153168).
-------------------------------------------------------------------
Mon Sep 23 14:03:32 UTC 2019 - Reinhard Max <max@suse.com>
- Stop shipping SUSEfirewall2 config files (bsc#1151591).
- Fix installation of bash_profile for SLE11 (pre systemd).
-------------------------------------------------------------------
Fri Feb 22 07:46:53 UTC 2019 - Franck Bui <fbui@suse.com>
- Drop use of $FIRST_ARG in .spec
The use of $FIRST_ARG was probably required because of the
%service_* rpm macros were playing tricks with the shell positional
parameters. This is bad practice and error prones so let's assume
that no macros should do that anymore and hence it's safe to assume
that positional parameters remains unchanged after any rpm macro
call.
-------------------------------------------------------------------
Tue Feb 19 16:05:22 UTC 2019 - Reinhard Max <max@suse.com>
- Change the persmissions for /var/run/postgresql to 1775, so that
the directory can only be used by users in the postgres group
(bsc#1123886).
-------------------------------------------------------------------
Thu Jan 31 13:23:56 UTC 2019 - Reinhard Max <max@suse.com>
- Move bash profile out of /var/lib to allow transactional updates
(bsc#1100397).
- Use /run/postgresql instead of /var/run/postgresql in %ghost and
postgresql-tmpfiles.conf to avoid rpmlint warnings and errors.
-------------------------------------------------------------------
Fri Nov 30 13:14:40 UTC 2018 - Marcus Rueckert <mrueckert@suse.de>
- add /var/run/postgresql to the filelist. as %ghost for systemd
systems and directly for non systemd systems
-------------------------------------------------------------------
Fri Nov 30 11:05:00 UTC 2018 - Marcus Rueckert <mrueckert@suse.de>
- fix the unexpanded macro in the description of server-devel
-------------------------------------------------------------------
Thu Nov 15 14:34:28 UTC 2018 - Reinhard Max <max@suse.com>
- Also bump the default package to 11.
-------------------------------------------------------------------
Wed Nov 7 16:57:50 UTC 2018 - Marcus Rueckert <mrueckert@suse.de>
- add server-devel and llvmjit package file sections
-------------------------------------------------------------------
Thu Oct 25 13:14:25 UTC 2018 - Reinhard Max <max@suse.com>
- Add the new subpackages server-devel and llvmjit that were
introduced with postgresql11.
-------------------------------------------------------------------
Mon Jul 2 17:08:32 UTC 2018 - mrueckert@suse.de
- bump to 11
-------------------------------------------------------------------
Mon Apr 30 13:26:49 UTC 2018 - dimstar@opensuse.org
- Require update-alternatives by postgresql: one of the main
scripts in use is install-alternatives, which calls u-a.
-------------------------------------------------------------------
Fri Feb 2 10:03:33 UTC 2018 - max@suse.com
- Put POSTGRES_LANG into LC_ALL instead of LANG to retain the
previous behaviour of that variable (boo#1077027).
-------------------------------------------------------------------
Wed Jan 17 16:48:57 UTC 2018 - max@suse.com
- postgresql-script: /etc/sysconfig/language is deprecated, use the
locale that was inherited from systemd instead for initializing
a new database instance (boo#1074988).
-------------------------------------------------------------------
Wed Dec 13 18:10:54 UTC 2017 - mrueckert@suse.de
- add provides for all the pkgconfig() provides you also find in
the postgresqlXY-devel packages. then we automatically will pull
postgresql-devel which in turn will pull our default
postgresqlXY-devel package. (boo#1071971)
-------------------------------------------------------------------
Wed Dec 6 10:32:06 UTC 2017 - bruno@ioda-net.ch
- Replace references to /var/adm/fillup-templates with new
%_fillupdir macro (boo#1069468)
-------------------------------------------------------------------
Fri Nov 24 11:24:09 UTC 2017 - mrueckert@suse.de
- instead of hardcoding version 10, just check if the prio is
smaller than 80.
-------------------------------------------------------------------
Thu Nov 23 17:05:21 UTC 2017 - mrueckert@suse.de
- simplify the postgresql-install-alternatives to only require the
pg version and go from there.
supported calls of the script are:
/usr/share/postgresql/install-alternatives postgresqlXY
/usr/share/postgresql/install-alternatives XY
where XY can currently be: 92 93 94 95 96 10
-------------------------------------------------------------------
Wed Nov 22 13:03:42 UTC 2017 - max@suse.com
- CVE-2017-14798, bsc#1062722: Fix LPE via postgres init script.
This only affected SysV-init based systems (i.e. SLE11).
-------------------------------------------------------------------
Tue Nov 14 08:52:46 UTC 2017 - max@suse.com
- postgresql-test was missing a %files section.
-------------------------------------------------------------------
Fri Nov 3 12:55:14 UTC 2017 - max@suse.com
- Move the start/stop script to /usr/share/postgresql
- Add a script for handling update-alternatives as subpackages
get installed/uninstalled, so that the implementation packages
don't have to repeat the logic (postgresql-install-alternatives).
- Add the postgresql-test subpackage.
- Fix some dependencies.
- Save the enabled and running state when upgrading from the
obsolete postgresql-init package.
-------------------------------------------------------------------
Fri Oct 6 14:33:54 UTC 2017 - mrueckert@suse.de
- properly guard the systemd macro in %pre server so it wont be
used on sle11
- add Requires(pre) so we have groupadd/useradd available
-------------------------------------------------------------------
Thu Sep 21 07:59:26 UTC 2017 - max@suse.com
- Refine the dependencies between the "dummy" packages and the
actual implementation of PostgreSQL. The dummy packages now
require an arbitrary implementation and recommend the default
version.
- Move the contents of postgresql-init to the server package.
-------------------------------------------------------------------
Thu Aug 3 23:06:39 UTC 2017 - mrueckert@suse.de
- bump to 10
-------------------------------------------------------------------
Wed Jun 28 09:35:46 UTC 2017 - max@suse.com
- Bump version and defaultpackage to 9.6 in SLE12 (bsc#1046324).
-------------------------------------------------------------------
Sun Oct 30 06:17:24 UTC 2016 - 13ilya@gmail.com
- Bump version and defaultpackage to 9.6 in Factory.
-------------------------------------------------------------------
Mon Sep 28 15:04:31 UTC 2015 - max@suse.com
- Move ~postgres/.bash_profile to postgresql-server to avoid a
file conflict between the versioned server packages.
-------------------------------------------------------------------
Mon Aug 17 00:25:13 CEST 2015 - ro@suse.de
- Bump version and defaultpackage to 9.4. in SLE (bnc#941886)
-------------------------------------------------------------------
Wed Feb 18 15:28:45 UTC 2015 - max@suse.com
- Bump version and defaultpackage to 9.4 in Factory.
-------------------------------------------------------------------
Tue Sep 17 11:44:19 UTC 2013 - max@suse.com
- Bump version and defaultpackage to 9.3.
-------------------------------------------------------------------
Wed Jan 9 09:55:11 UTC 2013 - max@suse.com
- Change license string to PostgreSQL.
-------------------------------------------------------------------
Fri Oct 5 17:28:22 UTC 2012 - max@suse.com
- Make all dummy packages noarch.
-------------------------------------------------------------------
Thu Oct 4 14:51:58 UTC 2012 - max@suse.com
- Make PostgreSQL 9.2 the default.
-------------------------------------------------------------------
Mon Oct 1 14:13:18 UTC 2012 - max@suse.com
- Reduce the postgresql packages with unversioned names to dummy
packages that require the respective versioned package names.

19
postgresql.service Normal file
View File

@ -0,0 +1,19 @@
[Unit]
Description=PostgreSQL database server
After=syslog.target
After=network.target
[Service]
Type=forking
User=postgres
EnvironmentFile=-/etc/sysconfig/postgresql
ExecStart=/usr/share/postgresql/postgresql-script start
ExecStop=/usr/share/postgresql/postgresql-script stop
ExecReload=/usr/share/postgresql/postgresql-script reload
# The server might be slow to stop, and that's fine. Don't kill it
SendSIGKILL=no
[Install]
WantedBy=multi-user.target

528
postgresql.spec Normal file
View File

@ -0,0 +1,528 @@
#
# spec file for package postgresql
#
# Copyright (c) 2016 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
%define pgmajor 15
%define defaultpackage postgresql%pgmajor
%if ! %{defined _rpmmacrodir}
%define _rpmmacrodir %{_rpmconfigdir}/macros.d
%endif
#Compat macro for new _fillupdir macro introduced in Nov 2017
%if ! %{defined _fillupdir}
%define _fillupdir /var/adm/fillup-templates
%endif
%if 0%{?suse_version} >= 1300
%bcond_without systemd
%else
%bcond_with systemd
%endif
# We do not need the pgmajor comparison here as it is irrelevant which version this package has
%if 0%{?suse_version} >= 1500
%bcond_without llvm
%else
%bcond_with llvm
%endif
# On SLE-15 up to SP3 sysusers does not support shells
# other than /bin/nologin
%if 0%{?suse_version} >= 1550 || 0%{?sle_version} >= 150400
%bcond_without sysusers
%else
%bcond_with sysusers
%endif
Name: postgresql
Summary: Basic Clients and Utilities for PostgreSQL
License: PostgreSQL
Group: Productivity/Databases/Tools
Version: %pgmajor
Release: 0
Url: https://www.postgresql.org/
BuildRoot: %{_tmppath}/%{name}-%{version}-build
Provides: postgresql-noarch = %version-%release
Requires: postgresql-implementation
Requires: update-alternatives
Recommends: %defaultpackage
# In June 2020 we changed the package layout for PostgreSQL and
# conflict with older releases to get a clean cut-over.
Conflicts: postgresql < 9
Conflicts: postgresql90
Conflicts: postgresql91
Conflicts: postgresql92
Conflicts: postgresql93
Conflicts: postgresql94 < 9.4.26
Conflicts: postgresql95 < 9.5.22
Conflicts: postgresql96 < 9.6.18
Conflicts: postgresql10 < 10.13
Conflicts: postgresql11 < 11.8
Conflicts: postgresql12 < 12.3
BuildArch: noarch
Source0: postgresql-init
Source1: postgresql-sysconfig
Source2: postgresql-firewall
Source3: postgresql-tmpfiles.conf
Source4: postgresql.service
Source5: postgresql-bashprofile
Source6: postgresql-script
Source7: postgresql-install-alternatives
Source8: postgresql-extensions-macros
Source9: postgresql.sysusers
%if 0%{?suse_version} > 1100
%define fwdir /etc/sysconfig/SuSEfirewall2.d/services
%define fwname postgresql
%else
%define fwdir /etc/sysconfig/scripts
%define fwname SuSEfirewall2-postgresql
%endif
%description
PostgreSQL is an advanced object-relational database management system
that supports an extended subset of the SQL standard, including
transactions, foreign keys, subqueries, triggers, and user-defined
types and functions.
This package contains the basic utility and client programs necessary
to maintain and work with local or remote PostgreSQL databases as well
as manual pages for the SQL commands that PostgreSQL supports. Full
HTML documentation for PostgreSQL can be found in the postgresql-docs
package.
%package server
Summary: The Programs Needed to Create and Run a PostgreSQL Server
Group: Productivity/Databases/Servers
Provides: postgresql-server-noarch = %version-%release
Requires: postgresql-server-implementation
Requires: postgresql = %version-%release
Recommends: %defaultpackage-server
%if 0%{?suse_version} >= 1315
%if %{with sysusers}
BuildRequires: sysuser-tools
%sysusers_requires
%else
Requires(pre): shadow
%endif
%else
Requires(pre): pwdutils
%endif
Provides: postgresql-init = %version.0-%release
Obsoletes: postgresql-init < %version.0-%release
%if %{with systemd}
BuildRequires: pkgconfig(systemd)
%{?systemd_requires}
%else
Requires(postun): %insserv_prereq
%endif
%description server
PostgreSQL is an advanced object-relational database management system
that supports an extended subset of the SQL standard, including
transactions, foreign keys, sub-queries, triggers, and user-defined
types and functions.
This package includes the programs needed to create and run a
PostgreSQL server, which will in turn allow you to create and maintain
PostgreSQL databases.
%package server-devel
Summary: PostgreSQL server development header files and utilities
Group: Development/Libraries/C and C++
Provides: postgresql-server-devel-noarch = %version-%release
Requires: postgresql-server-devel-implementation
Recommends: %defaultpackage-server-devel
%description server-devel
PostgreSQL is an advanced object-relational database management system
that supports an extended subset of the SQL standard, including
transactions, foreign keys, subqueries, triggers, and user-defined
types and functions.
This package contains the header files and libraries needed to compile
C extensions that link into the PostgreSQL server. For building client
applications, see the %defaultpackage-devel package.
%package llvmjit
Summary: Just-in-time compilation support for PostgreSQL
Group: Productivity/Databases/Servers
Provides: postgresql-llvmjit-noarch = %version-%release
Requires: postgresql-llvmjit-implementation
Recommends: %defaultpackage-llvmjit
%description llvmjit
PostgreSQL is an advanced object-relational database management system
that supports an extended subset of the SQL standard, including
transactions, foreign keys, sub-queries, triggers, and user-defined
types and functions.
This package contains support for just-in-time compiling parts of
PostgreSQL queries. Using LLVM it compiles e.g. expressions and tuple
deforming into native code, with the goal of accelerating analytics
queries.
%package llvmjit-devel
Summary: Helper package to pull all dependencies to build with llvm support
Group: Productivity/Databases/Servers
Provides: postgresql-llvmjit-devel-noarch = %version-%release
Requires: postgresql-server-devel-noarch
Requires: postgresql-llvmjit-devel-implementation
%description llvmjit-devel
PostgreSQL is an advanced object-relational database management system
that supports an extended subset of the SQL standard, including
transactions, foreign keys, sub-queries, triggers, and user-defined
types and functions.
This package will pull all the dependencies to build extensions with llvm
support if the base distro has llvm enabled.
Otherwise it will just pull the postgresqlXY-server-devel package
%package test
Summary: The test suite for PostgreSQL
Group: Productivity/Databases/Servers
Provides: postgresql-test-noarch = %version-%release
Requires: postgresql-test-implementation
Recommends: %defaultpackage-implementation
%description test
This package contains the sources and pre-built binaries of various
tests for the PostgreSQL database management system, including
regression tests and benchmarks.
%package docs
Summary: HTML Documentation for PostgreSQL
Group: Productivity/Databases/Tools
Provides: postgresql-docs-noarch = %version-%release
Requires: postgresql-docs-implementation
Recommends: %defaultpackage-docs
%description docs
PostgreSQL is an advanced object-relational database management system
that supports an extended subset of the SQL standard, including
transactions, foreign keys, subqueries, triggers, and user-defined
types and functions.
This package contains the HTML documentation for PostgreSQL. The start
page is: file:///usr/share/doc/packages/postgresql/html/index.html .
Manual pages for the PostgreSQL SQL statements can be found in the
postgresql package.
%package contrib
Summary: Contributed Extensions and Additions to PostgreSQL
Group: Productivity/Databases/Tools
Provides: postgresql-contrib-noarch = %version-%release
Requires: postgresql-contrib-implementation
Recommends: %defaultpackage-contrib
%description contrib
PostgreSQL is an advanced object-relational database management system
that supports an extended subset of the SQL standard, including
transactions, foreign keys, subqueries, triggers, and user-defined
types and functions.
The postgresql-contrib package includes extensions and additions that
are distributed along with the PostgreSQL sources, but are not (yet)
officially part of the PostgreSQL core.
Documentation for the modules contained in this package can be found in
/usr/share/doc/packages/postgresql/contrib.
%package devel
Summary: PostgreSQL development header files and libraries
Group: Development/Libraries/C and C++
Provides: postgresql-devel-noarch = %version-%release
Provides: pkgconfig(libecpg) = %{version}-%{release}
Provides: pkgconfig(libecpg_compat) = %{version}-%{release}
Provides: pkgconfig(libpgtypes) = %{version}-%{release}
Provides: pkgconfig(libpq) = %{version}-%{release}
Requires: postgresql-devel-implementation
Recommends: %defaultpackage-devel
%description devel
PostgreSQL is an advanced object-relational database management system
that supports an extended subset of the SQL standard, including
transactions, foreign keys, subqueries, triggers, and user-defined
types and functions.
This package contains the header files and libraries needed to compile
C applications which will directly interact with a PostgreSQL database
management server and the ECPG Embedded C Postgres preprocessor. You
need to install this package if you want to develop applications in C
which will interact with a PostgreSQL server.
%package plperl
Summary: The PL/Tcl, PL/Perl, and PL/Python procedural languages for PostgreSQL
Group: Productivity/Databases/Servers
Provides: postgresql-plperl-noarch = %version-%release
Requires: postgresql-plperl-implementation
Recommends: %defaultpackage-plperl
%description plperl
PostgreSQL is an advanced object-relational database management system
that supports an extended subset of the SQL standard, including
transactions, foreign keys, subqueries, triggers, and user-defined
types and functions.
This package contains the PL/Perl procedural language for PostgreSQL.
With this module one can use Perl to write stored procedures,
functions, and triggers.
%package plpython
Summary: The PL/Python Procedural Languages for PostgreSQL
Group: Productivity/Databases/Servers
Provides: postgresql-plpython-noarch = %version-%release
Requires: postgresql-plpython-implementation
Recommends: %defaultpackage-plpython
%description plpython
PostgreSQL is an advanced object-relational database management system
that supports an extended subset of the SQL standard, including
transactions, foreign keys, subqueries, triggers, and user-defined
types and functions.
This package contains the PL/Python procedural language for PostgreSQL.
With this module one can use Python to write stored procedures,
functions, and triggers.
%package pltcl
Summary: PL/Tcl Procedural Language for PostgreSQL
Group: Productivity/Databases/Tools
Provides: postgresql-pltcl-noarch = %version-%release
Requires: postgresql-pltcl-implementation
Recommends: %defaultpackage-pltcl
%description pltcl
PostgreSQL is an advanced object-relational database management system
that supports an extended subset of the SQL standard, including
transactions, foreign keys, subqueries, triggers, and user-defined
types and functions.
This package contains the PL/Tcl procedural language for PostgreSQL.
With thie module one can use Tcl to write stored procedures, functions,
and triggers.
%prep
%build
%if %{with sysusers}
%sysusers_generate_pre %{SOURCE9} %{name}-server %{name}-server.conf
%endif
echo "This is a dummy package to provide a dependency on the default PostgreSQL version." > README
%install
mkdir -p %buildroot/var/lib/pgsql/
install -m755 -d %buildroot%{_fillupdir}
install -m644 %{S:1} %buildroot%{_fillupdir}/sysconfig.postgresql
%if 0%{?suse_version} < 1550
install -m755 -d %buildroot%fwdir
install -m644 %{S:2} %buildroot%fwdir/%fwname
%endif
install -m755 -d %buildroot/usr/sbin
install -m755 -d %buildroot/usr/share/postgresql
install -m755 %{S:7} %buildroot/usr/share/postgresql/install-alternatives
%if %{with systemd}
install -m644 %{S:5} %buildroot/usr/share/postgresql/bash_profile
install -m755 -d %buildroot/%_tmpfilesdir
install -m644 %{S:3} %buildroot%_tmpfilesdir/postgresql.conf
install -m755 %{S:6} %buildroot/usr/share/postgresql
install -m755 -d %buildroot%_unitdir
install -m444 %{S:4} %buildroot%_unitdir
ln -sf service %buildroot/usr/sbin/rcpostgresql
%else
install -m640 %{S:5} %buildroot/var/lib/pgsql/.bash_profile
install -m755 -d %buildroot/etc/init.d
install -m755 %{S:0} %buildroot/etc/init.d/postgresql
ln -sf /etc/init.d/postgresql %buildroot/usr/sbin/rcpostgresql
%endif
install -D -m 0644 %{SOURCE8} %{buildroot}%{_rpmmacrodir}/macros.%{name}
# sysusers.d
%if %{with sysusers}
install -Dm0644 %{SOURCE9} %{buildroot}%{_sysusersdir}/%{name}-server.conf
%endif
%define eflag /run/postgresql-was-enabled
%define aflag /run/postgresql-was-running
%if %{with sysusers}
%pre server -f %{name}-server.pre
%else
%pre server
getent group postgres > /dev/null ||
groupadd -g 26 -o -r postgres
getent passwd postgres > /dev/null ||
useradd -g postgres -o -r -d /var/lib/pgsql -s /bin/bash \
-c "PostgreSQL Server" -u 26 postgres
%endif
%if %{with systemd}
%service_add_pre postgresql.service
# Save the "enabled" and "active" state across the transition of
# ownership of postgresql.service from postgresql-init to
# postgresql-server.
if [ $1 -ge 1 ]; then \
if [ x$(systemctl is-enabled postgresql.service 2>/dev/null ||:) = "xenabled" ]; then
touch %eflag
fi
systemctl is-active postgresql.service &>/dev/null && touch %aflag ||:
fi
%endif
%post server
%fillup_only -n postgresql
%if %{with systemd}
PROFILE="/var/lib/pgsql/.bash_profile"
if test -r "$PROFILE" && test "`cat $PROFILE`" = "/usr/share/postgresql/bash_profile"
then
# Correct a mistake in /usr/lib/tmpfiles.d/postgresql.conf
# that created /var/lib/pgsql/.bash_profile with invalid
# content (bsc#1159335).
rm "$PROFILE"
fi
%tmpfiles_create %_tmpfilesdir/postgresql.conf
%service_add_post postgresql.service
%endif
%preun server
%if %{with systemd}
# Cannot use systemd macros here, because they're doing too much
/usr/bin/systemctl --no-reload disable postgresql.service || :
%else
%stop_on_removal postgresql
%endif
%postun server
%if %{with systemd}
# Cannot use systemd macros here, because they're doing too much
rm -f "/var/lib/systemd/migrated/postgresql"
/usr/bin/systemctl daemon-reload || :
%else
%insserv_cleanup
%endif
%if %{with systemd}
%posttrans server
# Save the "enabled" and "active" state across the transition of
# ownership of postgresql.service from postgresql-init to
# postgresql-server.
if test -f %eflag; then
rm -f %eflag
systemctl enable postgresql.service
fi
if test -f %aflag; then
rm -f %aflag
systemctl start postgresql.service
fi
%endif
%files
%defattr(-,root,root,-)
%doc README
%dir /usr/share/postgresql
/usr/share/postgresql/install-alternatives
%files server
%defattr(-,root,root,-)
%doc README
%attr(750,postgres,postgres) %dir /var/lib/pgsql
%if %{with systemd}
%attr(644,root,root) /usr/share/postgresql/bash_profile
%ghost %config %attr(640,postgres,postgres) /var/lib/pgsql/.bash_profile
%else
%config %attr(640,postgres,postgres) /var/lib/pgsql/.bash_profile
%endif
%if 0%{?suse_version} < 1550
%if 0%{?suse_version} > 1110
%dir %fwdir
%endif
%config %fwdir/%fwname
%endif
%{_fillupdir}/sysconfig.postgresql
/usr/sbin/rcpostgresql
%if %{with systemd}
%_tmpfilesdir/postgresql.conf
%_unitdir/
/usr/share/postgresql/postgresql-script
%ghost %dir %attr(1775,postgres,postgres) /run/postgresql
%else
%config /etc/init.d/postgresql
%dir %attr(1775,postgres,postgres) /var/run/postgresql
%endif
%if %{with sysusers}
%{_sysusersdir}/%{name}-server.conf
%endif
%files test
%defattr(-,root,root,-)
%doc README
%files docs
%defattr(-,root,root,-)
%doc README
%files contrib
%defattr(-,root,root,-)
%doc README
%files devel
%defattr(-,root,root,-)
%doc README
%files server-devel
%defattr(-,root,root,-)
%doc README
%{_rpmmacrodir}/macros.%{name}
%if %{with llvm}
%files llvmjit
%defattr(-,root,root,-)
%doc README
%files llvmjit-devel
%defattr(-,root,root,-)
%doc README
%endif
%files plperl
%defattr(-,root,root,-)
%doc README
%files plpython
%defattr(-,root,root,-)
%doc README
%files pltcl
%defattr(-,root,root,-)
%doc README
%changelog

2
postgresql.sysusers Normal file
View File

@ -0,0 +1,2 @@
#Type Name ID GECOS Home directory Shell
u postgres - "PostgreSQL Server" /var/lib/pgsql /bin/bash