Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 2 Mar 2012 14:05:27 GMT
From:      Matthew Seaman <matthew@FreeBSD.org>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   ports/165624: Mk/bsd.port.mk -- record required shared libraries in pkg contents 
Message-ID:  <201203021405.q22E5RAi030070@lucid-nonsense.infracaninophile.co.uk>
Resent-Message-ID: <201203021410.q22EA8sl052532@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         165624
>Category:       ports
>Synopsis:       Mk/bsd.port.mk -- record required shared libraries in pkg contents
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Fri Mar 02 14:10:08 UTC 2012
>Closed-Date:
>Last-Modified:
>Originator:     Matthew Seaman
>Release:        FreeBSD 8.3-PRERELEASE amd64
>Organization:
>Environment:
System: FreeBSD lucid-nonsense.infracaninophile.co.uk 8.3-PRERELEASE FreeBSD 8.3-PRERELEASE #4 r232170: Sun Feb 26 10:27:22 GMT 2012 root@lucid-nonsense.infracaninophile.co.uk:/usr/obj/usr/src/sys/LUCID-NONSENSE amd64


	
>Description:

This is means of solving the perennial problem: knowing what ports
need to be rebuilt as the result of an ABI version bump of a shared
library.  Currently common advice is to rebuild all of the ports that
depend on the port providing the library.  That's frequently wasteful,
involving pointless rebuilds of packages that don't link to the shared
library in question at all.  It's also something that has to be
flagged up as a special instruction in UPDATING whereas I feel it should
be a standard thing.

The result of the patch is to add lines like so to the end of the
+CONTENTS file (this is from xterm-278):

[...]
@comment @unexec /usr/local/bin/update-desktop-database > /dev/null ||
/usr/bin/true
@comment SHLIB:libICE.so.6
@comment SHLIB:libSM.so.6
@comment SHLIB:libX11.so.6
@comment SHLIB:libXau.so.6
@comment SHLIB:libXaw7.so.7
@comment SHLIB:libXdmcp.so.6
@comment SHLIB:libXext.so.6
@comment SHLIB:libXft.so.2
@comment SHLIB:libXmu.so.6
@comment SHLIB:libXpm.so.4
@comment SHLIB:libXrender.so.1
@comment SHLIB:libXt.so.6
@comment SHLIB:libbz2.so.4
@comment SHLIB:libc.so.7
@comment SHLIB:libexpat.so.6
@comment SHLIB:libfontconfig.so.1
@comment SHLIB:libfreetype.so.9
@comment SHLIB:libncurses.so.8
@comment SHLIB:libpcre.so.1
@comment SHLIB:libpcreposix.so.0
@comment SHLIB:libpthread-stubs.so.0
@comment SHLIB:librpcsvc.so.5
@comment SHLIB:libutempter.so.0
@comment SHLIB:libxcb.so.2
@comment SHLIB:libz.so.5
@display +DISPLAY

Considering this notice in /usr/ports/UPDATING:

20120214:
  AFFECTS: users of devel/pcre
  AUTHOR: dougb@FreeBSD.org

  Until all dependent ports have been updated you should update pcre in
  a manner that will preserve its old shared library. For example:

  # portmaster -w devel/pcre
  or
  # portupgrade devel/pcre


I can now state with confidence that only the following ports would need
to be rebuilt on my system:

lucid-nonsense:/usr/ports:% grep -l '@comment SHLIB:libpcre.so'
/var/db/pkg/*/+CONTENTS | cut -d '/' -f 5
apache-2.2.22_5
avahi-app-0.6.29_1
dbus-glib-0.94
gamin-0.1.10_4
gio-fam-backend-2.28.8_1
glib-2.28.8_4
gobject-introspection-0.10.8_1
libslang2-2.2.4_1
maildrop-2.5.5_1
nmap-5.61.t4_1
pcre-8.30_1
php5-5.3.10_1
xterm-278

This change seems to sit happily with the current pkg tools -- it
survives pkg tarballs intact, and I haven't seen any problems in my
testing.  Of course, the timing is utterly wonderful, given that the
bright new age of pkgng is almost upon us.  I'm still finding my way
around the pkgng sources, but my initial impression is that something
similar could be implemented without excessive difficulty.

>How-To-Repeat:
	
>Fix:

	

--- plist-shlib.diff begins here ---
Index: bsd.commands.mk
===================================================================
RCS file: /home/ncvs/ports/Mk/bsd.commands.mk,v
retrieving revision 1.10
diff -u -u -r1.10 bsd.commands.mk
--- bsd.commands.mk	22 Feb 2012 17:34:47 -0000	1.10
+++ bsd.commands.mk	1 Mar 2012 14:18:06 -0000
@@ -39,7 +39,7 @@
 EGREP?=		/usr/bin/egrep
 EXPR?=		/bin/expr
 FALSE?=		false				# Shell builtin
-FILE?=		/usr/bin/file
+FILE_CMD?=		/usr/bin/file	# FILE is a commonly used variable
 FIND?=		/usr/bin/find
 FLEX?=		/usr/bin/flex
 FMT?=		/usr/bin/fmt
@@ -53,6 +53,7 @@
 ID?=		/usr/bin/id
 IDENT?=		/usr/bin/ident
 LDCONFIG?=	/sbin/ldconfig
+LDD?=		/usr/bin/ldd
 LN?=		/bin/ln
 LS?=		/bin/ls
 MKDIR?=		/bin/mkdir -p
Index: bsd.port.mk
===================================================================
RCS file: /home/ncvs/ports/Mk/bsd.port.mk,v
retrieving revision 1.706
diff -u -u -r1.706 bsd.port.mk
--- bsd.port.mk	22 Feb 2012 17:34:47 -0000	1.706
+++ bsd.port.mk	1 Mar 2012 14:17:44 -0000
@@ -4318,8 +4318,8 @@
 				install-desktop-entries install-license install-rc-script \
 				post-install post-install-script add-plist-info \
 				add-plist-docs add-plist-examples add-plist-data \
-				add-plist-post fix-plist-sequence compress-man \
-				install-ldconfig-file fake-pkg security-check
+				add-plist-post add-plist-shlibs fix-plist-sequence \
+				compress-man install-ldconfig-file fake-pkg security-check
 _PACKAGE_DEP=	install
 _PACKAGE_SEQ=	package-message pre-package pre-package-script \
 				do-package post-package-script
@@ -5859,6 +5859,29 @@
 .endif
 .endif
 
+.if !target(add-plist-shlibs)
+add-plist-shlibs:
+# Record all of the shared libraries used by this port
+	@${ECHO_MSG} "===> Recording shared libraries used by ${PKGNAME}"
+	@${RM} -f ${WRKDIR}/.PLIST.shlibs
+	@for i in `${GREP} -v '^@' ${TMPPLIST}` ; do \
+		f="${PREFIX}/$$i" ; \
+	    if [ ! -L $$f -a -f $$f ] ; then \
+			case `${FILE_CMD} $$f` in \
+				*GNU/Linux*) \
+					continue \
+					;; \
+				*ELF*) \
+	        		${LDD} -f '%o\n' $$f 2>/dev/null \
+						>> ${WRKDIR}/.PLIST.shlibs \
+					;; \
+			esac ; \
+		fi ; \
+	done
+	@${SORT} -u < ${WRKDIR}/.PLIST.shlibs | \
+		${SED} -e 's,^,@comment SHLIB:,' >> ${TMPPLIST}
+.endif
+
 # Compress (or uncompress) and symlink manpages.
 .if !target(compress-man)
 compress-man:
--- plist-shlib.diff ends here ---


>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201203021405.q22E5RAi030070>