download_and_compile.sh: add option --override-repo
This option allows one to override the repository from which a given
component is to be cloned (it doesn't do anything when the repository
for a component is simply updated).
Example that downloads OSG 3.4.2 from James' repository (it has
FlightGear-specific patches applied):
download_and_compile.sh -j$(nproc) -s --cleanup \
--override-repo OSG=GitHub:github.com/zakalawe/osg.git \
--component-branch OSG=fgfs-342-1 SIMGEAR FGFS DATA OSG
This commit is contained in:
@@ -873,7 +873,7 @@ Available options:
|
||||
default protocol to use for 'git clone' (https, git or ssh)
|
||||
--git-clone-site-params=SITE=PROTOCOL[:USERNAME]
|
||||
use PROTOCOL as USERNAME when cloning a Git repository located
|
||||
at SITE (sample sites: 'sourceforge', 'github'; valid
|
||||
at SITE (sample sites: 'SourceForge', 'GitHub'; valid
|
||||
protocols: 'ssh', 'https', 'git'; USERNAME is required when
|
||||
using 'ssh'). You may pass this option several times with
|
||||
different sites.
|
||||
@@ -901,6 +901,17 @@ Available options:
|
||||
corresponding versions for other components)
|
||||
-s compile the latest stable release of FlightGear (and
|
||||
corresponding versions of the other components)
|
||||
--override-repo=COMPONENT=SITE:ADDRESS
|
||||
Override the repository from which COMPONENT is fetched when
|
||||
its repository is cloned (initial retrieval). SITE is defined
|
||||
as in --git-clone-site-params (e.g., 'SourceForge' or 'GitHub').
|
||||
ADDRESS should not start with a protocol specification. This
|
||||
option may be given several times.
|
||||
|
||||
Example: in order to download OSG from the fgfs-342-1 branch of
|
||||
the repository at https://github.com/zakalawe/osg.git, you can
|
||||
use --override-repo OSG=GitHub:github.com/zakalawe/osg.git
|
||||
and --component-branch OSG=fgfs-342-1
|
||||
--component-branch=COMPONENT=BRANCH
|
||||
Override the default branch for COMPONENT. For the specified
|
||||
component, this overrides the effect of options -s, --lts and
|
||||
@@ -1048,7 +1059,7 @@ TEMP=$($getopt -o '+shc:p:a:d:r:j:O:ib:' \
|
||||
--longoptions cleanup,git-clone-default-proto:,git-clone-site-params: \
|
||||
--longoptions package-manager:,sudo:,ignore-intercomponent-deps,compositor \
|
||||
--longoptions component-branch:,sg-cmake-arg:,fg-cmake-arg:,non-interactive \
|
||||
--longoptions lts,old-lts,help,version \
|
||||
--longoptions lts,old-lts,override-repo:,help,version \
|
||||
-n "$PROGNAME" -- "$@")
|
||||
|
||||
case $? in
|
||||
@@ -1150,6 +1161,32 @@ while true; do
|
||||
fi
|
||||
shift 2
|
||||
;;
|
||||
--override-repo)
|
||||
if [[ $2 =~ ^([[:alnum:]]+)=([[:alnum:]]+):(.+) ]]; then
|
||||
component=${BASH_REMATCH[1]^^} # convert to uppercase
|
||||
site=${BASH_REMATCH[2],,} # convert to lowercase
|
||||
address=${BASH_REMATCH[3]}
|
||||
|
||||
if [[ $address =~ ^(https?|(([[:alnum:]]+)@)?ssh):/ ]]; then
|
||||
echo "When using --override-repo COMPONENT=SITE:ADDRESS, the" \
|
||||
"ADDRESS part should not" >&2
|
||||
echo "start with a protocol specification like 'https://'; it" \
|
||||
"should start with the" >&2
|
||||
echo "hostname." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
REPO_ADDRESS["$component"]=$address
|
||||
REPO_SITE["$component"]=$site
|
||||
unset -v component site address
|
||||
else
|
||||
echo "Invalid value passed to option --override-repo: '$2'." >&2
|
||||
echo "The correct syntax is --override-repo COMPONENT=SITE:ADDRESS" >&2
|
||||
echo "(or equivalently, --override-repo=COMPONENT=SITE:ADDRESS)." >&2
|
||||
exit 1
|
||||
fi
|
||||
shift 2
|
||||
;;
|
||||
--package-manager) PKG_MGR="$2"; shift 2 ;;
|
||||
--sudo) SUDO="$2"; shift 2 ;;
|
||||
--ignore-intercomponent-deps) IGNORE_INTERCOMPONENT_DEPS="y"; shift ;;
|
||||
|
||||
Reference in New Issue
Block a user