2024-12-03 18:33:26 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2024-12-04 00:35:47 +00:00
|
|
|
SPEC=${INPUT_SPEC}
|
|
|
|
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
|
|
|
|
|
|
|
SPEC_NAME=$(basename ${SPEC})
|
|
|
|
CONFIGURATION="${SYSTEM}-${ARCH}"
|
|
|
|
|
|
|
|
echo "Building ${SPEC_NAME} for ${CONFIGURATION}"
|
|
|
|
|
|
|
|
echo "::group::Building SRPM"
|
|
|
|
cd $(dirname ${SPEC})
|
|
|
|
|
|
|
|
spectool -g ${SPEC}
|
|
|
|
if [ $? -ne 0 ]; then
|
2024-12-04 16:12:19 +00:00
|
|
|
echo "::error::Failed to download sources"
|
2024-12-03 18:33:26 +00:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
mock -r "${SYSTEM}-${ARCH}" --buildsrpm --spec ${SPEC_NAME} --sources . --resultdir result
|
|
|
|
if [ $? -ne 0 ]; then
|
2024-12-04 16:12:19 +00:00
|
|
|
echo "::error::Failed to build SRPM"
|
2024-12-03 18:33:26 +00:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
echo "::endgroup::"
|
|
|
|
|
|
|
|
SRPM=$(grep Wrote result/build.log | cut -d" " -f 2)
|
|
|
|
|
|
|
|
echo "::group::Building RPM"
|
2024-12-04 13:15:16 +00:00
|
|
|
OPTS=""
|
|
|
|
if [ ${NOCHECK,,} == "true"]; then
|
|
|
|
OPTS="${OPTS} --nocheck"
|
|
|
|
fi
|
|
|
|
mock -r "${SYSTEM}-${ARCH}" --resultdir result ${OPTS} ${SRPM}
|
2024-12-03 18:33:26 +00:00
|
|
|
if [ $? -ne 0 ]; then
|
2024-12-04 16:12:19 +00:00
|
|
|
echo "::error::Failed to build RPM"
|
2024-12-03 18:33:26 +00:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
echo "::endgroup::"
|
|
|
|
|
|
|
|
RPM=i$(grep Wrote result/build.log | grep "/RPMS/" | cut -d" " -f 2)
|
|
|
|
echo "rpm=${RPM}" >> ${GITHUB_OUTPUT}
|