Skip to content

Commit

Permalink
Create test/doc tarball in CI
Browse files Browse the repository at this point in the history
Signed-off-by: jcsiadal <[email protected]>
  • Loading branch information
jcsiadal committed Mar 30, 2023
1 parent 0bbd6a0 commit 435a349
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 8 deletions.
2 changes: 1 addition & 1 deletion misc/build_srpm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
24 changes: 18 additions & 6 deletions misc/get_source.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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/"$//')
Expand Down
2 changes: 1 addition & 1 deletion misc/shell-functions
Original file line number Diff line number Diff line change
Expand Up @@ -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 }'
Expand Down

0 comments on commit 435a349

Please sign in to comment.