diff --git a/.travis.yml b/.travis.yml index e4e623f03b..d33051f57f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,34 +1,6 @@ language: java before_install: - - date - - sudo apt-get update -qq - - sudo apt-get install build-essential - - sudo apt-get install pv - - date - - mkdir protobuf_install - - pushd protobuf_install - - wget https://github.com/google/protobuf/archive/v3.5.1.tar.gz -O protobuf-3.5.1.tar.gz - - tar xzf protobuf-3.5.1.tar.gz - - cd protobuf-3.5.1 - - sudo apt-get install autoconf automake libtool curl make g++ unzip - - ./autogen.sh - - ./configure - - make - - sudo make install - - sudo ldconfig - - protoc --version - - popd - - date - - pwd - - sudo apt-get install -qq libboost-dev libboost-test-dev libboost-program-options-dev libevent-dev automake libtool flex bison pkg-config g++ libssl-dev - - wget -nv http://archive.apache.org/dist/thrift/0.9.3/thrift-0.9.3.tar.gz - - tar zxf thrift-0.9.3.tar.gz - - cd thrift-0.9.3 - - chmod +x ./configure - - ./configure --disable-gen-erl --disable-gen-hs --without-ruby --without-haskell --without-erlang --without-php --without-nodejs - - sudo make install - - cd .. - - date + - bash dev/travis-before_install.sh env: - HADOOP_PROFILE=default TEST_CODECS=uncompressed,brotli diff --git a/dev/travis-before_install-master.sh b/dev/travis-before_install-master.sh new file mode 100644 index 0000000000..2c865ce30f --- /dev/null +++ b/dev/travis-before_install-master.sh @@ -0,0 +1,50 @@ +# 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. + +################################################################################ +# This is a branch-specific script that gets invoked at the end of +# travis-before_install.sh. It is run for the master branch only. +################################################################################ + +fail_the_build= +reduced_pom="$(tempfile)" +shopt -s globstar # Enables ** to match files in subdirectories recursively +for pom in **/pom.xml +do + # Removes the project/version and project/parent/version elements, because + # those are allowed to have SNAPSHOT in them. Also removes comments. + xmlstarlet ed -N pom='http://maven.apache.org/POM/4.0.0' \ + -d '/pom:project/pom:version|/pom:project/pom:parent/pom:version|//comment()' "$pom" > "$reduced_pom" + if grep -q SNAPSHOT "$reduced_pom" + then + if [[ ! "$fail_the_build" ]] + then + printf "Error: POM files in the master branch can not refer to SNAPSHOT versions.\n" + fail_the_build=YES + fi + printf "\nOffending POM file: %s\nOffending content:\n" "$pom" + # Removes every element that does not have SNAPSHOT in it or its + # descendants. As a result, we get a skeleton of the POM file with only the + # offending parts. + xmlstarlet ed -d "//*[count((.|.//*)[contains(text(), 'SNAPSHOT')]) = 0]" "$reduced_pom" + fi +done +rm "$reduced_pom" +if [[ "$fail_the_build" ]] +then + exit 1 +fi diff --git a/dev/travis-before_install.sh b/dev/travis-before_install.sh new file mode 100644 index 0000000000..6d0427972c --- /dev/null +++ b/dev/travis-before_install.sh @@ -0,0 +1,55 @@ +# 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. + +################################################################################ +# This script gets invoked by .travis.yml in the before_install step +################################################################################ + +set -e +date +sudo apt-get update -qq +sudo apt-get install -qq build-essential pv autoconf automake libtool curl make \ + g++ unzip libboost-dev libboost-test-dev libboost-program-options-dev \ + libevent-dev automake libtool flex bison pkg-config g++ libssl-dev xmlstarlet +date +mkdir protobuf_install +pushd protobuf_install +wget https://github.com/google/protobuf/archive/v3.5.1.tar.gz -O protobuf-3.5.1.tar.gz +tar xzf protobuf-3.5.1.tar.gz +cd protobuf-3.5.1 +./autogen.sh +./configure +make +sudo make install +sudo ldconfig +protoc --version +popd +date +pwd +wget -nv http://archive.apache.org/dist/thrift/0.9.3/thrift-0.9.3.tar.gz +tar zxf thrift-0.9.3.tar.gz +cd thrift-0.9.3 +chmod +x ./configure +./configure --disable-gen-erl --disable-gen-hs --without-ruby --without-haskell --without-erlang --without-php --without-nodejs +sudo make install +cd .. +branch_specific_script="dev/travis-before_install-${TRAVIS_BRANCH}.sh" +if [[ -e "$branch_specific_script" ]] +then + . "$branch_specific_script" +fi +date