Merge pull request #17 from apache/de-pkg

Only automate/build Docker images in this repo
diff --git a/.travis.yml b/.travis.yml
index 2747b6f..66f9d15 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,87 +1,41 @@
-sudo: required
+dist: xenial
 
 language: minimal
 
+services:
+  - docker
+
 # Avoid double build on PRs (See https://github.com/travis-ci/travis-ci/issues/1147)
 branches:
   only:
     - master
 
-services:
-  - docker
-
 env:
-  global:
-    - TARBALL_URL=https://dist.apache.org/repos/dist/release/couchdb/source/2.2.0/apache-couchdb-2.2.0.tar.gz
-    - TARBALL=apache-couchdb-2.2.0.tar.gz
-
-matrix:
-  include:
-    - name: "debian-jessie base"
-      env: PLATFORM=debian-jessie TARGET=base
-    - name: "debian-jessie js-no-rebuild"
-      env: PLATFORM=debian-jessie TARGET=js-no-rebuild
-    - name: "debian-jessie couch"
-      env: PLATFORM=debian-jessie TARGET=couch
-    - name: "debian-jessie couch-pkg"
-      env: PLATFORM=debian-jessie TARGET=couch-pkg
-    - name: "debian-stretch base"
-      env: PLATFORM=debian-stretch TARGET=base
-    - name: "debian-stretch js-no-rebuild"
-      env: PLATFORM=debian-stretch TARGET=js-no-rebuild
-    - name: "debian-stretch couch"
-      env: PLATFORM=debian-stretch TARGET=couch
-    - name: "debian-stretch couch-pkg"
-      env: PLATFORM=debian-stretch TARGET=couch-pkg
-    - name: "ubuntu-trusty base"
-      env: PLATFORM=ubuntu-trusty TARGET=base
-    - name: "ubuntu-trusty js-no-rebuild"
-      env: PLATFORM=ubuntu-trusty TARGET=js-no-rebuild
-    - name: "ubuntu-trusty couch"
-      env: PLATFORM=ubuntu-trusty TARGET=couch
-    - name: "ubuntu-trusty couch-pkg"
-      env: PLATFORM=ubuntu-trusty TARGET=couch-pkg
-    - name: "ubuntu-xenial base"
-      env: PLATFORM=ubuntu-xenial TARGET=base
-    - name: "ubuntu-xenial js-no-rebuild"
-      env: PLATFORM=ubuntu-xenial TARGET=js-no-rebuild
-    - name: "ubuntu-xenial couch"
-      env: PLATFORM=ubuntu-xenial TARGET=couch
-    - name: "ubuntu-xenial couch-pkg"
-      env: PLATFORM=ubuntu-xenial TARGET=couch-pkg
-    - name: "ubuntu-bionic base"
-      env: PLATFORM=ubuntu-bionic TARGET=base
-    - name: "ubuntu-bionic js-no-rebuild"
-      env: PLATFORM=ubuntu-bionic TARGET=js-no-rebuild
-    - name: "ubuntu-bionic couch"
-      env: PLATFORM=ubuntu-bionic TARGET=couch
-    - name: "ubuntu-bionic couch-pkg"
-      env: PLATFORM=ubuntu-bionic TARGET=couch-pkg
-    - name: "centos-6 base"
-      env: PLATFORM=centos-6 TARGET=base
-    - name: "centos-6 js-no-rebuild"
-      env: PLATFORM=centos-6 TARGET=js-no-rebuild
-    - name: "centos-6 couch"
-      env: PLATFORM=centos-6 TARGET=couch
-    - name: "centos-6 couch-pkg"
-      env: PLATFORM=centos-6 TARGET=couch-pkg
-    - name: "centos-7 base"
-      env: PLATFORM=centos-7 TARGET=base
-    - name: "centos-7 js-no-rebuild"
-      env: PLATFORM=centos-7 TARGET=js-no-rebuild
-    - name: "centos-7 couch"
-      env: PLATFORM=centos-7 TARGET=couch
-    - name: "centos-7 couch-pkg"
-      env: PLATFORM=centos-7 TARGET=couch-pkg
+  matrix:
+    - PLATFORM=debian-jessie TARGET=base
+    - PLATFORM=debian-jessie TARGET=platform
+    - PLATFORM=debian-jessie TARGET=couch
+    - PLATFORM=debian-stretch TARGET=base
+    - PLATFORM=debian-stretch TARGET=platform
+    - PLATFORM=debian-stretch TARGET=couch
+    - PLATFORM=ubuntu-trusty TARGET=base
+    - PLATFORM=ubuntu-trusty TARGET=platform
+    - PLATFORM=ubuntu-trusty TARGET=couch
+    - PLATFORM=ubuntu-xenial TARGET=base
+    - PLATFORM=ubuntu-xenial TARGET=platform
+    - PLATFORM=ubuntu-xenial TARGET=couch
+    - PLATFORM=ubuntu-bionic TARGET=base
+    - PLATFORM=ubuntu-bionic TARGET=platform
+    - PLATFORM=ubuntu-bionic TARGET=couch
+    - PLATFORM=centos-6 TARGET=base
+    - PLATFORM=centos-6 TARGET=platform
+    - PLATFORM=centos-6 TARGET=couch
+    - PLATFORM=centos-7 TARGET=base
+    - PLATFORM=centos-7 TARGET=platform
+    - PLATFORM=centos-7 TARGET=couch
 
 before_install:
   - docker --version
-  - if [[ ${TARGET} == "js-no-rebuild" ]]; then docker pull couchdbdev/${PLATFORM}-base; fi
-  - if [[ ${TARGET} == "couch-pkg" ]]; then wget ${TARBALL_URL}; fi
-  - if [[ ${TARGET} == "couch-pkg" ]]; then docker pull couchdbdev/${PLATFORM}-erlang-19.3.6; fi
 
 script:
-  - if [[ ${TARGET} == "couch-pkg" ]]; then ./build.sh ${TARGET} ${PLATFORM} ${TARBALL}; else ./build.sh ${TARGET} ${PLATFORM}; fi
-
-after_script:
-  - ls -laR js couch
+  - ./build.sh ${TARGET} ${PLATFORM}
diff --git a/README.md b/README.md
index 743e037..ac5bf42 100644
--- a/README.md
+++ b/README.md
@@ -1,23 +1,31 @@
 # CouchDB Continuous Integration (CI) support repo
 
-The main purpose of this repository is to provide a number of Docker containers, Ansible roles/tasks and other configuration functionality so that the ASF Jenkins CI server (https://builds.apache.org/) is capable of building (and eventually packaging) CouchDB for a number of platforms. It intends to cover a range of both operating systems (Linux, macOS, BSD, Windows) and Erlang versions (17.x, 18.x, 19.x, etc.)
+The main purpose of this repository is to provide scripts that:
 
-The current configuration builds CouchDB, Fauxton, its documentation, and runs the Erlang and JS test suites for each combination of OS and Erlang revision.
+* Install the necessary build-time dependencies for CouchDB on a number of platforms, either inside or outside of a container or VM
+* Build Docker containers with those dependencies necessary to build binary JavaScript (SpiderMonkey 1.8.5) packages
+* Build Docker containers with all dependencies necessary to build CouchDB, including Erlang and JavaScript
 
-# Supported Configurations (updated 2018-05-19)
+It intends to cover a range of both operating systems (Linux, macOS, BSD, Windows) and Erlang versions (17.x, 18.x, 19.x, etc.)
 
-**OS / distro** | **Version** | **Erlang Version**
-----------------|-------------|-----------------------
-**ubuntu**      | trusty      | 19.3.6
-**ubuntu**      | xenial      | 19.3.6
-**ubuntu**      | bionic      | 19.3.6
-**debian**      | jessie      | 17.5.3
-**debian**      | jessie      | 19.3.6
-**debian**      | stretch     | 19.3.6
-**centos**      | 6           | 19.3.6
-**centos**      | 7           | 19.3.6
+These images are used by [Apache Jenkins CI](https://builds.apache.org/blue/organizations/jenkins/CouchDB/branches/) to build CouchDB with every checkin to `master` or a release branch (*e.g.*, `2.3.0`).
 
-CouchDB's CI build philosophy is to use Travis (with `kerl`) to validate CouchDB against different Erlang versions, and to use Jenkins to validate CouchDB against different OSes and architectures. Where possible, Jenkins also auto-builds convenience binaries or packages.
+CouchDB's CI build philosophy is to use Travis (with `kerl`) to validate CouchDB against different Erlang versions, and to use Jenkins to validate CouchDB against different OSes and architectures. Where possible, Jenkins also auto-builds convenience binaries or packages. The eventual goal is that these auto-built binaries/packages/Docker images will be auto-pushed to our distribution repos for downstream consumption.
+
+# Supported Configurations (updated 2018-12-05)
+
+**OS / distro** | **Version** | **Erlang Version** | **Architecture** | **Docker?**
+----------------|-------------|--------------------|------------------|--------------------
+**debian**      | jessie      | 17.5.3             | `x86_64`         | :heavy_check_mark:
+**debian**      | jessie      | 19.3.6             | `x86_64`         | :heavy_checK_mark:
+**debian**      | stretch     | 19.3.6             | `x86_64`         | :heavy_checK_mark:
+**ubuntu**      | trusty      | 19.3.6             | `x86_64`         | :heavy_checK_mark:
+**ubuntu**      | xenial      | 19.3.6             | `x86_64`         | :heavy_checK_mark:
+**ubuntu**      | bionic      | 19.3.6             | `x86_64`         | :heavy_checK_mark:
+**centos**      | 6           | 19.3.6             | `x86_64`         | :heavy_checK_mark:
+**centos**      | 7           | 19.3.6             | `x86_64`         | :heavy_checK_mark:
+**freebsd**     | 11.x        | *default*          | `x86_64`         | :x:
+**freebsd**     | 12.0        | *default*          | `x86_64`         | :x:
 
 ---
 
@@ -25,20 +33,31 @@
 
 For those OSes that support Docker, we run builds inside of Docker containers. These containers are built using the `build.sh` command at the root level.
 
-Separate targets exist to build a compatible SpiderMonkey 1.8.5 package for each Linux target release, known as the `-base` image.
+## Building a "base image"
 
-## Building a container
+The base images include all of the build dependencies necessary to build CouchDB **except** for Erlang and SpiderMonkey 1.8.5. These images are typically used to build the CouchDB SpiderMonkey 1.8.5 binaries for a given OS/version/architecture combination.
+
+Build a base image with:
+
+```
+./build.sh base <distro>-<version>
+```
+
+## Building a "platform image"
+
+The platform images include all of the build dependencies necessary to build and full test CouchDB on a given OS/version/architecture combination.
+
+Build a platform image with:
 
 ```
 ./build.sh platform <distro>-<version>
 ```
 
-Valid `distro` and `version` values come from the table above.
-
-## Building the special Debian Jessie 17.5.3 image
+## Building the special Debian Jessie 17.5.3 `x86_64` image
 
 We use this image to build the initial tarball, before running the build test on other platforms. We do this because we want to generate a `rebar` binary compatible with all versions of Erlang we support. If we do this on too new a version, older Erlangs won't recognize it. At present, Erlang 17 is the oldest version we still support.
 
+The build command is:
 ```
 ERLANGVERSION=17.5.3 ./build.sh platform debian-jessie
 ```
@@ -61,33 +80,23 @@
 
 Recognized commands:
   clean <plat>          Removes all images for <plat>.
-  clean-all             Cleans all images for all platforms.
+  clean-all             Removes all images for all platforms & base images.
 
   base <plat>           Builds the base (no JS/Erlang) image for <plat>.
   base-all              Builds all base (no JS/Erlang) images.
-  base-upload           Uploads the couchdbdev/*-base images to Docker Hub.
-                        Requires appropriate credentials.
-  base-upload-all       Uploads all the couchdbdev/*-base images.
-
-  js                    Builds the JS packages for <plat>.
-  js-all                Builds the JS packages for all platforms.
-  js-no-rebuild         Builds the JS packages for <plat> without rebuilding
-                        the base image first.
-  js-all-no-rebuild     Same as above, with the same condition.
-  js-upload <plat>      Uploads the JS packages for <plat> to bintray.
-                        Requires BINTRAY_USER and BINTRAY_API_KEY env vars.
+  *base-upload          Uploads the specified couchdbdev/*-base image
+                        to Docker Hub.
+  *base-upload-all      Uploads all the couchdbdev/*-base images.
 
   platform <plat>       Builds the image for <plat> with Erlang & JS support.
   platform-all          Builds all images with Erlang and JS support.
-  platform-upload       Uploads the couchdbdev/*-erlang-* images to Docker Hub.
-                        Requires appropriate credentials.
-  platform-upload-all   Uploads all the couchdbdev/*-erlang-* images to Docker.
+  *platform-upload      Uploads the couchdbdev/*-erlang-* images to Docker Hub.
+  *platform-upload-all  Uploads all the couchdbdev/*-erlang-* images to Docker.
 
   couch <plat>          Builds and tests CouchDB for <plat>.
   couch-all             Builds and tests CouchDB on all platforms.
 
-  couch-pkg <plat>      Builds CouchDB packages for <plat>.
-  couch-pkg-all         Builds CouchDB packages for all platforms.
+  Commands marked with * require appropriate Docker Hub credentials.
 ```
 
 ## Interactively working in a built container
@@ -108,28 +117,16 @@
 
 ## Building SpiderMonkey 1.8.5 convenience packages
 
-The Linux docker containers are also used to build suitable SpiderMonkey 1.8.5 binary packages.
+After building the base image as above, head over to the [apache/couchdb-pkg](https://github.com/apache/couchdb-pkg) repository and follow the instructions there.
 
-```
-./build.sh js <distro>-<version>
-```
+## Adding support for a new release/platform/architecture
 
-To build packages for all supported platforms:
-
-```
-./build.sh js-all
-```
-
-## Adding support for a new release/platform
-
-1. Copy and customize an appropriate Dockerfile in the `dockerfiles` directory.
-1. Build a base image using `./build.sh base <distro>-<version>`. Solve any problems with the build process here.
-1. Build the JS packages using `./build.sh js <distro>-<version>`. Again, fix any problems that arise.
-1. Publish the new JS packages with `./build.sh js-upload <distro>-<version>`.
-1. Build the full platform image with `./build.sh platform <distro>-<version>`.
-1. Publish the new image with `./build.sh platform-upload <distro>-<version>`.
-1. Be sure to add the new platform to Apache CouchDB's `Jenkinsfile`.
-1. Push any changes to this repo, or to `couchdb-pkg`, out for review and merging.
+1. Update the build scripts in the `bin/` directory to install the dependencies correctly on your new OS/version/platform. Push a PR with these changes.
+1. Copy and customize an appropriate Dockerfile in the `dockerfiles` directory for your new OS.
+1. Build a base image using `./build.sh base <distro>-<version>`. Solve any problems with the build process here. Add your new platform combination to the `.travis.yml` file, then push a PR with these changes.
+1. Using the [apache/couchdb-pkg](https://github.com/apache/couchdb-pkg) repository, validate you can build the JS package. Fix any problems in that repo that arise and raise a new PR. Open a new issue on that PR requesting that the JS packages be made available through the CouchDB repository/download infrastructure.
+1. Build a full platform image with `./build.sh platform <distro>-<version>`. Solve any problems with the build process here. Add your new platform combination to the `.travis.yml` file, then push a PR with these changes.
+1. Submit a PR against the [apache/couchdb](https://github.com/apache/couchdb) repository, adding the new platform to the top level `Jenkinsfile`. Ask if you need help.
 
 ---
 
@@ -137,15 +134,14 @@
 
 We are eager for contributions to enhance the build scripts to support setting up machines with the necessary build environment for:
 
-* FreeBSD
 * NetBSD
 * OpenBSD
 * macOS
-* Windows x64
+* Windows x64 (see [apache/couchdb-glazier](https://github.com/apache/couchdb-glazier]) for the current approach)
 
 as well as alternative architectures for the already supported image types (arm, ppc64le, s390x, sparc, etc).
 
-We know that Docker won't support most of these, but we should be able to at least expand the install scripts for all of these platforms (save Win x64).
+We know that Docker won't support some of these, but we should be able to at least expand the install scripts for all of these platforms.
 
 # Background 
 
@@ -153,4 +149,3 @@
 * this [thread](https://www.mail-archive.com/dev%40couchdb.apache.org/msg43591.html) on the couchdb-dev mailing list and
 * this [ASF Infra ticket](https://issues.apache.org/jira/browse/INFRA-10126).
 for the origins of this work.
-
diff --git a/bin/build-couchdb-pkg.sh b/bin/build-couchdb-pkg.sh
deleted file mode 100755
index e7a30e8..0000000
--- a/bin/build-couchdb-pkg.sh
+++ /dev/null
@@ -1,65 +0,0 @@
-#!/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.
-
-# This shell script builds and tests CouchDB on the current host.
-# It assumes the build environment is already set up correctly.
-# It needs no special privileges.
-
-# stop on error
-set -e
-
-SCRIPTPATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
-
-. ${SCRIPTPATH}/detect-os.sh
-
-redhats='(rhel|centos|fedora)'
-debians='(debian|ubuntu)'
-
-cd /home/jenkins
-
-if [[ $1 ]]; then
-  # use copied package
-  mkdir couchdb
-  tar -xf ${SCRIPTPATH}/../$1 -C couchdb
-  cp ${SCRIPTPATH}/../$1 couchdb
-else
-  # use master branch
-  git clone https://github.com/apache/couchdb
-  cd couchdb
-  ./configure -c
-  make dist
-  cd ..
-fi
-
-# now, build the package
-cd couchdb-pkg
-platform=${ID}-${VERSION_CODENAME}
-make $platform PLATFORM=${VERSION_CODENAME}
-
-# and save the output
-if [[ ${ID} =~ ${redhats} ]]; then
-  mv ../rpmbuild/RPMS/* ${SCRIPTPATH}/../couch/$platform
-elif [[ ${ID} =~ ${debians} ]]; then
-  mv ../couchdb/*.deb ${SCRIPTPATH}/../couch/$platform
-else
-  echo "Sorry, we don't support this Linux (${ID}) yet."
-  exit 1
-fi
-# and make sure we can delete it if necessary
-chmod -R a+rwx  ${SCRIPTPATH}/../couch/$platform/*
diff --git a/bin/build-js.sh b/bin/build-js.sh
deleted file mode 100755
index 5ec0c9c..0000000
--- a/bin/build-js.sh
+++ /dev/null
@@ -1,58 +0,0 @@
-#!/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.
-
-# This shell script builds a CouchDB-compatible SpiderMonkey 1.8.5
-# and assumes the build environment is already set up correctly.
-# It expects to be run as root.
-
-# stop on error
-set -e
-
-# This works if we're not called through a symlink
-# otherwise, see https://stackoverflow.com/questions/59895/
-SCRIPTPATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
-ARCH=$(arch)
-
-# Check if running as root
-if [[ ${EUID} -ne 0 ]]; then
-  echo "Sorry, this script must be run as root."
-  echo "Try: sudo $0 $*"
-  exit 1
-fi
-
-. ${SCRIPTPATH}/detect-os.sh
-
-cd /root
-git clone https://github.com/apache/couchdb-pkg
-cd /root/couchdb-pkg
-
-redhats='(rhel|centos|fedora)'
-debians='(debian|ubuntu)'
-if [[ ${ID} =~ ${redhats} ]]; then
-  make couch-js-rpms
-  cp /root/rpmbuild/RPMS/${ARCH}/couch-js-* /root/output
-elif [[ ${ID} =~ ${debians} ]]; then
-  make couch-js-debs PLATFORM=${VERSION_CODENAME}
-  # /root/output is mounted somewhere useful.
-  cp /root/couchdb-pkg/js/couch-lib* /root/output
-else
-  echo "Sorry, we don't support this Linux (${ID}) yet."
-  exit 1
-fi
-
diff --git a/build.sh b/build.sh
index 8ee62b5..65a84b6 100755
--- a/build.sh
+++ b/build.sh
@@ -67,28 +67,6 @@
   docker push couchdbdev/$1-base
 }
 
-build-js() {
-  # TODO: check if image is built first, if not, complain
-  # invoke as build-js <plat>
-  rm -rf ${SCRIPTPATH}/js/$1
-  mkdir -p ${SCRIPTPATH}/js/$1
-  docker run \
-      --mount type=bind,src=${SCRIPTPATH}/js/$1,dst=/root/output \
-      --mount type=bind,src=${SCRIPTPATH},dst=/root/couchdb-ci \
-      couchdbdev/$1-base \
-      sudo /root/couchdb-ci/bin/build-js.sh
-}
-
-build-all-js() {
-  rm -rf ${SCRIPTPATH}/js/*
-  for plat in $DEBIANS $UBUNTUS $CENTOSES; do
-    if [[ $1 != "no-rebuild" ]]; then
-      build-base-platform $plat
-    fi
-    build-js $plat
-  done
-}
-
 build-platform() {
   docker build -f dockerfiles/$1 \
       --build-arg nodeversion=${NODEVERSION} \
@@ -110,62 +88,6 @@
   done
 }
 
-bintray-check-credentials() {
-  if [[ ! ${BINTRAY_USER} || ! ${BINTRAY_API_KEY} ]]; then
-    echo "Please set your Bintray credentials before using this command:"
-    echo "  export BINTRAY_USER=<username>"
-    echo "  export BINTRAY_API_KEY=<key>"
-    exit 1
-  fi
-}
-
-upload-js() {
-  # invoke with $1 as plat, expect to find the binaries under js/$plat/*
-  bintray-check-credentials
-  for pkg in $(find js/$1 -type f); do
-    if [[ $1 =~ ${debs} ]]; then
-      # TODO: pull this stuff from buildinfo / changes files, perhaps? Not sure it matters.
-      if [[ $pkg =~ (changes|buildinfo)$ ]]; then
-        continue
-      fi
-      repo="couchdb-deb"
-      dist=$(echo $1 | cut -d- -f 2)
-      arch=$(echo $pkg | cut -d_ -f 3 | cut -d. -f 1)
-      relpath="pool/s/spidermonkey/${pkg##*/}"
-      HEADERS=("--header" "X-Bintray-Debian-Distribution: ${dist}")
-      HEADERS+=("--header" "X-Bintray-Debian-Component: main")
-      HEADERS+=("--header" "X-Bintray-Debian-Architecture: ${arch}")
-    elif [[ $1 =~ ${rpms} ]]; then
-      repo="couchdb-rpm"
-      # better not put any extra . in the filename...
-      dist=$(echo $pkg | cut -d. -f 4)
-      arch=$(echo $pkg | cut -d. -f 5)
-      relpath="${dist}/${arch}/${pkg##*/}"
-      HEADERS=()
-    else
-      echo "Unknown repo type $1, aborting"
-      exit 1
-    fi
-    local ret="$(curl \
-        --request PUT \
-        --upload-file $pkg \
-        --user ${BINTRAY_USER}:${BINTRAY_API_KEY} \
-        --header "X-Bintray-Package: spidermonkey" \
-        --header "X-Bintray-Version: 1.8.5" \
-        --header "X-Bintray-Publish: 1" \
-        --header "X-Bintray-Override: 1" \
-        --header "X-Bintray-Explode: 0" \
-        "${HEADERS[@]}" \
-        "${BINTRAY_API}/content/apache/${repo}/${relpath}")"
-    if [[ ${ret} == '{"message":"success"}' ]]; then
-      echo "Uploaded ${pkg} successfully."
-    else
-      echo "Failed to upload $pkg, ${ret}"
-      exit 1
-    fi
-  done
-}
-
 upload-platform() {
   if [[ ! ${DOCKER_ID_USER} ]]; then
     echo "Please set your Docker credentials before using this command:"
@@ -183,25 +105,7 @@
       /home/jenkins/couchdb-ci/bin/build-test-couchdb.sh $2
 }
 
-build-package() {
-  # $1 is plat, $2 is the optional path to a dist tarball
-  rm -rf ${SCRIPTPATH}/couch/$1
-  mkdir -p ${SCRIPTPATH}/couch/$1
-  chmod 777 ${SCRIPTPATH}/couch/$1
-  if [[ $2 ]]; then
-    cp $2 ${SCRIPTPATH}/${2##*/} || true
-  fi
-  if [[ ! -d ../couchdb-pkg ]]; then
-    git clone https://github.com/apache/couchdb-pkg ../couchdb-pkg
-  fi
-  docker run \
-      --mount type=bind,src=${SCRIPTPATH},dst=/home/jenkins/couchdb-ci \
-      --mount type=bind,src=${SCRIPTPATH}/../couchdb-pkg,dst=/home/jenkins/couchdb-pkg \
-      couchdbdev/$1-erlang-${ERLANGVERSION} \
-      /home/jenkins/couchdb-ci/bin/build-couchdb-pkg.sh ${2##*/}
-}
 
-# TODO help
 case "$1" in
   clean)
     # removes image for a given target platform
@@ -234,37 +138,6 @@
       upload-base $plat $*
     done
     ;;
-  js)
-    # Build js packages for a given platform
-    shift
-    build-base-platform $1
-    build-js $1
-    ;;
-  js-no-rebuild)
-    # Build js packages for a given platform but do NOT rebuild base img
-    shift
-    build-js $1
-    ;;
-  js-all)
-    # build all supported JS packages
-    shift
-    build-all-js
-    ;;
-  js-all-no-rebuild)
-    # build all supported JS packages with no rebuild
-    shift
-    build-all-js no-rebuild
-    ;;
-  js-upload)
-    shift
-    upload-js $1
-    ;;
-  js-upload-all)
-    shift
-    for dir in $(ls js); do
-      upload-js $dir
-    done
-    ;;
   platform)
     # build platform with JS and Erlang support
     shift
@@ -300,19 +173,6 @@
       build-test-couch $plat $*
     done
     ;;
-  couch-pkg)
-    # build CouchDB pkgs for <plat>
-    shift
-    build-package $*
-    ;;
-  couch-pkg-all)
-    # build CouchDB pkgs for all platforms
-    shift
-    rm -rf ${SCRIPTPATH}/couch/*
-    for plat in $DEBIANS $UBUNTUS $CENTOSES; do
-      build-package $plat $*
-    done
-    ;;
   *)
     if [[ $1 ]]; then
       echo "Unknown target $1."
@@ -322,34 +182,25 @@
 $0 <command> [OPTIONS]
 
 Recognized commands:
-  clean <plat>		Removes all images for <plat>.
-  clean-all		Cleans all images for all platforms.
+  clean <plat>          Removes all images for <plat>.
+  clean-all             Removes all images for all platforms & base images.
 
-  base <plat>		Builds the base (no JS/Erlang) image for <plat>.
-  base-all		Builds all base (no JS/Erlang) images.
-  base-upload           Uploads the couchdbdev/*-base images to Docker Hub.
-			Requires appropriate credentials.
-  base-upload-all       Uploads all the couchdbdev/*-base images.
+  base <plat>           Builds the base (no JS/Erlang) image for <plat>.
+  base-all              Builds all base (no JS/Erlang) images.
+  *base-upload          Uploads the specified couchdbdev/*-base image 
+                        to Docker Hub.
+  *base-upload-all      Uploads all the couchdbdev/*-base images.
 
-  js			Builds the JS packages for <plat>.
-  js-all		Builds the JS packages for all platforms.
-  js-no-rebuild		Builds the JS packages for <plat> without rebuilding
-                	the base image first.
-  js-all-no-rebuild	Same as above, with the same condition.
-  js-upload <plat>	Uploads the JS packages for <plat> to bintray.
-			Requires BINTRAY_USER and BINTRAY_API_KEY env vars.
+  platform <plat>       Builds the image for <plat> with Erlang & JS support.
+  platform-all          Builds all images with Erlang and JS support.
+  *platform-upload      Uploads the couchdbdev/*-erlang-* images to Docker Hub.
+  *platform-upload-all  Uploads all the couchdbdev/*-erlang-* images to Docker.
 
-  platform <plat>	Builds the image for <plat> with Erlang & JS support.
-  platform-all		Builds all images with Erlang and JS support.
-  platform-upload	Uploads the couchdbdev/*-erlang-* images to Docker Hub.
-			Requires appropriate credentials.
-  platform-upload-all	Uploads all the couchdbdev/*-erlang-* images to Docker.
+  couch <plat>          Builds and tests CouchDB for <plat>.
+  couch-all             Builds and tests CouchDB on all platforms.
 
-  couch <plat>		Builds and tests CouchDB for <plat>.
-  couch-all		Builds and tests CouchDB on all platforms.
+  Commands marked with * require appropriate Docker Hub credentials.
 
-  couch-pkg <plat>	Builds CouchDB packages for <plat>.
-  couch-pkg-all		Builds CouchDB packages for all platforms.
 EOF
     if [[ $1 ]]; then
       exit 1