-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Martin Perina <mperina@redhat.com>
- Loading branch information
Showing
9 changed files
with
343 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/bin/bash -xe | ||
|
||
source $(dirname "$(readlink -f "$0")")/build-srpm.sh | ||
|
||
# Install build dependencies | ||
dnf builddep -y rpmbuild/SRPMS/*src.rpm | ||
|
||
# Build binary package | ||
rpmbuild \ | ||
--define "_topmdir rpmbuild" \ | ||
--define "_rpmdir rpmbuild" \ | ||
--rebuild rpmbuild/SRPMS/*src.rpm | ||
|
||
# Move RPMs to exported artifacts | ||
[[ -d $ARTIFACTS_DIR ]] || mkdir -p $ARTIFACTS_DIR | ||
find rpmbuild -iname \*rpm | xargs mv -t $ARTIFACTS_DIR |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#!/bin/bash -xe | ||
|
||
# When building on GitHub we should use GITHUB_SHA environment variable, otherwise parse has from git | ||
if [ "${GITHUB_SHA}" == "" ]; then | ||
GIT_HASH=$(git rev-list HEAD | wc -l) | ||
else | ||
GIT_HASH=$(git rev-parse --short $GITHUB_SHA) | ||
fi | ||
|
||
# Directory, where build artifacts will be stored, should be passed as the 1st parameter | ||
ARTIFACTS_DIR=${1:-exported-artifacts} | ||
|
||
# Disabling tests can be passed as the 2nd parameter | ||
SKIP_TESTS=${2:-0} | ||
|
||
# Prepare the version string (with support for SNAPSHOT versioning) | ||
VERSION=$(mvn help:evaluate -q -DforceStdout -Dexpression=project.version) | ||
VERSION=${VERSION/-SNAPSHOT/-0.${GIT_HASH}.$(date +%04Y%02m%02d%02H%02M)} | ||
IFS='-' read -ra VERSION <<< "$VERSION" | ||
RELEASE=${VERSION[1]-1} | ||
|
||
# Prepare source archive | ||
[[ -d rpmbuild/SOURCES ]] || mkdir -p rpmbuild/SOURCES | ||
git archive --format=tar HEAD | gzip -9 > rpmbuild/SOURCES/ovirt-engine-api-model-$VERSION.tar.gz | ||
|
||
|
||
# Set version and release | ||
sed \ | ||
-e "s|@VERSION@|${VERSION}|g" \ | ||
-e "s|@RELEASE@|${RELEASE}|g" \ | ||
-e "s|@SKIP_TESTS@|${SKIP_TESTS}|g" \ | ||
< ovirt-engine-api-model.spec.in \ | ||
> ovirt-engine-api-model.spec | ||
|
||
# Build source package | ||
rpmbuild \ | ||
-D "_topdir rpmbuild" \ | ||
-bs ovirt-engine-api-model.spec |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
.PHONY: installdeps srpm | ||
|
||
installdeps: | ||
dnf -y install git gzip java-11-openjdk-devel make maven rpm-build sed | ||
|
||
srpm: installdeps | ||
./.automation/build-srpm.sh exported-artifacts 1 | ||
cp rpmbuild/SRPMS/*.src.rpm $(outdir) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
*.iml | ||
.idea/ | ||
.bash_history | ||
.vscode/ | ||
exported-artifacts/ | ||
logs* | ||
mocker* | ||
|
Oops, something went wrong.