Repository: couchdb-ci
Updated Branches:
  refs/heads/master 17b1b9245 -> acde835e4


Fixes for Jenkins, pkg building


Project: http://git-wip-us.apache.org/repos/asf/couchdb-ci/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-ci/commit/acde835e
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-ci/tree/acde835e
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-ci/diff/acde835e

Branch: refs/heads/master
Commit: acde835e4a4ab747709c33b938a01a22f16a99ad
Parents: 17b1b92
Author: Joan Touzet <[email protected]>
Authored: Mon Jun 11 16:33:42 2018 -0700
Committer: Joan Touzet <[email protected]>
Committed: Mon Jun 11 16:33:42 2018 -0700

----------------------------------------------------------------------
 .gitignore               |  2 ++
 .travis.yml              | 18 ++++--------
 bin/build-couchdb-pkg.sh | 65 +++++++++++++++++++++++++++++++++++++++++++
 build.sh                 | 37 +++++++++++++++++++++++-
 4 files changed, 109 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-ci/blob/acde835e/.gitignore
----------------------------------------------------------------------
diff --git a/.gitignore b/.gitignore
index 738f74f..1890956 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,6 @@
 .vagrant
 *~
 *.swp
+*.tar.*
+couch
 js

http://git-wip-us.apache.org/repos/asf/couchdb-ci/blob/acde835e/.travis.yml
----------------------------------------------------------------------
diff --git a/.travis.yml b/.travis.yml
index 7f80fb3..a4ea82d 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -3,19 +3,13 @@ sudo: required
 services:
   - docker
 
-env:
-  matrix:
-    - OS=centos-6
-    - OS=centos-7
-    - OS=debian-8
-    - OS=debian-9
-    - OS=ubuntu-14.04
-    - OS=ubuntu-16.04
-
 before_script:
   - docker --version
 
-script:
-  - find bin/${OS}-base -type d | xargs -I {} bash {}/create-container.sh
-  - find bin/${OS}-erlang* -type d | xargs -I {} bash {}/create-container.sh
+env:
+  matrix:
+    - TARGET=js-all
+    - TARGET=couch-pkg-all
 
+script:
+  - ./build.sh ${TARGET}

http://git-wip-us.apache.org/repos/asf/couchdb-ci/blob/acde835e/bin/build-couchdb-pkg.sh
----------------------------------------------------------------------
diff --git a/bin/build-couchdb-pkg.sh b/bin/build-couchdb-pkg.sh
new file mode 100755
index 0000000..e7a30e8
--- /dev/null
+++ b/bin/build-couchdb-pkg.sh
@@ -0,0 +1,65 @@
+#!/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/*

http://git-wip-us.apache.org/repos/asf/couchdb-ci/blob/acde835e/build.sh
----------------------------------------------------------------------
diff --git a/build.sh b/build.sh
index c8d3f7d..20f0632 100755
--- a/build.sh
+++ b/build.sh
@@ -68,6 +68,7 @@ build-js() {
 }
 
 build-all-js() {
+  rm -rf ${SCRIPTPATH}/js/*
   for plat in $DEBIANS $UBUNTUS $CENTOSES; do
     if [[ $1 != "no-rebuild" ]]; then
       build-base-platform $plat
@@ -166,7 +167,25 @@ build-test-couch() {
   docker run \
       --mount type=bind,src=${SCRIPTPATH},dst=/home/jenkins/couchdb-ci \
       couchdbdev/$1-erlang-${ERLANGVERSION} \
-      /home/jenkins/couchdb-ci/bin/build-test-couchdb.sh
+      /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
@@ -258,6 +277,19 @@ case "$1" in
       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."
@@ -290,6 +322,9 @@ Recognized commands:
 
   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.
 EOF
     if [[ $1 ]]; then
       exit 1

Reply via email to