You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficcontrol.apache.org by da...@apache.org on 2018/06/26 19:44:08 UTC

[trafficcontrol] branch master updated: Add documentation generation to pkg

This is an automated email from the ASF dual-hosted git repository.

dangogh pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficcontrol.git


The following commit(s) were added to refs/heads/master by this push:
     new c6e31b0  Add documentation generation to pkg
c6e31b0 is described below

commit c6e31b08fa2752b78f0ebb1194690f914edc4304
Author: Jonathan Gray <Jo...@comcast.com>
AuthorDate: Mon Jun 25 14:53:59 2018 -0600

    Add documentation generation to pkg
    
    #2463.
---
 build/build.sh                                 | 13 ++++++++
 build/functions.sh                             | 18 +++++++++++
 docs/source/requirements.txt                   |  1 +
 infrastructure/docker/build/Dockerfile-docs    | 44 ++++++++++++++++++++++++++
 infrastructure/docker/build/docker-compose.yml |  8 +++++
 5 files changed, 84 insertions(+)

diff --git a/build/build.sh b/build/build.sh
index c6ee105..1f25211 100755
--- a/build/build.sh
+++ b/build/build.sh
@@ -57,6 +57,19 @@ for p in "${projects[@]}"; do
 		fi
 		continue
 	fi
+	if [[ $p == docs ]]; then
+		if isInGitTree; then
+			echo "-----  Building docs ..."
+			pushd docs
+			make html
+			popd
+			tarball=$(createDocsTarball "${TC_DIR}")
+			ls -l $tarball
+		else
+			echo "---- Skipping docs creation"
+		fi
+		continue
+	fi
 	# strip trailing /
 	p=${p%/}
 	bldscript="$p/build/build_rpm.sh"
diff --git a/build/functions.sh b/build/functions.sh
index cdf8670..b99f17f 100755
--- a/build/functions.sh
+++ b/build/functions.sh
@@ -173,3 +173,21 @@ function createTarball() {
         rm -r "$bndir"
         echo "$tarball"
 }
+
+# ---------------------------------------
+function createDocsTarball() {
+	local projDir=$(cd "$1"; pwd)
+	local projName=trafficcontrol
+	local version=$(getVersion "$TC_DIR")
+	local tarball="dist/apache-$projName-$version-docs.tar.gz"
+	local tardir="${projDir}/docs/build/"
+
+	# Create a BULDNUMBER file and add to tarball
+	local bndir=$(mktemp -d)
+        getBuildNumber >"$bndir/BUILD_NUMBER"
+
+        # create the tarball only from files in repo and BUILD_NUMBER
+        tar -czf "$tarball" -C "$bndir" BUILD_NUMBER -C "$tardir" . --exclude-vcs
+        rm -r "$bndir"
+        echo "$tarball"
+}
diff --git a/docs/source/requirements.txt b/docs/source/requirements.txt
index 0d1765a..92ce080 100644
--- a/docs/source/requirements.txt
+++ b/docs/source/requirements.txt
@@ -13,3 +13,4 @@
 # limitations under the License.
 #
 Sphinx>=1.4.3
+sphinx_rtd_theme>=0.4.0
diff --git a/infrastructure/docker/build/Dockerfile-docs b/infrastructure/docker/build/Dockerfile-docs
new file mode 100644
index 0000000..0ecc315
--- /dev/null
+++ b/infrastructure/docker/build/Dockerfile-docs
@@ -0,0 +1,44 @@
+# 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.
+FROM centos:7
+
+MAINTAINER Jonathan Gray
+
+# top level of trafficcontrol directory must be mounted as a volume:
+# docker run --volume /trafficcontrol:$(pwd) ...
+VOLUME /trafficcontrol
+
+### Common for all sub-component builds
+RUN	yum -y install \
+		epel-release \
+		git \
+		rpm-build && \
+	yum -y clean all
+
+### docs specific requirements
+ADD docs/source/requirements.txt /docs.requirements.txt
+RUN	yum -y install \
+		python-pip \
+		make && \
+	yum -y clean all && \
+	pip install -r /docs.requirements.txt
+###
+
+ADD infrastructure/docker/build/clean_build.sh /
+CMD /clean_build.sh docs
+
+# vi:syntax=Dockerfile
diff --git a/infrastructure/docker/build/docker-compose.yml b/infrastructure/docker/build/docker-compose.yml
index 507cb73..3c1550e 100644
--- a/infrastructure/docker/build/docker-compose.yml
+++ b/infrastructure/docker/build/docker-compose.yml
@@ -91,3 +91,11 @@ services:
     volumes:
       - ../../..:/trafficcontrol:z
     command: ['-f', '/trafficcontrol/dist/weasel.txt', '/trafficcontrol']
+
+  docs:
+    image: docs_builder
+    build:
+      dockerfile: infrastructure/docker/build/Dockerfile-docs
+      context: ../../..
+    volumes:
+      - ../../..:/trafficcontrol:z