Author: schultz
Date: Sat Mar 4 16:42:02 2023
New Revision: 1908066
URL: http://svn.apache.org/viewvc?rev=1908066&view=rev
Log:
Add tools to help release-managers update the web site.
Added:
tomcat/site/trunk/tools/
tomcat/site/trunk/tools/doap.pl (with props)
tomcat/site/trunk/tools/migration.pl (with props)
tomcat/site/trunk/tools/update-version.sh
- copied, changed from r1908065, tomcat/site/trunk/update-version.sh
Removed:
tomcat/site/trunk/update-version.sh
Added: tomcat/site/trunk/tools/doap.pl
URL:
http://svn.apache.org/viewvc/tomcat/site/trunk/tools/doap.pl?rev=1908066&view=auto
==============================================================================
--- tomcat/site/trunk/tools/doap.pl (added)
+++ tomcat/site/trunk/tools/doap.pl Sat Mar 4 16:42:02 2023
@@ -0,0 +1,48 @@
+#!/usr/bin/perl
+use strict;
+use warnings;
+
+# This script modifies the Tomcaat DOAP file to update to the latest release.
+#
+# <release>
+# <Version>
+# <name>Latest Stable 10.0.x Release</name> <-- Look for this line
+# <created>2022-10-10</created> <-- Add this line, ignore original
+# <revision>10.0.27</revision> <-- Add this line, ignore original
+# </Version>
+# </release>
+sub usage {
+ print "Usage: $0 release date\n";
+}
+
+if(scalar @ARGV < 2) {
+ usage;
+
+ exit 1;
+}
+
+my($new_release) = shift;
+my($release_date) = shift;
+my($minor_release) = ( $new_release =~ /^([0-9]*\.[0-9]*)/ );
+
+# print "new=$new_release minor=$minor_release\n";
+
+my($skip_lines) = 0;
+
+while(<>) {
+ if ( $skip_lines > 0 ) {
+ --$skip_lines;
+ next;
+ }
+
+ if ( /Latest Stable ${minor_release}/ ) {
+ print; # Dump the header
+
+ print " <created>${release_date}</created>\n";
+ print " <revision>${new_release}</revision>\n";
+
+ $skip_lines = 2;
+ } else {
+ print;
+ }
+}
Propchange: tomcat/site/trunk/tools/doap.pl
------------------------------------------------------------------------------
svn:executable = *
Added: tomcat/site/trunk/tools/migration.pl
URL:
http://svn.apache.org/viewvc/tomcat/site/trunk/tools/migration.pl?rev=1908066&view=auto
==============================================================================
--- tomcat/site/trunk/tools/migration.pl (added)
+++ tomcat/site/trunk/tools/migration.pl Sat Mar 4 16:42:02 2023
@@ -0,0 +1,100 @@
+#!/usr/bin/perl
+use strict;
+use warnings;
+
+# This script modifies a migration file to update the drop-downs.
+#
+# In the "from" drop-down:
+# - remove 'selected' attribute from any old release
+# - add 'selected' attribute to old release
+# - add the new release
+#
+# In the "to" drop-down:
+# - remove 'selected' from the old release
+# - add the new release, including 'selected' attribute
+sub usage {
+ print "Usage: $0 old-release new-release\n";
+}
+
+if(scalar @ARGV < 2) {
+ usage;
+
+ exit 1;
+}
+
+my($old_release) = shift;
+my($new_release) = shift;
+my($minor_release) = ( $new_release =~ /^([0-9]*\.[0-9]*)/ );
+
+# print "new=$new_release minor=$minor_release\n";
+
+my($skip_lines) = 0;
+
+my($found_old_old_release_selected) = 0;
+my($found_old_release_unselected) = 0;
+my($found_old_release_selected) = 0;
+
+#
+# There are 3 stages to this script:
+# 1. Looking for "from" drop-down old-old release, to remove the "selected"
attribute.
+# 2. Looking for "from" drop-down old release, to add the "selected" attribute,
+# then add the new release with no selected attribute.
+# 3. Looking for the "to" drop-down old release, to remove the "selected"
attribute,
+# then add the new release with selected="true"
+#
+# print "1. Looking for <option value=\"${minor_release}.*\" selected\n";
+while(<>) {
+ if ( $skip_lines > 0 ) {
+ --$skip_lines;
+ next;
+ }
+
+ if (!$found_old_old_release_selected) {
+ if ( /<option value="${minor_release}.*" selected/ and ! /<option
value="${old_release}" selected/ ) {
+ $found_old_old_release_selected = 1;
+
+ s/ selected(="selected")?//; # Remove the "selected" attribute
+
+ print; # Dump the altered line
+
+#print "2. Now looking for <option value=\"$old_release\">\n";
+ } else {
+ print;
+ }
+ } elsif(!$found_old_release_unselected) {
+ if ( /<option value="$old_release">/ ) {
+ $found_old_release_unselected = 1;
+
+ s/">/" selected>/;
+
+ print; # Dump the altered line
+
+ # Add the new release, unselected
+ print " <option value=\"$new_release\">$new_release</option>\n";
+# print "3. Now looking for <option value=\"$old_release\"
selected=\"selected\">\n";
+ } else {
+ print;
+ }
+ } elsif(!$found_old_release_selected) {
+ if ( /<option value="$old_release" selected/ ) {
+ $found_old_release_selected = 1;
+
+ s/ selected(="selected")?//; # Remove the "selected" attribute
+
+ print; # Dump the altered line
+
+ # Add the new release at the end
+ print " <option value=\"$new_release\"
selected>$new_release</option>\n";
+ } else {
+ print;
+ }
+ } else {
+ print; # Finish-off the file
+ }
+}
+if(!$found_old_old_release_selected or !$found_old_release_unselected or
!$found_old_release_selected) {
+ #print STDERR "Something went wrong patching migration.\n";
+
+ exit(1);
+}
+
Propchange: tomcat/site/trunk/tools/migration.pl
------------------------------------------------------------------------------
svn:executable = *
Copied: tomcat/site/trunk/tools/update-version.sh (from r1908065,
tomcat/site/trunk/update-version.sh)
URL:
http://svn.apache.org/viewvc/tomcat/site/trunk/tools/update-version.sh?p2=tomcat/site/trunk/tools/update-version.sh&p1=tomcat/site/trunk/update-version.sh&r1=1908065&r2=1908066&rev=1908066&view=diff
==============================================================================
--- tomcat/site/trunk/update-version.sh (original)
+++ tomcat/site/trunk/tools/update-version.sh Sat Mar 4 16:42:02 2023
@@ -1,7 +1,44 @@
#!/bin/sh
+#
+# Assists updating the web site to include a new release.
+#
+# Run update-version.sh with -h or --help for usage instructions.
+#
+
+OLD_RELEASE=$1
+NEW_RELEASE=$2
+RELEASE_DATE=${3:-$(date -I)}
+SCRIPT_DIR=$( dirname $0 )
+
+if [ \( "$1" == '-h' \) -o \( "$1" == "--help" \) ] ; then
+ echo "Usage: $0 oldrelease newrelease [release date]"
+ echo
+ echo e.g. $0 8.5.86 8.5.87 2023-03-03
+ echo
+ echo The release date will default to "today" in your current time zone.
+ echo
+ exit 0
+fi
+if [ \( "" == "$NEW_RELEASE" \) -o \( "" == "$OLD_RELEASE" \) ] ; then
+ >&2 echo "You must specify both new and old release numbers"
+ >&2 echo
+ >&2 echo "Usage: $0 oldrelease newrelease [release date]"
+ >&2 echo
+ >&2 echo e.g. $0 8.5.85 8.5.86 2023-03-03
+ >&2 echo
+ exit 1
+fi
+
+MINOR_RELEASE=$( expr "${NEW_RELEASE}" : '^\([0-9]*\.[0-9]*\)' )
+MAJOR_RELEASE=$( expr "${NEW_RELEASE}" : '^\([0-9]*\)' )
+
+if [ "$DEBUG" == "1" ] ; then
+ echo major=$MAJOR_RELEASE
+ echo minor=$MINOR_RELEASE
+ echo $NEW_RELEASE / $OLD_RELEASE
+ echo RELEASE_DATE=$RELEASE_DATE
+fi
-RELEASE=${1:-8.5}
-MAJOR_RELEASE=$( expr "${RELEASE}" : '^\([0-9]*\)' )
if [ "8" = "${MAJOR_RELEASE}" ] ; then
DOWNLOAD_FILENAME=xdocs/download-80.xml
elif [ "9" = "${MAJOR_RELEASE}" ] ; then
@@ -10,22 +47,89 @@ else
DOWNLOAD_FILENAME=xdocs/download-${MAJOR_RELEASE}.xml
fi
-if [ "8.5" = "${RELEASE}" ] ; then
+if [ "8.5" = "${MINOR_RELEASE}" ] ; then
MIGRATION_FILENAME=xdocs/migration-85.xml
-elif [ "9.0" = "${RELEASE}" ] ; then
+elif [ "9.0" = "${MINOR_RELEASE}" ] ; then
MIGRATION_FILENAME=xdocs/migration-90.xml
else
MIGRATION_FILENAME=xdocs/migration-${RELEASE}.xml
fi
-# CHANGELOG_FILENAME=docs/tomcat-${RELEASE}-doc/changelog.html
+# build.properties.default
+# Set the current minor release to point to the new release
+# e.g. tomcat10.0=10.0.27
+echo "Patching build.properties.default..."
+sed -i '' -e
"s/tomcat${MINOR_RELEASE}=.*/tomcat${MINOR_RELEASE}=$NEW_RELEASE/"
build.properties.default
+
+# Download file
+# set the version number to the latest
+# e.g. [define v]8.5.87[end]
+echo "Patching ${DOWNLOAD_FILENAME}..."
+sed -i '' -e "s/\[define v]${MINOR_RELEASE}.*\[end\]/[define
v]${NEW_RELEASE}[end]/" "${DOWNLOAD_FILENAME}"
+
+# whichversion.xml
+# set the current point-release version
+# e.g. <td>10.1.7</td>
+echo "Patching xdocs/whichversion.xml..."
+sed -i '' -e "s/<td>${MINOR_RELEASE}\.[0-9]*<\/td>/<td>${NEW_RELEASE}<\/td>/"
"xdocs/whichversion.xml"
+
+# xdocs/doap_Tomcat.rdf
+# Set the release date and revision number e.g.
+# <release>
+# <Version>
+# <name>Latest Stable 8.5.x Release</name>
+# <created>2023-03-03</created>
+# <revision>8.5.88</revision>
+# </Version>
+# </release>
+#
+# This is difficult/impossible to do with just sed. This is also difficult to
do
+# with XSLT as it will re-format the file in some ways that make it less
readable.
+# sed -i '' -e
"s/<revision>${MINOR_RELEASE}\.[0-9]*<\/revision>/<revision>${NEW_RELEASE}<\/revision>/"
"xdocs/doap_Tomcat.rdf"
+#
+# We will do it in Perl
+"${SCRIPT_DIR}/doap.pl" "${NEW_RELEASE}" "${RELEASE_DATE}"
"xdocs/doap_Tomcat.rdf" > "xdocs/doap_Tomcat.rdf.new" && mv
"xdocs/doap_Tomcat.rdf.new" "xdocs/doap_Tomcat.rdf"
+
+echo "Building release documents..."
+
+ant "release-${MINOR_RELEASE}"
+
+# CHANGELOG
+#
+# The changelog needs to be merged AFTER the javadocs have been built.
+#
+# Set the release date.
+# e.g. <span id="Tomcat_8.5.87_(schultz)_rtext" style="float:
right;">2023-03-03</span>
+CHANGELOG_FILENAME=docs/tomcat-${MINOR_RELEASE}-doc/changelog.html
+echo "Patching ${CHANGELOG_FILENAME}..."
+sed -i '' -e "s/\(<span
id=\"Tomcat_${NEW_RELEASE}.*_rtext\"[^>]*>\)[^<]*/\1${RELEASE_DATE}/"
"${CHANGELOG_FILENAME}"
+
+# Migration file
+# Add new entries for the old and new releases like this:
+# In the "from" drop-down:
+# - remove 'selected' attribute from any old release
+# - add 'selected' attribute to old release
+# - add the new release
+#
+# In the "to" drop-down:
+# - remove 'selected' from the old release
+# - add the new release, including 'selected' attribute
+#
+# This is not possible with sed nor XSLT
+#
+# sed -e "s/<option value=\"${OLD_RELEASE}\"
selected=\"selected\">${OLD_RELEASE}<\/option>/<option
value=\"${OLD_RELEASE}\">${OLD_RELEASE}<\/option>\n <option
value=\"${NEW_RELEASE}\" selected=\"selected\">${NEW_RELEASE}<\/option>/"
"${MIGRATION_FILENAME}" > migration.xml
+echo "Patching ${MIGRATION_FILENAME}..."
+"${SCRIPT_DIR}/migration.pl" "${OLD_RELEASE}" "${NEW_RELEASE}"
"${MIGRATION_FILENAME}" > "${MIGRATION_FILENAME}.new" && mv
"${MIGRATION_FILENAME}.new" "${MIGRATION_FILENAME}" || ( echo "=====" && echo
"Something went wrong patching ${MIGRATION_FILENAME}; rolling-back changes.
File already updated?" && echo "=====" && rm -f "${MIGRATION_FILENAME}.new" )
+
+echo
+echo "Now you will have to edit xdocs/index.xml and xdocs/oldnews.xml"
+echo "to move the ${OLD_RELEASE} release announcement to xdocs/oldnews.xml"
+echo "and add the ${NEW_RELEASE} release announcement to xdocs/index.xml."
+echo
+echo "Press ENTER to continue..."
+read
-vi build.properties.default \
- "${DOWNLOAD_FILENAME}" \
- xdocs/whichversion.xml \
- xdocs/doap_Tomcat.rdf \
- "${MIGRATION_FILENAME}" \
- xdocs/index.xml \
- xdocs/oldnews.xml
-# "${CHANGELOG_FILENAME}" \
+vi xdocs/index.xml xdocs/oldnews.xml
+echo
+echo "Done. You should run 'svn status' to see whcih files changed, and maybe
an 'svn diff' on some of them."
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]