[pacman-dev] [PATCH] add support for .so dependencies

Allan McRae allan at archlinux.org
Sat Aug 15 10:08:42 EDT 2009


Hi,

I'm guessing this patch was more a request for comments rather than for 
actual consideration given a few of the issues I point out below mean 
this will not actually work...   So I will not comment on implementation 
at all.

As far as the idea goes, I do not like it...  This turns makepkg into a 
bit of a black box as you can no longer see the depends and provides 
from the PKGBUILD.  Although, I do like the idea of having soname 
provides and depends in general.

Allan


> From: Florian Pritz <bluewind at xssn.at>
>
> Support-by: brain0 <thomas at archlinux.org>
> Support-by: GNU\caustic <Christoph.Schied at uni-ulm.de>
> ---
>  etc/makepkg.conf.in   |    3 ++-
>  scripts/makepkg.sh.in |   43 +++++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 45 insertions(+), 1 deletions(-)
>
> diff --git a/etc/makepkg.conf.in b/etc/makepkg.conf.in
> index 3a3a415..c3caf3c 100644
> --- a/etc/makepkg.conf.in
> +++ b/etc/makepkg.conf.in
> @@ -67,8 +67,9 @@ 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
> +#-- sodepends: add .so files to depends/provides arrays
>  #
> -OPTIONS=(strip docs libtool emptydirs zipman purge)
> +OPTIONS=(strip docs libtool emptydirs zipman purge !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..405f3cb 100644
> --- a/scripts/makepkg.sh.in
> +++ b/scripts/makepkg.sh.in
> @@ -872,6 +872,33 @@ tidy_install() {
>  	fi
>  }
>  
> +find_sodependencies()
> +{
> +	find $pkgdir | while read filename
> +	do
> +		arch=$(readelf -h "$filename" 2> /dev/null| sed -nr 's/.*Class:.*ELF(.*).*/\1/p')
> +		[ -n "$arch" ] || continue
>   

Hmmm.... not good.  Think arch=('i686' 'x86_64')

> +
> +		readelf -d "$filename" 2> /dev/null | sed -nr 's/.*Shared library: \[(.*)\].*/\1/p' \
> +		| while read dep
> +		do
> +			echo sodep-${arch}-${dep}
> +		done
> +	done
> +}
> +
> +find_soprovides()
> +{
> +	find $pkgdir -name \*.so | while read filename
> +	do
> +		arch=$(readelf -h "$filename" 2> /dev/null| sed -nr 's/.*Class:.*ELF(.*).*/\1/p')
> +		[ -n "$arch" ] || continue
>   

Again.

> +		soname=$(readelf -d "$filename" 2>/dev/null | sed -nr 's/.*Library soname: \[(.*)\].*/\1/p')
> +		[ -n "$soname" ] || continue
> +		echo sodep-${arch}-${soname}
> +	done
> +}
> +
>  write_pkginfo() {
>  	local builddate=$(date -u "+%s")
>  	if [ -n "$PACKAGER" ]; then
> @@ -902,6 +929,22 @@ write_pkginfo() {
>  		echo "force = true" >> .PKGINFO
>  	fi
>  
> +	if [ "$(check_option sodepends)" = "y" ]; then
> +		sodepends=$(find_sodependencies)
> +		soprovides=$(find_soprovides)
> +		
> +		OLDIFS="$IFS"
> +		IFS=""
>   

Huh...  IFS?

> +
> +		# filter .so files provided by the package itself
> +		sodepends=$(echo $sodepends $soprovides $soprovides | sort | uniq -u)
> +		
> +		IFS="$OLDIFS"
> +
> +		depends=($depends $sodepends)
> +		provices=($provides $soprovides)
>   

"provides"

> +	fi
> +
>  	local it
>  	for it in "${license[@]}"; do
>  		echo "license = $it" >>.PKGINFO
>   





More information about the pacman-dev mailing list