From c5a163d4991d799a6d07d3d830dd8ff8f395d42c Mon Sep 17 00:00:00 2001 From: Richard Levitte Date: Fri, 23 Jun 2023 09:58:40 +0200 Subject: [PATCH] Enable a different announcement for premium releases The basic data of what is considered premium and what is considered public releases, a new bash function is added, std_release_type(), found in release-tools/release-aux/release-data-fn.sh. Along with this, the non-descript variable 'tag' is renamed to 'release_tag', and a spelling error is corrected. Fixes #157 --- .../openssl-announce-release-premium.tmpl | 35 +++++++++++++++++++ ...l => openssl-announce-release-public.tmpl} | 0 release-tools/release-aux/release-data-fn.sh | 29 +++++++++++++++ .../release-aux/release-version-fn.sh | 2 +- release-tools/stage-release.sh | 35 ++++++++++--------- 5 files changed, 84 insertions(+), 17 deletions(-) create mode 100644 release-tools/release-aux/openssl-announce-release-premium.tmpl rename release-tools/release-aux/{openssl-announce-release.tmpl => openssl-announce-release-public.tmpl} (100%) create mode 100644 release-tools/release-aux/release-data-fn.sh diff --git a/release-tools/release-aux/openssl-announce-release-premium.tmpl b/release-tools/release-aux/openssl-announce-release-premium.tmpl new file mode 100644 index 0000000..6fb81c6 --- /dev/null +++ b/release-tools/release-aux/openssl-announce-release-premium.tmpl @@ -0,0 +1,35 @@ + + + OpenSSL version $release released + ================================= + + OpenSSL - The Open Source toolkit for SSL/TLS + https://www.openssl.org/ + + The OpenSSL project team is pleased to announce the release of + version $release of our open source toolkit for SSL/TLS. + + OpenSSL $release is available for download via HTTPS from the following + location on our support system: + + https://github.openssl.org/openssl/extended-releases/releases/tag/$release_tag + + If you have not yet established access to our support system server, + please contact us on osf-contact@openssl.org to arrange your set up. + + The distribution file name is: + + o $tarfile + Size: $length + SHA1 checksum: $sha1hash + SHA256 checksum: $sha256hash + + The checksums were calculated using the following commands: + + openssl sha1 $tarfile + openssl sha256 $tarfile + + Yours, + + The OpenSSL Project Team. + diff --git a/release-tools/release-aux/openssl-announce-release.tmpl b/release-tools/release-aux/openssl-announce-release-public.tmpl similarity index 100% rename from release-tools/release-aux/openssl-announce-release.tmpl rename to release-tools/release-aux/openssl-announce-release-public.tmpl diff --git a/release-tools/release-aux/release-data-fn.sh b/release-tools/release-aux/release-data-fn.sh new file mode 100644 index 0000000..f43a31e --- /dev/null +++ b/release-tools/release-aux/release-data-fn.sh @@ -0,0 +1,29 @@ +#! /bin/bash +# Copyright 2023 The OpenSSL Project Authors. All Rights Reserved. +# +# Licensed under the Apache License 2.0 (the "License"). You may not use +# this file except in compliance with the License. You can obtain a copy +# in the file LICENSE in the source distribution or at +# https://www.openssl.org/source/license.html + +# Public or premium release? Let the version numbers determine it! +declare -A _ossl_release_types=( + [premium]='^1\.0\.2' + [public]='^(1\.1\.1|[3-9]\.)' +) + +std_release_type () { + local v=$1 + local rt + local re + local release_type= + + for rt in "${!_ossl_release_types[@]}"; do + re="${_ossl_release_types[$rt]}" + if [[ "$v" =~ $re ]]; then + release_type=$rt + break + fi + done + echo $release_type +} diff --git a/release-tools/release-aux/release-version-fn.sh b/release-tools/release-aux/release-version-fn.sh index 78730a1..e707f4e 100644 --- a/release-tools/release-aux/release-version-fn.sh +++ b/release-tools/release-aux/release-version-fn.sh @@ -34,7 +34,7 @@ # # SERIES The current release series. It is computed from # MAJOR, MINOR and (possibly) FIX -# VERSION The current version number. It is copmuted from +# VERSION The current version number. It is computed from # MAJOR, MINOR, (possibly) FIX and PATCH # FULL_VERSION Like VERSION, but with metadata (PRE_RELEASE_TAG, # BUILD_METADATA) added diff --git a/release-tools/stage-release.sh b/release-tools/stage-release.sh index 791d264..d785aea 100755 --- a/release-tools/stage-release.sh +++ b/release-tools/stage-release.sh @@ -283,6 +283,7 @@ fi found=true for fn in "$RELEASE_AUX/release-version-fn.sh" \ "$RELEASE_AUX/release-state-fn.sh" \ + "$RELEASE_AUX/release-data-fn.sh" \ "$RELEASE_AUX/string-fn.sh" \ "$RELEASE_AUX/upload-fn.sh"; do if ! [ -f "$fn" ]; then @@ -297,6 +298,7 @@ fi # Load version functions . $RELEASE_AUX/release-version-fn.sh . $RELEASE_AUX/release-state-fn.sh +. $RELEASE_AUX/release-data-fn.sh # Load string manipulation functions . $RELEASE_AUX/string-fn.sh # Load upload backend functions @@ -532,10 +534,10 @@ update_branch=$(format_string "$branch_fmt" \ "v=$FULL_VERSION") # Make the release tag and branch name according to our current data -tag=$(format_string "$tag_fmt" \ - "b=$orig_release_branch" \ - "t=$(std_tag_name)" \ - "v=$FULL_VERSION") +release_tag=$(format_string "$tag_fmt" \ + "b=$orig_release_branch" \ + "t=$(std_tag_name)" \ + "v=$FULL_VERSION") release_branch=$(format_string "$branch_fmt" \ "b=$orig_release_branch" \ "t=$(std_tag_name)" \ @@ -599,8 +601,9 @@ if [ -n "$PRE_LABEL" ]; then release_text="$SERIES$_BUILD_METADATA $PRE_LABEL $PRE_NUM" announce_template=openssl-announce-pre-release.tmpl else + release_type=$(std_release_type $VERSION) release_text="$release" - announce_template=openssl-announce-release.tmpl + announce_template=openssl-announce-release-$release_type.tmpl fi $VERBOSE "== Updated version information to $release" @@ -621,8 +624,8 @@ git commit $git_quiet -m "Prepare for release of $release_text"$'\n\nRelease: ye if [ -n "$reviewers" ]; then addrev --release --nopr $reviewers fi -$ECHO "Tagging release with tag $tag. You may need to enter a pass phrase" -git tag$tagkey "$tag" -m "OpenSSL $release release tag" +$ECHO "Tagging release with tag $release_tag. You may need to enter a pass phrase" +git tag$tagkey "$release_tag" -m "OpenSSL $release release tag" tarfile=openssl-$release.tar tgzfile=$tarfile.gz @@ -707,7 +710,7 @@ $VERBOSE "== Generating metadata file: $metadata" fi echo "release_branch='$orig_release_branch'" fi - echo "release_tag='$tag'" + echo "release_tag='$release_tag'" echo "upload_files='${staging_files[@]}'" echo "source_repo='$orig_remote_url'" ) > ../$metadata @@ -884,7 +887,7 @@ Push them to github, make PRs from them and have them approved. Update branch: $update_branch Release branch: $release_branch - Tag: $tag + Tag: $release_tag When merging everything into the main repository, do it like this: @@ -893,7 +896,7 @@ When merging everything into the main repository, do it like this: git push git@github.openssl.org:openssl/openssl.git \\ $update_branch:$orig_update_branch git push git@github.openssl.org:openssl/openssl.git \\ - $tag + $release_tag EOF elif [ "$update_branch" != "$orig_update_branch" ]; then # "Normal" scenario without --branch @@ -903,14 +906,14 @@ repository. Push them to github, make PRs from them and have them approved. Release/update branch: $update_branch - Tag: $tag + Tag: $release_tag When merging everything into the main repository, do it like this: git push git@github.openssl.org:openssl/openssl.git \\ $update_branch:$orig_update_branch git push git@github.openssl.org:openssl/openssl.git \\ - $tag + $release_tag EOF elif [ "$release_branch" != "$update_branch" ]; then # --clean-worktree and --branch scenario @@ -921,7 +924,7 @@ PRs from them and have them approved: Updated branch: $update_branch Release branch: $release_branch - Tag: $tag + Tag: $release_tag When merging everything into the main repository, do it like this: @@ -930,7 +933,7 @@ When merging everything into the main repository, do it like this: git push git@github.openssl.org:openssl/openssl.git \\ $update_branch git push git@github.openssl.org:openssl/openssl.git \\ - $tag + $release_tag EOF else # --clean-worktree without --branch scenario @@ -940,14 +943,14 @@ branch has been updated. Push them to github, make PRs from them and have them approved. Release/update branch: $update_branch - Tag: $tag + Tag: $release_tag When merging everything into the main repository, do it like this: git push git@github.openssl.org:openssl/openssl.git \\ $update_branch git push git@github.openssl.org:openssl/openssl.git \\ - $tag + $release_tag EOF fi