From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 4D6B213825A for ; Sun, 15 May 2016 02:49:37 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 0EB2221C06A; Sun, 15 May 2016 02:49:29 +0000 (UTC) Received: from out5-smtp.messagingengine.com (out5-smtp.messagingengine.com [66.111.4.29]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 1716821C04D for ; Sun, 15 May 2016 02:49:27 +0000 (UTC) Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id 395C12071E for ; Sat, 14 May 2016 22:49:27 -0400 (EDT) Received: from frontend2 ([10.202.2.161]) by compute2.internal (MEProxy); Sat, 14 May 2016 22:49:27 -0400 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:message-id:mime-version:subject:to:x-sasl-enc :x-sasl-enc; s=smtpout; bh=hF2S/b4yquInwOqGt09eDFp7VrI=; b=Whx9K P1nZtkAdDyd9nj4YDC+CNsj/qQ5RYjrgs+Evw1Uwd/dTC01DdKgaCMxRVgYyt6sy 66NB/4+HqGViy0+nl+LFvP9AUR2oqDP7+fN7ZWEsYNDGx+P5oiX1W1NDIE9Olpgg LnmCrHhxdt8VobMT6W+hcKXSGZOIMa1xE1HCqc= X-Sasl-enc: 9WdmfFrM2MA17Y7BggIKPhv+uyS+vWc/zrhVlIPg4jDj 1463280566 Received: from localhost.localdomain (cpe-66-24-84-54.stny.res.rr.com [66.24.84.54]) by mail.messagingengine.com (Postfix) with ESMTPA id D9DF668023C; Sat, 14 May 2016 22:49:26 -0400 (EDT) From: =?UTF-8?q?G=C3=B6kt=C3=BCrk=20Y=C3=BCksek?= To: devmanual@gentoo.org Cc: gentoo-dev@lists.gentoo.org Subject: [gentoo-dev] [PATCH] ebuild-writing/variables: add a section to explain the ROOT variable #144332 Date: Sat, 14 May 2016 22:49:20 -0400 Message-Id: <1463280560-5487-1-git-send-email-gokturk@binghamton.edu> X-Mailer: git-send-email 2.7.3 Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-dev@lists.gentoo.org Reply-to: gentoo-dev@lists.gentoo.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Archives-Salt: d52f6d20-2ecb-4a4e-90bf-fd4b38d924e5 X-Archives-Hash: cf012bc62573c502777d58d20e30c6c8 The text is originally based on the patch provided by Thilo Bangert in the bug. It is revised and expanded to mention the use of ROOT in cross-compiling environments as explained in PMS Table 11.1. Gentoo-Bug: https://bugs.gentoo.org/144332 Signed-off-by: Göktürk Yüksek --- ebuild-writing/variables/text.xml | 55 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 53 insertions(+), 2 deletions(-) diff --git a/ebuild-writing/variables/text.xml b/ebuild-writing/variables/text.xml index 9027cad..dc152e1 100644 --- a/ebuild-writing/variables/text.xml +++ b/ebuild-writing/variables/text.xml @@ -101,8 +101,8 @@ them. ROOT The absolute path to the root directory into which the package is to be - merged. Use this when referring to installed files in pkg_* - functions. Never use this in src_* functions. + merged. Only allowed in pkg_* phases. See + @@ -393,6 +393,57 @@ GLEP 23 for details.
+ROOT + + +

+The idea behind ROOT is that one can build a system with +ROOT=/somewhere and then chroot into it or tar up +/somewhere as a system image. It is not designed to allow the +user to run /somewhere/usr/bin/foo. +

+ +

+Ebuilds may reference ROOT only during pkg_* phases. It +can't be used correctly in src_* phases, since ROOT may +be different when merging a binary package. For example, a binary +package may be built with ROOT=/ and then installed onto a +system using ROOT=/somewhere. +

+ +

+When building a package, ROOT should not be used to satisfy the +required dependencies on libraries, headers files etc. Instead, the +files on the build system should be specified using /. +

+ +

+In a cross compiling environment, ebuilds must not call any of the +binaries inside ROOT since they may not be executable on the +build system. +

+ +

+Below is an example of an ebuild that uses ROOT in +pkg_postinst() to conditionally print an error message if an +old and obsolete configuration file still exists: + + +pkg_postinst() { + if [[ -e "${ROOT}/etc/oldconfig" ]]; then + ewarn "You still have the obsolete config file " + ewarn " ${ROOT}/etc/oldconfig." + ewarn "Please migrate your settings to ${ROOT}/etc/newconfig" + ewarn "and remove ${ROOT}/etc/oldconfig." + fi +} + +

+ + +
+ +
Version and Name Formatting Issues -- 2.7.3