2024-12-03 18:33:26 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2024-12-05 15:38:41 +00:00
|
|
|
# SPECS should be a JSON array of all the to-process spec files
|
|
|
|
# Forgejo runner doesn't support dynamic matrix jobs so, this has to be made this way
|
|
|
|
# Convert the JSON array to a bash array and iterate over it
|
2024-12-05 16:01:23 +00:00
|
|
|
echo "::debug::input_specs: ${INPUT_SPECS}"
|
2024-12-05 15:38:41 +00:00
|
|
|
readarray -t SPECS < <(echo ${INPUT_SPECS} | jq -c .[] | tr -d '"')
|
|
|
|
echo "::debug::specs: ${SPECS}"
|
2024-12-04 00:35:47 +00:00
|
|
|
SYSTEM=${INPUT_SYSTEM}
|
|
|
|
ARCH=${INPUT_ARCH}
|
2024-12-04 13:15:16 +00:00
|
|
|
NOCHECK=${INPUT_NOCHECK}
|
2024-12-03 18:33:26 +00:00
|
|
|
|
2024-12-05 15:38:41 +00:00
|
|
|
|
|
|
|
for SPEC in ${SPECS[@]}; do
|
|
|
|
SPEC_NAME=$(basename ${SPEC})
|
|
|
|
CONFIGURATION="${SYSTEM}-${ARCH}"
|
|
|
|
|
|
|
|
echo "::debug::spec file: ${INPUT_SPEC}"
|
|
|
|
echo "::debug::target: ${INPUT_SYSTEM}-${INPUT_ARCH}"
|
|
|
|
echo "::debug::nocheck: ${INPUT_NOCHECK}"
|
|
|
|
|
|
|
|
echo "Building ${SPEC_NAME} for ${CONFIGURATION}"
|
|
|
|
|
|
|
|
echo "::group::Building SRPM"
|
|
|
|
cd $(dirname ${SPEC})
|
|
|
|
|
|
|
|
spectool -g ${SPEC}
|
|
|
|
if [ $? -ne 0 ]; then
|
|
|
|
echo "::error::Failed to download sources"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
mock -r "${SYSTEM}-${ARCH}" --buildsrpm --spec ${SPEC_NAME} --sources . --resultdir result
|
|
|
|
if [ $? -ne 0 ]; then
|
|
|
|
echo "::error::Failed to build SRPM"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
echo "::endgroup::"
|
|
|
|
|
|
|
|
SRPM=$(grep Wrote result/build.log | cut -d" " -f 2)
|
|
|
|
|
|
|
|
echo "::group::Building RPM"
|
|
|
|
OPTS=""
|
|
|
|
if [ ${NOCHECK,,} == "true"]; then
|
|
|
|
OPTS="${OPTS} --nocheck"
|
|
|
|
fi
|
|
|
|
mock -r "${SYSTEM}-${ARCH}" --resultdir result ${OPTS} ${SRPM}
|
|
|
|
if [ $? -ne 0 ]; then
|
|
|
|
echo "::error::Failed to build RPM"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
echo "::endgroup::"
|
|
|
|
|
|
|
|
RPMS=i$(grep Wrote result/build.log | grep "/RPMS/" | cut -d" " -f 2)
|
|
|
|
echo "::debug::rpms: ${RPMS}"
|
|
|
|
echo "rpms=${RPMS}" >> ${GITHUB_OUTPUT}
|
|
|
|
done
|