diff --git a/build_rpm.sh b/build_rpm.sh index b9888aa4..6c8ad24b 100755 --- a/build_rpm.sh +++ b/build_rpm.sh @@ -1,13 +1,21 @@ #!/bin/bash set -euxo pipefail +FEDORA_RELEASE=39 +SPEC=/src/golang-github-redhatcloudx-otel-builder.spec + +# Set up packages. echo "fastestmirror=1" >>/etc/dnf/dnf.conf echo "max_parallel_downloads=20" >>/etc/dnf/dnf.conf dnf -qy install git mock rpm-build rpmdevtools -FEDORA_RELEASE=39 -SPEC=/src/*.spec +# Set the right commit SHA in the spec file. +pushd /src +CURRENT_COMMIT=$(git rev-parse HEAD) +sed -i "s/CURRENT_COMMIT_GOES_HERE/${CURRENT_COMMIT}/" $SPEC +popd +# Build the RPM. rpmdev-spectool -R -g $SPEC rpmbuild -bs $SPEC | tee /tmp/srpm-name.txt SRPM_NAME=$(grep Wrote /tmp/srpm-name.txt | awk '{print $2}') diff --git a/golang-github-redhatcloudx-otel-builder.spec b/golang-github-redhatcloudx-otel-builder.spec index 61977d6f..239ac570 100644 --- a/golang-github-redhatcloudx-otel-builder.spec +++ b/golang-github-redhatcloudx-otel-builder.spec @@ -3,7 +3,7 @@ # https://github.com/redhatcloudx/ocb-test %global goipath github.com/redhatcloudx/otel-builder -%global commit main +%global commit CURRENT_COMMIT_GOES_HERE %gometa -f