mpb: resolve port-tclsh symlink before executing

This avoids an undesirable modification of auto_path due to Tcl trying
to be helpful.

Closes: https://trac.macports.org/ticket/64507
This commit is contained in:
Joshua Root
2022-01-25 03:16:52 +11:00
parent 6c35baef3b
commit e30835a206
8 changed files with 9 additions and 8 deletions

View File

@@ -139,7 +139,7 @@ failcache_key() {
fi
local canonical_variants
canonical_variants=$("${option_prefix}/bin/port-tclsh" "${thisdir}/tools/canonical-variants.tcl" "$@")
canonical_variants=$("$(readlink "${option_prefix}/bin/port-tclsh")" "${thisdir}/tools/canonical-variants.tcl" "$@")
if [ $? -ne 0 ]; then
err "tools/canonical-variants.tcl" "$@" "failed"
return 4

View File

@@ -83,7 +83,7 @@ cleanup() {
echo "----> Uninstalling unneeded ports"
# $thisdir is set by mpbb and points to the directory in which this script resides
# shellcheck disable=SC2154
"${option_prefix}/bin/port-tclsh" "${thisdir}/tools/uninstall-unneeded-ports.tcl"
"$(readlink "${option_prefix}/bin/port-tclsh")" "${thisdir}/tools/uninstall-unneeded-ports.tcl"
if [ ! -L "${option_prefix}/var/macports/distfiles" ]; then
echo
echo "----> Deleting distfiles"

View File

@@ -53,7 +53,7 @@ gather-archives() {
# $option_prefix is set in mpbb
# shellcheck disable=SC2154
tclsh=${option_prefix}/bin/port-tclsh
tclsh=$(readlink "${option_prefix}/bin/port-tclsh")
if [ -d "${option_staging_dir}" ]; then
find "${option_staging_dir}" -type f -delete -print | sed -E -e "s|^.*/||" -e 's/^/Deleting previously staged archive: /'

View File

@@ -28,9 +28,10 @@ install-dependencies() {
# Script attempts to get to a state where all dependencies (and
# only dependencies) of the port are active
# Use of readlink is due to https://trac.macports.org/ticket/64507
# $option_prefix and $thisdir are set in mpbb
# shellcheck disable=SC2154
"${option_prefix}/bin/port-tclsh" "${thisdir}/tools/dependencies.tcl" --failcache_dir "${option_failcache_dir}" \
"$(readlink "${option_prefix}/bin/port-tclsh")" "${thisdir}/tools/dependencies.tcl" --failcache_dir "${option_failcache_dir}" \
--logs_dir "${option_log_dir}" "$@"
result=$?
if [ $result -ne 0 ]; then

View File

@@ -52,7 +52,7 @@ install-port() {
# $option_prefix and $thisdir are set in mpbb
# shellcheck disable=SC2154
if [[ -f $("${option_prefix}/bin/port-tclsh" "${thisdir}/tools/archive-path.tcl" "$@") ]]; then
if [[ -f $("$(readlink "${option_prefix}/bin/port-tclsh")" "${thisdir}/tools/archive-path.tcl" "$@") ]]; then
echo "$* already installed, nothing to do"
# log: summary for the portwatcher
echo "Building '$port' ... [OK]" >> "$log_subports_progress"

View File

@@ -35,7 +35,7 @@ print-subports() {
# $option_prefix is set in mpbb
# shellcheck disable=SC2154
tclsh=${option_prefix}/bin/port-tclsh
tclsh=$(readlink "${option_prefix}/bin/port-tclsh")
# $option_prefix is set in mpbb
# shellcheck disable=SC2154
if [ "${include_deps}" = "yes" ]; then

View File

@@ -73,6 +73,6 @@ mirror-distfiles() {
# Mirror the distfiles.
# $option_prefix is set by mpbb
# shellcheck disable=SC2154
"${option_prefix}/bin/port-tclsh" "${thisdir}/tools/mirror-multi.tcl" -c "${option_work_dir}/mirrorcache" "$@"
"$(readlink "${option_prefix}/bin/port-tclsh")" "${thisdir}/tools/mirror-multi.tcl" -c "${option_work_dir}/mirrorcache" "$@"
#"${option_prefix}/bin/port" -p mirror "$@" $("${option_prefix}/bin/port" -pq rdeps --index "$@" | sed -E -e '/^--$/d' -e 's/^[[:space:]]+//' | sort -u)
}

View File

@@ -37,7 +37,7 @@ print-info() {
# $option_prefix is set in mpbb
# shellcheck disable=SC2154
if portvariants=$("${option_prefix}/bin/port-tclsh" tools/canonical-variants.tcl "$port"); then
if portvariants=$("$(readlink "${option_prefix}/bin/port-tclsh")" tools/canonical-variants.tcl "$port"); then
printf "portvariants=%s\n" "$portvariants"
fi