Gentoo Archives: gentoo-pms

From: "Ulrich Müller" <ulm@g.o>
To: gentoo-pms@l.g.o
Subject: [gentoo-pms] [PATCH 18/21 v2] EAPI 8 has dosym -r
Date: Thu, 03 Jun 2021 08:24:31
Message-Id: u5yyvicef_-_@gentoo.org
In Reply to: [gentoo-pms] [PATCH 18/21] EAPI 8 has dosym -r by "Ulrich Müller"
1 Bug: https://bugs.gentoo.org/708360
2 Signed-off-by: Ulrich Müller <ulm@g.o>
3 ---
4 [v2] Updated wording in dosym -r description
5
6 eapi-differences.tex | 4 ++++
7 pkg-mgr-commands.tex | 39 ++++++++++++++++++++++++++++++++++++---
8 2 files changed, 40 insertions(+), 3 deletions(-)
9
10 diff --git a/eapi-differences.tex b/eapi-differences.tex
11 index bbb8957..8cfc442 100644
12 --- a/eapi-differences.tex
13 +++ b/eapi-differences.tex
14 @@ -293,6 +293,9 @@ Output commands use stdout & \compactfeatureref{output-no-stdout} &
15 \t{domo} destination path & \compactfeatureref{domo-path} &
16 \t{\$\{DESTTREE\}} & \t{\$\{DESTTREE\}} & \t{\$\{DESTTREE\}} & \t{/usr} & \t{/usr} \\
17
18 +\t{dosym -r} & \compactfeatureref{dosym-relative} &
19 + No & No & No & No & Yes \\
20 +
21 \t{new*} support stdin & \compactfeatureref{newfoo-stdin} &
22 No & Yes & Yes & Yes & Yes \\
23
24 @@ -517,6 +520,7 @@ EAPI 8 is EAPI 7 with the following changes:
25 \item \t{hasv} and \t{hasq} banned, \featureref{banned-commands}.
26 \item \t{econf} adds \t{-{}-datarootdir}, \featureref{econf-options}.
27 \item \t{econf} adds \t{-{}-disable-static}, \featureref{econf-options}.
28 +\item \t{dosym} can create relative paths, \featureref{dosym-relative}.
29 \end{compactitem}
30
31 \ChangeWhenAddingAnEAPI{8}
32 diff --git a/pkg-mgr-commands.tex b/pkg-mgr-commands.tex
33 index 817b52b..4e43c69 100644
34 --- a/pkg-mgr-commands.tex
35 +++ b/pkg-mgr-commands.tex
36 @@ -599,9 +599,28 @@ the current phase function has returned.
37
38 \item[dosbin] As \t{dobin}, but installs to \t{DESTTREE/sbin}.
39
40 -\item[dosym] Creates a symbolic link named as for its second parameter, pointing to the first. If
41 - the directory containing the new link does not exist, creates it. Failure behaviour is EAPI
42 - dependent as per section~\ref{sec:failure-behaviour}.
43 +\item[dosym] Creates a symbolic link named as for its second parameter, pointing to the first.
44 + If the directory containing the new link does not exist, creates it.
45 +
46 + \featurelabel{dosym-relative} In EAPIs listed in table~\ref{tab:dosym-r} as supporting creation
47 + of relative paths, when called with option \t{-r}, the first parameter (the link target) is
48 + converted from an absolute path to a path relative to the the second parameter (the link name).
49 + The algorithm must return a result identical to the one returned by the function in
50 + listing~\ref{lst:dosym-r}, with \t{realpath} and \t{dirname} from GNU coreutils version~8.32.
51 + Specifying option \t{-r} together with a relative path as first (target) parameter is an error.
52 +
53 + Failure behaviour is EAPI dependent as per section~\ref{sec:failure-behaviour}.
54 +
55 +\begin{listing}[h]
56 +\caption{Create a relative path for \t{dosym -r}} \label{lst:dosym-r}
57 +\begin{verbatim}
58 +dosym_relative_path() {
59 + local link=$(realpath -m -s "/${2#/}")
60 + local linkdir=$(dirname "${link}")
61 + realpath -m -s --relative-to="${linkdir}" "$1"
62 +}
63 +\end{verbatim}
64 +\end{listing}
65
66 \item[fowners] Acts as for \t{chown}, but takes paths relative to the image directory. Failure
67 behaviour is EAPI dependent as per section~\ref{sec:failure-behaviour}.
68 @@ -729,6 +748,20 @@ the current phase function has returned.
69 \end{tabular}
70 \end{centertable}
71
72 +\ChangeWhenAddingAnEAPI{8}
73 +\begin{centertable}{EAPIs supporting \t{dosym -r}}
74 + \label{tab:dosym-r}
75 + \begin{tabular}{ll}
76 + \toprule
77 + \multicolumn{1}{c}{\textbf{EAPI}} &
78 + \multicolumn{1}{c}{\textbf{\t{dosym} supports creation of relative paths?}} \\
79 + \midrule
80 + 0, 1, 2, 3, 4, 5, 6, 7 & No \\
81 + 8 & Yes \\
82 + \bottomrule
83 + \end{tabular}
84 +\end{centertable}
85 +
86 \subsection{Commands affecting install destinations}
87 The following commands are used to set the various destination trees and options used by the above
88 installation commands. They must be shell functions or aliases, due to the need to set variables
89 --
90 2.31.1