HTRACE-249 Script and doc on how to publish website
bin/publish_hbase_website.sh
Script copied from hbase written by Misty Stanley Jones.
Changed the hbase references to htrace and removed hbase-specific
checking.
htrace-hbase/pom.xml
Need hbase-common to build javadoc so can build htrace site
src/main/site/markdown/building.md
New file on how to build, release and publish to website.
Currently just how to publish to website.
src/main/site/markdown/index.md
Add news of releases.
src/main/site/site.xml
Add references to new building.md file so shows in menu.
diff --git a/bin/publish_hbase_website.sh b/bin/publish_hbase_website.sh
new file mode 100755
index 0000000..0248fe4
--- /dev/null
+++ b/bin/publish_hbase_website.sh
@@ -0,0 +1,217 @@
+#!/usr/bin/env 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.
+
+USAGE="Usage: $0 [-i | -a] [-g <dir>] [-s <dir>]\n\
+-h Show this message\n\
+-i Prompts the user for input\n\
+-a Does not prompt the user. Potentially dangerous.\n\
+-g The local location of the HTrace git repository\n\
+-s The local location of the HTrace website svn checkout\n\
+Either -i or -a is required.\n\
+Edit the script to set default Git and SVN directories."
+
+if [ "$#" == "0" ]; then
+ echo -e "$USAGE"
+ exit 1
+fi
+
+# Process args
+INTERACTIVE=
+AUTO=
+GIT_DIR=
+SVN_DIR=
+while getopts "hiag:s:" OPTION
+do
+ case $OPTION in
+ h)
+ echo -e "$USAGE"
+ exit
+ ;;
+ i)
+ INTERACTIVE=1
+ ;;
+ a)
+ # We don't actually use this variable but require it to be
+ # set explicitly because it will commit changes without asking
+ AUTO=1
+ ;;
+ g)
+ GIT_DIR=$OPTARG
+ ;;
+ s)
+ SVN_DIR=$OPTARG
+ ;;
+ esac
+done
+
+if [ $INTERACTIVE ] && [ $AUTO ]; then
+ echo "Only one of -i or -a can be used."
+ echo -e $USAGE
+ exit 1
+fi
+
+# Set GIT_DIR and SVN_DIR to defaults if not given
+if [ ! "${GIT_DIR}" ]; then
+ GIT_DIR=~/git/htrace
+fi
+if [ ! "${SVN_DIR}" ]; then
+ SVN_DIR=~/svn/htrace.incubator.apache.org/master
+fi
+
+# Check that GIT_DIR and SVN_DIR exist
+if [ ! -d "${GIT_DIR}" -o ! -d "${SVN_DIR}" ]; then
+ echo "Both the GIT and SVN directories must exist."
+ echo -e $USAGE
+ exit 1
+fi
+
+cd $GIT_DIR
+
+# Get the latest
+echo "Updating Git"
+git checkout master
+git pull
+
+# Generate the site to ~/git/htrace/target/stage
+if [ $INTERACTIVE ]; then
+ read -p "Build the site? (y/n)" yn
+ case $yn in
+ [Yy]* )
+ mvn clean package javadoc:aggregate site site:stage -DskipTests
+ status=$?
+ if [ $status != 0 ]; then
+ echo "The website does not build. Aborting."
+ exit $status
+ fi
+ ;;
+ [Nn]* )
+ echo "Not building the site."
+ ;;
+ esac
+else
+ echo "Building the site in auto mode."
+ mvn clean package javadoc:aggregate site site:stage -DskipTests
+ status=$?
+ if [ $status != 0 ]; then
+ echo "The website does not build. Aborting."
+ exit $status
+ fi
+fi
+
+
+# Refresh the local copy of the live website
+echo "Updating Subversion..."
+cd $SVN_DIR
+# Be aware that this will restore all the files deleted a few lines down
+# if you are debugging this script
+# and need to run it multiple times without svn committing
+svn update > /dev/null
+
+# Get current size of svn directory and # files, for sanity checking before commit
+SVN_OLD_SIZE=`du -sm . |awk '{print $1}'`
+SVN_OLD_NUMFILES=`find . -type f |wc -l |awk '{print $1}'`
+
+# Delete known auto-generated content from trunk
+echo "Deleting known auto-generated content from SVN"
+rm -rf apidocs devapidocs xref xref-test book book.html java.html
+
+# Copy generated site to svn -- cp takes different options on Darwin and GNU
+echo "Copying the generated site to SVN"
+if [ `uname` == "Darwin" ]; then
+ COPYOPTS='-r'
+elif [ `uname` == "Linux" ]; then
+ COPYOPTS='-au'
+fi
+
+cp $COPYOPTS "${GIT_DIR}"/target/site/* .
+
+# Look for things we need to fix up in svn
+
+echo "Untracked files: svn add"
+svn status |grep '?' |sed -e "s/[[:space:]]//g"|cut -d '?' -f 2|while read i
+ do svn add $i
+done
+
+echo "Locally deleted files: svn del"
+svn status |grep '!' |sed -e "s/[[:space:]]//g"|cut -d '!' -f 2|while read i
+ do svn del $i
+done
+
+# Display the proposed changes. I filtered out
+# modified because there are so many.
+if [ $INTERACTIVE ]; then
+ svn status |grep -v '^M'|less -P "Enter 'q' to exit the list."
+else
+ echo "The following changes will be made to SVN."
+ svn status
+fi
+
+# Get current size of svn directory, for sanity checking before commit
+SVN_NEW_SIZE=`du -sm . |awk '{print $1}'`
+SVN_NEW_NUMFILES=`find . -type f |wc -l |awk '{print $1}'`
+
+# Get difference between new and old size and number of files
+# We don't care about negatives so remove the sign
+SVN_SIZE_DIFF=`expr $SVN_NEW_SIZE - $SVN_OLD_SIZE|sed 's/-//g'`
+SVN_NUM_DIFF=`expr $SVN_NEW_NUMFILES - $SVN_OLD_NUMFILES|sed 's/-//g'`
+
+# The whole site is only 500 MB so a difference of 10 MB is huge
+# In this case, we should abort because something is wrong
+# Leaving this commented out for now until we get some benchmarks
+#if [ $SVN_SIZE_DIFF > 10 -o $SVN_NUM_DIFF > 50 ]; then
+# echo "This commit would cause the website to change sizes by \
+# $SVN_DIFF MB and $SVN_NUM_DIFF files. There is likely a problem.
+# Aborting."
+# exit 1
+#fi
+
+
+if [ $INTERACTIVE ]; then
+ read -p "Commit changes? This will publish the website. (y/n)" yn
+ case $yn in
+ [Yy]* )
+ echo "Published website using script in interactive mode. \
+This commit changed the size of the website by $SVN_SIZE_DIFF MB \
+and the number of files by $SVN_NUM_DIFF files." |tee commit.txt
+ cat /tmp/out.txt >> /tmp/commit.txt
+ svn commit -F /tmp/commit.txt
+ exit
+ ;;
+ [Nn]* )
+ read -p "Revert SVN changes? (y/n)" revert
+ case $revert in
+ [Yy]* )
+ svn revert -R .
+ svn update
+ exit
+ ;;
+ [Nn]* )
+ exit
+ ;;
+ esac
+ ;;
+ esac
+else
+ echo "Published website using script in auto mode. This commit \
+changed the size of the website by $SVN_SIZE_DIFF MB and the number of files \
+by $SVN_NUM_DIFF files." |tee /tmp/commit.txt
+ cat /tmp/out.txt >> /tmp/commit.txt
+ svn commit -F /tmp/commit.txt
+fi
+
diff --git a/htrace-hbase/pom.xml b/htrace-hbase/pom.xml
index 4cd6375..89db195 100644
--- a/htrace-hbase/pom.xml
+++ b/htrace-hbase/pom.xml
@@ -156,6 +156,13 @@
</dependency>
<!-- HBase specific deps. -->
<dependency>
+ <!--Needed for javadoc generation-->
+ <groupId>org.apache.hbase</groupId>
+ <artifactId>hbase-common</artifactId>
+ <version>${hbase.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
<groupId>org.apache.hbase</groupId>
<artifactId>hbase-client</artifactId>
<version>${hbase.version}</version>
diff --git a/src/main/site/markdown/building.md b/src/main/site/markdown/building.md
new file mode 100644
index 0000000..d5755af
--- /dev/null
+++ b/src/main/site/markdown/building.md
@@ -0,0 +1,45 @@
+<!---
+ Licensed 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. See accompanying LICENSE file.
+-->
+
+# Building HTrace
+## Publishing a Release Candidate
+TODO
+
+## Publishing htrace.incubator.apache.org website
+Checkout the current website. It is in svn (that's right, subversion).
+The website is in a distinct location such that when its' content is svn
+committed, the commit is published as `htrace.incubator.apache.org`.
+
+Here is how you'd check out the current site into a directory named
+`htrace.incubator.apache.org` in the current directory:
+
+ $ svn checkout https://svn.apache.org/repos/asf/incubator/htrace/site/publish htrace.incubator.apache.org
+
+Next, run the site publishing script at `${HTRACE_CHECKOUT_DIR}/bin/publish_hbase_website.sh`.
+It will dump out usage information that looks like this:
+ $ ./bin/publish_hbase_website.sh
+ Usage: ./bin/publish_hbase_website.sh [-i | -a] [-g <dir>] [-s <dir>]
+ -h Show this message
+ -i Prompts the user for input
+ -a Does not prompt the user. Potentially dangerous.
+ -g The local location of the HTrace git repository
+ -s The local location of the HTrace website svn checkout
+Either -i or -a is required.
+Edit the script to set default Git and SVN directories.
+
+To run the publish site script interactively, here is an example where
+the git checkout is at `~/checkouts/incubator-htrace` and the svn checkout
+is at `~/checkouts/htrace.incubator.apache.org`:
+
+ $ ./bin/publish_hbase_website.sh -i -g ~/checkouts/incubator-htrace -s ~/checkouts/htrace.incubator.apache.org/
diff --git a/src/main/site/markdown/index.md b/src/main/site/markdown/index.md
index 9207690..96d0e91 100644
--- a/src/main/site/markdown/index.md
+++ b/src/main/site/markdown/index.md
@@ -18,6 +18,8 @@
Formerly, HTrace was available at org.htrace.
+* htrace-4.0.0-incubating published September 15th, 2015. [Download it!](http://www.apache.org/dyn/closer.cgi/incubator/htrace/)
+* htrace-3.2.0-incubating published June 2nd, 2015. [Download it!](http://www.apache.org/dyn/closer.cgi/incubator/htrace/)
* We made our first release from Apache Incubator, htrace-3.1.0-incubating, January 20th, 2015. [Download it!](http://www.apache.org/dyn/closer.cgi/incubator/htrace/)
diff --git a/src/main/site/site.xml b/src/main/site/site.xml
index ce97490..4197159 100644
--- a/src/main/site/site.xml
+++ b/src/main/site/site.xml
@@ -45,6 +45,7 @@
<item name="Modules" href="modules.html" />
<item name="Project Info" href="project-info.html" />
<item name="Team" href="team-list.html" />
+ <item name="Building" href="building.html" />
</menu>
<menu name="ASF">
<item name="Apache Software Foundation" href="http://www.apache.org/foundation/" />