diff --git a/entrypoint.sh b/entrypoint.sh index 0b6636d..550cae6 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -14,6 +14,8 @@ rm -rf /var/lib/mock/* mount -t tmpfs tmpfs /var/lib/mock RESULT="rpms=[" +OUTPUTDIR=$(pwd)/artifacts +mkdir ${OUTPUTDIR} for SPEC in ${SPECS[@]}; do SPEC_NAME=$(basename ${SPEC}) @@ -34,28 +36,30 @@ for SPEC in ${SPECS[@]}; do exit 1 fi - mock -r "${SYSTEM}-${ARCH}" --buildsrpm --spec ${SPEC_NAME} --sources . --resultdir result + PKG_OUTPUTDIR=${OUTPUTDIR}/$(dirname ${SPEC}) + + mock -r "${SYSTEM}-${ARCH}" --buildsrpm --spec ${SPEC_NAME} --sources . --resultdir ${PKG_OUTPUTDIR} 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 | tr -d " " | xargs basename) + SRPM=$(grep Wrote ${PKG_OUTPUTDIR}/build.log | cut -d ":" -f 2 | tr -d " " | xargs basename) echo "::group::Building RPM" OPTS="" if [ ${NOCHECK,,} == "true" ]; then OPTS="${OPTS} --nocheck" fi - mock -r "${SYSTEM}-${ARCH}" --resultdir result ${OPTS} result/${SRPM} + mock -r "${SYSTEM}-${ARCH}" --resultdir ${PKG_OUTPUTDIR} ${OPTS} ${PKG_OUTPUTDIR}/${SRPM} if [ $? -ne 0 ]; then echo "::error::Failed to build RPM" exit 1 fi echo "::endgroup::" - RPMS=$(grep Wrote result/build.log | grep "/RPMS/" | cut -d" " -f 2 | xargs basename) + RPMS=$(grep Wrote ${PKG_OUTPUTDIR}/build.log | grep "/RPMS/" | cut -d" " -f 2 | xargs basename) echo "::debug::built rpm: ${RPMS}" RESULT="${RESULT},\"${RPMS}\"" cd - &> /dev/null