Skip to content

Commit f001437

Browse files
committed
[bld] Updates to how Koji jobs are prepared and submitted
The spec file no longer contains the external changelog, so update that. The spec file also performs a GPG verify and brings in the .asc file for the source archive. Signed-off-by: David Cantrell <[email protected]>
1 parent f2ac130 commit f001437

File tree

5 files changed

+51
-39
lines changed

5 files changed

+51
-39
lines changed

.copr/Makefile

+10-3
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,12 @@ PKG := $(shell grep ^Name: "$(SPEC_TEMPLATE)" | awk '{ print $$2; }')
3131
VER := $(shell grep 'version :' $(topdir)/meson.build | grep -E "'[0-9]+\.[0-9]+'" | cut -d "'" -f 2)
3232

3333
ifeq ($(BUILDTYPE),copr)
34-
GITDATE = $(shell date +'%Y%m%d%H%M')
35-
GITHASH = $(shell git rev-parse --short HEAD)
34+
GITDATE = $(shell date +'%Y%m%d%H%M')
35+
GITHASH = $(shell git rev-parse --short HEAD)
3636
TARBALL_BASENAME = $(PKG)-$(VER)-$(GITDATE)git$(GITHASH)
37+
TAG = HEAD
38+
else
39+
TAG = $(shell git tag -l | tail -n 1)
3740
endif
3841

3942
ifeq ($(BUILDTYPE),release)
@@ -43,6 +46,7 @@ endif
4346
srpm:
4447
$(topdir)/.copr/instpkgs.sh $(SPEC_TEMPLATE)
4548
sed -e 's|%%VERSION%%|$(VER)|g' < "$(SPEC_TEMPLATE)" > "$(SPEC)"
49+
sed -i -e 's|%%GPGKEYRING%%|gpgkey-$(GPGKEY).gpg|g' "$(SPEC)"
4650
ifeq ($(BUILDTYPE),copr)
4751
sed -i -e '/^Release:/ s/1[^%]*/0.1.$(GITDATE)git$(GITHASH)/' "$(SPEC)"
4852
sed -i -e 's|^Source0:.*$$|Source0: $(TARBALL_BASENAME).tar.xz|g' "$(SPEC)"
@@ -53,11 +57,14 @@ ifeq ($(BUILDTYPE),copr)
5357
echo "* $(RPMDATE) $(RPMAUTHOR) - $(VER)-$(GITDATE)git$(GITHASH)" >> "$(SPEC)"
5458
echo "- Build rpminspect-$(VER)-$(GITDATE)git$(GITHASH) snapshot" >> "$(SPEC)"
5559
endif
60+
rm -f "$(TARBALL_BASENAME)".tar.xz.asc
5661
git archive \
5762
--format=tar \
5863
--output='$(topdir)/$(TARBALL_BASENAME).tar' \
59-
--prefix='$(TARBALL_BASENAME)/' HEAD $(topdir)
64+
--prefix='$(TARBALL_BASENAME)/' $(TAG) $(topdir)
6065
xz -9f $(topdir)/$(TARBALL_BASENAME).tar
66+
gpg --detach-sign --armor "$(TARBALL_BASENAME)".tar.xz
67+
gpg --export -a $(GPGKEY) > gpgkey-$(GPGKEY).gpg
6168
rpmbuild \
6269
-bs --nodeps \
6370
--define "_sourcedir $(topdir)" \

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
_build/
22
build
33
changelog
4+
*.gpg
45
*.ko
56
*.ko.cmd
67
*.mod

Makefile

+11-5
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ TARGET_ARG = `arg="$(filter-out $@,$(MAKECMDGOALS))" && echo $${arg:-${1}}`
3939
PRIMARY_AUTHORS = [email protected]
4040

4141
# full path to release tarball and detached signature
42-
# (this comes from a 'make release')
43-
RELEASED_TARBALL = $(topdir)/$(MESON_BUILD_DIR)/meson-dist/$(PROJECT_NAME)-$(PROJECT_VERSION).tar.xz
42+
# (this comes from a 'make srpm')
43+
RELEASED_TARBALL = $(PROJECT_NAME)-$(PROJECT_VERSION).tar.xz
4444
RELEASED_TARBALL_ASC = $(RELEASED_TARBALL).asc
4545

4646
all: setup
@@ -102,16 +102,22 @@ new-release:
102102
release:
103103
$(topdir)/utils/release.sh -t -p
104104

105+
# Generates content for CHANGES.md from previous tag to HEAD
105106
announce:
107+
@$(topdir)/utils/mkannounce.sh
108+
109+
# Generates changes between the two most recent stable releases,
110+
# excluding HEAD
111+
stable-announce:
106112
@$(topdir)/utils/mkannounce.sh --stable
107113

108114
koji: srpm
109115
@if [ ! -f $(RELEASED_TARBALL) ]; then \
110-
echo "*** Missing $(RELEASED_TARBALL), be sure to have run 'make release'" >&2 ; \
116+
echo "*** Missing $(RELEASED_TARBALL), be sure to have run 'make srpm'" >&2 ; \
111117
exit 1 ; \
112118
fi
113119
@if [ ! -f $(RELEASED_TARBALL_ASC) ]; then \
114-
echo "*** Missing $(RELEASED_TARBALL_ASC), be sure to have run 'make release'" >&2 ; \
120+
echo "*** Missing $(RELEASED_TARBALL_ASC), be sure to have run 'make srpm'" >&2 ; \
115121
exit 1 ; \
116122
fi
117123
$(topdir)/utils/submit-koji-builds.sh $(RELEASED_TARBALL) $(RELEASED_TARBALL_ASC) $$(basename $(topdir))
@@ -177,7 +183,7 @@ help:
177183
@echo " make new-release # bumps version number, tags, and pushes"
178184
@echo
179185
@echo "Generate SRPM of the latest release and do all Koji builds:"
180-
@echo " env BRANCHES=\"master f31 f32 f33 epel7 epel8\" make koji"
186+
@echo " env BRANCHES=\"rawhide f31 f32 f33 epel7 epel8\" make koji"
181187
@echo "NOTE: You must set the BRANCHES environment variable for the koji target"
182188
@echo "otherwise it will just build for the master branch."
183189

rpminspect.spec.in

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ Recommends: xhtml1-dtds
6161
Recommends: html401-dtds
6262
%endif
6363

64-
# Required to support things like %autorelease in spec files
64+
# Required to support things like %%autorelease in spec files
6565
%if 0%{?fedora} >= 33
6666
Recommends: rpmautospec-rpm-macros
6767
%endif

utils/submit-koji-builds.sh

+28-30
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,6 @@ GIT_USERNAME="$(git config user.name)"
116116
GIT_USEREMAIL="$(git config user.email)"
117117

118118
cd "${CWD}" || exit
119-
"${CWD}"/utils/mkrpmchangelog.sh > "${WRKDIR}"/newchangelog
120119

121120
cd "${WRKDIR}" || exit
122121
${VENDORPKG} co "${PROJECT}"
@@ -128,12 +127,13 @@ if [ -z "${BRANCHES}" ]; then
128127
fi
129128

130129
for branch in ${BRANCHES} ; do
131-
git clean -d -x -f
130+
git clean -dxf
132131
git config user.name "${GIT_USERNAME}"
133132
git config user.email "${GIT_USEREMAIL}"
134133

135134
# skip this branch if we lack build targets
136135
if ! ${VENDORKOJI} list-targets | grep -q "${branch}" >/dev/null 2>&1 ; then
136+
echo "*** Skipping ${branch} because there is no longer a ${VENDORKOJI} target"
137137
continue
138138
fi
139139

@@ -142,38 +142,36 @@ for branch in ${BRANCHES} ; do
142142
git pull
143143

144144
# add the new source archive
145-
${VENDORPKG} new-sources "${TARBALL}"
146-
147-
# extract any changelog entries that appeared in the spec file
148-
sed -n '/^%changelog/,/^%include\ \%{SOURCE1}/p' "${PROJECT}".spec | \
149-
grep -vE '^(%changelog|%include)' | \
150-
sed -e :a -e '/./,$!d;/^\n*$/{$d;N;};/\n$/ba' > cl
151-
[ -s cl ] || rm -f cl
152-
153-
# update the rolling %changelog in dist-git
154-
if [ -f changelog ]; then
155-
if [ -f cl ]; then
156-
echo >> changelog
157-
cat changelog >> cl
158-
else
159-
mv changelog cl
160-
fi
161-
162-
cp "${WRKDIR}"/newchangelog changelog
163-
echo >> changelog
164-
cat cl >> changelog
165-
rm -f cl
166-
else
167-
cp "${WRKDIR}"/newchangelog changelog
145+
${VENDORPKG} new-sources "${TARBALL}" "${TARBALL_ASC}"
146+
147+
# save current changelog
148+
pos=$(grep -n '^%changelog' "${PROJECT}".spec | cut -d ':' -f 1)
149+
len=$(wc -l "${PROJECT}".spec | cut -d ' ' -f 1)
150+
tail -n $((${len} - ${pos})) "${PROJECT}".spec > "${CWD}"/cl
151+
152+
# new changelog entry
153+
VER="$(grep ^Version "${CWD}"/"${PROJECT}".spec | awk '{ print $2; }')"
154+
REL="$(grep ^Release: "${CWD}"/"${PROJECT}".spec | awk '{ print $2; }' | cut -d '%' -f 1)"
155+
echo "* $(date +"%a %b %d %Y") ${GIT_USERNAME} <${GIT_USEREMAIL}> - ${VER}-${REL}" > "${CWD}"/newcl
156+
echo "- Upgrade to ${PROJECT}-${VER}" >> "${CWD}"/newcl
157+
158+
# new spec file
159+
cat "${CWD}"/"${PROJECT}".spec "${CWD}"/newcl > "${PROJECT}".spec
160+
161+
if [ ! "$(stat -c %s "${CWD}"/cl)" = "0" ]; then
162+
echo >> "${PROJECT}".spec
163+
cat "${CWD}"/cl >> "${PROJECT}".spec
168164
fi
169165

170-
# copy in the new spec file
171-
cat "${CWD}"/"${PROJECT}".spec > "${PROJECT}".spec
166+
( cd "${CWD}" ; rm -f newcl cl )
167+
168+
# copy in gpgkey
169+
cp "${CWD}"/*.gpg .
172170

173171
# commit changes
174-
git add sources changelog "${PROJECT}".spec
175-
${VENDORPKG} ci -c -p -s
176-
git clean -d -x -f
172+
git add sources *.gpg "${PROJECT}".spec
173+
${VENDORPKG} ci -cps
174+
git clean -dxf
177175

178176
# build
179177
${VENDORPKG} build --nowait

0 commit comments

Comments
 (0)