diff options
author | Harald Musum <musum@verizonmedia.com> | 2021-09-22 13:51:03 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-22 13:51:03 +0200 |
commit | 5ff3a5a4cbbd43180d821700f572eae73720fc17 (patch) | |
tree | 98a5d2517e9fa23c194ecfc3ea0c55e36754476f | |
parent | e2583ce1e0494b07ff75ef4d2595b3d06dabb433 (diff) | |
parent | 3803aed9fb1272f9b581d45aa4e3a322f1cd3739 (diff) |
Merge pull request #19241 from vespa-engine/aressem/fix-srpm-generation
Aressem/fix srpm generation
-rw-r--r-- | .copr/Makefile | 7 | ||||
-rwxr-xr-x | dist/release-vespa-rpm.sh | 50 |
2 files changed, 15 insertions, 42 deletions
diff --git a/.copr/Makefile b/.copr/Makefile index 5b097ba0ad9..b0322bf29b3 100644 --- a/.copr/Makefile +++ b/.copr/Makefile @@ -1,17 +1,14 @@ # Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. TOP = $(realpath $(dir $(lastword $(MAKEFILE_LIST)))) -# Version -VESPA_VERSION := $(shell git tag --points-at HEAD | grep -oP "\d+\.\d+\.\d+" | sort -V | tail -1) - RPMTOPDIR := $(HOME)/rpmbuild SOURCEDIR := $(RPMTOPDIR)/SOURCES SPECDIR := $(RPMTOPDIR)/SPECS SPECFILE := $(SPECDIR)/vespa-$(VESPA_VERSION).spec srpm: - dnf install -y rpmdevtools - $(TOP)/../dist.sh $(VESPA_VERSION) + dnf install -y git rpmdevtools + $(TOP)/../dist.sh $$(git tag --points-at HEAD | grep -oP "\d+\.\d+\.\d+" | sort -V | tail -1) spectool -g -C $(SOURCEDIR) $(SPECFILE) rpmbuild -bs --define "_topdir $(RPMTOPDIR)" $(SPECFILE) cp -a $(RPMTOPDIR)/SRPMS/* $(outdir) diff --git a/dist/release-vespa-rpm.sh b/dist/release-vespa-rpm.sh index b217affe8fd..c975e10dd1a 100755 --- a/dist/release-vespa-rpm.sh +++ b/dist/release-vespa-rpm.sh @@ -1,62 +1,38 @@ #!/bin/bash -# Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +# Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. + set -e -if [ $# -ne 2 ]; then +if [[ $# -ne 2 ]]; then echo "Usage: $0 <version> <git ref>" exit 1 fi +if [[ -z $COPR_WEBHOOK ]]; then + echo "This script requires the COPR_WEBHOOK environment variable to be set." + exit 1 +fi + readonly VERSION=$1 readonly GITREF=$2 -readonly DIST_DIR="dist" -readonly SPECFILE="${DIST_DIR}/vespa.spec" -readonly TITO_DIR="${DIST_DIR}/.tito" -readonly RPM_BRANCH="rpmbuild" +readonly RELEASE_TAG="v$VERSION" readonly CURRENT_BRANCH=$(git branch | grep "^\*" | cut -d' ' -f2) # Make sure we are up to date git checkout master git pull --rebase -# Update the VERSION file on master to be the next releasable version -echo "$VERSION" | awk -F. '{print $1"."($2+1)".0"}' > VERSION -git commit -am "Updating VERSION file to next releasable minor version." -for i in 1 2 3; do - if git push; then - break; - fi - git pull --rebase -done - # Create a proper release tag -git tag -a "v$VERSION" -m "Release $VERSION" $GITREF -git push origin "v$VERSION" - -# Delete existing branch if exists and create new one -git push --delete origin $RPM_BRANCH &> /dev/null || true -git branch -D $RPM_BRANCH &> /dev/null || true -git checkout -b $RPM_BRANCH $GITREF - -# Tito expects spec file and .tito directory to be on root -git mv $TITO_DIR . -git mv $SPECFILE . - -# Hide pom.xml to avoid tito doing anything to our pom.xml files -mv pom.xml pom.xml.hide - -# Run tito to update spec file and tag -tito tag --use-version=$VERSION --no-auto-changelog -# Push changes and tag to branc -git push -u origin --follow-tags $RPM_BRANCH +git tag -a "$RELEASE_TAG" -m "Release version $VERSION" $GITREF +git push origin "$RELEASE_TAG" # Trig the build on Copr curl -X POST \ -H "Content-type: application/json" \ -H "X-GitHub-Event: create" \ - -d '{ "ref": "rpmbuild", "ref_type": "branch", "repository": { "clone_url": "https://github.com/vespa-engine/vespa.git" } }' \ - https://copr.fedorainfracloud.org/webhooks/github/8037/d1dd5867-b493-4647-a888-0c887e6087b3/ + -d '{ "ref": "$RELEASE_TAG", "ref_type": "tag", "repository": { "clone_url": "https://github.com/vespa-engine/vespa.git" } }' \ + "$COPR_WEBHOOK" git reset --hard HEAD git checkout $CURRENT_BRANCH |