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

rnewson pushed a commit to branch nouveau
in repository https://gitbox.apache.org/repos/asf/couchdb-pkg.git

commit ea538d55179ac38f6ca7d441ea3d639d68fd9ef1
Author: Robert Newson <[email protected]>
AuthorDate: Thu Dec 7 17:46:24 2023 +0000

    Build nouveau package
---
 debian/compat                            |  2 +-
 debian/conf/10-nouveau.ini               |  3 ++
 debian/conf/nouveau.yaml                 | 33 ++++++++++++++++++
 debian/control.in                        | 15 ++++++++-
 debian/couchdb-nouveau.config            | 16 +++++++++
 debian/couchdb-nouveau.dirs              |  3 ++
 debian/couchdb-nouveau.install           |  5 +++
 debian/couchdb-nouveau.lintian-overrides |  7 ++++
 debian/couchdb-nouveau.postinst          | 57 ++++++++++++++++++++++++++++++++
 debian/couchdb-nouveau.postrm            | 45 +++++++++++++++++++++++++
 debian/couchdb-nouveau.service           | 29 ++++++++++++++++
 debian/couchdb-nouveau.templates         | 10 ++++++
 debian/couchdb.lintian-overrides         |  6 ++++
 13 files changed, 229 insertions(+), 2 deletions(-)

diff --git a/debian/compat b/debian/compat
index ec63514..f599e28 100644
--- a/debian/compat
+++ b/debian/compat
@@ -1 +1 @@
-9
+10
diff --git a/debian/conf/10-nouveau.ini b/debian/conf/10-nouveau.ini
new file mode 100644
index 0000000..73c9edc
--- /dev/null
+++ b/debian/conf/10-nouveau.ini
@@ -0,0 +1,3 @@
+[nouveau]
+enable = true
+url = http://127.0.0.1:5987
diff --git a/debian/conf/nouveau.yaml b/debian/conf/nouveau.yaml
new file mode 100644
index 0000000..01358ed
--- /dev/null
+++ b/debian/conf/nouveau.yaml
@@ -0,0 +1,33 @@
+maxIndexesOpen: 1000
+commitIntervalSeconds: 30
+idleSeconds: 60
+rootDir: /var/opt/nouveau/indexes
+
+logging:
+  level: INFO
+
+server:
+  applicationConnectors:
+    - type: http
+      bindHost: 127.0.0.1
+      port: 5987
+      useDateHeader: false
+  adminConnectors:
+    - type: http
+      bindHost: 127.0.0.1
+      port: 5988
+      useDateHeader: false
+  gzip:
+    includedMethods:
+      - GET
+      - POST
+  requestLog:
+    appenders:
+      - type: file
+        archive: true
+        archivedFileCount: 5
+        archivedLogFilenamePattern: /var/opt/nouveau/log/nouveau-%i.log
+        currentLogFilename: /var/opt/nouveau/log/nouveau.log
+        immediateFlush: false
+        maxFileSize: 10MB
+        queueSize: 512
diff --git a/debian/control.in b/debian/control.in
index bfd5074..8984e6b 100644
--- a/debian/control.in
+++ b/debian/control.in
@@ -3,7 +3,7 @@ Section: misc
 Priority: optional
 Maintainer: CouchDB Developers <[email protected]>
 Standards-Version: 3.9.6
-Build-Depends: debhelper (>= 9),
+Build-Depends: debhelper (>= 10),
                dh-exec,
                erlang-dev (>= 1:19.2.1) | esl-erlang (>= 1:19.2.1),
                erlang-crypto | esl-erlang,
@@ -37,6 +37,7 @@ Depends: adduser,
          ${misc:Depends}
 Replaces: couchdb-bin,
           couchdb-common
+Suggests: couchdb-nouveau
 Breaks: couchdb-bin,
         couchdb-common
 Description: RESTful document oriented database
@@ -56,3 +57,15 @@ Description: RESTful document oriented database
  standalone node or part of a cluster, and associated other parameters as
  necessary. It adds the systemd / init job and other items needed for a
  system-wide CouchDB instance that is started at boot.
+
+Package: couchdb-nouveau
+Architecture: any
+Depends: adduser,
+         default-jre-headless | java11-runtime-headless | java11-runtime,
+         lsb-base,
+         procps,
+         systemd,
+         ${misc:Depends}
+Description: Nouveau adds Lucene capabilities to CouchDB
+ Nouveau transforms Apache CouchDB databases into Apache Lucene indexes at
+ the shard level and then merges the results together.
diff --git a/debian/couchdb-nouveau.config b/debian/couchdb-nouveau.config
new file mode 100644
index 0000000..07e0b28
--- /dev/null
+++ b/debian/couchdb-nouveau.config
@@ -0,0 +1,16 @@
+#!/bin/sh
+# 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.
+
+set -e
+
+. /usr/share/debconf/confmodule
diff --git a/debian/couchdb-nouveau.dirs b/debian/couchdb-nouveau.dirs
new file mode 100644
index 0000000..a40f803
--- /dev/null
+++ b/debian/couchdb-nouveau.dirs
@@ -0,0 +1,3 @@
+etc/opt/nouveau
+opt/nouveau
+var/opt/nouveau
diff --git a/debian/couchdb-nouveau.install b/debian/couchdb-nouveau.install
new file mode 100755
index 0000000..ac7bff0
--- /dev/null
+++ b/debian/couchdb-nouveau.install
@@ -0,0 +1,5 @@
+#!/usr/bin/dh-exec
+rel/couchdb/nouveau/bin/nouveau /opt/nouveau/bin
+rel/couchdb/nouveau/lib /opt/nouveau/
+debian/conf/nouveau.yaml /etc/opt/nouveau/
+debian/conf/10-nouveau.ini opt/couchdb/etc/default.d
diff --git a/debian/couchdb-nouveau.lintian-overrides 
b/debian/couchdb-nouveau.lintian-overrides
new file mode 100644
index 0000000..b080212
--- /dev/null
+++ b/debian/couchdb-nouveau.lintian-overrides
@@ -0,0 +1,7 @@
+# nouveau libs live in /opt
+couchdb-nouveau: jar-not-in-usr-share opt/nouveau/lib/*
+couchdb-nouveau: dir-or-file-in-etc-opt etc/opt/nouveau/
+couchdb-nouveau: dir-or-file-in-etc-opt etc/opt/nouveau/nouveau.yaml
+
+couchdb-nouveau: unknown-java-class-version opt/nouveau/lib/*
+couchdb-nouveau: codeless-jar opt/nouveau/lib/*
diff --git a/debian/couchdb-nouveau.postinst b/debian/couchdb-nouveau.postinst
new file mode 100644
index 0000000..eb8d5b5
--- /dev/null
+++ b/debian/couchdb-nouveau.postinst
@@ -0,0 +1,57 @@
+#!/bin/sh
+# 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.
+
+set -e
+
+# without this, debconf doesn't run on initial install
+. /usr/share/debconf/confmodule
+
+case $1 in
+    configure)
+        if ! getent passwd nouveau > /dev/null; then
+            adduser --system --quiet \
+                    --home /opt/nouveau --no-create-home \
+                    --disabled-login --disabled-password \
+                    --shell /bin/bash --group \
+                    --gecos "CouchDB Nouveau Administrator" \
+                    nouveau
+        fi
+        if test "`id -u nouveau`" -eq 0; then
+            echo "The nouveau administrative user must not be root." >&2
+            false
+        fi
+        if test "`id -g nouveau`" -eq 0; then
+            echo "The nouveau administrative group must not be root." >&2
+            false
+        fi
+        for i in "/etc/opt/nouveau
+          /etc/opt/nouveau/nouveau.yaml
+          /opt/nouveau
+          /opt/nouveau/bin
+          /opt/nouveau/bin/nouveau
+          /opt/nouveau/lib
+          /opt/nouveau/lib/*.jar
+          /var/opt/nouveau"
+        do
+            chown nouveau:nouveau $i >/dev/null 2>&1 || true
+        done
+        ;;
+
+    abort-upgrade|abort-remove|abort-configure)
+        ;;
+
+    *)
+        echo "postinst called with unknown argument '$1'" 1>&2
+        exit 1
+        ;;
+esac
diff --git a/debian/couchdb-nouveau.postrm b/debian/couchdb-nouveau.postrm
new file mode 100644
index 0000000..9e2ac61
--- /dev/null
+++ b/debian/couchdb-nouveau.postrm
@@ -0,0 +1,45 @@
+#!/bin/sh -e
+# 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.
+
+. /usr/share/debconf/confmodule
+
+case $1 in
+    purge)
+        if test -d "/opt/nouveau"; then
+            rm -rf "/opt/nouveau"
+        fi
+
+        db_input high couchdb-nouveau/postrm_remove_indexes || true
+        db_go || true
+        db_get couchdb-nouveau/postrm_remove_indexes || true
+
+        if [ "$RET" = "true" ]; then
+            if test -d "/var/opt/nouveau"; then
+                rm -rf "/var/opt/nouveau"
+            fi
+
+            # If we didn't delete the data, we should
+            # keep the uid and gid too.
+            if getent passwd nouveau > /dev/null; then
+                deluser nouveau >/dev/null 2>&1
+            fi
+            if getent group nouveau > /dev/null; then
+                delgroup nouveau >/dev/null 2>&1
+            fi
+        fi
+
+        #db_reset nouveau/?
+        ;;
+esac
+
+#DEBHELPER#
diff --git a/debian/couchdb-nouveau.service b/debian/couchdb-nouveau.service
new file mode 100644
index 0000000..13b3707
--- /dev/null
+++ b/debian/couchdb-nouveau.service
@@ -0,0 +1,29 @@
+[Unit]
+After=network-online.target
+Description=Apache CouchDB - Nouveau
+Wants=network-online.target
+
+[Service]
+
+# Configuration
+RuntimeDirectory=nouveau
+Environment="JAVA_OPTS=-server"
+
+# Lifecycle
+ExecStart=/opt/nouveau/bin/nouveau server /etc/opt/nouveau/nouveau.yaml
+LimitNOFILE=infinity
+Restart=on-failure
+
+# Security
+Group=nouveau
+NoNewPrivileges=true
+ProtectHome=yes
+ProtectSystem=strict
+ReadWritePaths=/var/opt/nouveau/
+SystemCallErrorNumber=EPERM
+SystemCallFilter=@system-service
+User=nouveau
+
+[Install]
+WantedBy=multi-user.target
+
diff --git a/debian/couchdb-nouveau.templates b/debian/couchdb-nouveau.templates
new file mode 100644
index 0000000..6fae549
--- /dev/null
+++ b/debian/couchdb-nouveau.templates
@@ -0,0 +1,10 @@
+# NOTE TO DEVELOPERS
+# If you change this file, run debconf-updatepo !
+# Failure to do so will result in a rejected pull request.
+
+Template: couchdb-nouveau/postrm_remove_indexes
+Type: boolean
+Default: false
+_Description: Remove all CouchDB Nouveau indexes?
+ The /var/opt/nouveau/ directory containing all CouchDB Nouveau indexes will be
+ removed. This will also remove the nouveau user and group.
diff --git a/debian/couchdb.lintian-overrides b/debian/couchdb.lintian-overrides
index 572bdde..ae929ba 100644
--- a/debian/couchdb.lintian-overrides
+++ b/debian/couchdb.lintian-overrides
@@ -15,3 +15,9 @@ couchdb: extra-license-file opt/couchdb/LICENSE
 # and our doc base won't move out of /opt, sorry
 couchdb: doc-base-file-references-wrong-path couchdb:8 
/opt/couchdb/share/www/docs/index.html
 couchdb: doc-base-file-references-wrong-path couchdb:9 
/opt/couchdb/share/www/docs/*
+
+# nouveau
+couchdb: jar-not-in-usr-share opt/couchdb/nouveau/lib/*
+couchdb: executable-not-elf-or-script opt/couchdb/nouveau/bin/nouveau.bat
+couchdb: unknown-java-class-version opt/couchdb/nouveau/lib/*
+couchdb: codeless-jar opt/couchdb/nouveau/lib/*

Reply via email to