kudu-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t...@apache.org
Subject [1/2] incubator-kudu git commit: Run RAT as part of release source tarball generation
Date Wed, 06 Apr 2016 21:23:23 GMT
Repository: incubator-kudu
Updated Branches:
  refs/heads/master a6dfbf6de -> 4c4c3ae59


Run RAT as part of release source tarball generation

Tested manually on a failed build and a "good" build.

Change-Id: I8bdadd1eeb124331af2a4c3c4b537d044b0aceae
Reviewed-on: http://gerrit.cloudera.org:8080/2724
Tested-by: Kudu Jenkins
Reviewed-by: Jean-Daniel Cryans


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

Branch: refs/heads/master
Commit: e0b3940839c58402799d75e278f257bd0b7e1180
Parents: a6dfbf6
Author: Mike Percy <mpercy@apache.org>
Authored: Mon Apr 4 12:38:23 2016 -0700
Committer: Mike Percy <mpercy@apache.org>
Committed: Wed Apr 6 19:20:56 2016 +0000

----------------------------------------------------------------------
 build-support/build_source_release.py | 44 ++++++++++++++++++++++++++++++
 build-support/release/README.adoc     | 13 +++++----
 2 files changed, 52 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-kudu/blob/e0b39408/build-support/build_source_release.py
----------------------------------------------------------------------
diff --git a/build-support/build_source_release.py b/build-support/build_source_release.py
index d6973d9..10650b3 100755
--- a/build-support/build_source_release.py
+++ b/build-support/build_source_release.py
@@ -20,8 +20,11 @@
 import hashlib
 import logging
 import os
+import shutil
 import subprocess
 import sys
+import tempfile
+import urllib
 
 from kudu_util import check_output, confirm_prompt, Colors, get_my_email
 
@@ -131,6 +134,46 @@ def gen_checksum_files(tarball_path):
     print Colors.GREEN + ("Generated %s:\t" % extension) + Colors.RESET, path
 
 
+def run_rat(tarball_path):
+  """
+  Run Apache RAT on the source tarball.
+
+  Raises an exception on failure.
+  """
+  if not confirm_prompt("Would you like to run Apache RAT (Release Audit Tool) now?"):
+    return
+
+  # TODO: Cache and call the jar from the maven repo?
+  rat_url = "http://central.maven.org/maven2/org/apache/rat/apache-rat/0.11/apache-rat-0.11.jar"
+
+  tmpdir_path = tempfile.mkdtemp()
+  rat_report_result = ''
+  try:
+    rat_jar_dest = "%s/%s" % (tmpdir_path, os.path.basename(rat_url))
+
+    print "> Downloading RAT jar from " + rat_url
+    urllib.urlretrieve(rat_url, rat_jar_dest)
+
+    print "> Running RAT..."
+    xml = subprocess.check_output(["java", "-jar", rat_jar_dest, "-x", tarball_path])
+    rat_report_dest = "%s/%s" % (tmpdir_path, "rat_report.xml")
+    with open(rat_report_dest, "w") as f:
+        f.write(xml)
+
+    print "> Parsing RAT report..."
+    rat_report_result = subprocess.check_output(
+        ["./build-support/release/check-rat-report.py",
+         "./build-support/release/rat_exclude_files.txt",
+         rat_report_dest],
+        stderr=subprocess.STDOUT)
+    print Colors.GREEN + "RAT: LICENSES APPROVED" + Colors.RESET
+  except subprocess.CalledProcessError as e:
+    print Colors.RED + "RAT: LICENSES NOT APPROVED" + Colors.RESET
+    print e.output
+    raise e
+  finally:
+    shutil.rmtree(tmpdir_path)
+
 def main():
   # Change into the source repo so that we can run git commands without having to
   # specify cwd=BUILD_SUPPORT every time.
@@ -140,6 +183,7 @@ def main():
   tarball_path = create_tarball()
   gen_checksum_files(tarball_path)
   sign_tarball(tarball_path)
+  run_rat(tarball_path)
 
   print Colors.GREEN + "Release successfully generated!" + Colors.RESET
   print

http://git-wip-us.apache.org/repos/asf/incubator-kudu/blob/e0b39408/build-support/release/README.adoc
----------------------------------------------------------------------
diff --git a/build-support/release/README.adoc b/build-support/release/README.adoc
index b54f0ef..cb24852 100644
--- a/build-support/release/README.adoc
+++ b/build-support/release/README.adoc
@@ -15,13 +15,16 @@
 // specific language governing permissions and limitations
 // under the License.
 
-= How to run RAT on a release tarball
+= How to run Apache RAT on a release tarball
 
 Kudu has a script and an excludes file to allow for running RAT on a release
 artifact. You can use the following steps to verify a source tarball.
 
-1. Download a binary artifact of RAT from
-   http://creadur.apache.org/rat/download_rat.cgi and unpack it.
-2. Run RAT: `java -jar apache-rat-0.11.jar -x apache-kudu-X.Y.Z.tar.gz > rat-report.xml`
-3. ./build-support/release/check-rat-report.py build-support/release/rat_exclude_files.txt
rat-report.xml
+1. Download a binary artifact of RAT:
+   `wget http://central.maven.org/maven2/org/apache/rat/apache-rat/0.11/apache-rat-0.11.jar`
+2. Run RAT:
+   `java -jar apache-rat-0.11.jar -x apache-kudu-X.Y.Z.tar.gz > rat-report.xml`
+3. Run the report checker:
+   `./build-support/release/check-rat-report.py build-support/release/rat_exclude_files.txt
rat-report.xml`
 
+The above steps are automatically performed as part of the `build-support/build_source_release.py`
script.


Mime
View raw message