From ec8b1f28fbe914a298a4a2bf18fcd6486c04a1ed Mon Sep 17 00:00:00 2001 From: Patrick McDermott Date: Wed, 10 Apr 2019 20:56:00 -0400 Subject: scripts/announce-release.sh: Update with opkbuild c3805f3 scripts/announce-release.sh: Lengthen short lines 9c0775b scripts/announce-release.sh: Fix trailing "\" 7b6372d scripts/announce-release.sh: Truuncate long shortlog and diffstat d9ae96f scripts/announce-release.sh: Quote-printable globally 4cf7edf scripts/announce-release.sh: Escape heading lines for quoted-printable 44a9b28 scripts/announce-release.sh: Fix old tag retrieval 3236236 scripts/announce-release.sh: Parameterize from/to info 7bf35fb scripts/announce-release.sh: Sign message 204bc01 scripts/announce-release.sh: Add Message-ID ee6f045 scripts/announce-release.sh: Terminate lines with \r\n 619f64a scripts/announce-release.sh: Move message to var c5457f9 scripts/announce-release.sh: Drop tag format assumption fcdbdbb scripts/announce-release.sh: Update "From" header 7c82eab scripts/announce-release.sh: Update e-mail address and signature --- diff --git a/scripts/announce-release.sh b/scripts/announce-release.sh index a166378..f27e0cb 100755 --- a/scripts/announce-release.sh +++ b/scripts/announce-release.sh @@ -1,10 +1,31 @@ #!/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; ${ @@ -26,23 +47,45 @@ news="$(sed -n ' ' "${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" -/usr/sbin/sendmail \ - -f pj+proteanos-ml@pehjota.net proteanos-dev@lists.proteanos.com <<-EOF - Date: $(LC_ALL='POSIX' date '+%a, %d %b %Y %H:%M:%S %z') - From: "Patrick 'P. J.' McDermott" - To: proteanos-dev@lists.proteanos.com - Subject: ${package_name} ${version} released +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 - About - ===== +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} - Downloading - =========== + $(heading 'Downloading') Source archives are available from the files site by HTTP or FTP: @@ -64,27 +107,45 @@ export GIT_DIR="${srcdir}/.git" This release is marked by the "${package}/${version}" tag. - NEWS for Version ${version} - =================$(printf '%s\n' "${version}" | sed 's/./=/g') + $(heading "NEWS for Version ${version}") ${news} - Shortlog of Changes Since Version ${old_version} - ==================================$(printf '%s\n' "${old_version}" | \ - sed 's/./=/g') + $(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" - $(git shortlog "${package}/${old_version}..HEAD" | \ - sed '/^..*$/s/^/ /') + --=-=-= + ${message} - Diffstat of Changes Since Version ${old_version} - ==================================$(printf '%s\n' "${old_version}" | \ - sed 's/./=/g') + --=-=-= + Content-Type: application/pgp-signature + Content-Description: OpenPGP digital signature - $(git diff --stat=69 --color=never --find-renames=50% \ - "${package}/${old_version}..HEAD" | sed 's/^/ /') + $(printf '%s\n' "${message}" | sed 's/$/\r/' | \ + gpg --local-user "${KEY}" --armor --output - \ + --digest-algo SHA256 --detach-sign) - -- $(: Just something to follow the trailing space) - Patrick "P. J." McDermott: http://www.pehjota.net/ - Lead Developer, ProteanOS: http://www.proteanos.com/ - Founder and CEO, Libiquity: http://www.libiquity.com/ + --=-=-=-- EOF -- cgit v0.9.1