[web] master update
Richard Levitte
levitte at openssl.org
Tue Mar 31 12:14:31 UTC 2020
The branch master has been updated
via 4b0220368e888aab29972537aff8602a45b724e9 (commit)
from e06c12c5f7222ba0a7fc7982bf8e4b8f696d0222 (commit)
- Log -----------------------------------------------------------------
commit 4b0220368e888aab29972537aff8602a45b724e9
Author: Richard Levitte <levitte at openssl.org>
Date: Tue Mar 31 11:24:47 2020 +0200
Fix 'make relupd'
The release updating targets relied on the files CHANGES and NEWS.
With OpenSSL 3.0, those have changed name to CHANGES.md and NEWS.md,
so an adjustment is needed.
Experience shows that we get the best output with a 'commonmark'
pandoc reader, and a little bit of post processing the output.
Reviewed-by: Matt Caswell <matt at openssl.org>
(Merged from https://github.com/openssl/web/pull/166)
-----------------------------------------------------------------------
Summary of changes:
Makefile | 28 +++++++++++++++-------------
bin/from-tt | 33 ++++++++++++++++++++++++++-------
bin/post-process-html5 | 18 ++++++++++++++++++
3 files changed, 59 insertions(+), 20 deletions(-)
create mode 100755 bin/post-process-html5
diff --git a/Makefile b/Makefile
index df2d75e..d31a473 100644
--- a/Makefile
+++ b/Makefile
@@ -161,9 +161,10 @@ docs/fips.inc: $(wildcard docs/fips/*) bin/mk-filelist
@rm -f $@
./bin/mk-filelist docs/fips fips/ '*' >$@
-news/changelog.inc: news/changelog.txt bin/mk-changelog
+news/changelog.inc: news/changelog.md bin/mk-changelog
@rm -f $@
- ./bin/mk-changelog <news/changelog.txt >$@
+ (echo 'Table of contents'; sed -e '1,/^OpenSSL Releases$$/d' < $<) \
+ | pandoc -t html5 -f commonmark | ./bin/post-process-html5 >$@
news/changelog.html: news/changelog.html.tt news/changelog.inc
@rm -f $@
./bin/from-tt 'releases=$(SERIES)' $<
@@ -175,41 +176,42 @@ news/changelog.html: $(foreach S,$(SERIES),news/cl$(subst .,,$(S)).txt)
# mknews_changelogtxt creates a target and ruleset for any changelog text
# file depending on the CHANGES file from the target release.
#
-# $(1) = output file, $(2) = source directory in CHECKOUTS
+# $(1) = output file, $(2) = CHANGES files, relative to CHECKOUTS
define mknews_changelogtxt
-news/$(1): $(CHECKOUTS)/$(2)/CHANGES
+news/$(1): $(CHECKOUTS)/$(2)
@rm -f $$@
cp $$? $$@
endef
# Create the target 'news/changelog.txt', taking the source from
-# $(CHECKOUTS)/openssl/CHANGES
-$(eval $(call mknews_changelogtxt,changelog.txt,openssl))
+# $(CHECKOUTS)/openssl/CHANGES.md
+$(eval $(call mknews_changelogtxt,changelog.md,openssl/CHANGES.md))
# Create the targets 'news/clxyz.txt' for all current releases, taking the
# source from $(CHECKOUTS)/openssl-x.y.z-stable/CHANGES
$(foreach S,$(SERIES),\
-$(eval $(call mknews_changelogtxt,cl$(subst .,,$(S)).txt,openssl-$(S)-stable)))
+$(eval $(call mknews_changelogtxt,cl$(subst .,,$(S)).txt,openssl-$(S)-stable/CHANGES)))
# mknews_noteshtml creates two targets and rulesets for creating notes from
# the NEWS file for each release. One target is to create a wrapping HTML
# file from a template, the other is to create the inclusion file with the
# actual text.
#
-# $(1) = release version
+# $(1) = release version, $(2) = NEWS file, relative to CHECKOUTS
define mknews_noteshtml
news/openssl-$(1)-notes.html: news/openssl-notes.html.tt
@rm -f $$@
- ./bin/from-tt -d news release='$(1)' < $$< > $$@
-news/openssl-$(1)-notes.inc: $(CHECKOUTS)/openssl-$(1)-stable/NEWS bin/mk-notes
+ ./bin/from-tt -d news -i $$< -o $$@ release='$(1)'
+news/openssl-$(1)-notes.inc: $(CHECKOUTS)/$(2) bin/mk-notes
@rm -f $$@
- ./bin/mk-notes $(1) < $(CHECKOUTS)/openssl-$(1)-stable/NEWS > $$@
+ ./bin/mk-notes $(1) < $(CHECKOUTS)/$(2) > $$@
endef
# Create the targets 'news/openssl-x.y.z-notes.html' and
# 'news/openssl-x.y.z-notes.inc' for each release number x.y.z, taking
-# the source from $(CHECKOUTS)/openssl-$(1)-stable/NEWS
-$(foreach S,$(SERIES),$(eval $(call mknews_noteshtml,$(S))))
+# the source from the news file given as second argument.
+$(foreach S,$(SERIES),\
+$(eval $(call mknews_noteshtml,$(S),openssl-$(S)-stable/NEWS)))
news/newsflash.inc: news/newsflash.txt
sed <$? >$@ \
diff --git a/bin/from-tt b/bin/from-tt
index e3ddf79..b5018b6 100755
--- a/bin/from-tt
+++ b/bin/from-tt
@@ -4,24 +4,31 @@ HERE=$(cd $(dirname $0); pwd)
THIS=$(basename $0)
dir=
+input=
+output=
-shortopts='d:h'
-longopts='dir:,help'
+shortopts='d:i:o:h'
+longopts='dir:,input:,output:,help'
usage="\
Usage 1: $THIS [ options ] [ key=value ... ] < file.tt > file
Usage 2: $THIS [ options ] [ key=value ... ] file.tt ...
Options:
-d, --dir=DIR Directory of the output file
+ -i, --input=FILE Input file (usage 1 only)
+ -o, --output=FILE Output file (usage 1 only)
-h, --help Output this usage and do nothing else
-In usage 1, the template is read from standard input and the processing
-result is output to standard output. In this usage, the --dir option is
-mandatory.
+In usage 1, the template is read from standard input or the file given
+with --input and the processing result is output to standard output or
+the file given with --output. When the output goes to stdout, the --dir
+option is mandatory.
In usage 2, the templates are read from the files given as argument, and
the processing result for each of them is written to a corresponding file
without the '.tt' suffix. All given file names must have the '.tt' suffix.
+In this usage, --input, --output, standard input and standard output are
+ignored.
In both usages, one can also set template variables with with the form
key=value. They must come before any file name."
@@ -42,6 +49,16 @@ while true; do
shift 2
continue
;;
+ '-i' | '--input' )
+ input="$2"
+ shift 2
+ continue
+ ;;
+ '-o' | '--output' )
+ output="$2"
+ shift 2
+ continue
+ ;;
'-h' | '--help' )
echo >&2 "$usage"
exit 0
@@ -80,8 +97,10 @@ if [ $# -eq 0 ]; then
fi
(
cd $dir
- ( cat $HERE/../inc/common.tt; cat ) | \
- eval "$tpagecmd --define 'dir=${dir:-filedir}'"
+ ( cat $HERE/../inc/common.tt;
+ if [ -n "$input" ]; then cat "$input"; else cat; fi ) \
+ | eval "$tpagecmd --define 'dir=${dir:-filedir}'" \
+ | ( if [ -n "$output" ]; then cat > "$output"; else cat; fi )
)
else
errfiles=
diff --git a/bin/post-process-html5 b/bin/post-process-html5
new file mode 100755
index 0000000..fb6459c
--- /dev/null
+++ b/bin/post-process-html5
@@ -0,0 +1,18 @@
+#! /usr/bin/perl
+
+use strict;
+
+while ( <STDIN> ) {
+ s/<h(\d)/"<h".($1 + 1)/eg;
+ s/<\/h(\d)/"<\/h".($1 + 1)/eg;
+
+ # This is for OpenSSL's CHANGES.md
+ my $gfmid = sub {
+ my $x = lc $_[0];
+ $x =~ s/\s+/-/g;
+ $x =~ s/\.//g;
+ $x
+ };
+ s/(<h3)(>)(OpenSSL .*?)(<\/h3>)/$1.' id="'.$gfmid->($3).'"'.$2.$3.$4/eg;
+ print;
+}
More information about the openssl-commits
mailing list