[pacman-dev] [PATCH 2/2] makepkg: Search/Add real library names libdepend link to

Mohammad Alsaleh msal at tormail.org
Wed May 8 17:15:29 EDT 2013


  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 at 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



More information about the pacman-dev mailing list