support/download: fix git/svn corrupted cache
Commit 54d3d94b6e
("support/download: print
command used for download") broke the git and svn download helpers, because
these helpers have invocations of the _git/_svn commands where the exact
output matters.
For example for git, this would result in:
date: invalid date ‘GIT_DIR=.../dl/libyuv/git/.git git log -1 --pretty=format:%ci \n2019-04-12 17:48:45 +0000’
Detected a corrupted git cache.
Removing it and starting afresh.
Fix by splitting the _git function in two: _git and _plain_git.
The former echoes the command, and then calls the latter.
Most invocations use _git as before, but those cases where the output should
not be disturbed, directly call _plain_git.
For symmetry, all download helpers are aligned, even though only the git and
svn helpers were broken.
Fixes: #13631
Fixes:
http://autobuild.buildroot.org/results/c2f/c2fcd4aa6660e3c2f9c6f85646ca7dfe0db56040/
Signed-off-by: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
[yann.morin.1998@free.fr: add bug report and autobuild failure]
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
This commit is contained in:
parent
7ba4ad4623
commit
b70ce56651
@ -37,6 +37,10 @@ _bzr() {
|
||||
if [ -z "${quiet}" ]; then
|
||||
printf '%s ' ${BZR} "${@}"; printf '\n'
|
||||
fi
|
||||
_plain_bzr "$@"
|
||||
}
|
||||
# Note: please keep command below aligned with what is printed above
|
||||
_plain_bzr() {
|
||||
eval ${BZR} "${@}"
|
||||
}
|
||||
|
||||
|
@ -42,6 +42,10 @@ _cvs() {
|
||||
if [ -z "${quiet}" ]; then
|
||||
printf '%s ' timeout 10m ${CVS} "${@}"; printf '\n'
|
||||
fi
|
||||
_plain_cvs "$@"
|
||||
}
|
||||
# Note: please keep command below aligned with what is printed above
|
||||
_plain_cvs() {
|
||||
eval timeout 10m ${CVS} "${@}"
|
||||
}
|
||||
|
||||
|
@ -39,6 +39,10 @@ _localfiles() {
|
||||
if [ -n "${verbose}" ]; then
|
||||
printf '%s ' ${LOCALFILES} "${@}"; printf '\n'
|
||||
fi
|
||||
_plain_localfiles "$@"
|
||||
}
|
||||
# Note: please keep command below aligned with what is printed above
|
||||
_plain_localfiles() {
|
||||
eval ${LOCALFILES} "${@}"
|
||||
}
|
||||
|
||||
|
@ -82,6 +82,10 @@ _git() {
|
||||
if [ -z "${quiet}" ]; then
|
||||
printf '%s ' GIT_DIR="${git_cache}/.git" ${GIT} "${@}"; printf '\n'
|
||||
fi
|
||||
_plain_git "$@"
|
||||
}
|
||||
# Note: please keep command below aligned with what is printed above
|
||||
_plain_git() {
|
||||
eval GIT_DIR="${git_cache}/.git" ${GIT} "${@}"
|
||||
}
|
||||
|
||||
@ -115,7 +119,7 @@ _EOF_
|
||||
_git init .
|
||||
|
||||
# Ensure the repo has an origin (in case a previous run was killed).
|
||||
if ! _git remote |grep -q -E '^origin$'; then
|
||||
if ! _plain_git remote |grep -q -E '^origin$'; then
|
||||
_git remote add origin "'${uri}'"
|
||||
fi
|
||||
|
||||
@ -181,7 +185,7 @@ _git clean -ffdx
|
||||
|
||||
# Get date of commit to generate a reproducible archive.
|
||||
# %ci is ISO 8601, so it's fully qualified, with TZ and all.
|
||||
date="$( _git log -1 --pretty=format:%ci )"
|
||||
date="$( _plain_git log -1 --pretty=format:%ci )"
|
||||
|
||||
# There might be submodules, so fetch them.
|
||||
if [ ${recurse} -eq 1 ]; then
|
||||
@ -194,7 +198,7 @@ if [ ${recurse} -eq 1 ]; then
|
||||
# versions. However, we can't do that if git is too old and uses
|
||||
# full repositories for submodules.
|
||||
cmd='printf "%s\n" "${path}/"'
|
||||
for module_dir in $( _git submodule --quiet foreach "'${cmd}'" ); do
|
||||
for module_dir in $( _plain_git submodule --quiet foreach "'${cmd}'" ); do
|
||||
[ -f "${module_dir}/.git" ] || continue
|
||||
relative_dir="$( sed -r -e 's,/+,/,g; s,[^/]+/,../,g' <<<"${module_dir}" )"
|
||||
sed -r -i -e "s:^gitdir\: $(pwd)/:gitdir\: "${relative_dir}":" "${module_dir}/.git"
|
||||
|
@ -36,6 +36,10 @@ _hg() {
|
||||
if [ -z "${quiet}" ]; then
|
||||
printf '%s ' ${HG} "${@}"; printf '\n'
|
||||
fi
|
||||
_plain_hg "$@"
|
||||
}
|
||||
# Note: please keep command below aligned with what is printed above
|
||||
_plain_hg() {
|
||||
eval ${HG} "${@}"
|
||||
}
|
||||
|
||||
|
@ -34,6 +34,10 @@ _scp() {
|
||||
if [ -z "${quiet}" ]; then
|
||||
printf '%s ' ${SCP} "${@}"; printf '\n'
|
||||
fi
|
||||
_plain_scp "$@"
|
||||
}
|
||||
# Note: please keep command below aligned with what is printed above
|
||||
_plain_scp() {
|
||||
eval ${SCP} "${@}"
|
||||
}
|
||||
|
||||
|
@ -43,6 +43,10 @@ _svn() {
|
||||
if [ -z "${quiet}" ]; then
|
||||
printf '%s ' ${SVN} "${@}"; printf '\n'
|
||||
fi
|
||||
_plain_svn "$@"
|
||||
}
|
||||
# Note: please keep command below aligned with what is printed above
|
||||
_plain_svn() {
|
||||
eval ${SVN} "${@}"
|
||||
}
|
||||
|
||||
@ -53,7 +57,7 @@ _svn export --ignore-keywords ${quiet} "${@}" "'${uri}@${rev}'" "'${basename}'"
|
||||
# UTC timezone), which we can feed as-is to the --mtime option for tar.
|
||||
# In case there is a redirection (e.g. http -> https), just keep the
|
||||
# last line (svn outputs everything on stdout)
|
||||
date="$( _svn info "'${uri}@${rev}'" \
|
||||
date="$( _plain_svn info "'${uri}@${rev}'" \
|
||||
|sed -r -e '/^Last Changed Date: /!d; s///'
|
||||
)"
|
||||
|
||||
|
@ -36,6 +36,10 @@ _wget() {
|
||||
if [ -z "${quiet}" ]; then
|
||||
printf '%s ' ${WGET} "${@}"; printf '\n'
|
||||
fi
|
||||
_plain_wget "$@"
|
||||
}
|
||||
# Note: please keep command below aligned with what is printed above
|
||||
_plain_wget() {
|
||||
eval ${WGET} "${@}"
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user