You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by rn...@apache.org on 2016/10/27 16:52:28 UTC

couchdb commit: updated refs/heads/master to 99b5331

Repository: couchdb
Updated Branches:
  refs/heads/master af6764e51 -> 99b5331ce


Adds a Snap package build option with:  ./configure && make snap


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

Branch: refs/heads/master
Commit: 99b5331ce9b5b51f3b428a0474d338397888bc2a
Parents: af6764e
Author: Michael Hall <mh...@ubuntu.com>
Authored: Thu Oct 27 17:51:05 2016 +0100
Committer: Robert Newson <rn...@apache.org>
Committed: Thu Oct 27 17:52:08 2016 +0100

----------------------------------------------------------------------
 Makefile  |  4 +++
 configure | 90 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 94 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb/blob/99b5331c/Makefile
----------------------------------------------------------------------
diff --git a/Makefile b/Makefile
index 018c845..a8e8718 100644
--- a/Makefile
+++ b/Makefile
@@ -201,6 +201,10 @@ introspect:
 	@$(REBAR) -r update-deps
 	@./introspect
 
+.PHONY: snap
+# target: snap - Build Snap package
+snap: release
+	@cd rel/; snapcraft snap --output ../couchdb_$(COUCHDB_VERSION)_amd64.snap
 
 ################################################################################
 # Distributing

http://git-wip-us.apache.org/repos/asf/couchdb/blob/99b5331c/configure
----------------------------------------------------------------------
diff --git a/configure b/configure
index 5a39e0a..34dc83e 100755
--- a/configure
+++ b/configure
@@ -25,10 +25,14 @@ PACKAGE_AUTHOR_NAME="The Apache Software Foundation"
 WITH_CURL="false"
 WITH_FAUXTON=1
 WITH_DOCS=1
+WITH_SNAP=1
 SKIP_DEPS=0
 
 COUCHDB_USER=`whoami`
 
+. ${rootdir}/version.mk
+COUCHDB_VERSION=${vsn_major}.${vsn_minor}.${vsn_patch}
+
 display_help () {
     cat << EOF
 Usage: $basename [OPTION]
@@ -43,6 +47,7 @@ Options:
   -c | --with-curl            request that couchjs is linked to cURL (default false)
   --disable-fauxton           do not build Fauxton
   --disable-docs              do not build any documentation or manpages
+  --disable-snap              do not build snap package config
   --skip-deps                 do not update erlang dependencies
   --rebar=PATH                use rebar by specified path (version >=2.6.0 && <3.0 required)
 EOF
@@ -74,6 +79,12 @@ parse_opts() {
                 continue
                 ;;
 
+            --disable-snap)
+                WITH_SNAP=0
+                shift
+                continue
+                ;;
+
             --skip-deps)
                 SKIP_DEPS=1
                 shift
@@ -184,6 +195,85 @@ EOF
 cat > $rootdir/config.erl << EOF
 {with_curl, $WITH_CURL}.
 EOF
+ 
+if [ "${WITH_SNAP}" -eq "1" ]; then
+echo "==> configuring snapcraft config"
+cat > rel/snapcraft.yaml << EOF
+name: couchdb
+version: $COUCHDB_VERSION
+summary: Document based database
+description: CouchDB is a database that completely embraces the web. Store your data with JSON documents. Access your documents and query your indexes with your web browser, via HTTP. Index, combine, and transform your documents with JavaScript. 
+confinement: strict
+grade: stable
+
+apps:
+    couchdb:
+        daemon: simple
+        command: snap_run
+        plugs: [network-bind]
+    run:
+        command: snap_run
+        plugs: [network-bind]
+parts:
+    couchdb: 
+        plugin: dump
+        source: .
+        organize:
+            snap.ini: couchdb/etc/snap.ini
+            snap_run: bin/snap_run
+        stage:
+            - couchdb
+            - bin
+        snap:
+            - couchdb
+            - bin
+    erlang:
+        plugin: nil
+        stage-packages:
+            - erlang-base-hipe
+            - erlang-crypto
+            - erlang-eunit
+            - erlang-inets
+            - erlang-os-mon
+            - erlang-public-key
+            - erlang-ssl
+            - erlang-syntax-tools
+            - erlang-tools
+            - erlang-xmerl
+            - libc6
+            - libcurl3
+            - libgcc1
+            - libicu55
+            - libmozjs185-1.0
+            - libstdc++6
+EOF
+
+cat > rel/snap.ini << EOF
+; Snap-specific Configuration Settings
+
+[couchdb]
+database_dir = /var/snap/couchdb/common/data
+view_index_dir = /var/snap/couchdb/common/data
+
+[log]
+writer = file
+file = /var/snap/couchdb/current/couchdb.log
+;level = info
+EOF
+
+cat > rel/snap_run << EOF
+#!/bin/sh
+
+export HOME=$SNAP_DATA
+export ERL_FLAGS="-couch_ini \${SNAP}/couchdb/etc/default.ini \${SNAP}/couchdb/etc/snap.ini \${SNAP_DATA}/local.ini"
+if [ ! -e \${SNAP_DATA}/local.ini ]; then
+    touch \${SNAP_DATA}/local.ini
+fi
+
+exec \${SNAP}/couchdb/bin/couchdb
+EOF
+chmod +x rel/snap_run
+fi
 
 
 install_local_rebar() {