mirror of
https://github.com/macports/mpbb.git
synced 2026-07-12 18:18:44 -07:00
89 lines
2.8 KiB
Bash
89 lines
2.8 KiB
Bash
#!/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'.
|
|
|
|
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:,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_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
|
|
|
|
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
|
|
}
|