-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

Regarding the current mass rebuilds because of libpng I'd like to
suggest implementing so dependencies again.

There will be no more cases where packages break because of library
updates and as a nice side effect AUR users see what they have to rebuild.
Pacman will treat those dependencies like others so if a user is sure he
wants to update he can use -Sd.
I've also tested if packages with sodeps would slow down pacman
operation, but that's not really the case.

The current patch adds "sodep-$arch-$soFileName" for every .so file
that's owned by a package in the depends array. Files from optdepends
are silently ignored and if no dependency owns the file there will be a
warning.

I've just rebased the old patch onto HEAD, fixed a little bit and tested
it with libjpeg, so it should be fine.

- -- 
Florian Pritz -- {flo,bluewi...@server-speed.net
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.14 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQIcBAEBAgAGBQJLWgg0AAoJEG0WVcFM4cE+xlYP/08Ec1K9gFz0g8Q/+ag4S8+S
U9mInCwJTe9xnu+H1J9JRsMwZ8DzP8WUlc99pqgz9n9Nxk8cpE1eUU9IIluHzjvR
bJglYvAKIIknEtc1OkLVicFW2OfvgNzSwx73W6J3fELlzABpxtEMwmmXAJMaVZKq
aIVgZ/zFP5b6XJT14FfQJbR7Mj4V5mCAhY0W+5SJL58RIHxPRz1PJKbzuZUcqLBo
ouBcBPH9YuiSKufJhbsowyE6Hfyg4btFVHktr7EBvHtB/nb8Kk09LduloaQ9ZtEl
hdSlbQL36AI2xJdN4XyuP4+UKmSh4hJKxfVBBCcDeWZd4ZbcC4WIersBY4Ia3hle
96Z8IZG8ydfC6+Ii5wdhdgzwzgaI2ZitgzO/XTLvBB1xpL+gQpupcSFSuypiU0K0
Yz3gybnj1XKb/8UEpNgjuKu6G1UChnmbenSS6lYFotXNWilQM9kAkYTDMV/KoQa0
CeyflEuUJuggMsKPz71NJnRCxcXSEdhVebeB9jKX8l2TIOgHwIYmmbO3yMaowzF+
39zEAgxYxaLlTXQ2mnL/OkPrFjNQ1exyWwD1nW1N8n7Sr0zT21P4XK8kOrCQlTp7
XswSeZBV+pfR2Uby5hU6tUW9UvWZOHq2YZB7SAWfI7IEzcQxyVcbwwjuxplVgUr+
whZlxxDSfR0k6Uc9jeGm
=/iDR
-----END PGP SIGNATURE-----
>From 61e820715daa8b775566a935302b33c242fd815c Mon Sep 17 00:00:00 2001
From: Florian Pritz <bluew...@xssn.at>
Date: Sat, 15 Aug 2009 12:35:32 +0200
Subject: [PATCH] add support for .so dependencies

Support-by: brain0 <tho...@archlinux.org>
Support-by: GNU\caustic <christoph.sch...@uni-ulm.de>

Signed-off-by: Florian Pritz <bluew...@xssn.at>
---
 etc/makepkg.conf.in   |    4 ++-
 scripts/makepkg.sh.in |   69 +++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 72 insertions(+), 1 deletions(-)

diff --git a/etc/makepkg.conf.in b/etc/makepkg.conf.in
index 3a3a415..8d91bcc 100644
--- a/etc/makepkg.conf.in
+++ b/etc/makepkg.conf.in
@@ -67,8 +67,10 @@ BUILDENV=(fakeroot !distcc color !ccache)
 #-- emptydirs: Leave empty directories in packages
 #-- zipman:    Compress manual (man and info) pages in MAN_DIRS with gzip
 #-- purge:     Remove files specified by PURGE_TARGETS
+#-- soprovides:add .so files to provides array
+#-- sodepends: add .so files to depends array
 #
-OPTIONS=(strip docs libtool emptydirs zipman purge)
+OPTIONS=(strip docs libtool emptydirs zipman purge soprovides !sodepends)
 
 #-- File integrity checks to use. Valid: md5, sha1, sha256, sha384, sha512
 INTEGRITY_CHECK=(md5)
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index 5bbd880..7ad471f 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -874,6 +874,62 @@ tidy_install() {
 	fi
 }
 
+so_in_depends() {
+	for soinfo in $(pacman -Ql | grep -F $1 | tr " " ":"); do
+		sopkg=$(echo $soinfo | cut -d: -f1)
+		sofile=$(echo $soinfo | cut -d: -f2)
+		if in_array ${sopkg} ${depen...@]}; then
+			if [ "$(readelf -h "$sofile" 2> /dev/null | sed -nr 's/.*Class:.*ELF(.*).*/\1/p')" = "$soarch" ]; then
+				echo 0
+				return 0
+			fi
+		fi
+		if in_array ${sopkg} ${optdepen...@]}; then
+			if [ "$(readelf -h "$sofile" 2> /dev/null | sed -nr 's/.*Class:.*ELF(.*).*/\1/p')" = "$soarch" ]; then
+				echo 2
+				return 0
+			fi
+		fi
+		done
+	echo 1
+}
+
+find_sodepends() {
+	find $pkgdir -type f | while read filename
+	do
+		soarch=$(readelf -h "$filename" 2> /dev/null | sed -nr 's/.*Class:.*ELF(.*).*/\1/p')
+		[ -n "$soarch" ] || continue
+		for dep in $(readelf -d "$filename" 2> /dev/null | sed -nr 's/.*Shared library: \[(.*)\].*/\1/p')
+		do
+			if ! in_array "sodep-${soarch}-${dep}" ${sodepen...@]} ${soprovides}; then
+				soret=$(so_in_depends ${dep})
+				if [ "$soret" = "0" ]; then
+					echo "sodep-${soarch}-${dep}"
+				elif [ "$soret" = "2" ]; then
+					# $dep in optdepends
+					msg "$(gettext "Ignoring dependency in \$optdepends: %s")" "$dep"
+					true
+				else
+					warning "$(gettext "Missing dependency providing .so file in \$depends: %s")" "$dep"
+				fi
+				sodepends=(${sodepen...@]} "sodep-${soarch}-${dep}")
+			fi
+		done
+	done
+}
+
+find_soprovides() {
+	find $pkgdir -type f -name \*.so\* | while read filename
+	do
+    if readelf -h "$filename" 2>/dev/null | grep -q '.*Type:.*DYN (Shared object file).*'; then
+      soarch=$(readelf -h "$filename" 2>/dev/null | sed -nr 's/.*Class:.*ELF(.*).*/\1/p')
+      soname=$(readelf -d "$filename" 2>/dev/null | sed -nr 's/.*Library soname: \[(.*)\].*/\1/p')
+      [ -z "$soname" ] && soname="$(basename "$filename")"
+      echo sodep-${soarch}-${soname}
+    fi
+	done
+}
+
 write_pkginfo() {
 	local builddate=$(date -u "+%s")
 	if [[ -n $PACKAGER ]]; then
@@ -903,6 +959,19 @@ write_pkginfo() {
 		echo "force = true" >> .PKGINFO
 	fi
 
+	if [ "$(check_option soprovides)" != "n" ] || [ "$(check_option sodepends)" = "y" ]; then
+		soprovides=$(find_soprovides)
+	fi
+		
+	if [ "$(check_option sodepends)" = "y" ]; then
+		sodepends=$(find_sodepends)
+		depends=("${depen...@]}" ${sodepends})
+	fi
+
+	if [ "$(check_option soprovides)" != "n" ]; then
+		provides=("${provid...@]}" ${soprovides})
+	fi
+
 	local it
 	for it in "${licen...@]}"; do
 		echo "license = $it" >>.PKGINFO
-- 
1.6.6.1

Attachment: 0001-add-support-for-.so-dependencies.patch.sig
Description: Binary data



Reply via email to