File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -65,7 +65,7 @@ import re
6565import sys
6666
6767macos = sys.argv[1]
68- tag_name = sys.argv[2]
68+ tag_name = sys.argv[2]
6969
7070package_pattern = macos + "[.]pkg$"
7171
@@ -221,12 +221,31 @@ main()
221221 ' Configuration Summary' \
222222 configuration_summary
223223
224+ # Guarded package selection and installation.
224225 if [ " ${macports_prefix} " = ' /opt/local' ]; then
225- fetch_and_install_package " $( make_package) "
226+ # Determine the package URL for this macOS/version.
227+ package_url=" $( make_package) "
228+ # Diagnostic values for debugging.
229+ detected_macos=" $( probe_macos) "
230+ detected_version=" ${macports_version:- unknown} "
231+
232+ if [ -z " ${package_url} " ] || [ " ${package_url} " = " :not-found" ]; then
233+ failwith ' Cannot determine MacPorts package for detected macOS "%s" and version "%s". Package URL is empty.' " ${detected_macos} " " ${detected_version} "
234+ fi
235+
236+ # Confirm the URL looks like an https URL to avoid passing blanks/options to curl.
237+ case " ${package_url} " in
238+ https://* )
239+ fetch_and_install_package " ${package_url} "
240+ ;;
241+ * )
242+ failwith ' Invalid MacPorts package URL: %s' " ${package_url} "
243+ ;;
244+ esac
226245 else
227- install_from_source
246+ install_from_source
228247 fi
229-
248+
230249 install_ports " ${macports_prefix} /etc/setup-macports.yaml"
231250}
232251
You can’t perform that action at this time.
0 commit comments