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 <jeremy.c.siadal@intel.com>
  • Loading branch information
jcsiadal committed Mar 30, 2023
1 parent 0bbd6a0 commit 711e072
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 9 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
26 changes: 19 additions & 7 deletions misc/get_source.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,23 +26,35 @@ do
echo "${file}"

DIR=$(dirname "${file}")
SOURCEDIR=$(dirname "${DIR}")/SOURCES
pushd "${DIR}" > /dev/null || exit 1
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 "${SOURCEDIR}/${u}"
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 "${SOURCEDIR}" "${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/"$//')
MV_DEST=../SOURCES/$(basename "${u}")
MV_DEST="${SOURCEDIR}"/$(basename "${u}")
mv "${MV_SOURCE}" "${MV_DEST}"
fi
done
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 711e072

Please sign in to comment.