You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by wa...@apache.org on 2015/07/25 03:33:15 UTC

[1/4] hadoop git commit: HADOOP-11807. add a lint mode to releasedocmaker (ramtin via aw)

Repository: hadoop
Updated Branches:
  refs/heads/trunk a3bd7b4a5 -> adcf5dd94


HADOOP-11807. add a lint mode to releasedocmaker (ramtin via aw)

(cherry picked from commit 8e657fba2fd33f7550597ea9c4c6e9a87aa1ef1c)


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

Branch: refs/heads/trunk
Commit: 098ba450cc98475b84d60bb5ac3bd7b558b2a67c
Parents: a3bd7b4
Author: Allen Wittenauer <aw...@apache.org>
Authored: Sat Jun 27 08:59:50 2015 -0700
Committer: Andrew Wang <wa...@apache.org>
Committed: Fri Jul 24 18:31:23 2015 -0700

----------------------------------------------------------------------
 dev-support/releasedocmaker.py                  | 76 +++++++++++++++++---
 hadoop-common-project/hadoop-common/CHANGES.txt |  2 +
 2 files changed, 68 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/098ba450/dev-support/releasedocmaker.py
----------------------------------------------------------------------
diff --git a/dev-support/releasedocmaker.py b/dev-support/releasedocmaker.py
index 2ccc1c0..8e68b3c 100755
--- a/dev-support/releasedocmaker.py
+++ b/dev-support/releasedocmaker.py
@@ -87,8 +87,15 @@ def notableclean(str):
   str=str.rstrip()
   return str
 
+# clean output dir
+def cleanOutputDir(dir):
+    files = os.listdir(dir)
+    for name in files:
+        os.remove(os.path.join(dir,name))
+    os.rmdir(dir)
+
 def mstr(obj):
-  if (obj == None):
+  if (obj is None):
     return ""
   return unicode(obj)
 
@@ -148,7 +155,7 @@ class Jira:
     return mstr(self.fields['description'])
 
   def getReleaseNote(self):
-    if (self.notes == None):
+    if (self.notes is None):
       field = self.parent.fieldIdMap['Release Note']
       if (self.fields.has_key(field)):
         self.notes=mstr(self.fields[field])
@@ -159,14 +166,14 @@ class Jira:
   def getPriority(self):
     ret = ""
     pri = self.fields['priority']
-    if(pri != None):
+    if(pri is not None):
       ret = pri['name']
     return mstr(ret)
 
   def getAssignee(self):
     ret = ""
     mid = self.fields['assignee']
-    if(mid != None):
+    if(mid is not None):
       ret = mid['displayName']
     return mstr(ret)
 
@@ -182,21 +189,21 @@ class Jira:
   def getType(self):
     ret = ""
     mid = self.fields['issuetype']
-    if(mid != None):
+    if(mid is not None):
       ret = mid['name']
     return mstr(ret)
 
   def getReporter(self):
     ret = ""
     mid = self.fields['reporter']
-    if(mid != None):
+    if(mid is not None):
       ret = mid['displayName']
     return mstr(ret)
 
   def getProject(self):
     ret = ""
     mid = self.fields['project']
-    if(mid != None):
+    if(mid is not None):
       ret = mid['key']
     return mstr(ret)
 
@@ -214,7 +221,7 @@ class Jira:
     return False
 
   def getIncompatibleChange(self):
-    if (self.incompat == None):
+    if (self.incompat is None):
       field = self.parent.fieldIdMap['Hadoop Flags']
       self.reviewed=False
       self.incompat=False
@@ -227,6 +234,24 @@ class Jira:
               self.reviewed=True
     return self.incompat
 
+  def checkMissingComponent(self):
+      if (len(self.fields['components'])>0):
+          return False
+      return True
+
+  def checkMissingAssignee(self):
+      if (self.fields['assignee'] is not None):
+          return False
+      return True
+
+  def checkVersionString(self):
+      field = self.parent.fieldIdMap['Fix Version/s']
+      for h in self.fields[field]:
+          found = re.match('^((\d+)(\.\d+)*).*$|^(\w+\-\d+)$', h['name'])
+          if not found:
+              return True
+      return False
+
   def getReleaseDate(self,version):
     for j in range(len(self.fields['fixVersions'])):
       if self.fields['fixVersions'][j]==version:
@@ -339,9 +364,11 @@ def main():
              help="build an index file")
   parser.add_option("-u","--usetoday", dest="usetoday", action="store_true",
              help="use current date for unreleased versions")
+  parser.add_option("-n","--lint", dest="lint", action="store_true",
+             help="use lint flag to exit on failures")
   (options, args) = parser.parse_args()
 
-  if (options.versions == None):
+  if (options.versions is None):
     options.versions = []
 
   if (len(args) > 2):
@@ -396,6 +423,9 @@ def main():
   reloutputs.writeAll(relhead)
   choutputs.writeAll(chhead)
 
+  errorCount=0
+  warningCount=0
+  lintMessage=""
   incompatlist=[]
   buglist=[]
   improvementlist=[]
@@ -408,6 +438,14 @@ def main():
   for jira in sorted(jlist):
     if jira.getIncompatibleChange():
       incompatlist.append(jira)
+      if (len(jira.getReleaseNote())==0):
+          warningCount+=1
+
+    if jira.checkVersionString():
+       warningCount+=1
+
+    if jira.checkMissingComponent() or jira.checkMissingAssignee():
+      errorCount+=1
     elif jira.getType() == "Bug":
       buglist.append(jira)
     elif jira.getType() == "Improvement":
@@ -431,15 +469,33 @@ def main():
       reloutputs.writeKeyRaw(jira.getProject(),"\n---\n\n")
       reloutputs.writeKeyRaw(jira.getProject(), line)
       line ='\n**WARNING: No release note provided for this incompatible change.**\n\n'
-      print 'WARNING: incompatible change %s lacks release notes.' % (notableclean(jira.getId()))
+      lintMessage += "\nWARNING: incompatible change %s lacks release notes." % (notableclean(jira.getId()))
       reloutputs.writeKeyRaw(jira.getProject(), line)
 
+    if jira.checkVersionString():
+        lintMessage += "\nWARNING: Version string problem for %s " % jira.getId()
+
+    if (jira.checkMissingComponent() or jira.checkMissingAssignee()):
+        errorMessage=[]
+        jira.checkMissingComponent() and errorMessage.append("component")
+        jira.checkMissingAssignee() and errorMessage.append("assignee")
+        lintMessage += "\nERROR: missing %s for %s " %  (" and ".join(errorMessage) , jira.getId())
+
     if (len(jira.getReleaseNote())>0):
       reloutputs.writeKeyRaw(jira.getProject(),"\n---\n\n")
       reloutputs.writeKeyRaw(jira.getProject(), line)
       line ='\n%s\n\n' % (tableclean(jira.getReleaseNote()))
       reloutputs.writeKeyRaw(jira.getProject(), line)
 
+  if (options.lint is True):
+      print lintMessage
+      print "======================================="
+      print "Error:%d, Warning:%d \n" % (errorCount, warningCount)
+
+      if (errorCount>0):
+          cleanOutputDir(version)
+          sys.exit(1)
+
   reloutputs.writeAll("\n\n")
   reloutputs.close()
 

http://git-wip-us.apache.org/repos/asf/hadoop/blob/098ba450/hadoop-common-project/hadoop-common/CHANGES.txt
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/CHANGES.txt b/hadoop-common-project/hadoop-common/CHANGES.txt
index 0da6194..baf39e3 100644
--- a/hadoop-common-project/hadoop-common/CHANGES.txt
+++ b/hadoop-common-project/hadoop-common/CHANGES.txt
@@ -730,6 +730,8 @@ Release 2.8.0 - UNRELEASED
     HADOOP-12170. hadoop-common's JNIFlags.cmake is redundant and can be
     removed (Alan Burlison via Colin P. McCabe)
 
+    HADOOP-11807. add a lint mode to releasedocmaker (ramtin via aw)
+
   OPTIMIZATIONS
 
     HADOOP-11785. Reduce the number of listStatus operation in distcp


[2/4] hadoop git commit: HADOOP-12135. cleanup releasedocmaker

Posted by wa...@apache.org.
HADOOP-12135. cleanup releasedocmaker

(cherry picked from commit 3fee9f8d18dd60d83da674b3cfbefe666915fad8)


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

Branch: refs/heads/trunk
Commit: e8b62d11d460e9706e48df92a0b0a72f4a02d3f5
Parents: 098ba45
Author: Allen Wittenauer <aw...@apache.org>
Authored: Mon Jul 6 15:49:03 2015 -0700
Committer: Andrew Wang <wa...@apache.org>
Committed: Fri Jul 24 18:31:30 2015 -0700

----------------------------------------------------------------------
 dev-support/releasedocmaker.py | 384 +++++++++++++++++++-----------------
 1 file changed, 207 insertions(+), 177 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/e8b62d11/dev-support/releasedocmaker.py
----------------------------------------------------------------------
diff --git a/dev-support/releasedocmaker.py b/dev-support/releasedocmaker.py
index 8e68b3c..6e01260 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
+import pprint
 import os
 import re
 import sys
@@ -99,23 +100,44 @@ def mstr(obj):
     return ""
   return unicode(obj)
 
-def buildindex(master):
+def buildindex(title,license):
   versions=reversed(sorted(glob("[0-9]*.[0-9]*.[0-9]*")))
   with open("index.md","w") as indexfile:
+    if license is True:
+      indexfile.write(asflicense)
     for v in versions:
-      indexfile.write("* Apache Hadoop v%s\n" % (v))
+      indexfile.write("* %s v%s\n" % (title,v))
       for k in ("Changes","Release Notes"):
-        indexfile.write("    *  %s\n" %(k))
-        indexfile.write("        * [Combined %s](%s/%s.%s.html)\n" \
+        indexfile.write("    * %s (%s/%s.%s.html)\n" \
           % (k,v,k.upper().replace(" ",""),v))
-        if not master:
-          indexfile.write("        * [Hadoop Common %s](%s/%s.HADOOP.%s.html)\n" \
-            % (k,v,k.upper().replace(" ",""),v))
-          for p in ("HDFS","MapReduce","YARN"):
-            indexfile.write("        * [%s %s](%s/%s.%s.%s.html)\n" \
-              % (p,k,v,k.upper().replace(" ",""),p.upper(),v))
   indexfile.close()
 
+class GetVersions:
+  """ yo """
+  def __init__(self,versions, projects):
+    versions = versions
+    projects = projects
+    self.newversions = []
+    pp = pprint.PrettyPrinter(indent=4)
+    at=0
+    end=1
+    count=100
+    versions.sort()
+    print "Looking for %s through %s"%(versions[0],versions[-1])
+    for p in projects:
+      resp = urllib.urlopen("https://issues.apache.org/jira/rest/api/2/project/%s/versions"%p)
+      data = json.loads(resp.read())
+      for d in data:
+        if d['name'][0].isdigit and versions[0] <= d['name'] and d['name'] <= versions[-1]:
+          print "Adding %s to the list" % d['name']
+          self.newversions.append(d['name'])
+    newlist=list(set(self.newversions))
+    self.newversions=newlist
+
+  def getlist(self):
+      pp = pprint.PrettyPrinter(indent=4)
+      return(self.newversions)
+
 class Version:
   """Represents a version number"""
   def __init__(self, data):
@@ -261,8 +283,10 @@ class Jira:
 class JiraIter:
   """An Iterator of JIRAs"""
 
-  def __init__(self, versions):
-    self.versions = versions
+  def __init__(self, version, projects):
+    self.version = version
+    self.projects = projects
+    v=str(version).replace("-SNAPSHOT","")
 
     resp = urllib.urlopen("https://issues.apache.org/jira/rest/api/2/field")
     data = json.loads(resp.read())
@@ -276,7 +300,7 @@ class JiraIter:
     end=1
     count=100
     while (at < end):
-      params = urllib.urlencode({'jql': "project in (HADOOP,HDFS,MAPREDUCE,YARN) and fixVersion in ('"+"' , '".join([str(v).replace("-SNAPSHOT","") for v in versions])+"') and resolution = Fixed", 'startAt':at, 'maxResults':count})
+      params = urllib.urlencode({'jql': "project in ('"+"' , '".join(projects)+"') and fixVersion in ('"+v+"') and resolution = Fixed", 'startAt':at, 'maxResults':count})
       resp = urllib.urlopen("https://issues.apache.org/jira/rest/api/2/search?%s"%params)
       data = json.loads(resp.read())
       if (data.has_key('errorMessages')):
@@ -286,10 +310,8 @@ class JiraIter:
       self.jiras.extend(data['issues'])
 
       needaversion=False
-      for j in versions:
-        v=str(j).replace("-SNAPSHOT","")
-        if v not in releaseVersion:
-          needaversion=True
+      if v not in releaseVersion:
+        needaversion=True
 
       if needaversion is True:
         for i in range(len(data['issues'])):
@@ -351,21 +373,29 @@ class Outputs:
       self.writeKeyRaw(jira.getProject(), line)
 
 def main():
-  parser = OptionParser(usage="usage: %prog --version VERSION [--version VERSION2 ...]",
+  parser = OptionParser(usage="usage: %prog --project PROJECT [--project PROJECT] --version VERSION [--version VERSION2 ...]",
 		epilog=
                "Markdown-formatted CHANGES and RELEASENOTES files will be stored in a directory"
                " named after the highest version provided.")
-  parser.add_option("-v", "--version", dest="versions",
-             action="append", type="string",
-             help="versions in JIRA to include in releasenotes", metavar="VERSION")
-  parser.add_option("-m","--master", dest="master", action="store_true",
-             help="only create the master, merged project files")
   parser.add_option("-i","--index", dest="index", action="store_true",
-             help="build an index file")
-  parser.add_option("-u","--usetoday", dest="usetoday", action="store_true",
-             help="use current date for unreleased versions")
+             default=False, help="build an index file")
+  parser.add_option("-l","--license", dest="license", action="store_false",
+             default=True, help="Add an ASF license")
   parser.add_option("-n","--lint", dest="lint", action="store_true",
              help="use lint flag to exit on failures")
+  parser.add_option("-p", "--project", dest="projects",
+             action="append", type="string",
+             help="projects in JIRA to include in releasenotes", metavar="PROJECT")
+  parser.add_option("-r", "--range", dest="range", action="store_true",
+             default=False, help="Given versions are a range")
+  parser.add_option("-t", "--projecttitle", dest="title",
+             type="string",
+             help="Title to use for the project (default is Apache PROJECT)")
+  parser.add_option("-u","--usetoday", dest="usetoday", action="store_true",
+             default=False, help="use current date for unreleased versions")
+  parser.add_option("-v", "--version", dest="versions",
+             action="append", type="string",
+             help="versions in JIRA to include in releasenotes", metavar="VERSION")
   (options, args) = parser.parse_args()
 
   if (options.versions is None):
@@ -377,169 +407,169 @@ def main():
   if (len(options.versions) <= 0):
     parser.error("At least one version needs to be supplied")
 
-  versions = [ Version(v) for v in options.versions ];
+  projects = options.projects
+
+  if (options.range is True):
+    versions = [ Version(v) for v in GetVersions(options.versions, projects).getlist() ]
+  else:
+    versions = [ Version(v) for v in options.versions ]
   versions.sort();
 
-  maxVersion = str(versions[-1])
+  if (options.title is None):
+    title=projects[0]
+  else:
+    title=options.title
 
-  jlist = JiraIter(versions)
-  version = maxVersion
+  for v in versions:
+    vstr=str(v)
+    jlist = JiraIter(vstr,projects)
 
-  if version in releaseVersion:
-    reldate=releaseVersion[version]
-  elif options.usetoday:
-    reldate=strftime("%Y-%m-%d", gmtime())
-  else:
-    reldate="Unreleased"
+    if vstr in releaseVersion:
+      reldate=releaseVersion[vstr]
+    elif options.usetoday:
+      reldate=strftime("%Y-%m-%d", gmtime())
+    else:
+      reldate="Unreleased"
 
-  if not os.path.exists(version):
-    os.mkdir(version)
+    if not os.path.exists(vstr):
+      os.mkdir(vstr)
 
-  if options.master:
     reloutputs = Outputs("%(ver)s/RELEASENOTES.%(ver)s.md",
       "%(ver)s/RELEASENOTES.%(key)s.%(ver)s.md",
-      [], {"ver":maxVersion, "date":reldate})
+      [], {"ver":v, "date":reldate, "title":title})
     choutputs = Outputs("%(ver)s/CHANGES.%(ver)s.md",
       "%(ver)s/CHANGES.%(key)s.%(ver)s.md",
-      [], {"ver":maxVersion, "date":reldate})
-  else:
-    reloutputs = Outputs("%(ver)s/RELEASENOTES.%(ver)s.md",
-      "%(ver)s/RELEASENOTES.%(key)s.%(ver)s.md",
-      ["HADOOP","HDFS","MAPREDUCE","YARN"], {"ver":maxVersion, "date":reldate})
-    choutputs = Outputs("%(ver)s/CHANGES.%(ver)s.md",
-      "%(ver)s/CHANGES.%(key)s.%(ver)s.md",
-      ["HADOOP","HDFS","MAPREDUCE","YARN"], {"ver":maxVersion, "date":reldate})
-
-  reloutputs.writeAll(asflicense)
-  choutputs.writeAll(asflicense)
-
-  relhead = '# Hadoop %(key)s %(ver)s Release Notes\n\n' \
-    'These release notes cover new developer and user-facing incompatibilities, features, and major improvements.\n\n'
-
-  chhead = '# Hadoop Changelog\n\n' \
-    '## Release %(ver)s - %(date)s\n'\
-    '\n'
-
-  reloutputs.writeAll(relhead)
-  choutputs.writeAll(chhead)
-
-  errorCount=0
-  warningCount=0
-  lintMessage=""
-  incompatlist=[]
-  buglist=[]
-  improvementlist=[]
-  newfeaturelist=[]
-  subtasklist=[]
-  tasklist=[]
-  testlist=[]
-  otherlist=[]
-
-  for jira in sorted(jlist):
-    if jira.getIncompatibleChange():
-      incompatlist.append(jira)
-      if (len(jira.getReleaseNote())==0):
-          warningCount+=1
-
-    if jira.checkVersionString():
-       warningCount+=1
-
-    if jira.checkMissingComponent() or jira.checkMissingAssignee():
-      errorCount+=1
-    elif jira.getType() == "Bug":
-      buglist.append(jira)
-    elif jira.getType() == "Improvement":
-      improvementlist.append(jira)
-    elif jira.getType() == "New Feature":
-      newfeaturelist.append(jira)
-    elif jira.getType() == "Sub-task":
-      subtasklist.append(jira)
-    elif jira.getType() == "Task":
-     tasklist.append(jira)
-    elif jira.getType() == "Test":
-      testlist.append(jira)
-    else:
-       otherlist.append(jira)
-
-    line = '* [%s](https://issues.apache.org/jira/browse/%s) | *%s* | **%s**\n' \
-        % (notableclean(jira.getId()), notableclean(jira.getId()), notableclean(jira.getPriority()),
-           notableclean(jira.getSummary()))
-
-    if (jira.getIncompatibleChange()) and (len(jira.getReleaseNote())==0):
-      reloutputs.writeKeyRaw(jira.getProject(),"\n---\n\n")
-      reloutputs.writeKeyRaw(jira.getProject(), line)
-      line ='\n**WARNING: No release note provided for this incompatible change.**\n\n'
-      lintMessage += "\nWARNING: incompatible change %s lacks release notes." % (notableclean(jira.getId()))
-      reloutputs.writeKeyRaw(jira.getProject(), line)
-
-    if jira.checkVersionString():
-        lintMessage += "\nWARNING: Version string problem for %s " % jira.getId()
-
-    if (jira.checkMissingComponent() or jira.checkMissingAssignee()):
-        errorMessage=[]
-        jira.checkMissingComponent() and errorMessage.append("component")
-        jira.checkMissingAssignee() and errorMessage.append("assignee")
-        lintMessage += "\nERROR: missing %s for %s " %  (" and ".join(errorMessage) , jira.getId())
-
-    if (len(jira.getReleaseNote())>0):
-      reloutputs.writeKeyRaw(jira.getProject(),"\n---\n\n")
-      reloutputs.writeKeyRaw(jira.getProject(), line)
-      line ='\n%s\n\n' % (tableclean(jira.getReleaseNote()))
-      reloutputs.writeKeyRaw(jira.getProject(), line)
-
-  if (options.lint is True):
-      print lintMessage
-      print "======================================="
-      print "Error:%d, Warning:%d \n" % (errorCount, warningCount)
-
-      if (errorCount>0):
-          cleanOutputDir(version)
-          sys.exit(1)
-
-  reloutputs.writeAll("\n\n")
-  reloutputs.close()
-
-  choutputs.writeAll("### INCOMPATIBLE CHANGES:\n\n")
-  choutputs.writeAll("| JIRA | Summary | Priority | Component | Reporter | Contributor |\n")
-  choutputs.writeAll("|:---- |:---- | :--- |:---- |:---- |:---- |\n")
-  choutputs.writeList(incompatlist)
-
-  choutputs.writeAll("\n\n### NEW FEATURES:\n\n")
-  choutputs.writeAll("| JIRA | Summary | Priority | Component | Reporter | Contributor |\n")
-  choutputs.writeAll("|:---- |:---- | :--- |:---- |:---- |:---- |\n")
-  choutputs.writeList(newfeaturelist)
-
-  choutputs.writeAll("\n\n### IMPROVEMENTS:\n\n")
-  choutputs.writeAll("| JIRA | Summary | Priority | Component | Reporter | Contributor |\n")
-  choutputs.writeAll("|:---- |:---- | :--- |:---- |:---- |:---- |\n")
-  choutputs.writeList(improvementlist)
-
-  choutputs.writeAll("\n\n### BUG FIXES:\n\n")
-  choutputs.writeAll("| JIRA | Summary | Priority | Component | Reporter | Contributor |\n")
-  choutputs.writeAll("|:---- |:---- | :--- |:---- |:---- |:---- |\n")
-  choutputs.writeList(buglist)
-
-  choutputs.writeAll("\n\n### TESTS:\n\n")
-  choutputs.writeAll("| JIRA | Summary | Priority | Component | Reporter | Contributor |\n")
-  choutputs.writeAll("|:---- |:---- | :--- |:---- |:---- |:---- |\n")
-  choutputs.writeList(testlist)
-
-  choutputs.writeAll("\n\n### SUB-TASKS:\n\n")
-  choutputs.writeAll("| JIRA | Summary | Priority | Component | Reporter | Contributor |\n")
-  choutputs.writeAll("|:---- |:---- | :--- |:---- |:---- |:---- |\n")
-  choutputs.writeList(subtasklist)
-
-  choutputs.writeAll("\n\n### OTHER:\n\n")
-  choutputs.writeAll("| JIRA | Summary | Priority | Component | Reporter | Contributor |\n")
-  choutputs.writeAll("|:---- |:---- | :--- |:---- |:---- |:---- |\n")
-  choutputs.writeList(otherlist)
-  choutputs.writeList(tasklist)
-
-  choutputs.writeAll("\n\n")
-  choutputs.close()
+      [], {"ver":v, "date":reldate, "title":title})
+
+    if (options.license is True):
+      reloutputs.writeAll(asflicense)
+      choutputs.writeAll(asflicense)
+
+    relhead = '# %(title)s %(key)s %(ver)s Release Notes\n\n' \
+      'These release notes cover new developer and user-facing incompatibilities, features, and major improvements.\n\n'
+    chhead = '# %(title)s Changelog\n\n' \
+      '## Release %(ver)s - %(date)s\n'\
+      '\n'
+
+    reloutputs.writeAll(relhead)
+    choutputs.writeAll(chhead)
+    errorCount=0
+    warningCount=0
+    lintMessage=""
+    incompatlist=[]
+    buglist=[]
+    improvementlist=[]
+    newfeaturelist=[]
+    subtasklist=[]
+    tasklist=[]
+    testlist=[]
+    otherlist=[]
+
+    for jira in sorted(jlist):
+      if jira.getIncompatibleChange():
+        incompatlist.append(jira)
+        if (len(jira.getReleaseNote())==0):
+            warningCount+=1
+
+      if jira.checkVersionString():
+         warningCount+=1
+
+      if jira.checkMissingComponent() or jira.checkMissingAssignee():
+        errorCount+=1
+      elif jira.getType() == "Bug":
+        buglist.append(jira)
+      elif jira.getType() == "Improvement":
+        improvementlist.append(jira)
+      elif jira.getType() == "New Feature":
+        newfeaturelist.append(jira)
+      elif jira.getType() == "Sub-task":
+        subtasklist.append(jira)
+      elif jira.getType() == "Task":
+       tasklist.append(jira)
+      elif jira.getType() == "Test":
+        testlist.append(jira)
+      else:
+         otherlist.append(jira)
+
+      line = '* [%s](https://issues.apache.org/jira/browse/%s) | *%s* | **%s**\n' \
+          % (notableclean(jira.getId()), notableclean(jira.getId()), notableclean(jira.getPriority()),
+             notableclean(jira.getSummary()))
+
+      if (jira.getIncompatibleChange()) and (len(jira.getReleaseNote())==0):
+        reloutputs.writeKeyRaw(jira.getProject(),"\n---\n\n")
+        reloutputs.writeKeyRaw(jira.getProject(), line)
+        line ='\n**WARNING: No release note provided for this incompatible change.**\n\n'
+        lintMessage += "\nWARNING: incompatible change %s lacks release notes." % (notableclean(jira.getId()))
+        reloutputs.writeKeyRaw(jira.getProject(), line)
+
+      if jira.checkVersionString():
+          lintMessage += "\nWARNING: Version string problem for %s " % jira.getId()
+
+      if (jira.checkMissingComponent() or jira.checkMissingAssignee()):
+          errorMessage=[]
+          jira.checkMissingComponent() and errorMessage.append("component")
+          jira.checkMissingAssignee() and errorMessage.append("assignee")
+          lintMessage += "\nERROR: missing %s for %s " %  (" and ".join(errorMessage) , jira.getId())
+
+      if (len(jira.getReleaseNote())>0):
+        reloutputs.writeKeyRaw(jira.getProject(),"\n---\n\n")
+        reloutputs.writeKeyRaw(jira.getProject(), line)
+        line ='\n%s\n\n' % (tableclean(jira.getReleaseNote()))
+        reloutputs.writeKeyRaw(jira.getProject(), line)
+
+    if (options.lint is True):
+        print lintMessage
+        print "======================================="
+        print "Error:%d, Warning:%d \n" % (errorCount, warningCount)
+
+        if (errorCount>0):
+            cleanOutputDir(version)
+            sys.exit(1)
+
+    reloutputs.writeAll("\n\n")
+    reloutputs.close()
+
+    choutputs.writeAll("### INCOMPATIBLE CHANGES:\n\n")
+    choutputs.writeAll("| JIRA | Summary | Priority | Component | Reporter | Contributor |\n")
+    choutputs.writeAll("|:---- |:---- | :--- |:---- |:---- |:---- |\n")
+    choutputs.writeList(incompatlist)
+
+    choutputs.writeAll("\n\n### NEW FEATURES:\n\n")
+    choutputs.writeAll("| JIRA | Summary | Priority | Component | Reporter | Contributor |\n")
+    choutputs.writeAll("|:---- |:---- | :--- |:---- |:---- |:---- |\n")
+    choutputs.writeList(newfeaturelist)
+
+    choutputs.writeAll("\n\n### IMPROVEMENTS:\n\n")
+    choutputs.writeAll("| JIRA | Summary | Priority | Component | Reporter | Contributor |\n")
+    choutputs.writeAll("|:---- |:---- | :--- |:---- |:---- |:---- |\n")
+    choutputs.writeList(improvementlist)
+
+    choutputs.writeAll("\n\n### BUG FIXES:\n\n")
+    choutputs.writeAll("| JIRA | Summary | Priority | Component | Reporter | Contributor |\n")
+    choutputs.writeAll("|:---- |:---- | :--- |:---- |:---- |:---- |\n")
+    choutputs.writeList(buglist)
+
+    choutputs.writeAll("\n\n### TESTS:\n\n")
+    choutputs.writeAll("| JIRA | Summary | Priority | Component | Reporter | Contributor |\n")
+    choutputs.writeAll("|:---- |:---- | :--- |:---- |:---- |:---- |\n")
+    choutputs.writeList(testlist)
+
+    choutputs.writeAll("\n\n### SUB-TASKS:\n\n")
+    choutputs.writeAll("| JIRA | Summary | Priority | Component | Reporter | Contributor |\n")
+    choutputs.writeAll("|:---- |:---- | :--- |:---- |:---- |:---- |\n")
+    choutputs.writeList(subtasklist)
+
+    choutputs.writeAll("\n\n### OTHER:\n\n")
+    choutputs.writeAll("| JIRA | Summary | Priority | Component | Reporter | Contributor |\n")
+    choutputs.writeAll("|:---- |:---- | :--- |:---- |:---- |:---- |\n")
+    choutputs.writeList(otherlist)
+    choutputs.writeList(tasklist)
+
+    choutputs.writeAll("\n\n")
+    choutputs.close()
 
   if options.index:
-    buildindex(options.master)
+    buildindex(title,options.license)
 
 if __name__ == "__main__":
   main()


[3/4] hadoop git commit: HADOOP-12202. releasedocmaker drops missing component and assignee entries (aw)

Posted by wa...@apache.org.
HADOOP-12202. releasedocmaker drops missing component and assignee entries (aw)

(cherry picked from commit adbacf7010373dbe6df239688b4cebd4a93a69e4)


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

Branch: refs/heads/trunk
Commit: d7697831e3b24bec149990feed819e7d96f78184
Parents: e8b62d1
Author: Allen Wittenauer <aw...@apache.org>
Authored: Tue Jul 7 14:30:32 2015 -0700
Committer: Andrew Wang <wa...@apache.org>
Committed: Fri Jul 24 18:31:44 2015 -0700

----------------------------------------------------------------------
 dev-support/releasedocmaker.py | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/d7697831/dev-support/releasedocmaker.py
----------------------------------------------------------------------
diff --git a/dev-support/releasedocmaker.py b/dev-support/releasedocmaker.py
index 6e01260..409d8e3 100755
--- a/dev-support/releasedocmaker.py
+++ b/dev-support/releasedocmaker.py
@@ -420,6 +420,8 @@ def main():
   else:
     title=options.title
 
+  haderrors=False
+
   for v in versions:
     vstr=str(v)
     jlist = JiraIter(vstr,projects)
@@ -468,14 +470,6 @@ def main():
     for jira in sorted(jlist):
       if jira.getIncompatibleChange():
         incompatlist.append(jira)
-        if (len(jira.getReleaseNote())==0):
-            warningCount+=1
-
-      if jira.checkVersionString():
-         warningCount+=1
-
-      if jira.checkMissingComponent() or jira.checkMissingAssignee():
-        errorCount+=1
       elif jira.getType() == "Bug":
         buglist.append(jira)
       elif jira.getType() == "Improvement":
@@ -496,6 +490,7 @@ def main():
              notableclean(jira.getSummary()))
 
       if (jira.getIncompatibleChange()) and (len(jira.getReleaseNote())==0):
+        warningCount+=1
         reloutputs.writeKeyRaw(jira.getProject(),"\n---\n\n")
         reloutputs.writeKeyRaw(jira.getProject(), line)
         line ='\n**WARNING: No release note provided for this incompatible change.**\n\n'
@@ -503,9 +498,11 @@ def main():
         reloutputs.writeKeyRaw(jira.getProject(), line)
 
       if jira.checkVersionString():
+          warningCount+=1
           lintMessage += "\nWARNING: Version string problem for %s " % jira.getId()
 
       if (jira.checkMissingComponent() or jira.checkMissingAssignee()):
+          errorCount+=1
           errorMessage=[]
           jira.checkMissingComponent() and errorMessage.append("component")
           jira.checkMissingAssignee() and errorMessage.append("assignee")
@@ -520,11 +517,11 @@ def main():
     if (options.lint is True):
         print lintMessage
         print "======================================="
-        print "Error:%d, Warning:%d \n" % (errorCount, warningCount)
-
+        print "%s: Error:%d, Warning:%d \n" % (vstr, errorCount, warningCount)
         if (errorCount>0):
-            cleanOutputDir(version)
-            sys.exit(1)
+           haderrors=True
+           cleanOutputDir(vstr)
+           continue
 
     reloutputs.writeAll("\n\n")
     reloutputs.close()
@@ -571,5 +568,8 @@ def main():
   if options.index:
     buildindex(title,options.license)
 
+  if haderrors is True:
+    sys.exit(1)
+
 if __name__ == "__main__":
   main()


[4/4] hadoop git commit: HADOOP-12237. releasedocmaker.py doesn't work behind a proxy (Tsuyoshi Ozawa via aw)

Posted by wa...@apache.org.
HADOOP-12237. releasedocmaker.py doesn't work behind a proxy (Tsuyoshi Ozawa via aw)

(cherry picked from commit b41fe3111ae37478cbace2a07e6ac35a676ef978)


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

Branch: refs/heads/trunk
Commit: adcf5dd94052481f66deaf402ac4ace1ffc06f49
Parents: d769783
Author: Allen Wittenauer <aw...@apache.org>
Authored: Mon Jul 20 09:47:46 2015 -0700
Committer: Andrew Wang <wa...@apache.org>
Committed: Fri Jul 24 18:31:48 2015 -0700

----------------------------------------------------------------------
 dev-support/releasedocmaker.py | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/adcf5dd9/dev-support/releasedocmaker.py
----------------------------------------------------------------------
diff --git a/dev-support/releasedocmaker.py b/dev-support/releasedocmaker.py
index 409d8e3..d2e5dda 100755
--- a/dev-support/releasedocmaker.py
+++ b/dev-support/releasedocmaker.py
@@ -24,6 +24,7 @@ import os
 import re
 import sys
 import urllib
+import urllib2
 try:
   import json
 except ImportError:
@@ -125,7 +126,7 @@ class GetVersions:
     versions.sort()
     print "Looking for %s through %s"%(versions[0],versions[-1])
     for p in projects:
-      resp = urllib.urlopen("https://issues.apache.org/jira/rest/api/2/project/%s/versions"%p)
+      resp = urllib2.urlopen("https://issues.apache.org/jira/rest/api/2/project/%s/versions"%p)
       data = json.loads(resp.read())
       for d in data:
         if d['name'][0].isdigit and versions[0] <= d['name'] and d['name'] <= versions[-1]:
@@ -288,7 +289,7 @@ class JiraIter:
     self.projects = projects
     v=str(version).replace("-SNAPSHOT","")
 
-    resp = urllib.urlopen("https://issues.apache.org/jira/rest/api/2/field")
+    resp = urllib2.urlopen("https://issues.apache.org/jira/rest/api/2/field")
     data = json.loads(resp.read())
 
     self.fieldIdMap = {}
@@ -301,7 +302,7 @@ class JiraIter:
     count=100
     while (at < end):
       params = urllib.urlencode({'jql': "project in ('"+"' , '".join(projects)+"') and fixVersion in ('"+v+"') and resolution = Fixed", 'startAt':at, 'maxResults':count})
-      resp = urllib.urlopen("https://issues.apache.org/jira/rest/api/2/search?%s"%params)
+      resp = urllib2.urlopen("https://issues.apache.org/jira/rest/api/2/search?%s"%params)
       data = json.loads(resp.read())
       if (data.has_key('errorMessages')):
         raise Exception(data['errorMessages'])
@@ -407,6 +408,10 @@ def main():
   if (len(options.versions) <= 0):
     parser.error("At least one version needs to be supplied")
 
+  proxy = urllib2.ProxyHandler()
+  opener = urllib2.build_opener(proxy)
+  urllib2.install_opener(opener)
+
   projects = options.projects
 
   if (options.range is True):