From 9e2756e7423cee9237ed22b4f977dea7f4dcdf0e Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Mon, 8 Oct 2018 10:36:58 +0200 Subject: lib/common-functions: download_sources_by_hash() should not check out the source directory again --- lib/common-functions | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) (limited to 'lib/common-functions') diff --git a/lib/common-functions b/lib/common-functions index 34a3bf6..b29379b 100755 --- a/lib/common-functions +++ b/lib/common-functions @@ -527,35 +527,25 @@ extract_source_directory() { } -# download_sources_by_hash $package $repository $git_revision $git_mod_revision +# download_sources_by_hash # try to download all sources by their hash into the current directory # returns 0 if any source was downloaded and 1 otherwise download_sources_by_hash() { - local package="$1" - local repository="$2" - local git_revision="$3" - local git_mod_revision="$4" - local return_value=1 local tmp_dir local sum_type local arch_suffix - tmp_dir=$(mktemp -d 'tmp.common-functions.download_sources_by_hash.XXXXXXXXXX' --tmpdir) - - if ! make_source_info "${package}" "${repository}" "${git_revision}" "${git_mod_revision}" "${tmp_dir}/.SRCINFO"; then - >&2 echo 'download_sources_by_hash: make_source_info failed.' - rm -rf --one-file-system "${tmp_dir}" + if [ ! -f 'PKGBUILD' ]; then + >&2 echo 'No PKGBUILD found - download_sources_by_hash() must be run from the source directory.' return 1 fi - if ! [ -s "${tmp_dir}/.SRCINFO" ]; then - >&2 echo 'download_sources_by_hash: ".SRCINFO" has not been created by make_source_info.' - rm -rf --one-file-system "${tmp_dir}" - return 1 - fi + tmp_dir=$(mktemp -d 'tmp.common-functions.download_sources_by_hash.XXXXXXXXXX' --tmpdir="$(pwd)") + + makepkg --printsrcinfo > "${tmp_dir}/.SRCINFO" for arch_suffix in '' '_i486' '_i686'; do for sum_type in 'md5sum' 'sha1sum' 'sha256sum' 'sha512sum'; do -- cgit v1.2.3-54-g00ecf