Author: schultz
Date: Tue Nov 14 22:52:20 2023
New Revision: 1913785
URL: http://svn.apache.org/viewvc?rev=1913785&view=rev
Log:
Improve update-versionsh
- Perform release-announcement migrations from index -> oldnews
- Insert version-specific release announcement template in index
- Automatically add/delete files from subversion after building docs
Added:
tomcat/site/trunk/tools/news-template-10.1.txt
tomcat/site/trunk/tools/news.pl (with props)
Modified:
tomcat/site/trunk/tools/update-version.sh
Added: tomcat/site/trunk/tools/news-template-10.1.txt
URL:
http://svn.apache.org/viewvc/tomcat/site/trunk/tools/news-template-10.1.txt?rev=1913785&view=auto
==============================================================================
--- tomcat/site/trunk/tools/news-template-10.1.txt (added)
+++ tomcat/site/trunk/tools/news-template-10.1.txt Tue Nov 14 22:52:20 2023
@@ -0,0 +1,29 @@
+<section name="Tomcat {NEW_RELEASE} Released" rtext="{RELEASE_DATE}">
+<p>
+The Apache Tomcat Project is proud to announce the release of version
{NEW_RELEASE}
+of Apache Tomcat. This release implements specifications that are part of the
+Jakarta EE 10 platform.</p>
+<p>Applications that run on Tomcat 9 and earlier will not run on Tomcat 10
+without changes. Java EE based applications designed for Tomcat 9 and earlier
+may be placed in the <code>$CATALINA_BASE/webapps-javaee</code> directory and
+Tomcat will automatically convert them to Jakarta EE and copy them to the
+webapps directory. This conversion is performed using the
+<a href="https://github.com/apache/tomcat-jakartaee-migration">Apache Tomcat
+migration tool for Jakarta EE tool</a> which is also available as a separate
+<a href="download-migration.cgi">download</a> for off-line use.</p>
+<p>The notable changes in this release are:</p>
+<ul>
+ <!-- TODO: Enter several changelog entries -->
+</ul>
+
+<p>
+Full details of these changes, and all the other changes, are available in the
+<a
href="tomcat-10.1-doc/changelog.html#Tomcat_{NEW_RELEASE}_({RELEASE_MANAGER})">Tomcat
10.1
+changelog</a>.
+</p>
+
+<p style="text-align: center;">
+<a href="download-10.cgi">Download</a>
+</p>
+</section>
+
Added: tomcat/site/trunk/tools/news.pl
URL:
http://svn.apache.org/viewvc/tomcat/site/trunk/tools/news.pl?rev=1913785&view=auto
==============================================================================
--- tomcat/site/trunk/tools/news.pl (added)
+++ tomcat/site/trunk/tools/news.pl Tue Nov 14 22:52:20 2023
@@ -0,0 +1,104 @@
+#!/usr/bin/perl
+use warnings;
+use strict;
+
+my $old_release = $ARGV[0];
+my $new_release = $ARGV[1];
+my $release_date = $ARGV[2];
+my $release_manager = $ARGV[3];
+
+my($major_version) = $new_release =~ /^([0-9]+\.[0-9]+)/;
+
+print "Migrating news for $old_release to oldnews.xml, major version
$major_version, RM $release_manager\n";
+
+open(OLD_NEWS, '<', 'xdocs/oldnews.xml') or die 'Cannot open xdocs/oldnews.xml
for reading';
+open(OLD_NEWS_NEW, '>', 'xdocs/oldnews.xml.new') or die 'Cannot open
xdocs/oldnews.xml.new for writing';
+
+my $found_new_announcement_location=0;
+my $line = 0;
+my $old_announcement_start_line = 0;
+my $old_announcement_end_line = 0;
+
+# Locate the place in the old news where we will insert the old announcement.
+while(<OLD_NEWS>) {
+ if( /<\/section>/ ) {
+ print "Found location in oldnews.xml to place old release announcement.\n";
+ print OLD_NEWS_NEW;
+
+ $found_new_announcement_location = 1;
+ last; # Abort this loop; start the next one
+ } else {
+ print OLD_NEWS_NEW;
+ }
+}
+
+die 'Failed to find old announcement target location in xdocs/oldnews.xml'
unless 1 == $found_new_announcement_location;
+
+open(NEWS, '<', 'xdocs/index.xml') or die 'Cannot open xdocs/index.xml for
reading';
+open(NEWS_NEW, '>', 'xdocs/index.xml.new') or die 'Cannot open
xdocs/index.xml.new for writing';
+
+my $migrating = 0;
+my $finish = 0;
+my $added_template = 0;
+
+print "Looking for old release announcement for $old_release ...\n";
+
+while(<NEWS>) {
+ ++$line;
+ if($finish == 1) {
+ print NEWS_NEW;
+ } elsif($migrating == 1) {
+ print OLD_NEWS_NEW;
+
+ if( /<\/section>/ ) {
+ print "Found old release announcement ending on line $line.\n";
+ print "Finished copying old announcement to old news.\n";
+ $finish = 1;
+ }
+ } elsif ( /<section.*Tomcat $old_release Released/ ) {
+ print "Found old release announcement starting on line $line.\n";
+
+ print OLD_NEWS_NEW;
+
+ $migrating = 1;
+ } elsif ( $added_template == 0 and /<\/section>/ ) {
+ print NEWS_NEW;
+ print "Found the beginning of the news. Adding new release announcement
template.\n";
+
+ open(ANNOUNCEMENT_TEMPLATE, '<',
"tools/news-template-${major_version}.txt") or die "Cannot open
tools/news-template-${major_version}.txt for reading.\n";
+
+ while(<ANNOUNCEMENT_TEMPLATE>) {
+ s/\{NEW_RELEASE\}/$new_release/g;
+ s/\{RELEASE_DATE\}/$release_date/g;
+ s/\{RELEASE_MANAGER\}/$release_manager/g;
+ print NEWS_NEW;
+ }
+ close(ANNOUNCEMENT_TEMPLATE);
+
+ $added_template = 1;
+ } else {
+ print NEWS_NEW;
+ }
+}
+
+close(NEWS_NEW);
+close(NEWS);
+
+die 'Failed to add new release announcement template.' unless $added_template
== 1;
+die 'Failed to complete copying old release announcement.' unless $finish == 1;
+
+print "Copying the rest of the old news.\n";
+
+while(<OLD_NEWS>) {
+ print OLD_NEWS_NEW;
+}
+close(OLD_NEWS_NEW);
+close(OLD_NEWS);
+
+print "Looks like everything went well. Swapping files.\n";
+
+unlink('xdocs/index.xml') or die 'Failed to delete xdocs/index.xml';
+unlink('xdocs/oldnews.xml') or die 'Failed to delete xdocs/oldnews.xml';
+rename('xdocs/index.xml.new', 'xdocs/index.xml') or die 'Failed to rename
xdocs/index.xml.new -> xdocs/index.xml';
+rename('xdocs/oldnews.xml.new', 'xdocs/oldnews.xml') or die 'Failed to rename
xdocs/oldnews.xml.new -> xdocs/oldnews.xml';
+
Propchange: tomcat/site/trunk/tools/news.pl
------------------------------------------------------------------------------
svn:executable = *
Modified: tomcat/site/trunk/tools/update-version.sh
URL:
http://svn.apache.org/viewvc/tomcat/site/trunk/tools/update-version.sh?rev=1913785&r1=1913784&r2=1913785&view=diff
==============================================================================
--- tomcat/site/trunk/tools/update-version.sh (original)
+++ tomcat/site/trunk/tools/update-version.sh Tue Nov 14 22:52:20 2023
@@ -10,6 +10,7 @@ EDITOR=${EDITOR:-vi}
OLD_RELEASE=$1
NEW_RELEASE=$2
RELEASE_DATE=${3:-$(date -I)}
+RELEASE_MANAGER=${4:-${USER}}
function fail_migration_patch() {
FAILED_MIGRATION=1
@@ -21,20 +22,21 @@ function fail_migration_patch() {
}
if [ \( "$1" == '-h' \) -o \( "$1" == "--help" \) ] ; then
- echo "Usage: $0 oldrelease newrelease [release date]"
+ echo "Usage: $0 oldrelease newrelease [release date] [release manager]"
echo
- echo e.g. $0 8.5.86 8.5.87 2023-03-03
+ echo e.g. $0 8.5.86 8.5.87 2023-03-03 asfuser
echo
echo The release date will default to "today" in your current time zone.
+ echo "The release-manager will default to your current username (${USER})"
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 "Usage: $0 oldrelease newrelease [release date] [release manager]"
>&2 echo
- >&2 echo e.g. $0 8.5.85 8.5.86 2023-03-03
+ >&2 echo e.g. $0 8.5.85 8.5.86 2023-03-03 asfuser
>&2 echo
exit 1
fi
@@ -110,15 +112,30 @@ sed -i '' -e "s/\(<span id=\"Tomcat_${NE
echo "Patching ${MIGRATION_FILENAME}..."
"${SCRIPT_DIR}/migration.pl" "${OLD_RELEASE}" "${NEW_RELEASE}"
"${MIGRATION_FILENAME}" > "${MIGRATION_FILENAME}.new" && mv
"${MIGRATION_FILENAME}.new" "${MIGRATION_FILENAME}" || fail_migration_patch
-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
+tools/news.pl ${OLD_RELEASE} ${NEW_RELEASE} ${RELEASE_DATE} ${RELEASE_MANAGER}
+
+if [ "0" = "$?" ] ; then
+ echo
+ echo Automated news patching was successful. You will have to modify
+ echo the release announcement to include the changelog highlights.
+ echo Just search the template for TODO.
+ echo
+ echo Press ENTER to edit xdocs/index.xml...
+ read
+
+ "${EDITOR}" xdocs/index.xml
+else
+ echo
+ echo Automated news patching was not successful. You will have to edit
+ echo 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
-"${EDITOR}" xdocs/index.xml xdocs/oldnews.xml
+ "${EDITOR}" xdocs/index.xml xdocs/oldnews.xml
+fi
# xdocs/doap_Tomcat.rdf
# Set the release date and revision number e.g.
@@ -142,8 +159,31 @@ echo "Building release documents..."
ant "release-${MINOR_RELEASE}"
+if [ "0" != "$?" ] ; then
+ echo Building the release documents has failed. You might want to re-run
+ echo this command:
+ echo
+ echo " ant release-${MINOR_RELEASE}"
+ echo
+ echo and then deal with the revision-control changes. You should run
+ echo \'svn status\' to see which files changed, and maybe an \'svn diff\'
+ echo on some of them.
+else
+ echo "Adding any new files to svn..."
+ svn status | grep '^?' | sed -e 's/^?//' | xargs svn add
+
+ echo "Removing any old files from svn..."
+ svn status | grep '^!' | sed -e 's/^!//' | xargs svn delete
+
+ echo Checking to see if there are other things to be done with svn...
+ svn status | grep '^[^MDA]'
+
+ if [ "1" = "$?" ] ; then
+ echo No further svn changes appear necessary.
+ fi
+fi
+
echo
-echo "Done. You should run 'svn status' to see which files changed, and maybe
an 'svn diff' on some of them."
if [ "1" == "$FAILED_MIGRATION" ] ; then
echo
echo "NOTE: The patch for ${MIGRATION_FILENAME} failed; you may want to
examine the situation manually."
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]