diff options
author | Erich Eckner <git@eckner.net> | 2018-10-08 10:36:58 +0200 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2018-10-08 10:36:58 +0200 |
commit | 9e2756e7423cee9237ed22b4f977dea7f4dcdf0e (patch) | |
tree | ef38363148fb2d399a04658e9799f78fa2475f52 /lib | |
parent | 00cd1c1f5f1373b4947792cec4b054450c949202 (diff) | |
download | builder-9e2756e7423cee9237ed22b4f977dea7f4dcdf0e.tar.xz |
lib/common-functions: download_sources_by_hash() should not check out the source directory again
Diffstat (limited to 'lib')
-rwxr-xr-x | lib/common-functions | 22 |
1 files changed, 6 insertions, 16 deletions
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 |