makepkg: do not download VCS sources unless needed

VCS sources are not needed for --geninteg or --source operations.
This also prevents VCS downloads outputting to stdout, which
prevented piping -g output to the PKGBUILD.

Signed-off-by: Allan McRae <allan@archlinux.org>
This commit is contained in:
Allan McRae 2012-07-15 23:57:25 +10:00
parent b3e82ec59e
commit 7fd56118d0

View file

@ -513,6 +513,11 @@ download_svn() {
download_sources() { download_sources() {
msg "$(gettext "Retrieving Sources...")" msg "$(gettext "Retrieving Sources...")"
local GET_VCS=1
if [[ $1 == "fast" ]]; then
GET_VCS=0
fi
pushd "$SRCDEST" &>/dev/null pushd "$SRCDEST" &>/dev/null
local netfile local netfile
@ -527,10 +532,10 @@ download_sources() {
download_file "$netfile" download_file "$netfile"
;; ;;
git*) git*)
download_git "$netfile" (( GET_VCS )) && download_git "$netfile"
;; ;;
svn*) svn*)
download_svn "$netfile" (( GET_VCS )) && download_svn "$netfile"
;; ;;
*) *)
error "$(gettext "Unknown download protocol: %s")" "$proto" error "$(gettext "Unknown download protocol: %s")" "$proto"
@ -2382,7 +2387,7 @@ if (( GENINTEG )); then
mkdir -p "$srcdir" mkdir -p "$srcdir"
chmod a-s "$srcdir" chmod a-s "$srcdir"
cd_safe "$srcdir" cd_safe "$srcdir"
download_sources download_sources fast
generate_checksums generate_checksums
exit 0 # $E_OK exit 0 # $E_OK
fi fi
@ -2527,10 +2532,11 @@ if (( SOURCEONLY )); then
mkdir -p "$srcdir" mkdir -p "$srcdir"
chmod a-s "$srcdir" chmod a-s "$srcdir"
cd_safe "$srcdir" cd_safe "$srcdir"
if ( (( ! SKIPCHECKSUMS )) || \ if (( SOURCEONLY == 2 )); then
( (( ! SKIPPGPCHECK )) && source_has_signatures ) ) || \
(( SOURCEONLY == 2 )); then
download_sources download_sources
elif ( (( ! SKIPCHECKSUMS )) || \
( (( ! SKIPPGPCHECK )) && source_has_signatures ) ); then
download_sources fast
fi fi
check_source_integrity check_source_integrity
cd_safe "$startdir" cd_safe "$startdir"