From 822d388dca58e4c2bb8308c625406949ad7ffa6e Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Wed, 31 May 2017 09:25:02 +0200 Subject: bin/build-packages: repair download of mirrored source --- bin/build-packages | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) (limited to 'bin/build-packages') diff --git a/bin/build-packages b/bin/build-packages index 1788f8b..4320c9f 100755 --- a/bin/build-packages +++ b/bin/build-packages @@ -184,14 +184,31 @@ while [ ${count} -ne 0 ]; do fi # maybe a missing source is/was the problem? # try to download them from sources.archlinux.org/sources/$repo/$source - tmp_file="$(mktemp)" - mksrcinfo -o "${tmp_file}" + source_name="$( + makepkg --printsrcinfo | \ + sed -n ' + /^\s*\(epoch\|pkg\(base\|ver\|rel\)\) = /{s|^\s\+||;p} + /^pkgname = /q + ' | \ + sed ' + s|^pkgbase = \(.*\)$|0 \1-| + s|^epoch = \(.*\)$|1 \1:| + s|^pkgver = \(.*\)$|2 \1-| + s|^pkgrel = \(.*\)$|3 \1.src.tar.gz| + ' | \ + sort -k1n,1 | \ + sed ' + s|^[0-9] || + :a + N + s|\n[0-9] || + ta + ' + )" git_repo="$(find_git_repository_to_package_repository "${repository}")" - sed -n '/\s*source = /{s|^\s*source = ||;s|::.*$||;s|^.*/||;p}' "${tmp_file}" | \ - while read -r source_file; do - wget -nc -nd "https://sources.archlinux.org/sources/${git_repo}/${source_file}" || true - done - rm -f "${tmp_file}" + if wget -nc -nd "https://sources.archlinux.org/sources/${git_repo}/${source_name}"; then + tar -xz --overwrite -f "${source_name}" + fi done if ! ${success}; then -- cgit v1.2.3-54-g00ecf