From cb29cad751089ceaa8bd72d5dc6e47174995ae6e Mon Sep 17 00:00:00 2001 From: Patrick McDermott Date: Thu, 01 Aug 2019 19:45:04 -0400 Subject: build: Add release target --- diff --git a/Makefile.am b/Makefile.am index 8414b8c..9579fc3 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,6 +1,6 @@ # Process this file with automake to produce an input makefile. # -# Copyright (C) 2017 Patrick McDermott +# Copyright (C) 2017, 2018 Patrick McDermott # # This file is part of wolfssl-util. # @@ -17,6 +17,8 @@ # You should have received a copy of the GNU General Public License # along with wolfssl-util. If not, see . +KEY = '2250 31F0 47FF E516 63ED 516F 1A45 9ECD E4D6 04BE' + if IN_GIT PACKAGE_VERSION_GIT = $$(printf ' (%s)' \ "$$({ git describe --tags --dirty 2>/dev/null || \ @@ -63,5 +65,31 @@ version.c: $(wolfssl_util_OBJECTS) $(wolfssl_util_DEPENDENCIES) $(AM_V_GEN)printf 'const char *PACKAGE_VERSION_GIT = "%s";\n' \ "$(PACKAGE_VERSION_GIT)" >version.c +release: + sed "s/^Released: ????-??-??\$$/Released: $$(date '+%Y-%m-%d')/" \ + '$(srcdir)/NEWS' >'$(srcdir)/NEWS~' + mv '$(srcdir)/NEWS~' '$(srcdir)/NEWS' + $(MAKE) distcheck + set -e; \ + export GIT_DIR='$(srcdir)/.git'; \ + export GIT_WORK_TREE='$(srcdir)'; \ + git commit -m 'NEWS: Release $(PACKAGE) $(VERSION)' -- NEWS; \ + git tag '$(PACKAGE)/$(VERSION)' HEAD; \ + git push --tags origin master:master + md5sum $(DIST_ARCHIVES) >MD5SUMS + sha256sum $(DIST_ARCHIVES) >SHA256SUMS + set -e; \ + sigs=''; \ + for f in $(DIST_ARCHIVES); do \ + gpg --local-user $(KEY) --armor --detach-sign $${f}; \ + sigs="$${sigs} $${f}.asc"; \ + done; \ + ssh files@files.proteanos.com mkdir -p files/pub/$(PACKAGE); \ + rsync -az --progress --stats $(DIST_ARCHIVES) $${sigs} \ + MD5SUMS SHA256SUMS \ + files@files.proteanos.com:files/pub/$(PACKAGE)/$(VERSION)/ + '$(srcdir)/scripts/announce-release.sh' \ + $(PACKAGE) $(VERSION) '$(PACKAGE_NAME)' + include $(top_srcdir)/src/local.mk include $(top_srcdir)/tests/local.mk diff --git a/scripts/announce-release.sh b/scripts/announce-release.sh new file mode 100755 index 0000000..f27e0cb --- /dev/null +++ b/scripts/announce-release.sh @@ -0,0 +1,151 @@ +#!/bin/sh + +FROM_NAME='Patrick McDermott' +FROM_EMAIL='patrick.mcdermott@libiquity.com' +SIG="$(cat <<-EOF + Patrick McDermott, CEO + Libiquity + Putting customers in control of high-quality technologies + http://www.libiquity.com/ + EOF + )" +KEY='2250 31F0 47FF E516 63ED 516F 1A45 9ECD E4D6 04BE' +TO_EMAIL='proteanos-dev@lists.proteanos.com' + +package="${1}" +version="${2}" +package_name="${3}" +srcdir="${0%/scripts/announce-release.sh}" + +heading() +{ + local name="${1}" + shift 1 + + printf '%s\n' "${name}" + printf '%s\n' "${name}" | sed 's/./=/g' +} + +about="$(sed -n ' + H; + ${ + g; + s/^\n*[^\n][^\n]*\n[=-][=-]*\n\n*//; + s/\n*[^\n][^\n]*\n[=-][=-]*\n.*$//; + p; + }; + ' "${srcdir}/README")" +news="$(sed -n ' + H; + ${ + g; + s/^\n*[^\n][^\n]*\n[=-][=-]*\n\n*//; + s/^Released: [^\n]*\n\n*//; + s/\n*[^\n][^\n]*\n[=-][=-]*\n.*$//; + p; + }; + ' "${srcdir}/NEWS")" +old_version="$(sed -n "/^${package_name} version /p;" "${srcdir}/NEWS" | \ + sed -n "2{ s/^${package_name} version //p; };")" +old_tag="$(git tag --sort=creatordate | tail -n 2 | head -n 1)" + +export GIT_DIR="${srcdir}/.git" + +shortlog="$(git shortlog "${old_tag}..HEAD" | \ + sed '/^..*$/s/^//')" +if [ $(printf '%s\n' "${shortlog}" | wc -l) -gt 100 ]; then + shortlog="$(git shortlog -s "${old_tag}..HEAD"; cat <<-EOF + + Commit descriptions suppressed for brevity. To see a log summary with + descriptions, run: + + \$ git shortlog ${old_tag}..${package}/${version} + EOF + )" +fi +diffstat="$(git diff --stat=72 --color=never --find-renames=50% \ + "${old_tag}..HEAD")" +if [ $(printf '%s\n' "${diffstat}" | wc -l) -gt 50 ]; then + diffstat="$(printf '%s\n' "${diffstat}" | tail -n 1; cat <<-EOF + + Difference statistics truncated for brevity. To see full statistics, + run: + + \$ git diff --stat --find-renames=50% \\ + > ${old_tag}..${package}/${version} + EOF + )" +fi + +message="$({ cat | sed 's/=/=3D/g; s/ $/=20/; s/\t$/=09/;'; } <<-EOF + Content-Type: text/plain; charset=UTF-8 + Content-Transfer-Encoding: quoted-printable + + $(heading 'About') + + ${about} + + $(heading 'Downloading') + + Source archives are available from the files site by HTTP or FTP: + + http://files.proteanos.com/pub/${package}/${version}/ + ftp://files.proteanos.com/pub/${package}/${version}/ + + Here are the MD5 checksums: + + $(sed 's/^/ /' MD5SUMS) + + Here are the SHA-256 checksums: + + $(sed 's/^/ /' SHA256SUMS) + + The sources are maintained in a Git repository: + + http://git.proteanos.com/${package}/${package}.git/ + git://git.proteanos.com/${package}/${package}.git/ + + This release is marked by the "${package}/${version}" tag. + + $(heading "NEWS for Version ${version}") + + ${news} + + $(heading "Shortlog of Changes Since Version ${old_version}") + + ${shortlog} + + $(heading "Diffstat of Changes Since Version ${old_version}") + + ${diffstat} + + -- + ${SIG} + EOF + )" + +{ sed 's/$/\r/' | /usr/sbin/sendmail -f "${FROM_EMAIL}" \ + "${TO_EMAIL}"; } <<-EOF + Date: $(LC_ALL='POSIX' date '+%a, %d %b %Y %H:%M:%S %z') + From: ${FROM_NAME} <${FROM_EMAIL}> + To: ${TO_EMAIL} + Subject: ${package_name} ${version} released + Message-ID: $(LC_ALL='POSIX' date \ + '+%Y%m%d%H%M%S').${FROM_EMAIL} + MIME-Version: 1.0 + Content-Type: multipart/signed; micalg=pgp-sha256; boundary="=-=-="; + protocol="application/pgp-signature" + + --=-=-= + ${message} + + --=-=-= + Content-Type: application/pgp-signature + Content-Description: OpenPGP digital signature + + $(printf '%s\n' "${message}" | sed 's/$/\r/' | \ + gpg --local-user "${KEY}" --armor --output - \ + --digest-algo SHA256 --detach-sign) + + --=-=-=-- + EOF -- cgit v0.9.1