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 391C7138262 for ; Wed, 18 May 2016 06:57:04 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 9F592142F0; Wed, 18 May 2016 06:57:03 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (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 4012E142F0 for ; Wed, 18 May 2016 06:57:03 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id F111D340C8A for ; Wed, 18 May 2016 06:57:01 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 05EA095E for ; Wed, 18 May 2016 06:56:54 +0000 (UTC) From: "Göktürk Yüksek" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Göktürk Yüksek" Message-ID: <1463554179.d1a7be9d1bf8138fe3476a579ce0af004979c914.gokturk@gentoo> Subject: [gentoo-commits] proj/devmanual:master commit in: ebuild-writing/variables/ X-VCS-Repository: proj/devmanual X-VCS-Files: ebuild-writing/variables/text.xml X-VCS-Directories: ebuild-writing/variables/ X-VCS-Committer: gokturk X-VCS-Committer-Name: Göktürk Yüksek X-VCS-Revision: d1a7be9d1bf8138fe3476a579ce0af004979c914 X-VCS-Branch: master Date: Wed, 18 May 2016 06:56:54 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: 3dc5df59-3fe6-43de-b5a8-3ba543b97afb X-Archives-Hash: 561d05e787615b30ce0909b4233f9413 commit: d1a7be9d1bf8138fe3476a579ce0af004979c914 Author: Göktürk Yüksek binghamton edu> AuthorDate: Sun May 15 02:34:54 2016 +0000 Commit: Göktürk Yüksek binghamton edu> CommitDate: Wed May 18 06:49:39 2016 +0000 URL: https://gitweb.gentoo.org/proj/devmanual.git/commit/?id=d1a7be9d ebuild-writing/variables: add a section to explain the ROOT variable #144332 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 binghamton.edu> 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