[pacman-dev] [PATCH 1/2] makepkg: fix extraction of soname in find_libdepends
libperl.so results in soname="libperl.so.so" which is wrong. This returns the correct string: "libperl.so" Fix-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Florian Pritz <bluewind@xinu.at> --- This should be applied to both master and maint. scripts/makepkg.sh.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 6e7a556..9301730 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -1071,7 +1071,7 @@ find_libdepends() { for sofile in $(LC_ALL=C readelf -d "$filename" 2>/dev/null | sed -nr 's/.*Shared library: \[(.*)\].*/\1/p') do # extract the library name: libfoo.so - soname="${sofile%%\.so\.*}.so" + soname="${sofile%.so?(+(.+([0-9])))}".so # extract the major version: 1 soversion="${sofile##*\.so\.}" if in_array "${soname}" ${depends[@]}; then -- 1.7.9.2
With multiple items in $libdepends this check only worked for the first one, everything after this returned an error. This was probably an issue with \s being treated wrong. Fix-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Florian Pritz <bluewind@xinu.at> --- This should be applied to both master and maint. scripts/makepkg.sh.in | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 9301730..0ca7513 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -1189,7 +1189,8 @@ write_pkginfo() { if [[ $it = *.so ]]; then # check if the entry has been found by find_libdepends # if not, it's unneeded; tell the user so he can remove it - if [[ ! $libdepends =~ (^|\s)${it}=.* ]]; then + printf -v re '(^|\s)%s=.*' "$it" + if [[ ! $libdepends =~ $re ]]; then error "$(gettext "Cannot find library listed in %s: %s")" "'depends'" "$it" return 1 fi -- 1.7.9.2
On 05/03/12 06:19, Florian Pritz wrote:
libperl.so results in soname="libperl.so.so" which is wrong.
This returns the correct string: "libperl.so"
Fix-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Florian Pritz <bluewind@xinu.at> --- This should be applied to both master and maint.
Ugh.. I didn't review this but the patch is entirely broken on the first file I tried it on.
scripts/makepkg.sh.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 6e7a556..9301730 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -1071,7 +1071,7 @@ find_libdepends() { for sofile in $(LC_ALL=C readelf -d "$filename" 2>/dev/null | sed -nr 's/.*Shared library: \[(.*)\].*/\1/p') do # extract the library name: libfoo.so - soname="${sofile%%\.so\.*}.so" + soname="${sofile%.so?(+(.+([0-9])))}".so
LC_ALL=C readelf -d /usr/lib/libalpm.so.7.0.2 2>/dev/null | sed -nr 's/.*Shared library: \[(.*)\].*/\1/p'
Broken: libcurl.so.4 libarchive.so.12 libcrypto.so.1.0.0 libgpgme.so.11 libc.so.6
sofile="libcrypto.so.1.0.0"
echo "${sofile%.so?(+(.+([0-9])))}".so libcrypto.so.1.0.0.so
Why not just: soname="${sofile%%\.so*}.so" I suppose that would not correctly work for... foo.so.bar.so.9 Allan
On 10/03/12 11:43, Allan McRae wrote:
On 05/03/12 06:19, Florian Pritz wrote:
libperl.so results in soname="libperl.so.so" which is wrong.
This returns the correct string: "libperl.so"
Fix-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Florian Pritz <bluewind@xinu.at> --- This should be applied to both master and maint.
Ugh.. I didn't review this but the patch is entirely broken on the first file I tried it on.
Ignore me... I was testing without extglob enabled.
participants (2)
-
Allan McRae
-
Florian Pritz