summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Gilbert <floppym@gentoo.org>2021-06-24 15:21:35 -0400
committerMike Gilbert <floppym@gentoo.org>2021-06-24 17:05:03 -0400
commit65808f23345eddd416362d2f3998fc45274d9bce (patch)
treeab10ad056dd6aea9f7458691911b0808622ef7c3 /eclass/python-utils-r1.eclass
parentsys-libs/libxcrypt: stable 4.4.20 for hppa, bug #796722 (diff)
downloadgentoo-65808f23345eddd416362d2f3998fc45274d9bce.tar.gz
gentoo-65808f23345eddd416362d2f3998fc45274d9bce.tar.bz2
gentoo-65808f23345eddd416362d2f3998fc45274d9bce.zip
Revert "python-utils-r1.eclass: Remove _python_ln_rel"
Reverts: 1f678a8cae66480493c43739435ec7feb85c08da Signed-off-by: Mike Gilbert <floppym@gentoo.org>
Diffstat (limited to 'eclass/python-utils-r1.eclass')
-rw-r--r--eclass/python-utils-r1.eclass40
1 files changed, 40 insertions, 0 deletions
diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass
index 7488802332f6..7022d3b7d88a 100644
--- a/eclass/python-utils-r1.eclass
+++ b/eclass/python-utils-r1.eclass
@@ -549,6 +549,46 @@ python_get_scriptdir() {
echo "${PYTHON_SCRIPTDIR}"
}
+# @FUNCTION: _python_ln_rel
+# @USAGE: <from> <to>
+# @INTERNAL
+# @DESCRIPTION:
+# Create a relative symlink.
+_python_ln_rel() {
+ debug-print-function ${FUNCNAME} "${@}"
+
+ local target=${1}
+ local symname=${2}
+
+ local tgpath=${target%/*}/
+ local sympath=${symname%/*}/
+ local rel_target=
+
+ while [[ ${sympath} ]]; do
+ local tgseg= symseg=
+
+ while [[ ! ${tgseg} && ${tgpath} ]]; do
+ tgseg=${tgpath%%/*}
+ tgpath=${tgpath#${tgseg}/}
+ done
+
+ while [[ ! ${symseg} && ${sympath} ]]; do
+ symseg=${sympath%%/*}
+ sympath=${sympath#${symseg}/}
+ done
+
+ if [[ ${tgseg} != ${symseg} ]]; then
+ rel_target=../${rel_target}${tgseg:+${tgseg}/}
+ fi
+ done
+ rel_target+=${tgpath}${target##*/}
+
+ debug-print "${FUNCNAME}: ${symname} -> ${target}"
+ debug-print "${FUNCNAME}: rel_target = ${rel_target}"
+
+ ln -fs "${rel_target}" "${symname}"
+}
+
# @FUNCTION: python_optimize
# @USAGE: [<directory>...]
# @DESCRIPTION: