From owner-freebsd-ports Sun May 5 6:48:36 2002 Delivered-To: freebsd-ports@freebsd.org Received: from sdns.kv.ukrtel.net (sdns.kv.ukrtel.net [195.5.27.246]) by hub.freebsd.org (Postfix) with ESMTP id A5B6337B40A; Sun, 5 May 2002 06:48:28 -0700 (PDT) Received: from vega.vega.com (195.5.51.243 [195.5.51.243]) by sdns.kv.ukrtel.net with SMTP (Microsoft Exchange Internet Mail Service Version 5.5.2650.21) id J9KHZCJT; Sun, 5 May 2002 16:50:10 +0300 Received: (from max@localhost) by vega.vega.com (8.11.6/8.11.3) id g45DmjI20055; Sun, 5 May 2002 16:48:45 +0300 (EEST) (envelope-from sobomax@FreeBSD.org) From: Maxim Sobolev Message-Id: <200205051348.g45DmjI20055@vega.vega.com> Subject: [RFC] Improving dependency registration procedure for ports To: ports@FreeBSD.org Date: Sun, 5 May 2002 16:48:45 +0300 (EEST) X-Mailer: ELM [version 2.5 PL5] MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="%--multipart-mixed-boundary-1.20046.1020606525--%" Sender: owner-freebsd-ports@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org --%--multipart-mixed-boundary-1.20046.1020606525--% Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Hi folks, Our ports system has one annoying long-term obvious flaw: when user installs a port from the just cvsuped ports collection he may get incomplete dependency registration, i.e. if he installs port foo, which depends on another port bar, but already has installed version of bar different from one in the ports collection, then foo will not be registered in the bar's +REQUIRED_BY, therefore later he may remove bar not even noticing that it is still required by installed foo package potentially leading to foo becoming non-functional (missed shared library or data file(s), missed executable(s) and so on). Attached patch should resolve this problem by registering real dependencies using bar's origin as a key for looking up name of package installed from the bar port. Another feature embodied into this patch is the ability to designate "replacement" ports for bar using ALT_ORIGINS variable. Imagine situation when you have bar and bar-devel port, both of which have the same functionality, but the latter being a bleeding-edge version of the former. In this case port maintainer could set "ALT_ORIGINS=somecat/bar-devel" in somecat/bar/Makefile and make all ports that could use either bar or bar-devel depending on bar. Then, during package-registration process bsd.port.mk will see which one is really installed and generate list of dependencies accordingly. This should be very useful for things like XFree86. Please note that you need up to date pkg_info utility from the very recent -current to use this patch. Any comments and suggestions are appreciated. I'm also working on extending pkg_create(1) to include into the package's packing list information about origins of all its dependencies, so that it would be possible to solve similar problem when user installs pre-built package having already installed some of its dependencies, but their versions don't match those recorded in the packing lists of the package being installed. -Maxim --%--multipart-mixed-boundary-1.20046.1020606525--% Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Content-Description: ASCII text Content-Disposition: attachment; filename="bsd.port.mk.diff" Index: bsd.port.mk =================================================================== RCS file: /home/ncvs/ports/Mk/bsd.port.mk,v retrieving revision 1.411 diff -d -u -r1.411 bsd.port.mk --- bsd.port.mk 27 Apr 2002 11:22:59 -0000 1.411 +++ bsd.port.mk 5 May 2002 13:46:35 -0000 @@ -3151,9 +3157,20 @@ package-depends-list: @${PACKAGE-DEPENDS-LIST} -PACKAGE-DEPENDS-LIST= \ +PACKAGE-DEPENDS-LIST= \ if [ "${CHILD_DEPENDS}" ]; then \ - ${ECHO_CMD} "${PKGNAME} ${.CURDIR}"; \ + for origin in ${PKGORIGIN} ${ALT_ORIGINS}; do \ + installed=$$(${PKG_INFO} -qO $$origin); \ + if [ "$$installed" ]; then \ + break; \ + fi; \ + done; \ + if [ -z "$$installed" ]; then \ + installed="${PKGNAME}"; \ + fi; \ + for pkgname in $$installed; do \ + ${ECHO_CMD} "$$pkgname ${.CURDIR}"; \ + done; \ fi; \ checked="${PARENT_CHECKED}"; \ for dir in $$(${ECHO_CMD} "${LIB_DEPENDS} ${RUN_DEPENDS}" | ${TR} '\040' '\012' | ${SED} -e 's/^[^:]*://' -e 's/:.*//') $$(${ECHO_CMD} ${DEPENDS} | ${TR} '\040' '\012' | ${SED} -e 's/:.*//'); do \ --%--multipart-mixed-boundary-1.20046.1020606525--%-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-ports" in the body of the message