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

Bug#474293: glibc: Add udeb: lines in shlibs files to improve udeb dependencies



Package: glibc
Version: 2.7-10
Severity: wishlist
Tags: d-i patch

For Etch we fixed debhelper and most library packages that provide udebs to 
improve the dependencies generated for udebs, but we skipped glibc then as 
it's less important when the installer is running (as libc is always 
included in the D-I initrds anyway and thus pulled in at build time).

However, it would be great to have this fixed before Lenny as it will help 
with the implementation of britney support for udebs.

The attached patch will add udeb: lines in the various libc packages, for 
example for libc6:
udeb: ld-linux 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)

Applying the patch should be safe and there are no transition issues. 
Possibly the change should be checked with Release Masters, but IMO it's 
not a problem to implement this at this stage of the release of Lenny.

After glibc has been uploaded with this patch, I plan to request binNMUs for 
all D-I packages that depend on libc to get their dependencies fixed.

Example of the effect of the patch
----------------------------------
fdisk-udeb_2.13.1-3_i386.udeb currently has:
   Depends: libc6 (>= 2.7-1)
when built against glibc with this patch this becomes:
   Depends: libc6-udeb (>= 2.7-1)

Comments
--------
We are aware the patch is a bit of a hack and the list of libs in the helper 
script will require some maintenance. We have discussed whether this could 
be implemented in debhelper instead, but this solution was preferred:
http://lists.debian.org/debian-boot/2008/02/msg00336.html

However, if you see alternative solutions, I'd be more than willing to 
discuss them and help develop/test them.

I removed the commented out dh_makeshlibs line in udebs section of 
debhelper.mk as I felt that to be better than adding a commented out call 
to the shlibs-add-udebs script.

I have only tested the patch on amd64 and i386, but AFAICT it should work 
for other arches too.

The udeb: lines are only added for libc6 and equivalent packages, and *not* 
for the "crossarch" packages (libc6-amd64, libc-i386, libc6-xen, etc.).
AFAICT udebs should not be compiled against those variants, so adding them 
there seemed redundant.
However, I'm not completely sure that is correct and I'd appreciate your 
opinion on this.

Please consider including this patch with your next upload.

Cheers,
FJP

commit e5619fdd8444d5e48d9cdea223f94df43dfa350f
Author: Frans Pop <fjp@debian.org>
Date:   Fri Apr 4 10:23:29 2008 +0200

    Add udeb lines in shlibs files
    
    Currently onther udebs depend on regular libc packages. This will allow
    then to correctly depend on the libc udeb instead.

diff --git a/debian/rules.d/debhelper.mk b/debian/rules.d/debhelper.mk
index fe127dd..96cfb98 100644
--- a/debian/rules.d/debhelper.mk
+++ b/debian/rules.d/debhelper.mk
@@ -109,6 +109,9 @@ endif
 		-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
+	chmod a+x debian/shlibs-add-udebs
+	./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/ ; \
@@ -152,7 +155,6 @@ $(patsubst %,$(stamp)binaryinst_%,$(DEB_UDEB_PACKAGES)): $(stamp)debhelper
 		-o -regex '.*lib[0-9]*/.*libpthread.*so.*' \
 		-o -regex '.*lib[0-9]*/libc[.-].*so.*' \) \
 		-exec chmod a+x '{}' ';'
-	# dh_makeshlibs -X/usr/lib/debug -p$(curpass) -V "$(call xx,shlib_dep)"
 	dh_installdeb -p$(curpass)
 	# dh_shlibdeps -p$(curpass)
 	dh_gencontrol -p$(curpass)
diff --git a/debian/shlibs-add-udebs b/debian/shlibs-add-udebs
new file mode 100755
index 0000000..651fb8e
--- /dev/null
+++ b/debian/shlibs-add-udebs
@@ -0,0 +1,51 @@
+#! /bin/sh
+set -e
+
+# This script adds "udeb lines" to shlibs files which allows other udebs
+# to get correct dependencies when built against glibc libraries.
+# The script was written by Frans Pop <fjp@debian.org>.
+
+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 -Eq "^libc[0-9.]+-"; then
+	exit 0
+fi
+
+# $1: regexp to select libraries for which lines should be duplicated
+# $2: name of the udeb the new line should point to
+add_udeb_line() {
+	local regexp udeb line lib soname package rest
+	regexp="$1"
+	udeb="$2"
+
+	if line="$(grep "^$regexp[[:space:]]" $shlibs_file)"; then
+		echo "$line" | while read lib soname package rest; do
+			echo "udeb: $lib $soname $udeb $rest" >>$shlibs_file
+		done
+	fi
+}
+
+
+W="[^[:space:]]*"
+
+# The following lists should match the ones in the *-udeb.install files
+# in debian/debhelper.in; $W replaces any "*" wildcards there.
+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: