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

Thomas Bächler wrote:
> Allan McRae schrieb:
>> Thomas Bächler wrote:
>>> I want to explicitly ask you about the cons for this feature. What do 
>>> you think is a hard reason NOT to do it?
>> 
>> 1) The depends array in the PKGBUILD no longer represents the 
>> information in the package.
> 
> I want that solved as well. We should only add dependencies for soname 
> if the corresponding packages are already in the depends array. For all 
> others, print a warning or ignore them. Otherwise, (in addition to your 
> concern about the PKGBUILD information being incomplete) optdepends will 
> break.

New patch fixes this.

Please comment.

- --
Florian Pritz -- {flo,[email protected]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.12 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iQIcBAEBAgAGBQJKl/48AAoJEG0WVcFM4cE+WvcQAL55MVvL8szpqwHubgnQsbuu
IOhgfsmz2ZiP7jYC9IpuYa4IFd6W2idH0fqwUMAwPrZLM2qE9hDG0l+u2Usoqw0z
Akrd0r2JOQKHOC6JtY6fu5j80PHJCZcnWzWJasnuhC+ZVdNznhq5Fqw4HoFLGXB6
EM5NN1HzSoFc6yYk3VgD3Wj2V6O14NTrMC1e3zIO43lSbsJpfgwPYoE/KJfx22NN
X5KjERhDpzb3LsY5PKrHgYF521na30JhJPyu5jxBHmVFM5PN5Gh2ebFU210wkg6o
1GkOLfCQQFnSMYXEytg1CZFzdK8jEj44p1oKRHIG8dEzVNPVSjoB3JYqw1DdS/Ed
+VaSDbQsWEG5jmkjoZgibVD1BmFsGPr4spP0zz5pPeGsTpkMze7QFka105ZM3rmc
4dPveVtZjXSHVQBtdr4RVYKtTiLBJ0nS4TRAJpMAC2BLo1vZM9hC00srYvn4Z03l
1M6OFn6uS3JhTxJw6fQdFw1rrKlEoQSNq2yCGOrHDJkCyxpOUEZ9V2IS7fZ5JqxT
S6LMHnPxKshXXZeP3dewhPHxEb4MbxTofVXlVYn+LfWY4TwbwH+YUe68hHo867/9
yPg1Uw/HmHQHohu1GzhPcHVybhyP1pYVPW4a0ED7k2LHbXFai+4Eh0wKAnGzMwuR
A+rU45K+yKs8bfrnPBlP
=40Hc
-----END PGP SIGNATURE-----
>From 4fadb605afff3e56adebdc8fdf31af7984c04c37 Mon Sep 17 00:00:00 2001
From: Florian Pritz <[email protected]>
Date: Sat, 15 Aug 2009 12:35:32 +0200
Subject: [PATCH] add support for .so dependencies

Support-by: brain0 <[email protected]>
Support-by: GNU\caustic <[email protected]>

Signed-off-by: Florian Pritz <[email protected]>
---
 etc/makepkg.conf.in   |    4 ++-
 scripts/makepkg.sh.in |   66 +++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 69 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 daa9585..eb315d6 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -872,6 +872,59 @@ 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
+				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
+				return 2
+			fi
+		fi
+		done
+	return 1
+}
+
+find_sodepends() {
+	find $pkgdir | 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
+				so_in_depends ${dep}
+				soret=$?
+				if [ "$soret" = "0" ]; then
+					echo "sodep-${soarch}-${dep}"
+				elif [ "$soret" = "2" ]; then
+					# $dep in optdepends
+					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 -name \*.so | while read filename
+	do
+		soarch=$(readelf -h "$filename" 2> /dev/null| sed -nr 's/.*Class:.*ELF(.*).*/\1/p')
+		[ -n "$soarch" ] || continue
+		soname=$(readelf -d "$filename" 2>/dev/null | sed -nr 's/.*Library soname: \[(.*)\].*/\1/p')
+		[ -n "$soname" ] || continue
+		echo sodep-${soarch}-${soname}
+	done
+}
+
 write_pkginfo() {
 	local builddate=$(date -u "+%s")
 	if [ -n "$PACKAGER" ]; then
@@ -902,6 +955,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.4.1

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



Reply via email to