From owner-freebsd-doc@FreeBSD.ORG Wed Apr 11 18:40:14 2012 Return-Path: Delivered-To: freebsd-doc@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4AB4D1065694 for ; Wed, 11 Apr 2012 18:40:14 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id DD0488FC18 for ; Wed, 11 Apr 2012 18:40:11 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.5/8.14.5) with ESMTP id q3BIeB3W036797 for ; Wed, 11 Apr 2012 18:40:11 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.5/8.14.5/Submit) id q3BIeBhO036796; Wed, 11 Apr 2012 18:40:11 GMT (envelope-from gnats) Resent-Date: Wed, 11 Apr 2012 18:40:11 GMT Resent-Message-Id: <201204111840.q3BIeBhO036796@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-doc@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, "A.J. Kehoe IV (Nanoman)" Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 54EFE1065672 for ; Wed, 11 Apr 2012 18:33:19 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22]) by mx1.freebsd.org (Postfix) with ESMTP id 13B088FC18 for ; Wed, 11 Apr 2012 18:33:19 +0000 (UTC) Received: from red.freebsd.org (localhost [127.0.0.1]) by red.freebsd.org (8.14.4/8.14.4) with ESMTP id q3BIXIpr034327 for ; Wed, 11 Apr 2012 18:33:18 GMT (envelope-from nobody@red.freebsd.org) Received: (from nobody@localhost) by red.freebsd.org (8.14.4/8.14.4/Submit) id q3BIXILU034322; Wed, 11 Apr 2012 18:33:18 GMT (envelope-from nobody) Message-Id: <201204111833.q3BIXILU034322@red.freebsd.org> Date: Wed, 11 Apr 2012 18:33:18 GMT From: "A.J. Kehoe IV (Nanoman)" To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Cc: Subject: docs/166855: [patch] Automatic Detection of Dependencies Addendum for Porter's Handbook X-BeenThere: freebsd-doc@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Documentation project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Apr 2012 18:40:14 -0000 >Number: 166855 >Category: docs >Synopsis: [patch] Automatic Detection of Dependencies Addendum for Porter's Handbook >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-doc >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Wed Apr 11 18:40:11 UTC 2012 >Closed-Date: >Last-Modified: >Originator: A.J. Kehoe IV (Nanoman) >Release: 9.0 >Organization: Nanoman's Company >Environment: FreeBSD localhost 9.0-RELEASE FreeBSD 9.0-RELEASE #0: Tue Jan 3 07:15:25 UTC 2012 root@obrian.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC i386 >Description: The automatic detection of dependencies causes inconsistent indexing, and therefore makes it very difficult to automate port and package management. A rule forbidding this method should be included in the Porter's Handbook. >How-To-Repeat: >Fix: I've attached an update for doc/en_US.ISO8859-1/books/porters-handbook/book.sgml. Patch attached with submission follows: --- book.sgml.old 2012-04-11 13:34:36.000000000 -0400 +++ book.sgml 2012-04-11 14:27:09.000000000 -0400 @@ -3843,6 +3843,56 @@ may be able to save a large number of people—including yourself— a lot of grief in the process. + + + Automatic Detection Causes Problems + + Dependencies must be declared either explicitly or by + using the OPTIONS framework. + Using other methods like automatic detection complicates + indexing, which causes problems for port and package + management. + + + Wrong Declaration of an Optional Dependency + + .include <bsd.port.pre.mk> + +.if exists(${LOCALBASE}/bin/foo) +LIB_DEPENDS= bar:${PORTSDIR}/foo/bar +.endif + + + The problem with the above method is that it declares a + dependency based on the existence of a file that may have + been installed by another port. If all options were + recursively defined for a batch of ports and an index of + these ports was built, then the index would become + inconsistent during the installation of this batch if one of + its ports installed that file. A new index would need to be + created, but it too may be inconsistent if there are other + ports that use this same method. + + + Correct Declaration of an Optional Dependency + + OPTIONS= BAR "Enable bar support" on + +.include <bsd.port.pre.mk> + +.if defined(WITH_BAR) && !defined(WITHOUT_BAR) +LIB_DEPENDS= bar:${PORTSDIR}/foo/bar +.endif + + + This second method is correct because it would not cause + inconsistencies in the index of a batch of ports, provided + the batch's options were defined prior to the index's build. + This makes it possible to use simple scripts to automate the + building, installation, and updating of these ports and + their packages. + >Release-Note: >Audit-Trail: >Unformatted: