-
-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathmpbb-list-subports
More file actions
111 lines (92 loc) · 3.82 KB
/
Copy pathmpbb-list-subports
File metadata and controls
111 lines (92 loc) · 3.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
#!/bin/bash
# -*- coding: utf-8; mode: sh; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=sh:et:sw=4:ts=4:sts=4
# Note:
# This script is sourced by the mpbb wrapper script.
# Do not execute this directly!
list-subports-usage() {
# "prog" is defined in mpbb-help.
# shellcheck disable=SC2154
cat <<EOF
usage: $prog [<global opts>] list-subports [<opts>] <port> [<port2> [...]]
Print the name and subports of each given port to standard output.
Options:
--archive-site=<URL>
URL to check for preexisting public archives. Defaults to
\`https://packages.macports.org'.
--archive-site-private=<URL>
URL to check for preexisting private archives. Defaults to
\`https://packages-private.macports.org'.
--archive-site-http=<URL>
URL to check for preexisting public archives if the OS is unable to
connect to modern https sites. Defaults to
\`http://packages.internal.macports.net'.
--archive-site-private-http=<URL>
URL to check for preexisting private archives if the OS is unable
to connect to modern https sites. Defaults to
\`http://packages-private.internal.macports.net'.
Run \`$prog help' for global options and a list of other subcommands.
EOF
}
print-subports() {
local archive_site_public=$1
local archive_site_private=$2
local include_deps=$3
local portnames=$4
# $option_prefix is set in mpbb
# shellcheck disable=SC2154
tclsh="${option_prefix}/bin/port-tclsh"
# $option_prefix is set in mpbb
# shellcheck disable=SC2154
if [ "${include_deps}" = "yes" ]; then
include_deps=--include_deps
else
include_deps=
fi
"${tclsh}" "${thisdir}/tools/sort-with-subports.tcl" --jobs_dir "${option_jobs_dir}" \
--license_db_dir "${option_license_db_dir}" --failcache_dir "${option_failcache_dir}" \
--archive_site_public "${archive_site_public}" \
--archive_site_private "${archive_site_private}" ${include_deps} \
${portnames} || return
}
list-subports() {
# $option_log_dir is set in mpbb
# shellcheck disable=SC2154
local log_subports_progress="${option_log_dir}/ports-progress.txt"
local args
parseopt archive-site:,archive-site-private:,archive-site-http:,archive-site-private-http:,include-deps: "$@" || return
# $option_archive_site is set by parseopt
# shellcheck disable=SC2154
: "${option_archive_site=https://packages.macports.org}"
# $option_archive_site_private is set by parseopt
# shellcheck disable=SC2154
: "${option_archive_site_private=https://packages-private.macports.org}"
# $option_archive_site_http is set by parseopt
# shellcheck disable=SC2154
: "${option_archive_site_http=http://packages.internal.macports.net}"
# $option_archive_site_private_http is set by parseopt
# shellcheck disable=SC2154
: "${option_archive_site_private_http=http://packages-private.internal.macports.net}"
# $option_include_deps is set by parseopt
# shellcheck disable=SC2154
: "${option_include_deps=yes}"
set -- ${args+"${args[@]}"}
if [ $# -le 0 ]; then
err "Must specify at least one port"
return 1
fi
# Use http on builders that don't support modern TLS
local -r os_major="$(uname -r | cut -f 1 -d .)"
if [ "$os_major" -lt 19 -a "$os_major" -ne 16 ]; then
option_archive_site="$option_archive_site_http"
option_archive_site_private="$option_archive_site_private_http"
fi
success=0
# prepare the log file and make sure to start with an empty one
mkdir -p "$option_log_dir"
> "$log_subports_progress"
print-subports "${option_archive_site}" "${option_archive_site_private}" "${option_include_deps}" "$*" && success=1
if [ $success -eq 0 ]; then
err "None of the specified ports were found in the port index."
return 1
fi
}