Hi Martin, I did not here anything from you, so I created a patch to make clear what I meant.
-------- Weitergeleitete Nachricht -------- > Von: Jens Lody <[email protected]> > An: Martin Pitt <[email protected]> > Kopie: [email protected] > Betreff: Re: Bug#640493: postgresql-common: logrotate 3.8.0 breaks > postgresql log rotation. > Datum: Tue, 25 Oct 2011 15:09:32 +0200 > > Am Dienstag, den 25.10.2011, 14:53 +0200 schrieb Martin Pitt: > > Jens Lody [2011-10-25 13:44 +0200]: > > > Wouldn't it be possible to add the line in the postinst-step ? > > > > No, you can't change dependencies in maintainer scripts. The point > is > > to stop apt from trying to install it in the first place. > > > > > This should work for all versions including the backports. > > > > The current solution should already work for backports. What is > broken > > right now? > > It's impossible to install logrotate 3.8 (from experimental) together with the actual postgresql-common from testing. > > Thanks, > > > > Martin > I know that dependencies are "hardcoded" at compile-time (or more > exactly during package-build). > > What I meant is to add the "su root root"-line to the logrotate-conf > file for p-common dynamically in the postinst-script depending on the > version of logrotate. > > No need to change dependency, as p-common already depends on > logrotate. > I attach a patch that fixes the logrotate conf-file in postinst, either at install time, or via a trigger if a new logrotate is installed. It works here on my local system, but no backports are tested. > It might be needed to change from depends to pre-depends on logrotate, > so a probably newer version is surely isntalled before p-commons's > postinst is reached. I'm not sure if this would really be needed. Seems to work without predepends. > > Jens > > -- > > Jens Lody > > (Un-)official debian-repository for Code::Blocks: > http://apt.jenslody.de/ > > > |\ _,,,---,,_ > /,`.-'`' -. ;-;;,_ > <|,4- ) )-,_..;\ ( `'-' > '---''(_/--' `-'\_) > Best regards, Jens -- Jens Lody (Un-)official debian-repository for Code::Blocks: http://apt.jenslody.de/ |\ _,,,---,,_ /,`.-'`' -. ;-;;,_ <|,4- ) )-,_..;\ ( `'-' '---''(_/--' `-'\_)
diff -Nru postgresql-common-125.orig/debian/control postgresql-common-125/debian/control
--- postgresql-common-125.orig/debian/control 2011-10-12 15:18:27.000000000 +0200
+++ postgresql-common-125/debian/control 2011-11-21 08:49:36.000000000 +0100
@@ -16,10 +16,9 @@
debconf (>= 0.5.00) | debconf-2.0,
lsb-base (>= 3.0-3),
ssl-cert (>= 1.0.11),
- logrotate ${logrotate:version},
+ logrotate,
${misc:Depends}
-Breaks: postgresql-9.1 (<< 9.1.1-3~),
- ${common-breaks}
+Breaks: postgresql-9.1 (<< 9.1.1-3~)
Description: PostgreSQL database-cluster manager
The postgresql-common package provides a structure under which
multiple versions of PostgreSQL may be installed and/or multiple
diff -Nru postgresql-common-125.orig/debian/postgresql-common.postinst postgresql-common-125/debian/postgresql-common.postinst
--- postgresql-common-125.orig/debian/postgresql-common.postinst 2011-08-08 10:21:40.000000000 +0200
+++ postgresql-common-125/debian/postgresql-common.postinst 2011-11-21 08:48:42.000000000 +0100
@@ -6,6 +6,24 @@
SSL_ROOT=/etc/postgresql-common/root.crt
+fix_logrotate()
+{
+ # logrotate 3.8+ requires an additional "su" command which is not
+ # backportable, see #640493
+ lrv=`dpkg -s logrotate 2> /dev/null | grep ^Version | cut -f2- -d' '`
+ if [ "x$lrv" = x ] ; then \
+ lrv=0; \
+ fi
+
+ sed -i '/su root root/d' /etc/logrotate.d/postgresql-common; \
+
+ if dpkg --compare-versions $lrv ge 3.8; then \
+ echo "Fixing logrotate configuration for logrotate >= 3.8..."; \
+ sed -i '/^}/ i\ su root root' /etc/logrotate.d/postgresql-common; \
+ fi
+}
+
+
if [ "$1" = configure ]; then
# Make sure the administrative user exists
if ! getent passwd postgres > /dev/null; then
@@ -74,13 +92,22 @@
/usr/share/postgresql-common/pg_checksystem || true
+ fix_logrotate
+
if dpkg --compare-versions "$2" lt 94; then
pg_updatedicts || true
fi
fi
if [ "$1" = triggered ]; then
- pg_updatedicts || true
+ for i in $2; do
+ if [ "$i" == "/usr/share/myspell/dicts" ]; then
+ pg_updatedicts || true
+ fi
+ if [ "$2" == "/usr/sbin/logrotate" ]; then
+ fix_logrotate
+ fi
+ done
fi
#DEBHELPER#
diff -Nru postgresql-common-125.orig/debian/postgresql-common.triggers postgresql-common-125/debian/postgresql-common.triggers
--- postgresql-common-125.orig/debian/postgresql-common.triggers 2010-08-05 17:51:34.000000000 +0200
+++ postgresql-common-125/debian/postgresql-common.triggers 2011-11-21 08:32:53.000000000 +0100
@@ -1 +1,2 @@
interest /usr/share/myspell/dicts
+interest /usr/sbin/logrotate
diff -Nru postgresql-common-125.orig/debian/rules postgresql-common-125/debian/rules
--- postgresql-common-125.orig/debian/rules 2011-09-25 21:25:10.000000000 +0200
+++ postgresql-common-125/debian/rules 2011-11-21 08:49:01.000000000 +0100
@@ -27,23 +27,10 @@
dh_gencontrol -ppostgresql -ppostgresql-client -ppostgresql-doc -ppostgresql-contrib -- \
-Vdefault-version="$(DEFAULT_VER)" -v'$(DEFAULT_VER)+$${source:Version}'
- # will ship different conffiles for logrotate pre- and post-3.8
- if dpkg --compare-versions `apt-cache show logrotate | grep ^Version | cut -f2- -d' '` ge 3.8; then \
- dh_gencontrol -ppostgresql-common -- -Vlogrotate:version="(>= 3.8)"; \
- else \
- dh_gencontrol -ppostgresql-common -- -Vcommon-breaks="logrotate (>= 3.8)"; \
- fi
-
dh_gencontrol --remaining-packages
override_dh_installlogrotate:
dh_installlogrotate
- # logroate 3.8+ requires an additional "su" command which is not
- # backportable, see #640493
- if dpkg --compare-versions `apt-cache show logrotate | grep ^Version | cut -f2- -d' '` ge 3.8; then \
- echo "Fixing logrotate configuration for logrotate >= 3.8..."; \
- sed -i '/^}/ i\ su root root' debian/postgresql-common/etc/logrotate.d/*; \
- fi
override_dh_clean:
dh_clean
signature.asc
Description: This is a digitally signed message part

