diff --git a/misc/build_srpm.sh b/misc/build_srpm.sh index 49536b8ab3..1907e97eb6 100755 --- a/misc/build_srpm.sh +++ b/misc/build_srpm.sh @@ -52,7 +52,7 @@ SRPM=$(build_srpm "${SPEC}" "${MPI_FAMILY}") RESULT=$? if [ "${RESULT}" == "1" ]; then echo "Building the SRPM for ${BASE} failed." - echo "Trying to fetch Source0" + echo "Trying to fetch Sources" "${ROOT}"/misc/get_source.sh "${BASE}" fi diff --git a/misc/get_source.sh b/misc/get_source.sh index 7cfaac7dc4..d4fa85f6a9 100755 --- a/misc/get_source.sh +++ b/misc/get_source.sh @@ -30,15 +30,27 @@ do BASE=$(basename "${file}") SOURCES=$(rpmspec --parse --define '_sourcedir ../../..' "${FLAGS[@]}" "${BASE}" | grep Source) - for u in ${SOURCES}; do - echo "${u}" - if [[ "${u}" != *"http"* ]]; then + for s in ${SOURCES}; do + echo "${s}" + # Remove the Source header + u=$(awk '{ print $2 }' <<< "${s}") + # Special handler for tests and docs + if [[ "${u}" == "docs-ohpc.tar" || "${u}" == "tests-ohpc.tar" ]]; then + if [ ! -f ../SOURCES/"${u}" ]; then + echo Creating "${u}" + SOURCEDIR="${PWD%/*}"/SOURCES + mkdir -p "${SOURCEDIR}" + tar -C ../../../.. -cf "${SOURCEDIR}/${u}" --xform="s#^#${u%.tar}/#" "${u%-ohpc.tar}" + continue + fi + fi + # Ignore everything else that's not an http/https download + if [[ "${u}" != "http"* ]]; then continue fi - u=$(awk '{ print $2 }' <<< "${u}") - echo "Trying to get ${u}" + echo "Trying to wget ${u}" # Try to download only if newer - WGET=$(wget -N -nv -P ../SOURCES "${u}" 2>&1) + WGET=$(wget -N -nv -P "../SOURCES" "${u}" 2>&1) # Handling for github URLs with #/ or #$/ if grep -E "#[$]?/" <<< "${u}"; then MV_SOURCE=$(echo "${WGET}" | tail -1 | cut -d\ -f6 | sed -e 's/^"//' -e 's/"$//') diff --git a/misc/shell-functions b/misc/shell-functions index 0bc28e9b8f..2aaca1e65c 100644 --- a/misc/shell-functions +++ b/misc/shell-functions @@ -29,7 +29,7 @@ build_srpm() { DIR=$(dirname "${1}") - SRPM=$(rpmbuild -bs --nodeps --define "_sourcedir ${DIR}/../SOURCES" --define "mpi_family ${MPI_FAMILY}" "${SPEC}" 2>/dev/null) + SRPM=$(rpmbuild -bs --nodeps --define "_sourcedir ${DIR}/../SOURCES" --define "mpi_family ${MPI_FAMILY}" "${SPEC}") RESULT=$? echo "${SRPM}" | tail -1 | awk -F\ '{ print $2 }'