Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 505A9200B43 for ; Tue, 19 Jul 2016 14:32:14 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 4EF85160A76; Tue, 19 Jul 2016 12:32:14 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 746AB160A8B for ; Tue, 19 Jul 2016 14:32:13 +0200 (CEST) Received: (qmail 34812 invoked by uid 500); 19 Jul 2016 12:32:12 -0000 Mailing-List: contact commits-help@hbase.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@hbase.apache.org Delivered-To: mailing list commits@hbase.apache.org Received: (qmail 34406 invoked by uid 99); 19 Jul 2016 12:32:12 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 19 Jul 2016 12:32:12 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 1B7AEE05D9; Tue, 19 Jul 2016 12:32:12 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: busbey@apache.org To: commits@hbase.apache.org Date: Tue, 19 Jul 2016 12:32:14 -0000 Message-Id: In-Reply-To: <273427d478e949c1b6335e8061547cc2@git.apache.org> References: <273427d478e949c1b6335e8061547cc2@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [4/6] hbase git commit: HBASE-16241 Allow specification of annotations to use when running check_compatibility.sh archived-at: Tue, 19 Jul 2016 12:32:14 -0000 HBASE-16241 Allow specification of annotations to use when running check_compatibility.sh * Also some trivial cleanup of spacing to undo poor formatting decisions of the past. Signed-off-by: stack Signed-off-by: Sean Busbey Project: http://git-wip-us.apache.org/repos/asf/hbase/repo Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/ce925890 Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/ce925890 Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/ce925890 Branch: refs/heads/branch-1.2 Commit: ce9258906f2946fa2ab39398319ee5883726ff70 Parents: 4098045 Author: Dima Spivak Authored: Mon Jul 18 12:48:16 2016 -0700 Committer: Sean Busbey Committed: Tue Jul 19 07:30:56 2016 -0500 ---------------------------------------------------------------------- dev-support/check_compatibility.sh | 93 ++++++++++++++++++--------------- 1 file changed, 50 insertions(+), 43 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hbase/blob/ce925890/dev-support/check_compatibility.sh ---------------------------------------------------------------------- diff --git a/dev-support/check_compatibility.sh b/dev-support/check_compatibility.sh index 249124d..d7ae6b5 100755 --- a/dev-support/check_compatibility.sh +++ b/dev-support/check_compatibility.sh @@ -47,6 +47,8 @@ # $ ./check_compatibility.sh 0.98.5 0.98.6 SCRIPT_DIRECTORY=$(dirname ${BASH_SOURCE[0]}) +# Save the InterfaceAudience package name as a variable to make annotation listing more convenient. +IA_PACKAGE="org.apache.hadoop.hbase.classification.InterfaceAudience" # Usage message. usage () { @@ -65,34 +67,41 @@ a branch (e.g. 0.98), or a particular commit hash. If ref2 is omitted, master will be used. Options: - -a, --all Do not filter by interface annotations. - -b, --binary-only Only run the check for binary compatibility. - -f, --force-download Download dependencies (i.e. Java ACC), even if they are - already present. - -h, --help Show this screen. - -j, --java-acc Specify which version of Java ACC to use to run the analysis. This - can be a tag, branch, or commit hash. Defaults to master. - -n, --no-checkout Run the tool without first using Git to checkout the two - HBase versions. If this option is selected, - dev-support/target/compatibility/1 and - dev-support/target compatibility/2 must each be Git repositories. - Also note that the references must still be specified as these are - used when naming the compatibility report. - -o , --options= A comma-separated list of options to pass directly to Java ACC. - -q, --quick Runs Java ACC in quick analysis mode, which disables a - number of checks for things that may break compatibility. - -r , --repo= URL of the HBase Git repository to use. Defaults to Apache - HBase's GitHub (https://github.com/apache/hbase.git). - -s, --source-only Only run the check for source compatibility. + -a, --all Do not filter by interface annotations. + -b, --binary-only Only run the check for binary compatibility. + -f, --force-download Download dependencies (i.e. Java ACC), even if they are + already present. + -h, --help Show this screen. + -j, --java-acc Specify which version of Java ACC to use to run the + analysis. This can be a tag, branch, or commit hash. + Defaults to master. + -l , --annotation-list= A comma-separated list of annotations to limit compatibility + checks to. Defaults to + "${IA_PACKAGE}.Public,${IA_PACKAGE}.LimitedPrivate". + -n, --no-checkout Run the tool without first using Git to checkout the two + HBase versions. If this option is selected, + dev-support/target/compatibility/1 and + dev-support/target compatibility/2 must each be Git + repositories. Also note that the references must still be + specified as these are used when naming the compatibility + report. + -o , --options= A comma-separated list of options to pass directly to Java + ACC. + -q, --quick Runs Java ACC in quick analysis mode, which disables a + number of checks for things that may break compatibility. + -r , --repo= URL of the HBase Git repository to use. Defaults to Apache + HBase's GitHub (https://github.com/apache/hbase.git). + -s, --source-only Only run the check for source compatibility. __EOF } # Allow a user to override which GETOPT to use, as described in the header. GETOPT=${GETOPT:-/usr/bin/env getopt} -# Parse command line arguments and check for proper syntax. -if ! ARG_LIST=$(${GETOPT} -q -o abfhj:no:qr:s \ - -l all,binary-only,force-download,help,java-acc:,no-checkout,options:,quick,repo:,source-only \ +# Parse command line arguments. We split long options (-l) to stay under 100 chars. +if ! ARG_LIST=$(${GETOPT} -q -o abfhj:nl:o:qr:s \ + -l all,annotation-list:,binary-only,force-download,help \ + -l java-acc:,no-checkout,options:,quick,repo:,source-only \ -- "${@}"); then usage >&2 exit 2 @@ -100,44 +109,49 @@ fi eval set -- "${ARG_LIST[@]}" # Set defaults for options in case they're not specified on the command line. +ANNOTATION_LIST=(${IA_PACKAGE}.Public ${IA_PACKAGE}.LimitedPrivate) JAVA_ACC_COMMIT="master" REPO_URL="https://github.com/apache/hbase.git" while ((${#})); do case "${1}" in - -a | --all ) + -a | --all ) ALL=true shift 1 ;; - -b | --binary-only ) + -b | --binary-only ) JAVA_ACC_COMMAND+=(-binary) shift 1 ;; -f | --force-download ) FORCE_DOWNLOAD=true shift 1 ;; - -h | --help ) + -h | --help ) usage exit 0 ;; - -j | --java-acc ) + -j | --java-acc ) JAVA_ACC_COMMIT="${2}" shift 2 ;; - -n | --no-checkout ) + -l | --annotation-list ) + # Process the comma-separated list of annotations and overwrite the default list. + ANNOTATION_LIST=($(tr "," "\n" <<< "${2}")) + shift 2 ;; + -n | --no-checkout ) NO_CHECKOUT=true shift 1 ;; - -q | --quick ) + -q | --quick ) JAVA_ACC_COMMAND+=(-quick) shift 1 ;; - -o | --options ) + -o | --options ) # Process and append the comma-separated list of options into the command array. JAVA_ACC_COMMAND+=($(tr "," "\n" <<< "${2}")) shift 2 ;; - -r | --repo ) + -r | --repo ) REPO_URL="${2}" shift 2 ;; - -s | --source-only ) + -s | --source-only ) JAVA_ACC_COMMAND+=(-source) shift 1 ;; # getopt inserts -- to separate options and positional arguments. - -- ) + -- ) # First, shift past the -- to get to the positional arguments. shift 1 # If there is one positional argument, only was specified. @@ -260,16 +274,8 @@ if [ ! -d ${SCRIPT_DIRECTORY}/target/compatibility/javaACC ] || [ -n "${FORCE_DO fi fi -# Generate annotation list dynamically; this way, there's no chance the file -# gets stale and you have better visiblity into what classes are actually analyzed. -declare -a ANNOTATION_LIST -ANNOTATION_LIST+=(org.apache.hadoop.hbase.classification.InterfaceAudience.Public) -ANNOTATION_LIST+=(org.apache.hadoop.hbase.classification.InterfaceAudience.LimitedPrivate) -if ! [ -f ${SCRIPT_DIRECTORY}/target/compatibility/annotations ]; then - cat > ${SCRIPT_DIRECTORY}/target/compatibility/annotations << __EOF -$(tr " " "\n" <<< "${ANNOTATION_LIST[@]}") -__EOF -fi +# Generate one-per-line list of annotations. +tr " " "\n" <<< "${ANNOTATION_LIST[@]}" > "${SCRIPT_DIRECTORY}/target/compatibility/annotations" # Generate command line arguments for Java ACC. JAVA_ACC_COMMAND+=(-l HBase) @@ -288,4 +294,5 @@ rm -rf ${SCRIPT_DIRECTORY}/target/compatibility/report # compatible, an exit code of 1 if the two versions are not, and several other codes # for various errors. See the tool's website for details. echo "Running the Java API Compliance Checker..." -perl ${SCRIPT_DIRECTORY}/target/compatibility/javaACC/japi-compliance-checker.pl ${JAVA_ACC_COMMAND[@]} +perl "${SCRIPT_DIRECTORY}/target/compatibility/javaACC/japi-compliance-checker.pl" \ + "${JAVA_ACC_COMMAND[@]}"