BIGTOP-3498. Bump Phoenix to 5.1.0. (#733)

diff --git a/bigtop-packages/src/common/phoenix/do-component-build b/bigtop-packages/src/common/phoenix/do-component-build
index 6525566..e7213d6 100644
--- a/bigtop-packages/src/common/phoenix/do-component-build
+++ b/bigtop-packages/src/common/phoenix/do-component-build
@@ -19,21 +19,10 @@
 
 mvn -DskipTests \
     -Dhadoop.version=$HADOOP_VERSION  \
-    -Dhadoop-two.version=$HADOOP_VERSION  \
     -Dhbase.version=$HBASE_VERSION  \
-    -Dflume.version=$FLUME_VERSION  \
-    -Dspark.version=${SPARK_VERSION} \
-    -Dhive.version=${HIVE_VERSION}  \
+    -Dhbase.profile=${HBASE_VERSION%.*} \
     clean install "$@"
 rm -rf build
 mkdir build
 
-# Make binary tar
-rm -rf $(find . -type d -name archive-tmp);
-
-find -iname phoenix-*.jar -exec cp -n {} build/ \;
-
-cp -R bin build/;
-cp -R phoenix-pherf/config build/bin/
-cp -R examples build/
-cp dev/release_files/* build/
+tar -C build --strip-components=1 -xzf phoenix-assembly/target/phoenix-hbase-${HBASE_VERSION%.*}-${PHOENIX_VERSION}-bin.tar.gz
\ No newline at end of file
diff --git a/bigtop-packages/src/common/phoenix/install_phoenix.sh b/bigtop-packages/src/common/phoenix/install_phoenix.sh
index 6157fa4..8a70a82 100755
--- a/bigtop-packages/src/common/phoenix/install_phoenix.sh
+++ b/bigtop-packages/src/common/phoenix/install_phoenix.sh
@@ -116,10 +116,6 @@
 cp $BUILD_DIR/*.jar $PREFIX/$LIB_DIR/
 cp -r $BUILD_DIR/bin $PREFIX/$LIB_DIR/
 chmod 755 $PREFIX/$BIN_DIR/*.py
-chmod 755 $PREFIX/$BIN_DIR/*.sh
-
-# Remove sources jar
-rm $PREFIX/$LIB_DIR/phoenix-*-sources.jar
 
 cp -a $BUILD_DIR/{LICENSE,NOTICE} $PREFIX/$DOC_DIR/
 cp -ra $BUILD_DIR/examples $PREFIX/$DOC_DIR
@@ -129,16 +125,7 @@
 
 # Create version independent symlinks
 # phoenix-client for clients like sqlline
-ln -s `cd $PREFIX/$LIB_DIR ; ls phoenix*-client.jar | grep -v thin` $PREFIX/$LIB_DIR/phoenix-client.jar
-
-# phoenix-thin-client
-ln -s `cd $PREFIX/$LIB_DIR ; ls phoenix*-thin-client.jar` $PREFIX/$LIB_DIR/phoenix-thin-client.jar
+ln -s `cd $PREFIX/$LIB_DIR ; ls phoenix-client*.jar` $PREFIX/$LIB_DIR/phoenix-client.jar
 
 # phoenix-server for placing on the HBase regionserver classpath
-ln -s `cd $PREFIX/$LIB_DIR ; ls phoenix*-server.jar` $PREFIX/$LIB_DIR/phoenix-server.jar
-
-# phoenix-hive
-ln -s `cd $PREFIX/$LIB_DIR ; ls phoenix*-hive.jar` $PREFIX/$LIB_DIR/phoenix-hive.jar
-
-# phoenix-pig
-ln -s `cd $PREFIX/$LIB_DIR ; ls phoenix*-pig.jar` $PREFIX/$LIB_DIR/phoenix-pig.jar
+ln -s `cd $PREFIX/$LIB_DIR ; ls phoenix-server*.jar` $PREFIX/$LIB_DIR/phoenix-server.jar
diff --git a/bigtop-packages/src/common/phoenix/patch0-PHOENIX-5711.diff b/bigtop-packages/src/common/phoenix/patch0-PHOENIX-5711.diff
deleted file mode 100644
index c8198ae..0000000
--- a/bigtop-packages/src/common/phoenix/patch0-PHOENIX-5711.diff
+++ /dev/null
@@ -1,22 +0,0 @@
-diff --git a/phoenix-client/pom.xml b/phoenix-client/pom.xml
-index b8ee4a2..09cdf60 100644
---- a/phoenix-client/pom.xml
-+++ b/phoenix-client/pom.xml
-@@ -369,7 +369,7 @@
-                     <exclude>META-INF/*.RSA</exclude>
-                     <exclude>META-INF/license/*</exclude>
-                     <exclude>LICENSE.*</exclude>
--                    <exclude>NOTICE.*</exclude>
-+                    <exclude>NOTICE*</exclude>
-                   </excludes>
-                 </filter>
-               </filters>
-@@ -405,7 +405,7 @@
-                     <exclude>META-INF/*.RSA</exclude>
-                     <exclude>META-INF/license/*</exclude>
-                     <exclude>LICENSE.*</exclude>
--                    <exclude>NOTICE.*</exclude>
-+                    <exclude>NOTICE*</exclude>
-                   </excludes>
-                 </filter>
-               </filters>
diff --git a/bigtop-packages/src/common/phoenix/phoenix-queryserver.default b/bigtop-packages/src/common/phoenix/phoenix-queryserver.default
deleted file mode 100644
index 996d3b3..0000000
--- a/bigtop-packages/src/common/phoenix/phoenix-queryserver.default
+++ /dev/null
@@ -1,20 +0,0 @@
-# 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.
-
-export HBASE_CONF_DIR=/etc/hbase/conf/
-
-export PHOENIX_QUERYSERVER_OPTS=
-export PHOENIX_QUERYSERVER_PID_DIR=/var/run/phoenix
-export PHOENIX_QUERYSERVER_LOG_DIR=/var/log/phoenix
diff --git a/bigtop-packages/src/common/phoenix/phoenix-queryserver.svc b/bigtop-packages/src/common/phoenix/phoenix-queryserver.svc
deleted file mode 100644
index 8eb6053..0000000
--- a/bigtop-packages/src/common/phoenix/phoenix-queryserver.svc
+++ /dev/null
@@ -1,79 +0,0 @@
-# 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.
-
-DAEMON="phoenix-queryserver"
-DESC="Phoenix QueryServer"
-EXEC_PATH="/usr/lib/phoenix/bin/queryserver.py"
-SVC_USER="phoenix"
-WORKING_DIR="/usr/lib/phoenix"
-DAEMON_FLAGS=""
-CONF_DIR=""
-PIDFILE="/var/run/phoenix/${SVC_USER}-${DAEMON}.pid"
-
-generate_start() {
-
-cat <<'__EOT__'
-start() {
-    [ -x $EXE_FILE ] || exit $ERROR_PROGRAM_NOT_INSTALLED
-
-    checkstatusofproc
-    status=$?
-    if [ "$status" -eq "$STATUS_RUNNING" ]; then
-        log_success_msg "${DESC} is running"
-        exit 0
-    fi
-
-    LOG_FILE=/var/log/phoenix/${DAEMON}.out
-
-    runuser -s /bin/bash $SVC_USER -c "nohup nice -n 0 $EXEC_PATH start \
-      > $LOG_FILE 2>&1 < /dev/null & "'echo $! '"> $PIDFILE"
-    sleep 3
-
-    checkstatusofproc
-    RETVAL=$?
-
-    if [ $RETVAL -eq $STATUS_RUNNING ]; then
-      touch $LOCKFILE
-      log_success_msg "Started ${DESC} (${DAEMON}): "
-    else
-      log_failure_msg "Failed to start ${DESC}. Return value: $RETVAL"
-    fi
-
-    return $RETVAL
-}
-__EOT__
-
-}
-
-generate_stop() {
-
-cat <<'__EOT__'
-stop() {
-    runuser -s /bin/bash $SVC_USER -c "$EXEC_PATH stop"
-    RETVAL=$?
-
-    if [ $RETVAL -eq $RETVAL_SUCCESS ]; then
-      log_success_msg "Stopped ${DESC}: "
-      rm -f $LOCKFILE $PIDFILE
-    else
-      log_failure_msg "Failure to stop ${DESC}. Return value: $RETVAL"
-    fi
-
-    return $RETVAL
-}
-__EOT__
-
-}
-
diff --git a/bigtop-packages/src/deb/phoenix/control b/bigtop-packages/src/deb/phoenix/control
index 4e1208a..5dae359 100644
--- a/bigtop-packages/src/deb/phoenix/control
+++ b/bigtop-packages/src/deb/phoenix/control
@@ -33,10 +33,3 @@
  tens of millions of rows. Applications interact with Phoenix through a
  standard JDBC interface; all the usual interfaces are supported.
 
-Package: phoenix-queryserver
-Architecture: all
-Depends: phoenix (= ${source:Version})
-Description: The Phoenix Query Server provides an alternative means for 
- interaction with Phoenix and HBase. Soon this will enable access from 
- environments other than the JVM.
-
diff --git a/bigtop-packages/src/deb/phoenix/phoenix.dirs b/bigtop-packages/src/deb/phoenix/phoenix.dirs
deleted file mode 100644
index efefb65..0000000
--- a/bigtop-packages/src/deb/phoenix/phoenix.dirs
+++ /dev/null
@@ -1 +0,0 @@
-/etc/default
diff --git a/bigtop-packages/src/deb/phoenix/rules b/bigtop-packages/src/deb/phoenix/rules
index 7be0a19..4a44f93 100755
--- a/bigtop-packages/src/deb/phoenix/rules
+++ b/bigtop-packages/src/deb/phoenix/rules
@@ -39,13 +39,7 @@
 	mkdir -p debian/tmp/bigtop-empty
 	bash debian/do-component-build -Dmaven.repo.local=${HOME}/.m2/repository
 
-.PHONY: queryserver
-	bash debian/init.d.tmpl debian/${phoenix_pkg_name}-queryserver.svc deb debian/${phoenix_pkg_name}-queryserver.init
-	
-override_dh_auto_install: queryserver
-	cp debian/phoenix.default debian/${phoenix_pkg_name}/etc/default/${phoenix_pkg_name}
-	cp debian/phoenix-queryserver.default debian/${phoenix_pkg_name}/etc/default/${phoenix_pkg_name}-queryserver
+override_dh_auto_install:
 	bash -x debian/install_phoenix.sh \
 	  --build-dir=$${PWD}/build     \
 	  --prefix=debian/tmp
-
diff --git a/bigtop-packages/src/rpm/phoenix/SPECS/phoenix.spec b/bigtop-packages/src/rpm/phoenix/SPECS/phoenix.spec
index 22ffbfe..b06372c 100644
--- a/bigtop-packages/src/rpm/phoenix/SPECS/phoenix.spec
+++ b/bigtop-packages/src/rpm/phoenix/SPECS/phoenix.spec
@@ -46,7 +46,6 @@
 
 %define doc_phoenix %{_docdir}/%{name}
 %define alternatives_cmd update-alternatives
-%global initd_dir %{_sysconfdir}/rc.d
 
 %else
 
@@ -69,7 +68,6 @@
 
 %define doc_phoenix %{_docdir}/%{name}-%{phoenix_version}
 %define alternatives_cmd alternatives
-%global initd_dir %{_sysconfdir}/rc.d/init.d
 
 %endif
 
@@ -84,10 +82,7 @@
 Source0: %{name}-%{phoenix_base_version}-src.tar.gz
 Source1: do-component-build
 Source2: install_phoenix.sh
-Source3: phoenix.default
-Source4: bigtop.bom
-Source5: %{name}-queryserver.svc
-Source6: %{name}-queryserver.default
+Source3: bigtop.bom
 BuildArch: noarch
 Requires: hadoop, hadoop-mapreduce, hadoop-yarn, hbase, zookeeper
 
@@ -106,18 +101,8 @@
 tens of millions of rows. Applications interact with Phoenix through a
 standard JDBC interface; all the usual interfaces are supported.
 
-%package queryserver
-Summary: A stand-alone server that exposes Phoenix to thin clients
-Group: Development/Libraries
-Requires: phoenix = %{version}-%{release}
-
-%description queryserver
-The Phoenix Query Server provides an alternative means for interaction 
-with Phoenix and HBase. Soon this will enable access from environments 
-other than the JVM.
-
 %prep
-%setup -n apache-%{name}-%{phoenix_base_version}-src
+%setup -n %{name}-%{phoenix_base_version}
 #BIGTOP_PATCH_COMMANDS
 
 %build
@@ -126,22 +111,14 @@
 %install
 %__rm -rf $RPM_BUILD_ROOT
 bash %{SOURCE2} \
-	--build-dir=build \
-        --doc-dir=%{doc_phoenix} \
-	--prefix=$RPM_BUILD_ROOT
-
-%__install -d -m 0755 $RPM_BUILD_ROOT/etc/default/
-%__install -m 0644 %{SOURCE3} $RPM_BUILD_ROOT/etc/default/%{name}
-%__install -m 0644 %{SOURCE6} $RPM_BUILD_ROOT/etc/default/%{name}-queryserver
-
-# Install init script
-init_file=$RPM_BUILD_ROOT/%{initd_dir}/%{name}-queryserver
-bash $RPM_SOURCE_DIR/init.d.tmpl $RPM_SOURCE_DIR/%{name}-queryserver.svc rpm $init_file
+  --build-dir=build \
+  --doc-dir=%{doc_phoenix} \
+  --prefix=$RPM_BUILD_ROOT
 
 %pre
 getent group phoenix >/dev/null || groupadd -r phoenix
 getent passwd phoenix >/dev/null || useradd -c "Phoenix" -s /sbin/nologin -g phoenix -r -d %{var_lib_phoenix} phoenix 2> /dev/null || :
-    
+
 %post
 %{alternatives_cmd} --install %{etc_phoenix_conf} %{name}-conf %{etc_phoenix_conf_dist} 30
 
@@ -161,24 +138,3 @@
 %{phoenix_home}/phoenix-*.jar
 %{bin_phoenix}
 %config(noreplace) %{etc_phoenix_conf_dist}
-%config(noreplace) %{_sysconfdir}/default/phoenix
-
-%define service_macro() \
-%files %1 \
-%attr(0755,root,root)/%{initd_dir}/%{name}-%1 \
-%attr(0775,phoenix,phoenix) %{var_lib_phoenix} \
-%attr(0775,phoenix,phoenix) %{var_log_phoenix} \
-%config(noreplace) /etc/default/%{name}-%1 \
-%post %1 \
-chkconfig --add %{name}-%1 \
-\
-%preun %1 \
-if [ "$1" = 0 ] ; then \
-        service %{name}-%1 stop > /dev/null \
-        chkconfig --del %{name}-%1 \
-fi \
-%postun %1 \
-if [ $1 -ge 1 ]; then \
-   service %{name}-%1 condrestart >/dev/null 2>&1 || : \
-fi
-%service_macro queryserver
diff --git a/bigtop.bom b/bigtop.bom
index e25eb0a..4026b0b 100644
--- a/bigtop.bom
+++ b/bigtop.bom
@@ -299,16 +299,10 @@
     'phoenix' {
       name    = 'phoenix'
       relNotes = 'Apache Phoenix: A SQL skin over HBase'
-      /*
-       * phoenix.hbase is used to select the Phoenix release corresponding
-       * to the base HBase version. Update as needed whenever changing the
-       * HBase version in the BOM.
-       */
-      phoenix.hbase ='HBase-1.5'
-      version { base = "4.15.0-${phoenix.hbase}"; pkg = '4.15.0'; release = 1 }
+      version { base = "5.1.0"; pkg = base; release = 1 }
       tarball { destination = "$name-${version.base}-src.tar.gz"
-                source      = "apache-$name-${version.base}-src.tar.gz" }
-      url     { download_path = "/$name/apache-$name-${version.base}/src"
+                source      = destination }
+      url     { download_path = "/$name/$name-${version.base}"
                 site = "${apache.APACHE_MIRROR}/${download_path}"
                 archive = "${apache.APACHE_ARCHIVE}/${download_path}" }
     }