Skip to content

Commit 06620d1

Browse files
committed
Support specifying variants in list-subports
Allow passing variants into list-subports by separating port name and variants specification with an "@" sign. @ is not a valid character in port names and should allow us to specify variants per port in the buildbot's portlist. When not using this new syntax, the output will look exactly as it did before to avoid breaking the existing setup. Closes: https://trac.macports.org/ticket/52742
1 parent 9ff38f0 commit 06620d1

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

mpbb-list-subports

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ list-subports-usage() {
99
# "prog" is defined in mpbb-help.
1010
# shellcheck disable=SC2154
1111
cat <<EOF
12-
usage: $prog [<global opts>] list-subports [<opts>] <port> [<port2> [...]]
12+
usage: $prog [<global opts>] list-subports [<opts>] <port>[@(+|-)variant [...]] [<port2>[@(+|-)variant [...]] [...]]
1313
1414
Print the name and subports of each given port to standard output.
1515
@@ -25,7 +25,8 @@ EOF
2525

2626
print-subports() {
2727
local archive_site=$1
28-
local portname=$2
28+
local portname=${2%%@*}
29+
local portvariants=${2:${#portname}+1}
2930
local port
3031
local portgroup
3132
local ports
@@ -44,16 +45,15 @@ print-subports() {
4445
exclude=0
4546
exclude_reasons=()
4647

47-
# FIXME: this doesn't take selected variants into account
4848
# $thisdir is set in mpbb
4949
# shellcheck disable=SC2154
50-
archive_path=$("${tclsh}" "${thisdir}/tools/archive-path.tcl" "${port}")
50+
archive_path=$("${tclsh}" "${thisdir}/tools/archive-path.tcl" "${port}" "${portvariants}")
5151
if [[ -f "${archive_path}" ]]; then
5252
archive_basename=$(basename "${archive_path}")
5353
if curl -fIsL "${archive_site}/${port}/${archive_basename}" > /dev/null; then
5454
exclude=1
5555
exclude_reasons+=("it has already been built and uploaded")
56-
elif ! "${tclsh}" "${option_jobs_dir}/port_binary_distributable.tcl" "${port}"; then
56+
elif ! "${tclsh}" "${option_jobs_dir}/port_binary_distributable.tcl" "${port}" "${portvariants}"; then
5757
exclude=1
5858
exclude_reasons+=("it has already been built and is not distributable")
5959
fi
@@ -66,7 +66,7 @@ print-subports() {
6666
else
6767
# $thisdir is set in mpbb
6868
# shellcheck disable=SC2154
69-
for portgroup in $("${tclsh}" "${thisdir}/tools/portgroups.tcl" "$port"); do
69+
for portgroup in $("${tclsh}" "${thisdir}/tools/portgroups.tcl" "${port}" "${portvariants}"); do
7070
if [ "$portgroup" = "obsolete-1.0" ]; then
7171
exclude=1
7272
exclude_reasons+=("it includes the obsolete 1.0 PortGroup")
@@ -76,7 +76,7 @@ print-subports() {
7676
fi
7777

7878
if [[ $exclude -eq 0 && ("${os_version}" = "10.6" || "${os_version}" = "10.5") ]]; then
79-
supported_archs=$("${tclsh}" "${thisdir}/tools/supported-archs.tcl" "${port}")
79+
supported_archs=$("${tclsh}" "${thisdir}/tools/supported-archs.tcl" "${port}" "${portvariants}")
8080
if [[ -n "${supported_archs}" ]]; then
8181
is_64bit_capable="$(sysctl -n hw.cpu64bit_capable)"
8282
if [[ "${os_version}" = "10.6" && "${is_64bit_capable}" = "0" && ! ("${supported_archs}" == *"x86_64"* && "${supported_archs}" == *"i386"*) ]]; then
@@ -90,7 +90,11 @@ print-subports() {
9090
fi
9191

9292
if [ $exclude -eq 0 ]; then
93-
echo "$port"
93+
if [ -n "${portvariants}" ]; then
94+
echo "${port}@${portvariants}"
95+
else
96+
echo "$port"
97+
fi
9498
else
9599
if [ ${#exclude_reasons[@]} -eq 1 ]; then
96100
echo >&2 "Excluding '${port}' because ${exclude_reasons[0]}."

0 commit comments

Comments
 (0)