Gentoo Archives: gentoo-pms

From: James Le Cuirot <chewi@g.o>
To: gentoo-pms@l.g.o
Cc: James Le Cuirot <chewi@g.o>
Subject: [gentoo-pms] [PATCH] Correct the definition of ESYSROOT as EPREFIX isn't always applicable
Date: Sat, 01 Jun 2019 22:29:51
Message-Id: 20190601222921.12072-1-chewi@gentoo.org
1 Unfortunately my conception of ESYSROOT was a little short-sighted. It
2 was previously defined as SYSROOT + EPREFIX but if SYSROOT does not
3 equal ROOT then EPREFIX does not make sense in this context. Consider
4 a more concrete example:
5
6 BROOT=/foo
7 ROOT=/bar
8 PREFIX=/baz
9 EROOT=/bar/baz
10 SYSROOT=/
11
12 In this scenario, ESYSROOT should be /foo (matching BROOT), not
13 /baz. From the build system's perspective, /baz does not even exist.
14
15 It was also originally envisaged (but not stated in PMS) that SYSROOT
16 would only ever need to equal / or ROOT as a distinct SYSROOT would
17 have no benefit. A check was added to Portage to ensure this held.
18 Myself, the ChromiumOS team, and others have since been caught out by
19 this check when trying to bootstrap brand new systems from scratch.
20 You cannot bootstrap with no headers at all! The check will therefore
21 be adjusted to merely ensure that SYSROOT is / when ROOT is /.
22
23 As a result of this original design, no prefix variable for a distinct
24 SYSROOT was ever established. We therefore assume a blank prefix in
25 this context. A distinct SYSROOT is most likely to point to a crossdev
26 toolchain under /usr/${CHOST} but even if pointed elsewhere, it could
27 include a prefix and still work effectively.
28
29 A single variable to hold the SYSROOT prefix, whether determined by /,
30 ROOT, or the user, would have been nice but it is too late to
31 introduce one now. In practise, you are unlikely to need one as the
32 SYSROOT is almost entirely used as a source of headers and libraries
33 that are best referenced using ESYSROOT. Otherwise, you could simply
34 derive the value from ${ESYSROOT#${SYSROOT}}.
35
36 Signed-off-by: James Le Cuirot <chewi@g.o>
37 ---
38 dependencies.tex | 12 ++++++------
39 ebuild-env-vars.tex | 7 ++++---
40 2 files changed, 10 insertions(+), 9 deletions(-)
41
42 diff --git a/dependencies.tex b/dependencies.tex
43 index 44382d1..acfebc1 100644
44 --- a/dependencies.tex
45 +++ b/dependencies.tex
46 @@ -32,13 +32,13 @@
47 \label{tab:dep-class-api}
48 \begin{tabular}{llll}
49 \toprule
50 - & \t{BDEPEND} & \t{DEPEND} & \t{RDEPEND}, \t{PDEPEND} \\
51 + & \t{BDEPEND} & \t{DEPEND} & \t{RDEPEND}, \t{PDEPEND} \\
52 \midrule
53 - Binary compatible with & \t{CBUILD} & \t{CHOST} & \t{CHOST} \\
54 - Base unprefixed path & \t{/} & \t{\$\{SYSROOT\}} & \t{\$\{ROOT\}} \\
55 - Relevant offset-prefix & \t{\$\{BROOT\}} & \t{\$\{EPREFIX\}} & \t{\$\{EPREFIX\}} \\
56 - Path combined with prefix & \t{\$\{BROOT\}} & \t{\$\{ESYSROOT\}} & \t{\$\{EROOT\}} \\
57 - PM query command option & \t{-b} & \t{-d} & \t{-r} \\
58 + Binary compatible with & \t{CBUILD} & \t{CHOST} & \t{CHOST} \\
59 + Base unprefixed path & \t{/} & \t{\$\{SYSROOT\}} & \t{\$\{ROOT\}} \\
60 + Relevant offset-prefix & \t{\$\{BROOT\}} & \t{\$\{BROOT\}}, \t{\$\{EPREFIX\}}, or blank if \t{\$\{SYSROOT\}} equals \t{/}, \t{\$\{ROOT\}}, or something else respectively & \t{\$\{EPREFIX\}} \\
61 + Path combined with prefix & \t{\$\{BROOT\}} & \t{\$\{ESYSROOT\}} & \t{\$\{EROOT\}} \\
62 + PM query command option & \t{-b} & \t{-d} & \t{-r} \\
63 \bottomrule
64 \end{tabular}
65 \end{centertable}
66 diff --git a/ebuild-env-vars.tex b/ebuild-env-vars.tex
67 index 660d17b..45f0a7b 100644
68 --- a/ebuild-env-vars.tex
69 +++ b/ebuild-env-vars.tex
70 @@ -141,9 +141,10 @@ variable.
71 \t{ESYSROOT} &
72 Ditto &
73 No &
74 - Contains the concatenation of the paths in the \t{SYSROOT} and \t{EPREFIX} variables,
75 - for convenience. See also the \t{EPREFIX} variable. Only for EAPIs listed
76 - in table~\ref{tab:offset-env-vars-table} as supporting \t{ESYSROOT}. \\
77 + Contains the concatenation of the \t{SYSROOT} path and applicable prefix value. The prefix value
78 + is \t{BROOT}, \t{EPREFIX}, or blank if \t{SYSROOT} is equal to /, \t{ROOT}, or something else
79 + respectively. Only for EAPIs listed in table~\ref{tab:offset-env-vars-table} as supporting
80 + \t{ESYSROOT}. \\
81 \t{BROOT} &
82 Ditto &
83 No &
84 --
85 2.21.0

Replies