[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[RFC] Adding udebs in shlibs files for glibc



As you may know, dependencies on glibc udebs are the only category that is 
still incorrect [1]. This is an attempt to fix that.

Normally we would add an option '--udeb <udeb name>' to the dh_makeshlibs 
call in debian/rules. However, in the case of glibc this does not work.
Reason is that two libraries (libnss-dns and libnss-files) that are both in 
the regular libc6 package, have been split out into separate udebs.
Another (minor) reason is that not all libraries are copied into udebs, so 
adding udeb: lines in the shlibs files for those seems redundant.

Solution I have come up with is to write a small script that will generate 
the udeb: lines _after_ dh_makeshlibs has generated the basic shlibs file.

As an example, the output of the script on amd64 is:
udeb: ld-linux-x86-64 2 libc6-udeb (>= 2.7-1)
udeb: libm 6 libc6-udeb (>= 2.7-1)
udeb: libdl 2 libc6-udeb (>= 2.7-1)
udeb: libresolv 2 libc6-udeb (>= 2.7-1)
udeb: libc 6 libc6-udeb (>= 2.7-1)
udeb: libutil 1 libc6-udeb (>= 2.7-1)
udeb: libcrypt 1 libc6-udeb (>= 2.7-1)
udeb: librt 1 libc6-udeb (>= 2.7-1)
udeb: libpthread 0 libc6-udeb (>= 2.7-1)
udeb: libnss_dns 2 libnss-dns-udeb (>= 2.7-1)
udeb: libnss_files 2 libnss-files-udeb (>= 2.7-1)

Any comments on this approach and the patch before I proceed [2] with this?

Joey: do you see any chance to incorporate this in debhelper, or is adding 
it glibc the better option?

Cheers,
FJP

[1] Except maybe the deps of some components we currently don't use.
    See also: http://wiki.debian.org/DebianInstaller/LibraryUdebs
[2] Before I submit the patch I would at least like to do some build and
    run tests with this to see if there'd be any transition issues.

diff -u glibc-2.7/debian/changelog glibc-2.7/debian/changelog
--- glibc-2.7/debian/changelog
+++ glibc-2.7/debian/changelog
@@ -1,3 +1,9 @@
+glibc (2.7-7~fjp) UNRELEASED; urgency=low
+
+  * Add udeb lines in shlibs files.
+
+ -- Frans Pop <fjp@debian.org>  Sun, 10 Feb 2008 02:06:10 +0100
+
 glibc (2.7-6) unstable; urgency=low
 
   [ Aurelien Jarno ]
diff -u glibc-2.7/debian/rules.d/debhelper.mk glibc-2.7/debian/rules.d/debhelper.mk
--- glibc-2.7/debian/rules.d/debhelper.mk
+++ glibc-2.7/debian/rules.d/debhelper.mk
@@ -109,6 +109,8 @@
 		-o -regex '.*/libc-.*so' \) \
 		-exec chmod a+x '{}' ';'
 	dh_makeshlibs -X/usr/lib/debug -p$(curpass) -V "$(call xx,shlib_dep)"
+	# Add relevant udeb: lines in shlibs files
+	./debian/shlibs-add-udebs $(curpass)
 
 	if [ -f debian/$(curpass).lintian ] ; then \
 		install -d -m 755 -o root -g root debian/$(curpass)/usr/share/lintian/overrides/ ; \
@@ -153,6 +155,8 @@
 		-o -regex '.*lib[0-9]*/libc[.-].*so.*' \) \
 		-exec chmod a+x '{}' ';'
 	# dh_makeshlibs -X/usr/lib/debug -p$(curpass) -V "$(call xx,shlib_dep)"
+	# Add relevant udeb: lines in shlibs files
+	# ./debian/shlibs-add-udebs $(curpass)
 	dh_installdeb -p$(curpass)
 	# dh_shlibdeps -p$(curpass)
 	dh_gencontrol -p$(curpass)
only in patch2:
unchanged:
--- glibc-2.7.orig/debian/shlibs-add-udebs
+++ glibc-2.7/debian/shlibs-add-udebs
@@ -0,0 +1,43 @@
+#! /bin/sh
+set -e
+
+package="$1"
+shlibs_file="debian/$package/DEBIAN/shlibs"
+
+# Skip packages that don't have an shlibs file
+# The "cross-subarch" library packages have an shlibs file, but should
+# not have udeb lines, so skip those as well
+if [ ! -r "$shlibs_file" ] || \
+   echo "$package" | grep -q "^libc[0-9.]\+-"; then
+	exit 0
+fi
+
+# $1: regular expr. to select libraries for which lines should be duplicated
+# $2: name of the udeb the new line should point to
+add_udeb_line() {
+	regexp="$1"
+	udeb="$2"
+	if line="$(grep -E "^$1[[:space:]]" $shlibs_file)"; then
+		echo "$line" | while read llib lsoname lpackage lrest; do
+			echo "udeb: $llib $lsoname $2 $lrest" >>$shlibs_file
+		done
+	fi
+}
+
+
+# The following lists should match the ones in the *-udeb.install files
+W="[^[:space:]]*"
+expr_libc1="ld$W libm-$W libm libdl$W libresolv$W libc-$W libc"
+expr_libc2="libutil$W libcrypt$W librt$W libpthread$W"
+expr_nss_dns="libnss_dns$W"
+expr_nss_files="libnss_files$W"
+
+for expr in $expr_libc1 $expr_libc2; do
+	add_udeb_line "$expr" $package-udeb
+done
+for expr in $expr_nss_dns; do
+	add_udeb_line "$expr" libnss-dns-udeb
+done
+for expr in $expr_nss_files; do
+	add_udeb_line "$expr" libnss-files-udeb
+done

Attachment: signature.asc
Description: This is a digitally signed message part.


Reply to: