You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@yetus.apache.org by bu...@apache.org on 2015/09/23 04:24:15 UTC

[45/50] [abbrv] yetus git commit: HADOOP-12277. releasedocmaker index mode should create a readme.md in addition to a index.md (aw)

HADOOP-12277. releasedocmaker index mode should create a readme.md in addition to a index.md (aw)


Project: http://git-wip-us.apache.org/repos/asf/yetus/repo
Commit: http://git-wip-us.apache.org/repos/asf/yetus/commit/e63656ba
Tree: http://git-wip-us.apache.org/repos/asf/yetus/tree/e63656ba
Diff: http://git-wip-us.apache.org/repos/asf/yetus/diff/e63656ba

Branch: refs/heads/master
Commit: e63656bad3cb437e636e5171d6f67b0ad58d8dd0
Parents: e54a49b
Author: Allen Wittenauer <aw...@apache.org>
Authored: Wed Sep 9 08:40:18 2015 -0700
Committer: Allen Wittenauer <aw...@apache.org>
Committed: Wed Sep 9 08:40:18 2015 -0700

----------------------------------------------------------------------
 dev-support/docs/releasedocmaker.md |  9 +++++++++
 dev-support/releasedocmaker.py      | 26 +++++++++++++++++++++-----
 2 files changed, 30 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/yetus/blob/e63656ba/dev-support/docs/releasedocmaker.md
----------------------------------------------------------------------
diff --git a/dev-support/docs/releasedocmaker.md b/dev-support/docs/releasedocmaker.md
index 31eb8e0..405800d 100644
--- a/dev-support/docs/releasedocmaker.md
+++ b/dev-support/docs/releasedocmaker.md
@@ -21,6 +21,7 @@ releasedocmaker
 * [Multiple Versions](#Multiple_Versions)
 * [Unreleased Dates](#Unreleased_Dates)
 * [Lint Mode](#Lint_Mode)
+* [Index Mode](#Index_Mode)
 
 # Purpose
 
@@ -119,3 +120,11 @@ $ releasedocmaker.py --project HBASE --version 1.0.0 --lint
 ```
 
 This will do the normal JIRA querying, looking for items it considers problematic.  It will print the information to the screen and then exit with either success or failure, depending upon if any issues were discovered.
+
+# Index Mode
+
+There is basic support for an autoindexer.  It will create two files that contain links to all directories that have a major.minor.micro-style version numbering system, where all fields are numeric.
+
+  * index.md: a file suitable for conversion to HTML via mvn site
+  * README.md: a file suitable for display on Github and other Markdown rendering websites
+

http://git-wip-us.apache.org/repos/asf/yetus/blob/e63656ba/dev-support/releasedocmaker.py
----------------------------------------------------------------------
diff --git a/dev-support/releasedocmaker.py b/dev-support/releasedocmaker.py
index d62c0d1..0c16d8a 100755
--- a/dev-support/releasedocmaker.py
+++ b/dev-support/releasedocmaker.py
@@ -19,6 +19,7 @@
 from glob import glob
 from optparse import OptionParser
 from time import gmtime, strftime
+from distutils.version import LooseVersion
 import os
 import re
 import sys
@@ -113,24 +114,38 @@ def mstr(obj):
     return unicode(obj)
 
 def buildindex(title, asf_license):
-    versions = reversed(sorted(glob("[0-9]*.[0-9]*.[0-9]*")))
+    """Write an index file for later conversion using mvn site"""
+    versions = glob("[0-9]*.[0-9]*.[0-9]*")
+    versions.sort(key=LooseVersion, reverse=True)
     with open("index.md", "w") as indexfile:
         if asf_license is True:
             indexfile.write(ASF_LICENSE)
         for version in versions:
             indexfile.write("* %s v%s\n" % (title, version))
             for k in ("Changes", "Release Notes"):
-                indexfile.write("    * %s (%s/%s.%s.html)\n" \
+                indexfile.write("    * [%s](%s/%s.%s.html)\n" \
+                    % (k, version, k.upper().replace(" ", ""), version))
+
+def buildreadme(title, asf_license):
+    """Write an index file for Github using README.md"""
+    versions = glob("[0-9]*.[0-9]*.[0-9]*")
+    versions.sort(key=LooseVersion, reverse=True)
+    with open("README.md", "w") as indexfile:
+        if asf_license is True:
+            indexfile.write(ASF_LICENSE)
+        for version in versions:
+            indexfile.write("* %s v%s\n" % (title, version))
+            for k in ("Changes", "Release Notes"):
+                indexfile.write("    * [%s](%s/%s.%s.md)\n" \
                     % (k, version, k.upper().replace(" ", ""), version))
-    indexfile.close()
 
 class GetVersions(object):
-    """ yo """
+    """ List of version strings """
     def __init__(self, versions, projects):
         versions = versions
         projects = projects
         self.newversions = []
-        versions.sort()
+        versions.sort(key=LooseVersion)
         print "Looking for %s through %s"%(versions[0], versions[-1])
         for project in projects:
             url = "https://issues.apache.org/jira/rest/api/2/project/%s/versions" % project
@@ -587,6 +602,7 @@ def main():
 
     if options.index:
         buildindex(title, options.license)
+        buildreadme(title, options.license)
 
     if haderrors is True:
         sys.exit(1)