From 6b6221fbc5b5a83656ac16e350c48094db8c0e67 Mon Sep 17 00:00:00 2001 From: "Uwe L. Korn" Date: Thu, 13 Oct 2016 20:51:26 +0200 Subject: [PATCH 1/2] ARROW-336: Run Apache Rat in Travis builds Change-Id: I4388c59732a267447e984cf4c4f6cad324a96284 --- ci/travis_script_cpp.sh | 4 +++ dev/release/02-source.sh | 37 ++++------------------------ dev/release/run-rat.sh | 53 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 62 insertions(+), 32 deletions(-) create mode 100644 dev/release/run-rat.sh diff --git a/ci/travis_script_cpp.sh b/ci/travis_script_cpp.sh index c3bd3b5f207..d555cab3e64 100755 --- a/ci/travis_script_cpp.sh +++ b/ci/travis_script_cpp.sh @@ -16,6 +16,10 @@ set -e : ${CPP_BUILD_DIR=$TRAVIS_BUILD_DIR/cpp-build} +# Check licenses according to Apache policy +git archive HEAD -o arrow-src.tar.gz +./dev/release/run-rat.sh arrow-src.tar.gz + pushd $CPP_BUILD_DIR make lint diff --git a/dev/release/02-source.sh b/dev/release/02-source.sh index 1bbe2e92753..bdaa5cc9340 100644 --- a/dev/release/02-source.sh +++ b/dev/release/02-source.sh @@ -7,9 +7,9 @@ # to you under the Apache License, Version 2.0 (the # "License"); you may not use this file except in compliance # with the License. You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -18,6 +18,8 @@ # under the License. # +SOURCE_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + if [ -z "$1" ]; then echo "Usage: $0 " exit @@ -56,36 +58,7 @@ tarball=$tag.tar.gz # archive (identical hashes) using the scm tag git archive $release_hash --prefix $tag/ -o $tarball -# download apache rat -curl -s https://repo1.maven.org/maven2/org/apache/rat/apache-rat/0.12/apache-rat-0.12.jar > apache-rat-0.12.jar - -RAT="java -jar apache-rat-0.12.jar -d " - -# generate the rat report -$RAT $tarball \ - -e ".*" \ - -e mman.h \ - -e "*_generated.h" \ - -e random.h \ - -e status.cc \ - -e status.h \ - -e asan_symbolize.py \ - -e cpplint.py \ - -e FindPythonLibsNew.cmake \ - -e pax_global_header \ - -e MANIFEST.in \ - -e __init__.pxd \ - -e __init__.py \ - -e requirements.txt \ - > rat.txt -UNAPPROVED=`cat rat.txt | grep "Unknown Licenses" | head -n 1 | cut -d " " -f 1` - -if [ "0" -eq "${UNAPPROVED}" ]; then - echo "No unnaproved licenses" -else - echo "${UNAPPROVED} unapproved licences. Check rat report: rat.txt" - exit -fi +${SOURCE_DIR}/run-rat.sh $tarball # sign the archive gpg --armor --output ${tarball}.asc --detach-sig $tarball diff --git a/dev/release/run-rat.sh b/dev/release/run-rat.sh new file mode 100644 index 00000000000..d8ec6507fc4 --- /dev/null +++ b/dev/release/run-rat.sh @@ -0,0 +1,53 @@ +#!/bin/bash +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# + +# download apache rat +curl -s https://repo1.maven.org/maven2/org/apache/rat/apache-rat/0.12/apache-rat-0.12.jar > apache-rat-0.12.jar + +RAT="java -jar apache-rat-0.12.jar -d " + +# generate the rat report +$RAT $1 \ + -e ".*" \ + -e mman.h \ + -e "*_generated.h" \ + -e random.h \ + -e status.cc \ + -e status.h \ + -e asan_symbolize.py \ + -e cpplint.py \ + -e FindPythonLibsNew.cmake \ + -e pax_global_header \ + -e MANIFEST.in \ + -e __init__.pxd \ + -e __init__.py \ + -e requirements.txt \ + > rat.txt +cat rat.txt +UNAPPROVED=`cat rat.txt | grep "Unknown Licenses" | head -n 1 | cut -d " " -f 1` + +if [ "0" -eq "${UNAPPROVED}" ]; then + echo "No unnaproved licenses" +else + echo "${UNAPPROVED} unapproved licences. Check rat report: rat.txt" + exit 1 +fi + + From 25f797c34fa90261f5e5c0b3b39ab1eb7d49d72b Mon Sep 17 00:00:00 2001 From: "Uwe L. Korn" Date: Fri, 14 Oct 2016 07:09:41 +0200 Subject: [PATCH 2/2] Make run-rat executable Change-Id: Iffe32bb9c8d620fd37ff56bf154ecf849ec34315 --- dev/release/run-rat.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 dev/release/run-rat.sh diff --git a/dev/release/run-rat.sh b/dev/release/run-rat.sh old mode 100644 new mode 100755