postgresql/rc.postgresql

Tue, 29 Mar 2011 20:04:34 +0200

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 29 Mar 2011 20:04:34 +0200
changeset 334
4a34d7a82eab
permissions
-rw-r--r--

Rework package yet again, correcting and introducing new buildconf logic:
Conditionally disable bootstrap stage comparison correctly, correct
english grammar, better find system as(1) and ld(1), indotruce detailed
optimization option messages, more completely guess cpu types, allow
profiled bootstrapping without a preinstalled GCC because many other
compilers have long since implemented 64-bit arithmetic, instruct make
to build sequentially (not in sparallel) when building a profiled
bootstrap as GCC online documents recommend, and generally improve
comment blocks.

The single most important correction in this changeset relates to the
GCC changed optimization policy since at least GCC 4.5, in which -march
is always passed and not always correctly guessed. In the case of this
package, allowing GCC to guess the architecture leads to wild build
errors at various subcomponents (zlib, libgcc, libiberty...) and
bootstrap stages. It seems quite platform specific, and the safest
approach to correcting this seems to be explicitly always specifying the
-march argument when bootstrapping GCC. Because the best choice 'native'
is not available when bootstrapping using a foreign (non GCC) compiler,
a guess is made according to rpmmacros l_platform in that case.

It is questionable as to whether these recent optimization changes
on the part of GCC or this package are compatible with each other,
or if either are complete or correct at all. At least applying these
corrections allows this package to build again in most cases test.

     1 #!@l_prefix@/bin/openpkg rc
     2 ##
     3 ##  rc.postgresql -- Run-Commands
     4 ##
     6 %config
     7     postgresql_enable="$openpkg_rc_def"
     8     postgresql_flags=""
     9     postgresql_datadir="@l_prefix@/var/postgresql/db"
    10     postgresql_rundir="@l_prefix@/var/postgresql/run"
    11     postgresql_shut_mode="fast"
    12     postgresql_socket_inet="127.0.0.1"
    13     postgresql_socket_unix="@l_prefix@/var/postgresql/run"
    14     postgresql_log_prolog="true"
    15     postgresql_log_epilog="true"
    16     postgresql_log_numfiles="10"
    17     postgresql_log_minsize="1M"
    18     postgresql_log_complevel="9"
    19     postgresql_slony1="no"
    21 %common
    22     postgresql_opts="-h $postgresql_socket_inet -k $postgresql_socket_unix"
    23     postgresql_opts="$postgresql_opts $postgresql_flags"
    24     postgresql_logfile="$postgresql_rundir/postgresql.log"
    25     postgresql_pidfile="$postgresql_datadir/postgresql.pid"
    26     postgresql_slony1_pidfile="$postgresql_rundir/slon.pid"
    27     postgresql_slony1_start () {
    28         ( . @l_prefix@/etc/postgresql/slony1.conf
    29           nohup @l_prefix@/bin/slon \
    30               -d "$SLON_SYNC_LOGLEVEL" -g "$SLON_SYNC_GROUPSIZE" \
    31               -s "$SLON_SYNC_INTERVAL" -t "$SLON_SYNC_TIMEOUT" \
    32               "$SLON_CLUSTER_NAME" \
    33               user="$SLON_CONNECT_USER" password="$SLON_CONNECT_PASS" \
    34               dbname="$SLON_CONNECT_DBNAME" host="$SLON_CONNECT_HOST"
    35               </dev/null >/dev/null 2>&1 &
    36           echo $! >$postgresql_slony1_pidfile
    37         ) >/dev/null 2>&1
    38     }
    39     postgresql_slony1_stop () {
    40         if [ -f $postgresql_slony1_pidfile ]; then
    41             kill -TERM `cat $postgresql_slony1_pidfile`
    42             rm -f $postgresql_slony1_pidfile
    43         fi
    44     }
    45     postgresql_ctl () {
    46         if [ -s $postgresql_pidfile ]; then
    47             kill -0 `head -1 $postgresql_pidfile` >/dev/null 2>&1
    48             if [ $? -ne 0 ]; then
    49                 rm -f $postgresql_pidfile    >/dev/null 2>&1 || true
    50                 rm -f $postgresql_rundir/.s* >/dev/null 2>&1 || true
    51             fi
    52         fi
    53         cmd="$1"; shift
    54         @l_prefix@/bin/pg_ctl $cmd \
    55             -l $postgresql_logfile \
    56             -D $postgresql_datadir \
    57             ${1+"$@"}
    58     }
    60 %status -u @l_rusr@ -o
    61     postgresql_usable="unknown"
    62     postgresql_active="no"
    63     rcService postgresql enable yes && \
    64         postgresql_ctl status >/dev/null && \
    65         postgresql_active="yes"
    66     echo "postgresql_enable=\"$postgresql_enable\""
    67     echo "postgresql_usable=\"$postgresql_usable\""
    68     echo "postgresql_active=\"$postgresql_active\""
    70 %start -p 400 -u @l_rusr@
    71     rcService postgresql enable yes || exit 0
    72     rcService postgresql active yes && exit 0
    73     postgresql_ctl start -o "$postgresql_opts"
    74     if rcVarIsYes postgresql_slony1; then
    75         postgresql_slony1_start
    76     fi
    78 %stop -p 600 -u @l_rusr@
    79     rcService postgresql enable yes || exit 0
    80     rcService postgresql active no  && exit 0
    81     postgresql_ctl stop -m "$postgresql_shut_mode"
    82     if rcVarIsYes postgresql_slony1; then
    83         postgresql_slony1_stop
    84     fi
    86 %restart -p 400 -u @l_rusr@
    87     rcService postgresql enable yes || exit 0
    88     rcService postgresql active no  && exit 0
    89     postgresql_ctl restart -o "$postgresql_opts" -m "$postgresql_shut_mode"
    90     if rcVarIsYes postgresql_slony1; then
    91         postgresql_slony1_stop
    92         postgresql_slony1_start
    93     fi
    95 %reload -p 400 -u @l_rusr@
    96     rcService postgresql enable yes || exit 0
    97     rcService postgresql active no  && exit 0
    98     postgresql_ctl reload
   100 %daily -u @l_rusr@
   101     rcService postgresql enable yes || exit 0
   102     shtool rotate -f \
   103         -n ${postgresql_log_numfiles} -s ${postgresql_log_minsize} -d -c \
   104         -z ${postgresql_log_complevel} -m 600 -o @l_rusr@ -g @l_rgrp@ \
   105         -P "$postgresql_log_prolog" \
   106         -E "$postgresql_log_epilog" \
   107         $postgresql_logfile

mercurial