Gentoo Archives: gentoo-dev

From: Jeremy Huddleston <eradicator@g.o>
To: gentoo-dev@l.g.o
Subject: [gentoo-dev] RFC: eutils addition - preserve_old_lib
Date: Sat, 02 Oct 2004 22:26:34
Message-Id: 1096755990.8353.6.camel@cid.outersquare.org
1 When the soname of a lib changes between versions of a package, we need
2 to do a revdep-rebuild --soname <old lib> to make sure all programs that
3 link against the old lib are rebuilt to use the new one. In order to
4 not break currently installed programs, it is best for a package to keep
5 the old version around until this process is done and the user deletes
6 the file. Currently it is up to the individual package maintainers to
7 do this in their own way. I've had to do it enough times that I decided
8 it might be best to just write something into eutils.eclass to handle
9 it... so...
10
11 I'd like to get feedback on the following addition to the eutils.eclass
12 which I'd like to commit to cvs in the next couple days
13
14 +# Jeremy Huddleston <eradicator@g.o>:
15 +# preserve_old_lib /path/to/libblah.so.0
16 +# preserve_old_lib_notify /path/to/libblah.so.0
17 +#
18 +# These functions are useful when a lib in your package changes
19 --soname. Such
20 +# an example might be from libogg.so.0 to libogg.so.1. Removing
21 libogg.so.0
22 +# would break packages that link against it. Most people get around
23 this
24 +# by using the portage SLOT mechanism, but that is not always a
25 relevant
26 +# solution, so instead you can add the following to your ebuilds:
27 +#
28 +# src_install() {
29 +# ...
30 +# preserve_old_lib /usr/$(get_libdir)/libogg.so.0
31 +# ...
32 +# }
33 +#
34 +# pkg_postinst() {
35 +# ...
36 +# preserve_old_lib_notify /usr/$(get_libdir)/libogg.so.0
37 +# ...
38 +# }
39 +
40 +preserve_old_lib() {
41 + LIB=$1
42 +
43 + if [ -n "${LIB}" -a -f "${ROOT}${LIB}" ]; then
44 + SONAME=`basename ${LIB}`
45 + DIRNAME=`dirname ${LIB}`
46 +
47 + dodir ${DIRNAME}
48 + cp ${ROOT}${LIB} ${D}${DIRNAME}
49 + touch ${D}${LIB}
50 + fi
51 +}
52 +
53 +preserve_old_lib_notify() {
54 + LIB=$1
55 +
56 + if [ -n "${LIB}" -a -f "${ROOT}${LIB}" ]; then
57 + SONAME=`basename ${LIB}`
58 +
59 + einfo "An old version of an installed library was
60 detected on your system."
61 + einfo "In order to avoid breaking packages that link
62 against is, this older version"
63 + einfo "is not being removed. In order to make full use
64 of this newer version,"
65 + einfo "you will need to execute the following command:"
66 + einfo " revdep-rebuild --soname ${SONAME}"
67 + einfo
68 + einfo "After doing that, you can safely remove ${LIB}"
69 + fi
70 +}
71 --
72 Jeremy Huddleston <eradicator@g.o>

Attachments

File name MIME type
signature.asc application/pgp-signature

Replies