hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a.@apache.org
Subject hadoop git commit: HADOOP-12277. releasedocmaker index mode should create a readme.md in addition to a index.md (aw)
Date Wed, 09 Sep 2015 15:40:27 GMT
Repository: hadoop
Updated Branches:
  refs/heads/HADOOP-12111 5e422ab37 -> 5e93128d0


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/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/5e93128d
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/5e93128d
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/5e93128d

Branch: refs/heads/HADOOP-12111
Commit: 5e93128d0059bcf255a925cf3656711569beb2a0
Parents: 5e422ab
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/hadoop/blob/5e93128d/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/hadoop/blob/5e93128d/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)


Mime
View raw message