-
-
Notifications
You must be signed in to change notification settings - Fork 13
/
mpbb-gather-archives
73 lines (59 loc) · 2.51 KB
/
mpbb-gather-archives
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
#!/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=$(readlink "${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
# $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 $?
}