commit:     42fdc187b717120717e55d9b1bee06a764e55b5d
Author:     Ulrich Müller <ulm <AT> gentoo <DOT> org>
AuthorDate: Sun May 16 18:22:15 2021 +0000
Commit:     Ulrich Müller <ulm <AT> gentoo <DOT> org>
CommitDate: Sat Jun  5 08:55:40 2021 +0000
URL:        https://gitweb.gentoo.org/proj/pms.git/commit/?id=42fdc187

EAPI 8 has dosym -r

Bug: https://bugs.gentoo.org/708360
Signed-off-by: Ulrich Müller <ulm <AT> gentoo.org>

 eapi-differences.tex |  4 ++++
 pkg-mgr-commands.tex | 39 ++++++++++++++++++++++++++++++++++++---
 2 files changed, 40 insertions(+), 3 deletions(-)

diff --git a/eapi-differences.tex b/eapi-differences.tex
index bbb8957..8cfc442 100644
--- a/eapi-differences.tex
+++ b/eapi-differences.tex
@@ -293,6 +293,9 @@ Output commands use stdout & 
\compactfeatureref{output-no-stdout} &
 \t{domo} destination path & \compactfeatureref{domo-path} &
     \t{\$\{DESTTREE\}} & \t{\$\{DESTTREE\}} & \t{\$\{DESTTREE\}} & \t{/usr} & 
\t{/usr} \\
 
+\t{dosym -r} & \compactfeatureref{dosym-relative} &
+    No & No & No & No & Yes \\
+
 \t{new*} support stdin & \compactfeatureref{newfoo-stdin} &
     No & Yes & Yes & Yes & Yes \\
 
@@ -517,6 +520,7 @@ EAPI 8 is EAPI 7 with the following changes:
 \item \t{hasv} and \t{hasq} banned, \featureref{banned-commands}.
 \item \t{econf} adds \t{-{}-datarootdir}, \featureref{econf-options}.
 \item \t{econf} adds \t{-{}-disable-static}, \featureref{econf-options}.
+\item \t{dosym} can create relative paths, \featureref{dosym-relative}.
 \end{compactitem}
 
 \ChangeWhenAddingAnEAPI{8}

diff --git a/pkg-mgr-commands.tex b/pkg-mgr-commands.tex
index 817b52b..4e43c69 100644
--- a/pkg-mgr-commands.tex
+++ b/pkg-mgr-commands.tex
@@ -599,9 +599,28 @@ the current phase function has returned.
 
 \item[dosbin] As \t{dobin}, but installs to \t{DESTTREE/sbin}.
 
-\item[dosym] Creates a symbolic link named as for its second parameter, 
pointing to the first. If
-    the directory containing the new link does not exist, creates it. Failure 
behaviour is EAPI
-    dependent as per section~\ref{sec:failure-behaviour}.
+\item[dosym] Creates a symbolic link named as for its second parameter, 
pointing to the first.
+    If the directory containing the new link does not exist, creates it.
+
+    \featurelabel{dosym-relative} In EAPIs listed in table~\ref{tab:dosym-r} 
as supporting creation
+    of relative paths, when called with option \t{-r}, the first parameter 
(the link target) is
+    converted from an absolute path to a path relative to the the second 
parameter (the link name).
+    The  algorithm must return a result identical to the one returned by the 
function in
+    listing~\ref{lst:dosym-r}, with \t{realpath} and \t{dirname} from GNU 
coreutils version~8.32.
+    Specifying option \t{-r} together with a relative path as first (target) 
parameter is an error.
+
+    Failure behaviour is EAPI dependent as per 
section~\ref{sec:failure-behaviour}.
+
+\begin{listing}[h]
+\caption{Create a relative path for \t{dosym -r}} \label{lst:dosym-r}
+\begin{verbatim}
+dosym_relative_path() {
+    local link=$(realpath -m -s "/${2#/}")
+    local linkdir=$(dirname "${link}")
+    realpath -m -s --relative-to="${linkdir}" "$1"
+}
+\end{verbatim}
+\end{listing}
 
 \item[fowners] Acts as for \t{chown}, but takes paths relative to the image 
directory. Failure
     behaviour is EAPI dependent as per section~\ref{sec:failure-behaviour}.
@@ -729,6 +748,20 @@ the current phase function has returned.
     \end{tabular}
 \end{centertable}
 
+\ChangeWhenAddingAnEAPI{8}
+\begin{centertable}{EAPIs supporting \t{dosym -r}}
+    \label{tab:dosym-r}
+    \begin{tabular}{ll}
+      \toprule
+      \multicolumn{1}{c}{\textbf{EAPI}} &
+      \multicolumn{1}{c}{\textbf{\t{dosym} supports creation of relative 
paths?}} \\
+      \midrule
+      0, 1, 2, 3, 4, 5, 6, 7  & No  \\
+      8                       & Yes \\
+      \bottomrule
+    \end{tabular}
+\end{centertable}
+
 \subsection{Commands affecting install destinations}
 The following commands are used to set the various destination trees and 
options used by the above
 installation commands. They must be shell functions or aliases, due to the 
need to set variables

Reply via email to