wait-for-mirror: read credentials from a file

This commit is contained in:
Joshua Root
2026-01-20 17:40:29 +11:00
parent 5f07b18646
commit d0eaf6f209
3 changed files with 12 additions and 4 deletions
+1 -1
View File
@@ -60,7 +60,7 @@ parseopt prefix:,work-dir: "$@" || exit
option_failcache_dir=${option_work_dir}/failcache
option_license_db_dir=${option_work_dir}/license_db
option_mirrordb_url=""
option_mirrordb_credentials=""
option_mirrordb_credentials_file=""
# Inform the user if old repositories are still present.
if [[ -d ${option_work_dir}/tools/.svn ]]; then
+1 -1
View File
@@ -75,7 +75,7 @@ install-port() {
if [ -n "$option_mirrordb_url" ]; then
echo "Waiting for '$port' to be mirrored."
if "${option_prefix}/bin/port-tclsh" "${thisdir}/tools/wait-for-mirror.tcl" \
"$option_mirrordb_url" "$option_mirrordb_credentials" "$port"; then
"$option_mirrordb_url" "$option_mirrordb_credentials_file" "$port"; then
echo "Mirroring of '$port' done. Retrying fetch."
if ! "${option_prefix}/bin/port" -d fetch "$@"; then
echo "Second fetch of '$port' failed."
+10 -2
View File
@@ -5,10 +5,18 @@
# periodically until it has been, or timeout is reached.
if {$argc != 3} {
error "Usage: wait-for-mirror.tcl mirrorcache_baseurl mirrorcache_credentials portname"
error "Usage: wait-for-mirror.tcl mirrorcache_baseurl mirrorcache_credentials_file portname"
}
lassign $argv mirrorcache_baseurl mirrorcache_credentials portname
lassign $argv mirrorcache_baseurl mirrorcache_credentials_file portname
try {
set fd [open $mirrorcache_credentials_file r]
set mirrorcache_credentials [gets $fd]
close $fd
} on error {eMessage} {
puts stderr "Failed to load credentials file '$mirrorcache_credentials_file': $eMessage"
exit 1
}
package require macports
source [file join [file dirname [info script]] mirrordb.tcl]