blob: 351ddc5528333f9527badddf9fe43233dcd8ddee [file] [log] [blame]
Richard Levitteb0b0b6a2020-04-06 23:58:24 +02001#! /bin/bash -e
Matt Caswella28d06f2021-02-18 14:57:13 +00002# Copyright 2020-2021 The OpenSSL Project Authors. All Rights Reserved.
Richard Levitteb0b0b6a2020-04-06 23:58:24 +02003#
4# Licensed under the Apache License 2.0 (the "License"). You may not use
5# this file except in compliance with the License. You can obtain a copy
6# in the file LICENSE in the source distribution or at
7# https://www.openssl.org/source/license.html
8
9# This is the most shell agnostic way to specify that POSIX rules.
10POSIXLY_CORRECT=1
11
12usage () {
13 cat <<EOF
14Usage: release.sh [ options ... ]
15
16--alpha Start or increase the "alpha" pre-release tag.
17--next-beta Switch to the "beta" pre-release tag after alpha release.
18 It can only be given with --alpha.
19--beta Start or increase the "beta" pre-release tag.
20--final Get out of "alpha" or "beta" and make a final release.
21 Implies --branch.
22
Richard Levitte8e706c82021-08-31 12:07:33 +020023--branch Create a release branch 'openssl-{major}.{minor}',
Richard Levitteb0b0b6a2020-04-06 23:58:24 +020024 where '{major}' and '{minor}' are the major and minor
25 version numbers.
26
Richard Levitte64af3ae2020-04-24 11:03:28 +020027--reviewer=<id> The reviewer of the commits.
Richard Levitteb0b0b6a2020-04-06 23:58:24 +020028--local-user=<keyid>
29 For the purpose of signing tags and tar files, use this
30 key (default: use the default e-mail address key).
31
32--no-upload Don't upload to upload@dev.openssl.org.
Tomas Mraz773f1c32021-05-13 19:41:09 +020033--no-update Don't perform 'make update' and 'make update-fips-checksums'.
Richard Levitteb0b0b6a2020-04-06 23:58:24 +020034--verbose Verbose output.
35--debug Include debug output. Implies --no-upload.
36
37--force Force execution
38
39--help This text
40--manual The manual
41
42If none of --alpha, --beta, or --final are given, this script tries to
43figure out the next step.
44EOF
45 exit 0
46}
47
48# Set to one of 'major', 'minor', 'alpha', 'beta' or 'final'
49next_method=
50next_method2=
51
52do_branch=false
53warn_branch=false
54
55do_clean=true
56do_upload=true
57do_update=true
58DEBUG=:
59VERBOSE=:
60git_quiet=-q
61
62force=false
63
64do_help=false
65do_manual=false
66
67tagkey=' -s'
68gpgkey=
Richard Levitte64af3ae2020-04-24 11:03:28 +020069reviewers=
Richard Levitteb0b0b6a2020-04-06 23:58:24 +020070
71upload_address=upload@dev.openssl.org
72
73TEMP=$(getopt -l 'alpha,next-beta,beta,final' \
74 -l 'branch' \
75 -l 'no-upload,no-update' \
76 -l 'verbose,debug' \
77 -l 'local-user:' \
Richard Levitte64af3ae2020-04-24 11:03:28 +020078 -l 'reviewer:' \
Richard Levitteb0b0b6a2020-04-06 23:58:24 +020079 -l 'force' \
80 -l 'help,manual' \
81 -n release.sh -- - "$@")
82eval set -- "$TEMP"
83while true; do
84 case $1 in
85 --alpha | --beta | --final )
86 next_method=$(echo "x$1" | sed -e 's|^x--||')
87 if [ -z "$next_method2" ]; then
88 next_method2=$next_method
89 fi
90 shift
91 if [ "$next_method" = 'final' ]; then
92 do_branch=true
93 fi
94 ;;
95 --next-beta )
96 next_method2=$(echo "x$1" | sed -e 's|^x--next-||')
97 shift
98 ;;
99 --branch )
100 do_branch=true
101 warn_branch=true
102 shift
103 ;;
104 --no-upload )
105 do_upload=false
106 shift
107 ;;
108 --no-update )
109 do_update=false
110 shift
111 ;;
112 --verbose )
113 VERBOSE=echo
114 git_quiet=
115 shift
116 ;;
117 --debug )
118 DEBUG=echo
119 do_upload=false
120 shift
121 ;;
122 --local-user )
123 shift
Richard Levitte93bae032020-11-09 08:39:39 +0100124 tagkey=" -u $1"
Richard Levitteb0b0b6a2020-04-06 23:58:24 +0200125 gpgkey=" -u $1"
126 shift
127 ;;
Richard Levitte64af3ae2020-04-24 11:03:28 +0200128 --reviewer )
129 reviewers="$reviewers $1=$2"
130 shift
131 shift
132 ;;
Richard Levitteb0b0b6a2020-04-06 23:58:24 +0200133 --force )
134 force=true
135 shift
136 ;;
137 --help )
138 usage
139 exit 0
140 ;;
141 --manual )
142 sed -e '1,/^### BEGIN MANUAL/d' \
143 -e '/^### END MANUAL/,$d' \
144 < "$0" \
145 | pod2man \
146 | man -l -
147 exit 0
148 ;;
149 -- )
150 shift
151 break
152 ;;
153 * )
154 echo >&2 "Unknown option $1"
155 shift
156 exit 1
157 ;;
158 esac
159done
160
161$DEBUG >&2 "DEBUG: \$next_method=$next_method"
162$DEBUG >&2 "DEBUG: \$next_method2=$next_method2"
163
164$DEBUG >&2 "DEBUG: \$do_branch=$do_branch"
165
166$DEBUG >&2 "DEBUG: \$do_upload=$do_upload"
167$DEBUG >&2 "DEBUG: \$do_update=$do_update"
168$DEBUG >&2 "DEBUG: \$DEBUG=$DEBUG"
169$DEBUG >&2 "DEBUG: \$VERBOSE=$VERBOSE"
170$DEBUG >&2 "DEBUG: \$git_quiet=$git_quiet"
171
172case "$next_method+$next_method2" in
173 major+major | minor+minor )
174 # These are expected
175 ;;
176 alpha+alpha | alpha+beta | beta+beta | final+final | + | +beta )
177 # These are expected
178 ;;
179 * )
180 echo >&2 "Internal option error ($next_method, $next_method2)"
181 exit 1
182 ;;
183esac
184
185# Verbosity feed for certain commands
186VERBOSITY_FIFO=/tmp/openssl-$$.fifo
187mkfifo -m 600 $VERBOSITY_FIFO
188( cat $VERBOSITY_FIFO | while read L; do $VERBOSE "> $L"; done ) &
189exec 42>$VERBOSITY_FIFO
190trap "exec 42>&-; rm $VERBOSITY_FIFO" 0 2
191
192# Setup ##############################################################
193
194# Make sure we're in the work directory
195cd $(dirname $0)/..
196HERE=$(pwd)
197
198# Check that we have the scripts that define functions we use
199found=true
200for fn in "$HERE/dev/release-aux/release-version-fn.sh" \
201 "$HERE/dev/release-aux/release-state-fn.sh"; do
202 if ! [ -f "$fn" ]; then
203 echo >&2 "'$fn' is missing"
204 found=false
205 fi
206done
207if ! $found; then
208 exit 1
209fi
210
211# Load version functions
212. $HERE/dev/release-aux/release-version-fn.sh
213. $HERE/dev/release-aux/release-state-fn.sh
214
215# Make sure it's a branch we recognise
216orig_branch=$(git rev-parse --abbrev-ref HEAD)
217if (echo "$orig_branch" \
218 | grep -E -q \
219 -e '^master$' \
220 -e '^OpenSSL_[0-9]+_[0-9]+_[0-9]+[a-z]*-stable$' \
Richard Levitte8e706c82021-08-31 12:07:33 +0200221 -e '^openssl-[0-9]+\.[0-9]+$'); then
Richard Levitteb0b0b6a2020-04-06 23:58:24 +0200222 :
223elif $force; then
224 :
225else
226 echo >&2 "Not in master or any recognised release branch"
227 echo >&2 "Please 'git checkout' an approprite branch"
228 exit 1
229fi
Richard Levitte4588f352020-08-09 14:22:09 +0200230orig_HEAD=$(git rev-parse HEAD)
Richard Levitteb0b0b6a2020-04-06 23:58:24 +0200231
232# Initialize #########################################################
233
234echo "== Initializing work tree"
235
236get_version
237
238# Generate a cloned directory name
Richard Levitte4588f352020-08-09 14:22:09 +0200239release_clone="$orig_branch-release-tmp"
Richard Levitteb0b0b6a2020-04-06 23:58:24 +0200240
241echo "== Work tree will be in $release_clone"
242
243# Make a clone in a subdirectory and move there
244if ! [ -d "$release_clone" ]; then
245 $VERBOSE "== Cloning to $release_clone"
Richard Levitte4588f352020-08-09 14:22:09 +0200246 git clone $git_quiet -b "$orig_branch" -o parent . "$release_clone"
Richard Levitteb0b0b6a2020-04-06 23:58:24 +0200247fi
248cd "$release_clone"
249
250get_version
251
Richard Levitte4588f352020-08-09 14:22:09 +0200252# Branches we will work with. The release branch is where we make the
253# changes for the release, the update branch is where we make the post-
254# release changes
255update_branch="$orig_branch"
Richard Levitte8e706c82021-08-31 12:07:33 +0200256release_branch="openssl-$SERIES"
Richard Levitteb0b0b6a2020-04-06 23:58:24 +0200257
Richard Levitte4588f352020-08-09 14:22:09 +0200258# among others, we only create a release branch if the patch number is zero
259if [ "$update_branch" = "$release_branch" ] || [ $PATCH -ne 0 ]; then
260 if $do_branch && $warn_branch; then
261 echo >&2 "Warning! We're already in a release branch; --branch ignored"
262 fi
263 do_branch=false
Richard Levitteb0b0b6a2020-04-06 23:58:24 +0200264fi
265
Richard Levitte4588f352020-08-09 14:22:09 +0200266if ! $do_branch; then
267 release_branch="$update_branch"
268fi
269
270# Branches we create for PRs
271branch_version="$VERSION${PRE_LABEL:+-$PRE_LABEL$PRE_NUM}"
272tmp_update_branch="OSSL--$update_branch--$branch_version"
273tmp_release_branch="OSSL--$release_branch--$branch_version"
274
275# Check that we're still on the same branch as our parent repo, or on a
276# release branch
277current_branch=$(git rev-parse --abbrev-ref HEAD)
278if [ "$current_branch" = "$update_branch" ]; then
279 :
280elif [ "$current_branch" = "$release_branch" ]; then
281 :
282else
283 echo >&2 "The cloned sub-directory '$release_clone' is on a branch"
284 if [ "$update_branch" = "$release_branch" ]; then
285 echo >&2 "other than '$update_branch'."
286 else
287 echo >&2 "other than '$update_branch' or '$release_branch'."
Richard Levitteb0b0b6a2020-04-06 23:58:24 +0200288 fi
Richard Levitte4588f352020-08-09 14:22:09 +0200289 echo >&2 "Please 'cd \"$(pwd)\"; git checkout $update_branch'"
290 exit 1
Richard Levitteb0b0b6a2020-04-06 23:58:24 +0200291fi
292
293SOURCEDIR=$(pwd)
294$DEBUG >&2 "DEBUG: Source directory is $SOURCEDIR"
295
296# Release ############################################################
297
298# We always expect to start from a state of development
299if [ "$TYPE" != 'dev' ]; then
300 echo >&2 "Not in a development branch"
301 echo >&2 "Have a look at the git log in $release_clone, it may be that"
302 echo >&2 "a previous crash left it in an intermediate state and that"
303 echo >&2 "need to drop the top commit:"
304 echo >&2 ""
305 echo >&2 "(cd $release_clone; git reset --hard HEAD^)"
306 echo >&2 "# WARNING! LOOK BEFORE YOU ACT"
307 exit 1
308fi
309
Richard Levitteb0b0b6a2020-04-06 23:58:24 +0200310# Update the version information. This won't save anything anywhere, yet,
311# but does check for possible next_method errors before we do bigger work.
312next_release_state "$next_method"
313
Richard Levitte4588f352020-08-09 14:22:09 +0200314# Create our temporary release branch
315$VERBOSE "== Creating a local release branch: $tmp_release_branch"
316git checkout $git_quiet -b "$tmp_release_branch"
Richard Levitteb0b0b6a2020-04-06 23:58:24 +0200317
318echo "== Configuring OpenSSL for update and release. This may take a bit of time"
319
320./Configure cc >&42
321
Tomas Mraz773f1c32021-05-13 19:41:09 +0200322$VERBOSE "== Checking source file updates and fips checksums"
Richard Levitteb0b0b6a2020-04-06 23:58:24 +0200323
324make update >&42
Matt Caswell6ee47412021-06-24 16:07:03 +0100325# As long as we're doing an alpha release, we can have symbols without specific
326# numbers assigned. In a beta or final release, all symbols MUST have an
327# assigned number.
328if [ "$next_method" != 'alpha' ]; then
329 make renumber >&42
330fi
Tomas Mraz773f1c32021-05-13 19:41:09 +0200331make update-fips-checksums >&42
332
Richard Levitteb0b0b6a2020-04-06 23:58:24 +0200333if [ -n "$(git status --porcelain)" ]; then
334 $VERBOSE "== Committing updates"
335 git add -u
336 git commit $git_quiet -m 'make update'
Richard Levitte64af3ae2020-04-24 11:03:28 +0200337 if [ -n "$reviewers" ]; then
338 addrev --nopr $reviewers
339 fi
Richard Levitteb0b0b6a2020-04-06 23:58:24 +0200340fi
341
Richard Levitte4588f352020-08-09 14:22:09 +0200342# Create our temporary update branch, if it's not the release branch.
343# This is used in post-release below
344if $do_branch; then
345 $VERBOSE "== Creating a local update branch: $tmp_update_branch"
346 git branch $git_quiet "$tmp_update_branch"
Tomas Mraz773f1c32021-05-13 19:41:09 +0200347fi
Richard Levitte4588f352020-08-09 14:22:09 +0200348
Richard Levitteb0b0b6a2020-04-06 23:58:24 +0200349# Write the version information we updated
350set_version
351
352if [ -n "$PRE_LABEL" ]; then
353 release="$VERSION-$PRE_RELEASE_TAG$BUILD_METADATA"
354 release_text="$SERIES$BUILD_METADATA $PRE_LABEL $PRE_NUM"
355 announce_template=openssl-announce-pre-release.tmpl
356else
357 release="$VERSION$BUILD_METADATA"
358 release_text="$release"
359 announce_template=openssl-announce-release.tmpl
360fi
361tag="openssl-$release"
362$VERBOSE "== Updated version information to $release"
363
364$VERBOSE "== Updating files with release date for $release : $RELEASE_DATE"
365for fixup in "$HERE/dev/release-aux"/fixup-*-release.pl; do
366 file="$(basename "$fixup" | sed -e 's|^fixup-||' -e 's|-release\.pl$||')"
367 $VERBOSE "> $file"
368 RELEASE="$release" RELEASE_TEXT="$release_text" RELEASE_DATE="$RELEASE_DATE" \
369 perl -pi $fixup $file
370done
371
372$VERBOSE "== Comitting updates and tagging"
373git add -u
374git commit $git_quiet -m "Prepare for release of $release_text"
Richard Levitte64af3ae2020-04-24 11:03:28 +0200375if [ -n "$reviewers" ]; then
376 addrev --nopr $reviewers
377fi
Richard Levitteb0b0b6a2020-04-06 23:58:24 +0200378echo "Tagging release with tag $tag. You may need to enter a pass phrase"
379git tag$tagkey "$tag" -m "OpenSSL $release release tag"
380
381tarfile=openssl-$release.tar
382tgzfile=$tarfile.gz
383announce=openssl-$release.txt
384
385echo "== Generating tar, hash and announcement files. This make take a bit of time"
386
387$VERBOSE "== Making tarfile: $tgzfile"
388# Unfortunately, util/mktar.sh does verbose output on STDERR... for good
389# reason, but it means we don't display errors unless --verbose
390./util/mktar.sh --tarfile="../$tarfile" 2>&1 \
391 | while read L; do $VERBOSE "> $L"; done
392
393if ! [ -f "../$tgzfile" ]; then
394 echo >&2 "Where did the tarball end up? (../$tgzfile)"
395 exit 1
396fi
397
398$VERBOSE "== Generating checksums: $tgzfile.sha1 $tgzfile.sha256"
399openssl sha1 < "../$tgzfile" | \
400 (IFS='='; while read X H; do echo $H; done) > "../$tgzfile.sha1"
401openssl sha256 < "../$tgzfile" | \
402 (IFS='='; while read X H; do echo $H; done) > "../$tgzfile.sha256"
403length=$(wc -c < "../$tgzfile")
404sha1hash=$(cat "../$tgzfile.sha1")
405sha256hash=$(cat "../$tgzfile.sha256")
406
407$VERBOSE "== Generating announcement text: $announce"
408# Hack the announcement template
409cat "$HERE/dev/release-aux/$announce_template" \
410 | sed -e "s|\\\$release_text|$release_text|g" \
411 -e "s|\\\$release|$release|g" \
412 -e "s|\\\$series|$SERIES|g" \
413 -e "s|\\\$label|$PRE_LABEL|g" \
414 -e "s|\\\$tarfile|$tgzfile|" \
415 -e "s|\\\$length|$length|" \
416 -e "s|\\\$sha1hash|$sha1hash|" \
417 -e "s|\\\$sha256hash|$sha256hash|" \
418 | perl -p "$HERE/dev/release-aux/fix-title.pl" \
419 > "../$announce"
Tomas Mraz773f1c32021-05-13 19:41:09 +0200420
Richard Levitteb0b0b6a2020-04-06 23:58:24 +0200421$VERBOSE "== Generating signatures: $tgzfile.asc $announce.asc"
422rm -f "../$tgzfile.asc" "../$announce.asc"
423echo "Signing the release files. You may need to enter a pass phrase"
424gpg$gpgkey --use-agent -sba "../$tgzfile"
425gpg$gpgkey --use-agent -sta --clearsign "../$announce"
426
Richard Levitte4588f352020-08-09 14:22:09 +0200427# Push everything to the parent repo
428$VERBOSE "== Push what we have to the parent repository"
429git push --follow-tags parent HEAD
Richard Levitteb0b0b6a2020-04-06 23:58:24 +0200430
431if $do_upload; then
432 (
433 if [ "$VERBOSE" != ':' ]; then
434 echo "progress"
435 fi
436 echo "put ../$tgzfile"
437 echo "put ../$tgzfile.sha1"
438 echo "put ../$tgzfile.sha256"
439 echo "put ../$tgzfile.asc"
440 echo "put ../$announce.asc"
441 ) \
442 | sftp "$upload_address"
443fi
444
445# Post-release #######################################################
446
Richard Levitte4588f352020-08-09 14:22:09 +0200447$VERBOSE "== Reset all files to their pre-release contents"
448git reset $git_quiet HEAD^ -- .
449git checkout -- .
450
Richard Levitteb0b0b6a2020-04-06 23:58:24 +0200451prev_release_text="$release_text"
452prev_release_date="$RELEASE_DATE"
453
454next_release_state "$next_method2"
455set_version
456
457release="$VERSION-$PRE_RELEASE_TAG$BUILD_METADATA"
458release_text="$VERSION$BUILD_METADATA"
459if [ -n "$PRE_LABEL" ]; then
460 release_text="$SERIES$BUILD_METADATA $PRE_LABEL $PRE_NUM"
461fi
462$VERBOSE "== Updated version information to $release"
463
464$VERBOSE "== Updating files for $release :"
465for fixup in "$HERE/dev/release-aux"/fixup-*-postrelease.pl; do
466 file="$(basename "$fixup" | sed -e 's|^fixup-||' -e 's|-postrelease\.pl$||')"
467 $VERBOSE "> $file"
468 RELEASE="$release" RELEASE_TEXT="$release_text" \
469 PREV_RELEASE_TEXT="$prev_release_text" \
470 PREV_RELEASE_DATE="$prev_release_date" \
471 perl -pi $fixup $file
472done
473
474$VERBOSE "== Comitting updates"
475git add -u
476git commit $git_quiet -m "Prepare for $release_text"
Richard Levitte64af3ae2020-04-24 11:03:28 +0200477if [ -n "$reviewers" ]; then
478 addrev --nopr $reviewers
479fi
Richard Levitteb0b0b6a2020-04-06 23:58:24 +0200480
Richard Levitte4588f352020-08-09 14:22:09 +0200481# Push everything to the parent repo
482$VERBOSE "== Push what we have to the parent repository"
483git push parent HEAD
484
Richard Levitteb0b0b6a2020-04-06 23:58:24 +0200485if $do_branch; then
Richard Levitte4588f352020-08-09 14:22:09 +0200486 $VERBOSE "== Going back to the update branch $tmp_update_branch"
487 git checkout $git_quiet "$tmp_update_branch"
Richard Levitteb0b0b6a2020-04-06 23:58:24 +0200488
489 get_version
490 next_release_state "minor"
491 set_version
492
493 release="$VERSION-$PRE_RELEASE_TAG$BUILD_METADATA"
494 release_text="$SERIES$BUILD_METADATA"
495 $VERBOSE "== Updated version information to $release"
496
497 $VERBOSE "== Updating files for $release :"
498 for fixup in "$HERE/dev/release-aux"/fixup-*-postrelease.pl; do
499 file="$(basename "$fixup" | sed -e 's|^fixup-||' -e 's|-postrelease\.pl$||')"
500 $VERBOSE "> $file"
501 RELEASE="$release" RELEASE_TEXT="$release_text" \
502 perl -pi $fixup $file
503 done
504
505 $VERBOSE "== Comitting updates"
506 git add -u
507 git commit $git_quiet -m "Prepare for $release_text"
Richard Levitte64af3ae2020-04-24 11:03:28 +0200508 if [ -n "$reviewers" ]; then
509 addrev --nopr $reviewers
510 fi
Richard Levitteb0b0b6a2020-04-06 23:58:24 +0200511fi
512
Richard Levitte4588f352020-08-09 14:22:09 +0200513# Push everything to the parent repo
514$VERBOSE "== Push what we have to the parent repository"
515git push parent HEAD
516
Richard Levitteb0b0b6a2020-04-06 23:58:24 +0200517# Done ###############################################################
Tomas Mraz773f1c32021-05-13 19:41:09 +0200518
Richard Levitteb0b0b6a2020-04-06 23:58:24 +0200519$VERBOSE "== Done"
520
Richard Levitte4588f352020-08-09 14:22:09 +0200521cd $HERE
Richard Levitteb0b0b6a2020-04-06 23:58:24 +0200522cat <<EOF
523
524======================================================================
Richard Levitte4588f352020-08-09 14:22:09 +0200525The release is done, and involves a few files and commits for you to
526deal with. Everything you need has been pushed to your repository,
527please see instructions that follow.
528======================================================================
529
Richard Levitteb0b0b6a2020-04-06 23:58:24 +0200530EOF
Richard Levitteb0b0b6a2020-04-06 23:58:24 +0200531
532if $do_release; then
533 cat <<EOF
534
Richard Levitte4588f352020-08-09 14:22:09 +0200535The following files were uploaded to $upload_address, please ensure they
536are dealt with appropriately:
Richard Levitteb0b0b6a2020-04-06 23:58:24 +0200537
Richard Levitte4588f352020-08-09 14:22:09 +0200538 $tgzfile
539 $tgzfile.sha1
540 $tgzfile.sha256
541 $tgzfile.asc
542 $announce.asc
Richard Levitteb0b0b6a2020-04-06 23:58:24 +0200543EOF
544fi
545
546cat <<EOF
547
Richard Levitte4588f352020-08-09 14:22:09 +0200548----------------------------------------------------------------------
Richard Levitteb0b0b6a2020-04-06 23:58:24 +0200549EOF
Richard Levitte4588f352020-08-09 14:22:09 +0200550
Richard Levitteb0b0b6a2020-04-06 23:58:24 +0200551if $do_branch; then
552 cat <<EOF
Richard Levitte4588f352020-08-09 14:22:09 +0200553You need to prepare the main repository with a new branch, '$release_branch'.
554That is done directly in the server's bare repository like this:
555
556 git branch $release_branch $orig_HEAD
557
558Two additional release branches have been added to your repository.
559Push them to github, make PRs from them and have them approved:
560
561 $tmp_update_branch
562 $tmp_release_branch
563
564When merging them into the main repository, do it like this:
565
Richard Levittea1fc4642020-10-16 10:24:18 +0200566 git push openssl-git@git.openssl.org:openssl.git \\
Richard Levitte4588f352020-08-09 14:22:09 +0200567 $tmp_release_branch:$release_branch
568 git push openssl-git@git.openssl.org:openssl.git \\
569 $tmp_update_branch:$update_branch
Richard Levittea1fc4642020-10-16 10:24:18 +0200570 git push openssl-git@git.openssl.org:openssl.git \\
571 $tag
Richard Levitte4588f352020-08-09 14:22:09 +0200572EOF
573else
574cat <<EOF
575One additional release branch has been added to your repository.
576Push it to github, make a PR from it and have it approved:
577
578 $tmp_release_branch
579
580When merging it into the main repository, do it like this:
581
Richard Levittea1fc4642020-10-16 10:24:18 +0200582 git push openssl-git@git.openssl.org:openssl.git \\
Richard Levitte4588f352020-08-09 14:22:09 +0200583 $tmp_release_branch:$release_branch
Richard Levittea1fc4642020-10-16 10:24:18 +0200584 git push openssl-git@git.openssl.org:openssl.git \\
585 $tag
Richard Levitteb0b0b6a2020-04-06 23:58:24 +0200586EOF
587fi
588
589cat <<EOF
Richard Levitte4588f352020-08-09 14:22:09 +0200590
591----------------------------------------------------------------------
Richard Levitteb0b0b6a2020-04-06 23:58:24 +0200592EOF
593
594cat <<EOF
Richard Levitte4588f352020-08-09 14:22:09 +0200595
596When everything is done, or if something went wrong and you want to start
597over, simply clean away temporary things left behind:
598
599The release worktree:
Richard Levitteb0b0b6a2020-04-06 23:58:24 +0200600
601 rm -rf $release_clone
Richard Levitteb0b0b6a2020-04-06 23:58:24 +0200602EOF
603
Richard Levitte4588f352020-08-09 14:22:09 +0200604if $do_branch; then
605 cat <<EOF
606
607The additional release branches:
608
609 git branch -D $tmp_release_branch
610 git branch -D $tmp_update_branch
611EOF
612else
613 cat <<EOF
614
615The temporary release branch:
616
617 git branch -D $tmp_release_branch
618EOF
619fi
620
Richard Levitteb0b0b6a2020-04-06 23:58:24 +0200621exit 0
622
623# cat is inconsequential, it's only there to fend off zealous shell parsers
624# that parse all the way here.
625cat <<EOF
626### BEGIN MANUAL
627=pod
628
629=head1 NAME
630
631release.sh - OpenSSL release script
632
633=head1 SYNOPSIS
634
635B<release.sh>
636[
637B<--alpha> |
638B<--next-beta> |
639B<--beta> |
640B<--final> |
641B<--branch> |
642B<--local-user>=I<keyid> |
Richard Levitte64af3ae2020-04-24 11:03:28 +0200643B<--reviewer>=I<id> |
Richard Levitteb0b0b6a2020-04-06 23:58:24 +0200644B<--no-upload> |
645B<--no-update> |
646B<--verbose> |
647B<--debug> |
648B<--help> |
649B<--manual>
650]
651
652=head1 DESCRIPTION
653
654B<release.sh> creates an OpenSSL release, given current worktree conditions.
655It will refuse to work unless the current branch is C<master> or a release
656branch (see L</RELEASE BRANCHES AND TAGS> below for a discussion on those).
657
658B<release.sh> tries to be smart and figure out the next release if no hints
659are given through options, and will exit with an error in ambiguous cases.
660
Richard Levitte4588f352020-08-09 14:22:09 +0200661B<release.sh> finishes off with instructions on what to do next. When
662finishing commands are given, they must be followed exactly.
663
664B<release.sh> leaves behind a clone of the local workspace, as well as one
665or two branches in the local repository. These will be mentioned and can
666safely be removed after all instructions have been successfully followed.
Richard Levitteb0b0b6a2020-04-06 23:58:24 +0200667
668=head1 OPTIONS
669
670=over 4
671
672=item B<--alpha>, B<--beta>
673
674Set the state of this branch to indicate that alpha or beta releases are
675to be done.
676
677B<--alpha> is only acceptable if the I<PATCH> version number is zero and
678the current state is "in development" or that alpha releases are ongoing.
679
680B<--beta> is only acceptable if the I<PATCH> version number is zero and
681that alpha or beta releases are ongoing.
682
683=item B<--next-beta>
684
685Use together with B<--alpha> to switch to beta releases after the current
686release is done.
687
688=item B<--final>
689
690Set the state of this branch to indicate that regular releases are to be
691done. This is only valid if alpha or beta releases are currently ongoing.
692
693This implies B<--branch>.
694
695=item B<--branch>
696
Richard Levitte8e706c82021-08-31 12:07:33 +0200697Create a branch specific for the I<SERIES> release series, if it doesn't
Richard Levitteb0b0b6a2020-04-06 23:58:24 +0200698already exist, and switch to it. The exact branch name will be
Richard Levitte8e706c82021-08-31 12:07:33 +0200699C<< openssl-I<SERIES> >>.
Richard Levitteb0b0b6a2020-04-06 23:58:24 +0200700
701=item B<--no-upload>
702
703Don't upload the produced files.
704
705=item B<--no-update>
706
Tomas Mraz773f1c32021-05-13 19:41:09 +0200707Don't run C<make update> and C<make update-fips-checksums>.
Richard Levitteb0b0b6a2020-04-06 23:58:24 +0200708
709=item B<--verbose>
710
711Verbose output.
712
713=item B<--debug>
714
715Display extra debug output. Implies B<--no-upload>
716
717=item B<--local-user>=I<keyid>
718
719Use I<keyid> as the local user for C<git tag> and for signing with C<gpg>.
720
721If not given, then the default e-mail address' key is used.
722
Richard Levitte64af3ae2020-04-24 11:03:28 +0200723=item B<--reviewer>=I<id>
724
725Add I<id> to the set of reviewers for the commits performed by this script.
726Multiple reviewers are allowed.
727
728If no reviewer is given, you will have to run C<addrev> manually, which
729means retagging a release commit manually as well.
730
Richard Levitteb0b0b6a2020-04-06 23:58:24 +0200731=item B<--force>
732
733Force execution. Precisely, the check that the current branch is C<master>
734or a release branch is not done.
735
736=item B<--help>
737
738Display a quick help text and exit.
739
740=item B<--manual>
741
742Display this manual and exit.
743
744=back
745
746=head1 RELEASE BRANCHES AND TAGS
747
748Prior to OpenSSL 3.0, the release branches were named
749C<< OpenSSL_I<SERIES>-stable >>, and the release tags were named
750C<< OpenSSL_I<VERSION> >> for regular releases, or
751C<< OpenSSL_I<VERSION>-preI<n> >> for pre-releases.
752
753From OpenSSL 3.0 ongoing, the release branches are named
Richard Levitte8e706c82021-08-31 12:07:33 +0200754C<< openssl-I<SERIES> >>, and the release tags are named
Richard Levitteb0b0b6a2020-04-06 23:58:24 +0200755C<< openssl-I<VERSION> >> for regular releases, or
756C<< openssl-I<VERSION>-alphaI<n> >> for alpha releases
757and C<< openssl-I<VERSION>-betaI<n> >> for beta releases.
758
759B<release.sh> recognises both forms.
760
761=head1 VERSION AND STATE
762
763With OpenSSL 3.0, all the version and state information is in the file
Dr. David von Oheimb036cbb62020-06-10 14:15:28 +0200764F<VERSION.dat>, where the following variables are used and changed:
Richard Levitteb0b0b6a2020-04-06 23:58:24 +0200765
766=over 4
767
768=item B<MAJOR>, B<MINOR>, B<PATCH>
769
770The three part of the version number.
771
772=item B<PRE_RELEASE_TAG>
773
774The indicator of the current state of the branch. The value may be one pf:
775
776=over 4
777
778=item C<dev>
779
780This branch is "in development". This is typical for the C<master> branch
781unless there are ongoing alpha or beta releases.
782
783=item C<< alphaI<n> >> or C<< alphaI<n>-dev >>
784
785This branch has alpha releases going on. C<< alphaI<n>-dev >> is what
786should normally be seen in the git workspace, indicating that
787C<< alphaI<n> >> is in development. C<< alphaI<n> >> is what should be
788found in the alpha release tar file.
789
790=item C<< alphaI<n> >> or C<< alphaI<n>-dev >>
791
792This branch has beta releases going on. The details are otherwise exactly
793as for alpha.
794
795=item I<no value>
796
797This is normally not seen in the git workspace, but should always be what's
798found in the tar file of a regular release.
799
800=back
801
802=item B<RELEASE_DATE>
803
804This is normally empty in the git workspace, but should always have the
805release date in the tar file of any release.
806
807=back
808
809=head1 COPYRIGHT
810
Matt Caswella28d06f2021-02-18 14:57:13 +0000811Copyright 2020-2021 The OpenSSL Project Authors. All Rights Reserved.
Richard Levitteb0b0b6a2020-04-06 23:58:24 +0200812
813Licensed under the Apache License 2.0 (the "License"). You may not use
814this file except in compliance with the License. You can obtain a copy
815in the file LICENSE in the source distribution or at
816L<https://www.openssl.org/source/license.html>.
817
818=cut
819### END MANUAL
820EOF