mirror of
https://github.com/macports/mpbb.git
synced 2026-07-12 18:18:44 -07:00
75 lines
2.5 KiB
Bash
75 lines
2.5 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!
|
|
|
|
gather-archives-usage() {
|
|
# "prog" is defined in mpbb-help.
|
|
# shellcheck disable=SC2154
|
|
cat <<EOF
|
|
usage: $prog [<global opts>] gather-archives [<opts>]
|
|
|
|
Copy unpublished, distributable archives of active ports into a staging
|
|
directory for uploading.
|
|
|
|
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'.
|
|
|
|
--staging-dir=<path>
|
|
A directory for storing archives before deployment. Defaults to the
|
|
\`archive-staging' subdirectory of the \`--work-dir' working directory.
|
|
|
|
Run \`$prog help' for global options and a list of other subcommands.
|
|
EOF
|
|
}
|
|
|
|
device-of-path() {
|
|
df -P -- "$1" | awk 'NR==2 {print $1}'
|
|
}
|
|
|
|
gather-archives() {
|
|
local args
|
|
parseopt archive-site:,archive-site-private:,staging-dir: "$@" || 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_staging_dir is set by parseopt
|
|
# shellcheck disable=SC2154
|
|
: "${option_staging_dir=${option_work_dir}/archive-staging}"
|
|
# shellcheck disable=SC2086
|
|
set -- ${args+"${args[@]}"}
|
|
|
|
# $option_prefix is set in mpbb
|
|
# shellcheck disable=SC2154
|
|
tclsh="${option_prefix}/bin/port-tclsh"
|
|
|
|
if [ -d "${option_staging_dir}" ]; then
|
|
find "${option_staging_dir}" -type f -delete -print | sed -E -e "s|^.*/||" -e 's/^/Deleting previously staged archive: /'
|
|
rm -rf "${option_staging_dir}"
|
|
echo
|
|
fi
|
|
|
|
mkdir -p "${option_staging_dir}"/public "${option_staging_dir}"/private || return
|
|
chmod -R a+rX "${option_staging_dir}"
|
|
|
|
# $thisdir is set in mpbb
|
|
# shellcheck disable=SC2154
|
|
"${tclsh}" "${thisdir}/tools/gather-archives.tcl" --archive_site_private "${option_archive_site_private}" \
|
|
--archive_site_public "${option_archive_site}" --jobs_dir "${option_jobs_dir}" \
|
|
--license_db_dir "${option_license_db_dir}" --staging_dir "${option_staging_dir}" \
|
|
"${option_work_dir}/requested_port"
|
|
return $?
|
|
}
|