Repository: hive Updated Branches: refs/heads/master 8777125b3 -> 42187fdbc
HIVE-18883: Add findbugs to yetus pre-commit checks (Sahil Takiar, reviewed by Peter Vary) Project: http://git-wip-us.apache.org/repos/asf/hive/repo Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/42187fdb Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/42187fdb Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/42187fdb Branch: refs/heads/master Commit: 42187fdbc3de0be793319483e2f463b3e8756f20 Parents: 8777125 Author: Sahil Takiar <takiar.sa...@gmail.com> Authored: Wed Apr 11 11:01:11 2018 -0700 Committer: Sahil Takiar <stak...@cloudera.com> Committed: Wed Apr 11 12:08:24 2018 -0700 ---------------------------------------------------------------------- dev-support/yetus-wrapper.sh | 47 ++++++++++++---- .../findbugs/findbugs-exclude.xml | 24 +++++++++ standalone-metastore/pom.xml | 57 +++++++++++++++++++- 3 files changed, 117 insertions(+), 11 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hive/blob/42187fdb/dev-support/yetus-wrapper.sh ---------------------------------------------------------------------- diff --git a/dev-support/yetus-wrapper.sh b/dev-support/yetus-wrapper.sh index 3a814d5..58da1d2 100755 --- a/dev-support/yetus-wrapper.sh +++ b/dev-support/yetus-wrapper.sh @@ -91,6 +91,34 @@ if [[ $? != 0 ]]; then fi HIVE_PATCHPROCESS=${mytmpdir} +CURLBIN=$(command -v curl) + +# Set FindBugs Home +FINDBUGS_VERSION="3.0.1" +if [[ ! -d "${HIVE_PATCHPROCESS}/findbugs-${FINDBUGS_VERSION}/" ]]; then + # Download FindBugs + FINDBUGS_BASEURL="http://prdownloads.sourceforge.net/findbugs/" + FINDBUGS_TARBALL="findbugs-${FINDBUGS_VERSION}.tar" + + pushd "${HIVE_PATCHPROCESS}" >/dev/null + if [[ -n "${CURLBIN}" ]]; then + "${CURLBIN}" -f -s -L -O "${FINDBUGS_BASEURL}/${FINDBUGS_TARBALL}.gz" + if [[ $? != 0 ]]; then + yetus_error "ERROR: yetus-dl: unable to download ${FINDBUGS_BASEURL}/${FINDBUGS_TARBALL}.gz" + exit 1 + fi + fi + + gunzip -c "${FINDBUGS_TARBALL}.gz" | tar xpf - + if [[ $? != 0 ]]; then + yetus_error "ERROR: ${FINDBUGS_TARBALL}.gz is corrupt. Investigate and then remove ${HIVE_PATCHPROCESS} to try again." + exit 1 + fi + popd >/dev/null +fi + +export FINDBUGS_HOME=${HIVE_PATCHPROCESS}/findbugs-${FINDBUGS_VERSION} + ## ## if we've already DL'd it, then short cut ## @@ -102,11 +130,10 @@ fi ## need to DL, etc ## -BASEURL="https://archive.apache.org/dist/yetus/${HIVE_YETUS_VERSION}/" -TARBALL="yetus-${HIVE_YETUS_VERSION}-bin.tar" +YETUS_BASEURL="https://archive.apache.org/dist/yetus/${HIVE_YETUS_VERSION}/" +YETUS_TARBALL="yetus-${HIVE_YETUS_VERSION}-bin.tar" GPGBIN=$(command -v gpg) -CURLBIN=$(command -v curl) pushd "${HIVE_PATCHPROCESS}" >/dev/null if [[ $? != 0 ]]; then @@ -115,9 +142,9 @@ if [[ $? != 0 ]]; then fi if [[ -n "${CURLBIN}" ]]; then - "${CURLBIN}" -f -s -L -O "${BASEURL}/${TARBALL}.gz" + "${CURLBIN}" -f -s -L -O "${YETUS_BASEURL}/${YETUS_TARBALL}.gz" if [[ $? != 0 ]]; then - yetus_error "ERROR: yetus-dl: unable to download ${BASEURL}/${TARBALL}.gz" + yetus_error "ERROR: yetus-dl: unable to download ${YETUS_BASEURL}/${YETUS_TARBALL}.gz" exit 1 fi else @@ -141,9 +168,9 @@ if [[ -n "${GPGBIN}" ]]; then yetus_error "ERROR: yetus-dl: unable to fetch https://dist.apache.org/repos/dist/release/yetus/KEYS" exit 1 fi - "${CURLBIN}" -s -L -O "${BASEURL}/${TARBALL}.gz.asc" + "${CURLBIN}" -s -L -O "${YETUS_BASEURL}/${YETUS_TARBALL}.gz.asc" if [[ $? != 0 ]]; then - yetus_error "ERROR: yetus-dl: unable to fetch ${BASEURL}/${TARBALL}.gz.asc" + yetus_error "ERROR: yetus-dl: unable to fetch ${YETUS_BASEURL}/${YETUS_TARBALL}.gz.asc" exit 1 fi "${GPGBIN}" --homedir "${HIVE_PATCHPROCESS}/.gpg" --import "${HIVE_PATCHPROCESS}/KEYS_YETUS" >/dev/null 2>&1 @@ -151,16 +178,16 @@ if [[ -n "${GPGBIN}" ]]; then yetus_error "ERROR: yetus-dl: gpg unable to import ${HIVE_PATCHPROCESS}/KEYS_YETUS" exit 1 fi - "${GPGBIN}" --homedir "${HIVE_PATCHPROCESS}/.gpg" --verify "${TARBALL}.gz.asc" >/dev/null 2>&1 + "${GPGBIN}" --homedir "${HIVE_PATCHPROCESS}/.gpg" --verify "${YETUS_TARBALL}.gz.asc" >/dev/null 2>&1 if [[ $? != 0 ]]; then yetus_error "ERROR: yetus-dl: gpg verify of tarball in ${HIVE_PATCHPROCESS} failed" exit 1 fi fi -gunzip -c "${TARBALL}.gz" | tar xpf - +gunzip -c "${YETUS_TARBALL}.gz" | tar xpf - if [[ $? != 0 ]]; then - yetus_error "ERROR: ${TARBALL}.gz is corrupt. Investigate and then remove ${HIVE_PATCHPROCESS} to try again." + yetus_error "ERROR: ${YETUS_TARBALL}.gz is corrupt. Investigate and then remove ${HIVE_PATCHPROCESS} to try again." exit 1 fi http://git-wip-us.apache.org/repos/asf/hive/blob/42187fdb/standalone-metastore/findbugs/findbugs-exclude.xml ---------------------------------------------------------------------- diff --git a/standalone-metastore/findbugs/findbugs-exclude.xml b/standalone-metastore/findbugs/findbugs-exclude.xml new file mode 100644 index 0000000..e2c76d0 --- /dev/null +++ b/standalone-metastore/findbugs/findbugs-exclude.xml @@ -0,0 +1,24 @@ +<!-- + 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. +--> +<FindBugsFilter> + <Match> + <Class name="~org.apache.hadoop.hive.metastore.parser.*" /> + </Match> + <Match> + <Class name="~org.apache.hadoop.hive.metastore.api.*" /> + </Match> +</FindBugsFilter> http://git-wip-us.apache.org/repos/asf/hive/blob/42187fdb/standalone-metastore/pom.xml ---------------------------------------------------------------------- diff --git a/standalone-metastore/pom.xml b/standalone-metastore/pom.xml index 5a9ca04..c340fe2 100644 --- a/standalone-metastore/pom.xml +++ b/standalone-metastore/pom.xml @@ -422,6 +422,39 @@ </plugins> </build> </profile> + <profile> + <id>findbugs</id> + <build> + <plugins> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>findbugs-maven-plugin</artifactId> + <version>3.0.0</version> + <configuration> + <fork>true</fork> + <maxHeap>2048</maxHeap> + <jvmArgs>-Djava.awt.headless=true -Xmx2048m -Xms512m</jvmArgs> + <excludeFilterFile>${basedir}/findbugs/findbugs-exclude.xml</excludeFilterFile> + </configuration> + </plugin> + </plugins> + </build> + <reporting> + <plugins> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>findbugs-maven-plugin</artifactId> + <version>3.0.0</version> + <configuration> + <fork>true</fork> + <maxHeap>2048</maxHeap> + <jvmArgs>-Djava.awt.headless=true -Xmx2048m -Xms512m</jvmArgs> + <excludeFilterFile>${basedir}/findbugs/findbugs-exclude.xml</excludeFilterFile> + </configuration> + </plugin> + </plugins> + </reporting> + </profile> <!-- <profile> <id>checkin</id> @@ -592,7 +625,6 @@ </execution> </executions> </plugin> - <!-- TODO MS-SPLIT findbugs plugin --> <!-- TODO MS-SPLIT javadoc plugin --> <plugin> <groupId>org.apache.maven.plugins</groupId> @@ -618,6 +650,29 @@ </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-enforcer-plugin</artifactId> + <executions> + <execution> + <id>enforce-banned-dependencies</id> + <goals> + <goal>enforce</goal> + </goals> + <configuration> + <rules> + <bannedDependencies> + <excludes> + <!--LGPL licenced library--> + <exclude>com.google.code.findbugs:annotations</exclude> + </excludes> + </bannedDependencies> + </rules> + <fail>true</fail> + </configuration> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-failsafe-plugin</artifactId> <version>2.20.1</version> <executions>