mirror of
https://github.com/macports/mpbb.git
synced 2026-07-12 18:18:44 -07:00
À la Git, command-line options that are applicable to all subcommands
(e.g., `--prefix`) are now given before the subcommand name, while
options that are specific to particular subcommands (e.g.,
`--archive-site`) come after. For example, this:
mpbb checkout --prefix /opt/local --svn /usr/bin/svn
is now:
mpbb --prefix /opt/local checkout --svn /usr/bin/svn
This is a practical improvement as well as a conceptual one, as the
Buildbot configuration will be able to factor out the common command
prefix like so:
cmd = ('./mpbb/mpbb', '--prefix', WithProperties(prefix))
cmd_selfupdate = cmd + ('selfupdate',)
cmd_checkout = cmd + ('checkout', '--svn-url', svnurl)
[...]
For backwards compatibility with our current Buildbot deployment, all
subcommands except `list-subports` still accept `--prefix`.
git-svn-id: https://svn.macports.org/repository/macports/contrib/mp-buildbot@152525 d073be05-634f-4543-b044-5fe20cf6d1d6
90 lines
3.0 KiB
Bash
90 lines
3.0 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!
|
|
|
|
|
|
checkout-help() {
|
|
cat <<EOF
|
|
Update or checkout a working copy of the ports tree from --svn-url to specific
|
|
SVN revision (--svn-revision), update or create the PortIndex and configure
|
|
the MacPorts installation to use this ports tree.
|
|
EOF
|
|
}
|
|
|
|
checkout() {
|
|
local args
|
|
parseopt prefix:,svn:,svn-revision:,svn-url: "$@" || return
|
|
: "${option_svn=$(which svn)}"
|
|
: "${option_svn_revision=HEAD}"
|
|
: "${option_svn_url=https://svn.macports.org/repository/macports/trunk}"
|
|
# shellcheck disable=SC2086
|
|
set -- ${args+"${args[@]}"}
|
|
|
|
# $option_work_dir is set in mpbb, which sources this script
|
|
# shellcheck disable=SC2154
|
|
dports_svn=${option_work_dir}/dports
|
|
tools_svn=${option_work_dir}/tools
|
|
svn=${option_svn}
|
|
svn_url=${option_svn_url}
|
|
svn_rev=${option_svn_revision}
|
|
|
|
if [[ -d "${tools_svn}/.svn" ]] ; then
|
|
echo "Update macports tools from svn..."
|
|
if [[ -e "${tools_svn}/.svn/lock" ]]; then
|
|
"$svn" --non-interactive cleanup "${tools_svn}" || return
|
|
fi
|
|
"$svn" update --non-interactive \
|
|
-r HEAD \
|
|
"${tools_svn}" || return
|
|
else
|
|
echo "Checking out macports tools from svn..."
|
|
mkdir -p "${option_work_dir}"
|
|
"$svn" checkout --non-interactive \
|
|
-r HEAD "${svn_url}/base/portmgr/jobs" \
|
|
"${tools_svn}" || return
|
|
fi
|
|
|
|
if [[ -d "${dports_svn}/.svn" ]] ; then
|
|
echo "Update macports from svn..."
|
|
# TODO: add switching of SVN server
|
|
if [[ -e "${dports_svn}/.svn/lock" ]]; then
|
|
"$svn" --non-interactive cleanup "${dports_svn}" || return
|
|
fi
|
|
"$svn" update --non-interactive \
|
|
-r "${svn_rev}" \
|
|
"${dports_svn}" || return
|
|
else
|
|
echo "Checking out macports from svn..."
|
|
mkdir -p "${option_work_dir}"
|
|
"$svn" checkout --non-interactive \
|
|
-r "${svn_rev}" "${svn_url}/dports" \
|
|
"${dports_svn}" || return
|
|
fi
|
|
|
|
# $option_prefix is set in mpbb
|
|
# shellcheck disable=SC2154
|
|
(cd "${dports_svn}" && "${option_prefix}/bin/portindex") || return
|
|
|
|
local -ar mirrors=(aarnet.au cjj.kr fco.it her.gr jnb.za jog.id
|
|
lil.fr mse.uk nou.nc nue.de osl.no sea.us ykf.ca)
|
|
# Unset IFS to ensure "${mirrors[*]}" uses spaces as separators.
|
|
(unset IFS && cat > "${option_work_dir}/macports.conf" <<EOF
|
|
# Automatically overwritten by mpbb-checkout
|
|
# Do not edit !!!
|
|
sources_conf ${option_work_dir}/sources.conf
|
|
host_blacklist ${mirrors[*]/%/.distfiles.macports.org} \
|
|
${mirrors[*]/%/.packages.macports.org}
|
|
EOF
|
|
) || return
|
|
|
|
cat > "${option_work_dir}/sources.conf" <<EOF || return
|
|
# Automatically overwritten by mpbb-checkout
|
|
# Do not edit !!!
|
|
file://${dports_svn} [default]
|
|
EOF
|
|
|
|
}
|