[Pkg-openldap-devel] Re: r556 - openldap/trunk-2.1/debian

Torsten Landschoff torsten@debian.org
Wed, 18 May 2005 09:10:29 +0200


--6TrnltStXW4iwmi0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Hi Steve,=20

On Wed, May 18, 2005 at 04:57:06AM +0000, Steve Langasek wrote:
> Log:
> nuke files orphaned by libldap2-tls on install, so that running ldconfig
> doesn't break our symlinks.
=20
> Added: openldap/trunk-2.1/debian/libldap2.postinst
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> --- openldap/trunk-2.1/debian/libldap2.postinst	2005-05-14 03:00:06 UTC (=
rev 555)
> +++ openldap/trunk-2.1/debian/libldap2.postinst	2005-05-18 04:57:06 UTC (=
rev 556)
> @@ -0,0 +1,8 @@
> +#!/bin/sh -e
> +
> +if [ "$1" =3D "configure" ]; then
> +	rm -f /usr/lib/libldap.so.2.0.15 /usr/lib/libldap_r.so.2.0.15 \
> +	      /usr/lib/liblber.so.2.0.15
> +fi
> +
> +#DEBHELPER#

Thanks for figuring this out, Steve! The problem I am seeing is that
there were different versions of libldap2-tls and we can't be sure what
the user is running. I don't have libldap2-tls available anymore but I
found libldap2-tls on the net as 2.0.27-3.bunk which has the following
code in the postrm:

undivert_lib() {
        dpkg-divert --package libldap2-tls --remove --rename \
                --divert /usr/lib/lib$1-notls.so.2.0.17 \
                        /usr/lib/lib$1.so.2.0.17
}

if [ "$1" =3D remove ]; then
        for i in ldap_r ldap lber; do
                undivert_lib $i
        done
fi

Looking at this now I wonder if postrm is always called with "remove".
Looking at the policy I get the impression that it might also be called
with the "upgrade" parameter instead. So maybe we have different library
versions.=20

So maybe we have do deal with other versions of libldap2* as well. The
other question: Doesn't dpkg remove the diversions of a package together
with the package?=20

Perhaps we can use dpkg-divert --list to remove those old diversions and
files. But I am not entirely sure about the semantics of dpkg-divert
under this circumstances. The following old code from libldap2-tls'
postinst gives an idea how to do this (adapted lightly):

# Removes the left over diversions of the old package

# List the library versions of the installed diversions
list_versions() {
        dpkg-divert --list /usr/lib/liblber.so.\*|grep "by libldap2-tls" \
                        |sed -e 's,^.*/usr/lib/liblber.so.\([^ ]*\).*$,\1,g'
}

undivert_lib() {
	local notls tls
	notls=3D/usr/lib/lib$1-notls.so.$2
	tls=3D/usr/lib/lib$1.so.$2
        dpkg-divert --package libldap2-tls --remove --rename \
		--divert $notls $tls
	rm -f $notls $tls
=09
}

if [ "$1" =3D remove -o "$1" =3D configure ]; then
        for v in `list_versions`; do
		for i in ldap_r ldap lber; do=20
			undivert_lib $i $v
		done
	done
fi

Greetings

	Torsten

--6TrnltStXW4iwmi0
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: Digital signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (GNU/Linux)

iD8DBQFCiupldQgHtVUb5EcRAmD7AJ4sDYFFogMtWjjV9XllECVUVByO3wCfd1X0
Mp1QisHAfux5eo1h8ayAlLs=
=sInx
-----END PGP SIGNATURE-----

--6TrnltStXW4iwmi0--