kumquat-buildroot/support/download/hg
Yann E. MORIN 697e2b7d94 support/download: fix the Hg backend for tags
When the version of a package is a Mercurial tag, the download fails,
with:
    abort: unknown revision 'X.Y.Z'!

This is because, in Mercurial, tags are commits like the others, and
when we clone, we actively request a tag. But then, the server
"dereferences" that tag and sends us the revision pointed to by that
tag. Of course, since the tag is a commit after the revision we got,
we do not have the revision adding the tag.

So, we just have to download the full repository to be sure we have
the tags in our local clone.

Reported-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2015-08-29 11:38:00 +02:00

33 lines
721 B
Bash
Executable File

#!/usr/bin/env bash
# We want to catch any unexpected failure, and exit immediately
set -e
# Download helper for hg, to be called from the download wrapper script
#
# Call it as:
# .../hg [-q] OUT_FILE REPO_URL CSET BASENAME
#
# Environment:
# HG : the hg command to call
verbose=
while getopts :q OPT; do
case "${OPT}" in
q) verbose=-q;;
\?) printf "unknown option '%s'\n" "${OPTARG}" >&2; exit 1;;
esac
done
shift $((OPTIND-1))
output="${1}"
repo="${2}"
cset="${3}"
basename="${4}"
${HG} clone ${verbose} --noupdate "${repo}" "${basename}"
${HG} archive ${verbose} --repository "${basename}" --type tgz \
--prefix "${basename}" --rev "${cset}" \
"${output}"