Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 23 Mar 2002 14:06:35 -0500 (EST)
From:      Mikhail Teterin <mi@aldan.algebra.com>
To:        FreeBSD-gnats-submit@FreeBSD.org
Cc:        portmgr@FreeBSD.org, knu@FreeBSD.org, will@FreeBSD.org
Subject:   ports/36237: registering _real_ dependencies in bsd.port.mk
Message-ID:  <200203231906.g2NJ6ZSB062993@aldan.algebra.com>

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

>Number:         36237
>Category:       ports
>Synopsis:       registering _real_ dependencies in bsd.port.mk
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-ports
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat Mar 23 11:10:00 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     Mikhail Teterin
>Release:        FreeBSD 5.0-CURRENT i386
>Organization:
Virtual Estates, Inc.
>Environment:
System: FreeBSD aldan.algebra.com 5.0-CURRENT FreeBSD 5.0-CURRENT #0: Thu Mar 21 23:22:05 EST 2002 mi@aldan.algebra.com:/ccd/src/sys/i386/compile/DEBUG i386


>Description:

	The existing bsd.port.mk is fundamentally wrong in how it
	determines the packages, that the port/package being installed
	depends on. (Which is why this PR is filed as a sw-bug.)

	The packages actually installed at the build-time should be
	registered instead of those, that _would have been installed
	if none were present_. For example, if I build/install the
	libxml2 and libxsl with out PYTHON support, the actual installed
	packages on my system will be known as

		libxslt-nopython-1.0.12
		libxml2-nopython-2.4.16

	However, all of the ports that depend on libxml2 and libxslt
	will now to try register their dependency on

		libxslt-1.0.13
		libxml2-2.4.17

	(Note, that the version is different too).

>How-To-Repeat:

	See description.

>Fix:

	Since forever, the pkg_info(1)'s -W option was available
	to find the port/package, which installed a particular file.
	Since Feb 4, the bin/34628

		http://www.freebsd.org/cgi/query-pr.cgi?pr=bin/34628

	is there with a patch to make that option stronger by
	considering the recorded md5 checksum if multiple packages claim
	the same file.

	The patch below makes use of the pkg_info's ability and lists
	the actually installed ports/packages, that a port depends on.

	The old version of package-depends is renamed to package-depends-old
	as it may still have its uses for determining, which packages
	this one is going to depend on _by default_. Perhaps,
	package-depends-default is a better name for it...

	This patch is a slightly improved version of what was sent
	privately to will (as the prominent Portmgr member and someone,
	who, actually, expressed a desire to see something like this
	implemented) and knu -- another ports committer who has in the
	past expressed concern about the bsd.port.mk brokennes with respect
	to package dependecies registration.

	The handling of LIB_dependencies in it mirror the improvement
	proposed in ports/34126

		http://www.freebsd.org/cgi/query-pr.cgi?pr=ports/34126

	but don't require that patch to be committed first.

Index: bsd.port.mk
===================================================================
RCS file: /home/ncvs/ports/Mk/bsd.port.mk,v
retrieving revision 1.402
diff -U2 -r1.402 bsd.port.mk
--- bsd.port.mk	16 Mar 2002 23:37:02 -0000	1.402
+++ bsd.port.mk	23 Mar 2002 18:41:58 -0000
@@ -3166,9 +3166,37 @@
 
 # Print out package names.
-
-package-depends:
+package-depends-old:
 	@for dir in $$(${PACKAGE-DEPENDS-LIST}); do \
 		(cd $$dir; ${MAKE} package-name); \
 	done
+
+package-depends:
+# For LIB_DEPENDS allow the library to be specified as a regexp, and use
+# ldconfig to fine it -- see lib-depends. With RUN_DEPENDS, life is
+# easier, since pkg_info will invoke which(1) for us by itself and we
+# do not (yet?) want to be able to use regexps in RUN_DEPENDS.
+	@if ! [ -z "${LIB_DEPENDS}" ]; \
+	then \
+		for i in ${LIB_DEPENDS}; do \
+			lib=$${i%%:*}; \
+			case $$lib in \
+				*.*.*)	pattern=$$lib ;;\
+				*.*)	pattern="$${lib%%.*}\.$${lib#*.}" ;;\
+				*)		pattern=$$lib ;;\
+			esac; \
+			search=$${search}`${LDCONFIG} -r | awk "\
+				/-l$$pattern[^ \t]* =>/ {\
+					print \" -W \" \\$$NF \
+				} \
+			"`; \
+		done; \
+	fi; \
+	search="$${search}${RUN_DEPENDS:C,([^:]+):[^ ]*, -W \1,g}"; \
+	if ! [ -z "$$search" ]; \
+	then \
+		${PKG_INFO} $$search | awk '\
+			/was installed by package/ { P[$$NF] = 1 } \
+			END { for (p in P) print p }'; \
+	fi
 
 ################################################################
>Release-Note:
>Audit-Trail:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-ports" in the body of the message




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