Enable a different announcement for premium releases
authorRichard Levitte <levitte@openssl.org>
Fri, 23 Jun 2023 07:58:40 +0000 (09:58 +0200)
committerRichard Levitte <levitte@openssl.org>
Fri, 23 Jun 2023 09:26:58 +0000 (11:26 +0200)
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

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/tools/pull/160)

release-tools/release-aux/openssl-announce-release-premium.tmpl [new file with mode: 0644]
release-tools/release-aux/openssl-announce-release-public.tmpl [moved from release-tools/release-aux/openssl-announce-release.tmpl with 100% similarity]
release-tools/release-aux/release-data-fn.sh [new file with mode: 0644]
release-tools/release-aux/release-version-fn.sh
release-tools/stage-release.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 (file)
index 0000000..6fb81c6
--- /dev/null
@@ -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/release-data-fn.sh b/release-tools/release-aux/release-data-fn.sh
new file mode 100644 (file)
index 0000000..f43a31e
--- /dev/null
@@ -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
+}
index 78730a107ac8e4b092dc689927b54291669444eb..e707f4e62f3bab6055bab44ae9f9af9ee921308e 100644 (file)
@@ -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
index 791d264488ea54ed5400883bb08aae13d0ef1d27..475689baa4d2f4ff94f78d862a97f23aaa0e87c0 100755 (executable)
@@ -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
@@ -662,6 +665,7 @@ $VERBOSE "== Generating announcement text: $announce"
 # Hack the announcement template
 cat "$RELEASE_AUX/$announce_template" \
     | sed -e "s|\\\$release_text|$release_text|g" \
+          -e "s|\\\$release_tag|$release_tag|g" \
           -e "s|\\\$release|$release|g" \
           -e "s|\\\$series|$SERIES|g" \
           -e "s|\\\$label|$PRE_LABEL|g" \
@@ -707,7 +711,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 +888,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 +897,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 +907,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 +925,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 +934,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 +944,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