Skip to content

Commit

Permalink
Updates to the 'make koji' process
Browse files Browse the repository at this point in the history
  • Loading branch information
dcantrell committed Oct 26, 2020
1 parent 6f85e19 commit 509bd16
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 12 deletions.
20 changes: 17 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
MESON_BUILD_DIR = build
topdir := $(shell realpath $(dir $(lastword $(MAKEFILE_LIST))))

# Project information (may be an easier way to get this from meson)
PROJECT_NAME = $(shell grep ^project $(topdir)/meson.build | cut -d "'" -f 2)
PROJECT_VERSION = $(shell grep version $(topdir)/meson.build | grep -E ',$$' | cut -d "'" -f 2)

all: setup
ninja -C $(MESON_BUILD_DIR) -v

Expand All @@ -19,8 +23,16 @@ new-release:
release:
$(topdir)/utils/release.sh -t -p

koji: srpm
$(topdir)/utils/submit-koji-builds.sh $$(ls -1 $(topdir)/*.tar.*) $$(basename $(topdir))
koji:
@if [ ! -f $(RELEASED_TARBALL) ]; then \
echo "*** Missing $(RELEASED_TARBALL), be sure to have run 'make release'" >&2 ; \
exit 1 ; \
fi
@if [ ! -f $(RELEASED_TARBALL_ASC) ]; then \
echo "*** Missing $(RELEASED_TARBALL_ASC), be sure to have run 'make release'" >&2 ; \
exit 1 ; \
fi
$(topdir)/utils/submit-koji-builds.sh $(RELEASED_TARBALL) $(RELEASED_TARBALL_ASC) $$(basename $(topdir))

clean:
-rm -rf $(MESON_BUILD_DIR)
Expand Down Expand Up @@ -50,4 +62,6 @@ help:
@echo " make new-release # bumps version number, tags, and pushes"
@echo
@echo "Generate SRPM of the latest release and do all Koji builds:"
@echo " make koji"
@echo " env BRANCHES=\"master f31 f32 f33 epel7 epel8\" make koji"
@echo "NOTE: You must set the BRANCHES environment variable for the koji target"
@echo "otherwise it will just build for the master branch."
40 changes: 31 additions & 9 deletions utils/submit-koji-builds.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,32 +20,28 @@

# Arguments:
# $1 Path to the release tarball to build
# $2 The name of the project in dist-git
# $2 Path to the detached signature for the release tarball
# $3 The name of the project in dist-git

PATH=/usr/bin
CWD="$(pwd)"
WRKDIR="$(mktemp -d)"

# The list of tools that may or may not be installed locally but
# that the script needs. Extend this list if needed.
TOOLS="klist fedpkg"
TOOLS="klist"

# What dist-git interaction tool we are using, e.g. Fedora is 'fedpkg'
VENDORPKG="fedpkg"

# Allow the calling environment to override the list of dist-git branches
if [ -z "${BRANCHES}" ]; then
BRANCHES="master"
fi

cleanup() {
rm -rf "${WRKDIR}"
}

trap cleanup EXIT

# Verify specific tools are available
for tool in ${TOOLS} ; do
for tool in ${TOOLS} ${VENDORPKG} ; do
${tool} >/dev/null 2>&1
if [ $? -eq 127 ]; then
echo "*** Missing '${tool}', perhaps 'yum install -y /usr/bin/${tool}'" >&2
Expand Down Expand Up @@ -73,6 +69,26 @@ fi

shift

# Need tarball signature
if [ $# -eq 0 ]; then
echo "*** Missing detached signature of release tarball" >&2
exit 1
fi

TARBALL_ASC="$(realpath "$1")"

if [ ! -f "${TARBALL_ASC}" ]; then
echo "*** $(basename "${TARBALL_ASC}") does not exist" >&2
exit 1
fi

if [ ! "$(file -b --mime-type "${TARBALL_ASC}")" = "application/pgp-signature" ]; then
echo "*** $(basename "${TARBALL_ASC}") is not a gpg signature" >&2
exit 1
fi

shift

# Need project name
if [ $# -eq 0 ]; then
echo "*** Missing project name" >&2
Expand Down Expand Up @@ -105,16 +121,22 @@ cd "${WRKDIR}" || exit
${VENDORPKG} co "${PROJECT}"
cd "${PROJECT}" || exit

# Allow the calling environment to override the list of dist-git branches
if [ -z "${BRANCHES}" ]; then
BRANCHES="$(git branch -r | grep -vE "(HEAD)" | cut -d '/' -f 2 | sort | xargs)"
fi

for branch in ${BRANCHES} ; do
git clean -d -x -f
git config user.name "${GIT_USERNAME}"
git config user.email "${GIT_USEREMAIL}"

# make sure we are on the right branch
${VENDORPKG} switch-branch ${branch}
git pull

# add the new source archive
${VENDORPKG} new-sources "${TARBALL}"
${VENDORPKG} new-sources "${TARBALL}" "${TARBALL}".asc

# extract any changelog entries that appeared in the spec file
sed -n '/^%changelog/,/^%include\ \%{SOURCE1}/p' "${PROJECT}".spec | \
Expand Down

0 comments on commit 509bd16

Please sign in to comment.