[pacman-dev] [PATCH 2/2] makepkg: Search/Add real library names libdepend link to
Search library paths for libdepend. If found and its realpath is not of the name scheme "libdepend.ver". Add the real library name to depends. Coupled with code in the libprovides side, this is necessary as the real library name is the one binaries depend on. And it is the one we can obtain version/arch info from. Signed-off-by: Mohammad Alsaleh <msal@tormail.org> --- Note: parsing library paths from `ldconfig -v` output is relatively slow. scripts/makepkg.sh.in | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 7f4ee25..c4d0020 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -1680,6 +1680,25 @@ tidy_install() { fi } +extra_libdepends() { + local d dfile extra_d extra_dfile + + # Search library paths for libdepend. + # If libdepend's file realpath has a different library name, add that name to depends + for d in "${depends[@]}"; do + if [[ $d = *.so ]]; then + while read dfile; do + extra_dfile="$(basename "$(realpath "$dfile")")" + if [[ "$extra_dfile" =~ \.so && "${extra_dfile%.so*}.so" != "$d" ]]; then + extra_d="${extra_dfile%.so*}.so" + depends+=("$extra_d") + warning "$(gettext "Library %s added to %s")" "$extra_d" "'depends'" + fi + done < <(find $(ldconfig -v 2>/dev/null| grep '^/' | sed 's|:||') -type l -maxdepth 1 -name "$d" 2>/dev/null) + fi + done +} + find_libdepends() { local d sodepends; @@ -1846,6 +1865,7 @@ write_pkginfo() { printf "size = %s\n" "$size" printf "arch = %s\n" "$pkgarch" + extra_libdepends extra_libprovides mapfile -t provides < <(find_libprovides) mapfile -t depends < <(find_libdepends) -- 1.8.2.2
On Thu, May 09, 2013 at 12:15:29AM +0300, Mohammad Alsaleh wrote:
realpath is not portable -- we can't use it. We have a canonicalize_path function which should be used instead. Calling basename is also unnecessary when a PE will suffice.
+ if [[ "$extra_dfile" =~ \.so && "${extra_dfile%.so*}.so" != "$d" ]]; then
regex isn't necessary here when a simple glob will suffice.
Does the flag exist on other libc implementations? Is it even consistent? I'm extremely wary of parsing the output, especially like this in conjunction with find.
participants (2)
-
Dave Reisner
-
Mohammad Alsaleh