On 02/04/2010 04:38 PM, Thomas Bächler wrote: > I disagree in the "arch" part. It might not be as important now, but in > the future it could cause problems if we end up havnig multiple > architecture libraries in one system (and ultimately I want to make that > possible, if I ever get to it). If we could agree on this scheme: > > soprovides=(libreadline.so) > would generate > provides=("${provid...@]}" libreadline.so-x86_64=6) > > Then the "weak -d" flag could ignore the =6 version above and we still > have everything we would need for matching so-names. > >> From my suggestions it should be clear that I really do not want every >> package to have all possible so-provides and -depends added >> automatically. That seems too much like an even poorer implementation >> of rpm to me and would be very, very difficult to get around all the >> edge cases. Currently both sodepends and soprovides have to be specified in the PKGBUILD: sodepends=(libreadline.so libc.so) soprovides=(libreadline.so)
Versions and arch will be added afterwards and the final line in .PKGINFO looks like this: provides = libreadline.so-elf64_x86_64=6 For the arch part a better way to find the arch of the lib would be nice. Neither readelf nor objdump seem to fit. Readelf only shows 32/64 and objdump shows i686 libs as i368. If anyone has an idea please share. -- Florian Pritz -- {flo,bluewi...@server-speed.net
>From 266c1769446675d6f2ca4ad35320c2366d7f647e Mon Sep 17 00:00:00 2001 From: Florian Pritz <bluew...@xssn.at> Date: Sat, 6 Feb 2010 00:18:00 +0100 Subject: [PATCH 1/2] makepkg: add soprovides support 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 | 3 ++- scripts/makepkg.sh.in | 26 ++++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletions(-) diff --git a/etc/makepkg.conf.in b/etc/makepkg.conf.in index b92a697..47b9209 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 +#-- soprovides:add .so files to provides array # -OPTIONS=(strip docs libtool emptydirs zipman purge) +OPTIONS=(strip docs libtool emptydirs zipman purge soprovides) #-- 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 5bd294c..80c9d50 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -874,6 +874,24 @@ tidy_install() { fi } +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=$(objdump -a "$filename" 2>/dev/null | sed -rn 's/.* file format (.*)$/\1/p' | tr - _) + sofile=$(readelf -d "$filename" 2>/dev/null | sed -nr 's/.*Library soname: \[(.*)\].*/\1/p') + [ -z "$sofile" ] && sofile="$(basename "$filename")" + + soname=$(sed -rn 's/(.*)\.so.*/\1.so/p' <<< "$sofile") + soversion=$(sed -rn 's/.*\.so\.(.*)/\1/p' <<< "$sofile") + + if in_array "$soname" ${soprovid...@]}; then + echo ${soname}-${soarch}=${soversion} + fi + fi + done +} + write_pkginfo() { local builddate=$(date -u "+%s") if [[ -n $PACKAGER ]]; then @@ -903,6 +921,14 @@ write_pkginfo() { echo "force = true" >> .PKGINFO fi + if [ "$(check_option soprovides)" != "n" ]; then + _soprovides=$(find_soprovides) + 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
>From 875a7cc396ba293c2130ded9b9dd22dc9a77794c Mon Sep 17 00:00:00 2001 From: Florian Pritz <bluew...@xssn.at> Date: Sat, 6 Feb 2010 00:19:07 +0100 Subject: [PATCH 2/2] makepkg: add sodepends support 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 | 3 ++- scripts/makepkg.sh.in | 24 +++++++++++++++++++++++- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/etc/makepkg.conf.in b/etc/makepkg.conf.in index 47b9209..aa17f71 100644 --- a/etc/makepkg.conf.in +++ b/etc/makepkg.conf.in @@ -68,8 +68,9 @@ BUILDENV=(fakeroot !distcc color !ccache) #-- 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 soprovides) +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 80c9d50..47ecf34 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -874,6 +874,23 @@ tidy_install() { fi } +find_sodepends() { + find $pkgdir -type f | while read filename + do + soarch=$(objdump -a "$filename" 2>/dev/null | sed -rn 's/.* file format (.*)$/\1/p' | tr - _) + [ -n "$soarch" ] || continue + for sofile in $(readelf -d "$filename" 2> /dev/null | sed -nr 's/.*Shared library: \[(.*)\].*/\1/p') + do + soname=$(sed -rn 's/(.*)\.so.*/\1.so/p' <<< "$sofile") + soversion=$(sed -rn 's/.*\.so\.(.*)/\1/p' <<< "$sofile") + if in_array "${soname}" ${sodepen...@]}; then + echo "${soname}-${soarch}=${soversion}" + sodepends=(${sodepen...@]} "${soname}-${soarch}=${soversion}") + fi + done + done +} + find_soprovides() { find $pkgdir -type f -name \*.so\* | while read filename do @@ -921,10 +938,15 @@ write_pkginfo() { echo "force = true" >> .PKGINFO fi - if [ "$(check_option soprovides)" != "n" ]; then + 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 -- 1.6.6.1