40 lines
829 B
Bash
40 lines
829 B
Bash
|
#!/bin/bash
|
||
|
|
||
|
SPEC=$1
|
||
|
SYSTEM=$2
|
||
|
ARCH=$3
|
||
|
|
||
|
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
|
||
|
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"
|
||
|
mock -r "${SYSTEM}-${ARCH}" --resultdir result ${SRPM}
|
||
|
if [ $? -ne 0 ]; then
|
||
|
echo "::error Failed to build RPM"
|
||
|
exit 1
|
||
|
fi
|
||
|
echo "::endgroup::"
|
||
|
|
||
|
RPM=i$(grep Wrote result/build.log | grep "/RPMS/" | cut -d" " -f 2)
|
||
|
echo "rpm=${RPM}" >> ${GITHUB_OUTPUT}
|