You are viewing a plain text version of this content. The canonical link for it is here.
Posted to gitbox@yetus.apache.org by aw...@apache.org on 2020/10/22 14:30:40 UTC

[yetus] branch main updated: YETUS-1036. Provide comprehensive changelogs and release notes (#168)

This is an automated email from the ASF dual-hosted git repository.

aw pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/yetus.git


The following commit(s) were added to refs/heads/main by this push:
     new 0c17025  YETUS-1036. Provide comprehensive changelogs and release notes (#168)
0c17025 is described below

commit 0c17025c794895f5cdaabd24c2724890bf4c16a0
Author: Allen Wittenauer <aw...@apache.org>
AuthorDate: Thu Oct 22 07:21:25 2020 -0700

    YETUS-1036. Provide comprehensive changelogs and release notes (#168)
    
    * fix a bug with README generation
    * add a --prettyindex to match our middleman config
    * add a link to the downloads page
    * make sure not to commit the generated page
---
 asf-site-src/pom.xml                               | 32 ++++++++++++++++++++++
 asf-site-src/source/downloads/.gitignore           |  1 +
 .../index.html.md.erb}                             | 10 +++++--
 .../src/main/python/releasedocmaker/__init__.py    | 28 +++++++++++++++----
 4 files changed, 63 insertions(+), 8 deletions(-)

diff --git a/asf-site-src/pom.xml b/asf-site-src/pom.xml
index 7144d41..8f78e52 100644
--- a/asf-site-src/pom.xml
+++ b/asf-site-src/pom.xml
@@ -157,6 +157,38 @@
               </arguments>
             </configuration>
           </execution>
+            <execution>
+            <id>all-releasedocs</id>
+            <phase>pre-site</phase>
+            <goals>
+              <goal>exec</goal>
+            </goals>
+            <configuration>
+              <executable>${rdm.bin}</executable>
+              <requiresOnline>true</requiresOnline>
+              <arguments>
+                <argument>--dirversions</argument>
+                <argument>--fileversions</argument>
+                <argument>--lint=all</argument>
+                <argument>--license</argument>
+                <argument>--outputdir</argument>
+                <argument>source/downloads/releasenotes</argument>
+                <argument>--prettyindex</argument>
+                <argument>--project</argument>
+                <argument>YETUS</argument>
+                <argument>--projecttitle</argument>
+                <argument>Apache Yetus</argument>
+                <argument>--usetoday</argument>
+                <argument>--range</argument>
+                <argument>--version</argument>
+                <argument>0.0.0</argument>
+                <argument>--version</argument>
+                <argument>${project.version}</argument>
+                <argument>--extension</argument>
+                <argument>.html.md</argument>
+              </arguments>
+            </configuration>
+          </execution>
           <execution>
             <id>bundle-install</id>
             <phase>pre-site</phase>
diff --git a/asf-site-src/source/downloads/.gitignore b/asf-site-src/source/downloads/.gitignore
new file mode 100644
index 0000000..f558533
--- /dev/null
+++ b/asf-site-src/source/downloads/.gitignore
@@ -0,0 +1 @@
+releasenotes
diff --git a/asf-site-src/source/downloads.html.md.erb b/asf-site-src/source/downloads/index.html.md.erb
similarity index 95%
rename from asf-site-src/source/downloads.html.md.erb
rename to asf-site-src/source/downloads/index.html.md.erb
index e66b54b..2def1b5 100644
--- a/asf-site-src/source/downloads.html.md.erb
+++ b/asf-site-src/source/downloads/index.html.md.erb
@@ -49,7 +49,7 @@ third-party repositories (e.g. Maven Central) and [Docker Hub](../yetus-docker-i
 <%   end
    end %>
 
-## OS X Homebrew/Linuxbrew
+# OS X Homebrew/Linuxbrew
 
 The latest version of Apache Yetus is also available via Homebrew on Mac OS X:
 
@@ -60,7 +60,7 @@ brew install yetus
 
 This will install many of the dependencies needed for the precommit functionality as well.
 
-## Helper Script
+# Helper Script
 
 To aid in downloading Apache Yetus for continuous integration systems, local build environments, etc, we provide a simple script that may be checked into your local repo [here](https://raw.githubusercontent.com/apache/yetus/main/yetus-dl.sh). It takes two parameters:
 
@@ -68,4 +68,8 @@ To aid in downloading Apache Yetus for continuous integration systems, local bui
 $ yetus-dl.sh <location> <version>
 ```
 
-By default, location is `/tmp/yetus` and the version is the latest version. Compatibility is not guaranteed between 'latest' versions.  Additionally, only the last three released versions will be available via this method.
\ No newline at end of file
+By default, location is `/tmp/yetus` and the version is the latest version. Compatibility is not guaranteed between 'latest' versions.  Additionally, only the last three released versions will be available via this method.
+
+# Previous Releases
+
+The changelogs and release notes for previous releases are available [here](releasenotes).
diff --git a/releasedocmaker/src/main/python/releasedocmaker/__init__.py b/releasedocmaker/src/main/python/releasedocmaker/__init__.py
index 2997e62..5778c06 100755
--- a/releasedocmaker/src/main/python/releasedocmaker/__init__.py
+++ b/releasedocmaker/src/main/python/releasedocmaker/__init__.py
@@ -17,6 +17,8 @@
 
 """ Generate releasenotes based upon JIRA """
 
+# pylint: disable=too-many-lines
+
 from __future__ import print_function
 import sys
 from glob import glob
@@ -75,7 +77,7 @@ ASF_LICENSE = '''
 -->
 '''
 
-def buildindex(title, asf_license):
+def indexbuilder(title, asf_license, format_string):
     """Write an index file for later conversion using mvn site"""
     versions = glob("[0-9]*.[0-9]*")
     versions.sort(key=LooseVersion, reverse=True)
@@ -85,16 +87,26 @@ def buildindex(title, asf_license):
         for version in versions:
             indexfile.write("* %s v%s\n" % (title, version))
             for k in ("Changelog", "Release Notes"):
-                indexfile.write("    * [%s](%s/%s.%s.html)\n" %
+                indexfile.write(format_string %
                                 (k, version, k.upper().replace(" ", ""),
                                  version))
 
 
+def buildprettyindex(title, asf_license):
+    """Write an index file for later conversion using middleman"""
+    indexbuilder(title, asf_license, "    * [%s](%s/%s.%s)\n")
+
+
+def buildindex(title, asf_license):
+    """Write an index file for later conversion using mvn site"""
+    indexbuilder(title, asf_license, "    * [%s](%s/%s.%s.html)\n")
+
+
 def buildreadme(title, asf_license):
     """Write an index file for Github using README.md"""
     versions = glob("[0-9]*.[0-9]*")
     versions.sort(key=LooseVersion, reverse=True)
-    with open("README." + EXTENSION, "w") as indexfile:
+    with open("README.md", "w") as indexfile:
         if asf_license is True:
             indexfile.write(ASF_LICENSE)
         for version in versions:
@@ -109,8 +121,6 @@ class GetVersions(object): # pylint: disable=too-few-public-methods
     """ List of version strings """
 
     def __init__(self, versions, projects):
-        versions = versions
-        projects = projects
         self.newversions = []
         versions.sort(key=LooseVersion)
         print("Looking for %s through %s" % (versions[0], versions[-1]))
@@ -600,6 +610,11 @@ def parse_args(): # pylint: disable=too-many-branches
                       type="string",
                       help="projects in JIRA to include in releasenotes",
                       metavar="PROJECT")
+    parser.add_option("--prettyindex",
+                      dest="prettyindex",
+                      action="store_true",
+                      default=False,
+                      help="build an index file with pretty URLs")
     parser.add_option("-r",
                       "--range",
                       dest="range",
@@ -982,6 +997,9 @@ def main(): # pylint: disable=too-many-statements, too-many-branches, too-many-l
         buildindex(title, options.license)
         buildreadme(title, options.license)
 
+    if options.prettyindex:
+        buildprettyindex(title, options.license)
+
     if haderrors is True:
         sys.exit(1)