Physikerwelt has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/113025

Change subject: npm version of debian package
......................................................................

npm version of debian package

Change-Id: I5f30ebebae567232778127a95bd3b3306c907af5
---
A debian/README
A debian/README.Debian
A debian/README.source
A debian/changelog
A debian/compat
A debian/control
A debian/copyright
A debian/docs
A debian/files
A debian/mathoid.debhelper.log
A debian/mathoid.default
A debian/mathoid.init
A debian/mathoid.install
A debian/mathoid.logrotate
A debian/mathoid.postinst
A debian/mathoid.postinst.debhelper
A debian/mathoid.postrm
A debian/mathoid.preinst.debhelper
A debian/mathoid.prerm.debhelper
A debian/mathoid.substvars
A debian/mathoid.upstart
A debian/rules
A debian/source/format
A debian/upstart/mathoid.conf
24 files changed, 525 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/services/mathoid 
refs/changes/25/113025/1

diff --git a/debian/README b/debian/README
new file mode 100644
index 0000000..6cd09c3
--- /dev/null
+++ b/debian/README
@@ -0,0 +1,6 @@
+The Debian Package mathoid
+----------------------------
+
+Comments regarding the Package
+
+ -- Moritz Schubotz (Physikerwelt) <w...@physikerwelt.de>  Tue, 11 Feb 2014 
17:56:54 +0000
diff --git a/debian/README.Debian b/debian/README.Debian
new file mode 100644
index 0000000..588f126
--- /dev/null
+++ b/debian/README.Debian
@@ -0,0 +1,6 @@
+mathoid for Debian
+------------------
+
+<possible notes regarding this package - if none, delete this file>
+
+ -- Moritz Schubotz (Physikerwelt) <w...@physikerwelt.de>  Tue, 11 Feb 2014 
17:56:54 +0000
diff --git a/debian/README.source b/debian/README.source
new file mode 100644
index 0000000..11c79ca
--- /dev/null
+++ b/debian/README.source
@@ -0,0 +1,9 @@
+mathoid for Debian
+------------------
+
+<this file describes information about the source package, see Debian policy
+manual section 4.14. You WILL either need to modify or delete this file>
+
+
+
+
diff --git a/debian/changelog b/debian/changelog
new file mode 100644
index 0000000..e6d689c
--- /dev/null
+++ b/debian/changelog
@@ -0,0 +1,5 @@
+mathoid (0.1-0) precise; urgency=low
+
+  * Initial Release.
+
+ -- Moritz Schubotz (Physikerwelt) <w...@physikerwelt.de>  Tue, 11 Feb 2014 
17:56:54 +0000
diff --git a/debian/compat b/debian/compat
new file mode 100644
index 0000000..ec63514
--- /dev/null
+++ b/debian/compat
@@ -0,0 +1 @@
+9
diff --git a/debian/control b/debian/control
new file mode 100644
index 0000000..5d26489
--- /dev/null
+++ b/debian/control
@@ -0,0 +1,16 @@
+Source: mathoid
+Section: web
+Priority: extra
+Maintainer: Moritz Schubotz (Physikerwelt) <w...@physikerwelt.de>
+Build-Depends: debhelper (>= 8.0.0)
+Standards-Version: 3.9.2
+Homepage: http://www.formulasearchengine.com/Mathoid
+Vcs-Git: https://github.com/physikerwelt/mathoid-deploy.git
+Vcs-Browser: https://github.com/physikerwelt/mathoid-deploy
+
+Package: mathoid
+Architecture: any
+Depends: nodejs (>=0.8.0), phantomjs (>=1.9.0),  logrotate, adduser, 
${shlibs:Depends}, ${misc:Depends}
+Enhances: mediawiki
+Description: Web service converting LaTeX to MathML
+ Conversion from LaTeX to MathML node.js web service that uses Phantomjs in 
the background. See http://www.formulasearchengine.com/mathoid.
diff --git a/debian/copyright b/debian/copyright
new file mode 100644
index 0000000..6ba5044
--- /dev/null
+++ b/debian/copyright
@@ -0,0 +1,30 @@
+Format: http://dep.debian.net/deps/dep5
+Upstream-Name: mathoid
+Source: <https://www.formulasearchengine.com/mathoid>
+Files: *
+Copyright: 2013- The Mathoid authors, see src/COPYING.>
+License: GPL-3.0+
+
+Files: debian/*
+Copyright: 2014 Moritz Schubotz (Physikerwelt) <w...@physikerwelt.de>
+License: GPL-3.0+
+
+License: GPL-3.0+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+ .
+ This package is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ GNU General Public License for more details.
+ .
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ .
+ On Debian systems, the complete text of the GNU General
+ Public License version 3 can be found in "/usr/share/common-licenses/GPL-3".
+
+# Please also look if there are files or directories which have a
+# different copyright/license attached and list them here.
diff --git a/debian/docs b/debian/docs
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/debian/docs
diff --git a/debian/files b/debian/files
new file mode 100644
index 0000000..911d13b
--- /dev/null
+++ b/debian/files
@@ -0,0 +1 @@
+mathoid_0.1-0_amd64.deb web extra
diff --git a/debian/mathoid.debhelper.log b/debian/mathoid.debhelper.log
new file mode 100644
index 0000000..0924d1f
--- /dev/null
+++ b/debian/mathoid.debhelper.log
@@ -0,0 +1,47 @@
+dh_auto_configure
+dh_auto_build
+dh_auto_test
+dh_prep
+dh_installdirs
+dh_auto_install
+dh_install
+dh_installdocs
+dh_installchangelogs
+dh_installexamples
+dh_installman
+dh_installcatalogs
+dh_installcron
+dh_installdebconf
+dh_installemacsen
+dh_installifupdown
+dh_installinfo
+dh_installinit
+dh_installmenu
+dh_installmime
+dh_installmodules
+dh_installlogcheck
+dh_installlogrotate
+dh_installpam
+dh_installppp
+dh_installudev
+dh_installwm
+dh_installxfonts
+dh_installgsettings
+dh_bugfiles
+dh_ucf
+dh_lintian
+dh_gconf
+dh_icons
+dh_perl
+dh_usrlocal
+dh_link
+dh_compress
+dh_fixperms
+dh_strip
+dh_makeshlibs
+dh_shlibdeps
+dh_installdeb
+dh_gencontrol
+dh_md5sums
+dh_builddeb
+dh_builddeb
diff --git a/debian/mathoid.default b/debian/mathoid.default
new file mode 100644
index 0000000..4d3b262
--- /dev/null
+++ b/debian/mathoid.default
@@ -0,0 +1,10 @@
+# Defaults for mathoid initscript
+
+# File where the mathoid daemon will write stderr and stdout to
+MATHOID_LOG_FILE=/var/log/mathoid/mathoid.log
+
+MATHOID_PORT="10042"
+
+# Default is to listen on all interfaces
+#MATHOID_INTERFACE="0.0.0.0"
+
diff --git a/debian/mathoid.init b/debian/mathoid.init
new file mode 100644
index 0000000..0ecec3e
--- /dev/null
+++ b/debian/mathoid.init
@@ -0,0 +1,164 @@
+#!/bin/sh
+# Do NOT "set -e"
+
+# PATH should only include /usr/* if it runs after the mountnfs.sh script
+PATH=/sbin:/usr/sbin:/bin:/usr/bin
+DESC="Mathoid HTTP service"
+NAME=mathoid
+SCRIPT_PATH=/usr/lib/mathoid/src/mathoid.js
+DAEMON="/usr/bin/nodejs $SCRIPT_PATH"
+#DAEMON_ARGS=""
+PIDFILE=/var/run/$NAME.pid
+#SCRIPTNAME=/etc/init.d/$NAME
+
+# Exit if the package is not installed
+[ -e "$SCRIPT_PATH" ] || exit 0
+
+# Read configuration variable file if it is present
+#[ -r /etc/default/$NAME ] && . /etc/default/$NAME
+
+# export the port and host env vars, if set
+if [ ! -z "$MATHOID_PORT" ];then
+    export MATHOID_PORT="$MATHOID_PORT"
+fi
+#if [ ! -z "$MATHOID_INTERFACE" ];then
+#    export MATHOID_INTERFACE="$MATHOID_INTERFACE"
+#fi
+
+# Load the VERBOSE setting and other rcS variables
+. /lib/init/vars.sh
+
+# Define LSB log_* functions.
+# Depend on lsb-base (>= 3.2-14) to ensure that this file is present
+# and status_of_proc is working.
+. /lib/lsb/init-functions
+
+#
+# Function that starts the daemon/service
+#
+do_start()
+{
+       # Return
+       #   0 if daemon has been started
+       #   1 if daemon was already running
+       #   2 if daemon could not be started
+       start-stop-daemon --start --quiet --pidfile $PIDFILE -bm --no-close \
+               -c mathoid:mathoid \
+               --exec $DAEMON --test > /dev/null \
+               || return 1
+       start-stop-daemon --start --quiet --pidfile $PIDFILE -bm --no-close \
+               -c mathoid:mathoid \
+               --exec $DAEMON -- $DAEMON_ARGS >> /var/log/mathoid/mathoid.log 
2>&1 \
+               || return 2
+       # The above code will not work for interpreted scripts, use the next
+       # six lines below instead (Ref: #643337, start-stop-daemon(8) )
+       #start-stop-daemon --start --quiet --pidfile $PIDFILE --startas $DAEMON 
\
+       #       --name $NAME --test > /dev/null \
+       #       || return 1
+       #start-stop-daemon --start --quiet --pidfile $PIDFILE --startas $DAEMON 
\
+       #       --name $NAME -- $DAEMON_ARGS \
+       #       || return 2
+
+       # Add code here, if necessary, that waits for the process to be ready
+       # to handle requests from services started subsequently which depend
+       # on this one.  As a last resort, sleep for some time.
+    sleep 5
+}
+
+#
+# Function that stops the daemon/service
+#
+do_stop()
+{
+       # Return
+       #   0 if daemon has been stopped
+       #   1 if daemon was already stopped
+       #   2 if daemon could not be stopped
+       #   other if a failure occurred
+       start-stop-daemon --stop --quiet --retry=TERM/5/KILL/5 --pidfile 
$PIDFILE --name $NAME
+       RETVAL="$?"
+       [ "$RETVAL" = 2 ] && return 2
+       # Wait for children to finish too if this is a daemon that forks
+       # and if the daemon is only ever run from this initscript.
+       # If the above conditions are not satisfied then add some other code
+       # that waits for the process to drop all resources that could be
+       # needed by services started subsequently.  A last resort is to
+       # sleep for some time.
+       start-stop-daemon --stop --quiet --oknodo --retry=0/5/KILL/5 --exec 
$DAEMON
+       [ "$?" = 2 ] && return 2
+       # Many daemons don't delete their pidfiles when they exit.
+       rm -f $PIDFILE
+       return "$RETVAL"
+}
+
+#
+# Function that sends a SIGHUP to the daemon/service
+#
+do_reload() {
+       #
+       # If the daemon can reload its configuration without
+       # restarting (for example, when it is sent a SIGHUP),
+       # then implement that here.
+       #
+       start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE --name 
$NAME
+       return 0
+}
+
+case "$1" in
+  start)
+       [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
+       do_start
+       case "$?" in
+               0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
+               2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
+       esac
+       ;;
+  stop)
+       [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
+       do_stop
+       case "$?" in
+               0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
+               2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
+       esac
+       ;;
+  status)
+       status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
+       ;;
+  #reload|force-reload)
+       #
+       # If do_reload() is not implemented then leave this commented out
+       # and leave 'force-reload' as an alias for 'restart'.
+       #
+       #log_daemon_msg "Reloading $DESC" "$NAME"
+       #do_reload
+       #log_end_msg $?
+       #;;
+  restart|force-reload)
+       #
+       # If the "reload" option is implemented then remove the
+       # 'force-reload' alias
+       #
+       log_daemon_msg "Restarting $DESC" "$NAME"
+       do_stop
+       case "$?" in
+         0|1)
+               do_start
+               case "$?" in
+                       0) log_end_msg 0 ;;
+                       1) log_end_msg 1 ;; # Old process is still running
+                       *) log_end_msg 1 ;; # Failed to start
+               esac
+               ;;
+         *)
+               # Failed to stop
+               log_end_msg 1
+               ;;
+       esac
+       ;;
+  *)
+       echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2
+       exit 3
+       ;;
+esac
+
+:
diff --git a/debian/mathoid.install b/debian/mathoid.install
new file mode 100644
index 0000000..191b5d2
--- /dev/null
+++ b/debian/mathoid.install
@@ -0,0 +1,14 @@
+# main source
+engine.js usr/lib/mathoid/
+index.html usr/lib/mathoid/
+LICENSE.txt usr/lib/mathoid/
+mathoid.config.json usr/lib/mathoid/
+mathoid.js usr/lib/mathoid/
+mathoid-worker.js usr/lib/mathoid/
+README.md usr/lib/mathoid/
+main.js usr/lib/mathoid/
+# node modules
+node_modules/ usr/lib/mathoid/
+package.json usr/lib/mathoid/
+#MathJax
+Math/ usr/lib/mathoid/
\ No newline at end of file
diff --git a/debian/mathoid.logrotate b/debian/mathoid.logrotate
new file mode 100644
index 0000000..d08847b
--- /dev/null
+++ b/debian/mathoid.logrotate
@@ -0,0 +1,9 @@
+/var/log/mathoid/mathoid.log {
+    daily
+    copytruncate
+    missingok
+    compress
+    notifempty
+    rotate 15
+    size 256M
+}
diff --git a/debian/mathoid.postinst b/debian/mathoid.postinst
new file mode 100644
index 0000000..cbcf82d
--- /dev/null
+++ b/debian/mathoid.postinst
@@ -0,0 +1,56 @@
+#!/bin/sh
+# postinst script for mathoid
+#
+# see: dh_installdeb(1)
+
+set -e
+
+# summary of how this script can be called:
+#        * <postinst> `configure' <most-recently-configured-version>
+#        * <old-postinst> `abort-upgrade' <new version>
+#        * <conflictor's-postinst> `abort-remove' `in-favour' <package>
+#          <new-version>
+#        * <postinst> `abort-remove'
+#        * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
+#          <failed-install-package> <version> `removing'
+#          <conflicting-package> <version>
+# for details, see http://www.debian.org/doc/debian-policy/ or
+# the debian-policy package
+
+
+case "$1" in
+    configure)
+    ;;
+
+    abort-upgrade|abort-remove|abort-deconfigure)
+    ;;
+
+    *)
+        echo "postinst called with unknown argument \`$1'" >&2
+        exit 1
+    ;;
+esac
+
+makedir() {
+    if [ ! -d $1 ]; then
+        mkdir $1
+    fi
+    chown $2 $1 && chmod $3 $1
+}
+
+# make sure that the mathoid user exists.  Simplest portable way to check is to
+# chown something, so we'll create the directories that we need here.
+cd /var/log
+makedir mathoid root:root 700
+chgrp mathoid mathoid 2>/dev/null ||
+    addgroup --system mathoid
+chown mathoid mathoid 2>/dev/null ||
+    adduser --system --home /usr/lib/mathoid --no-create-home \
+       --disabled-password --ingroup mathoid mathoid
+makedir mathoid mathoid:mathoid 700
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+exit 0
diff --git a/debian/mathoid.postinst.debhelper 
b/debian/mathoid.postinst.debhelper
new file mode 100644
index 0000000..8da8077
--- /dev/null
+++ b/debian/mathoid.postinst.debhelper
@@ -0,0 +1,8 @@
+# Automatically added by dh_installinit
+if [ -e "/etc/init/mathoid.conf" ]; then
+       invoke-rc.d mathoid start || exit $?
+fi
+# End automatically added section
+# Automatically added by dh_installinit
+update-rc.d -f mathoid remove >/dev/null || exit $?
+# End automatically added section
diff --git a/debian/mathoid.postrm b/debian/mathoid.postrm
new file mode 100644
index 0000000..bc23f40
--- /dev/null
+++ b/debian/mathoid.postrm
@@ -0,0 +1,59 @@
+#!/bin/sh
+# postrm script for mathoid
+#
+# see: dh_installdeb(1)
+
+set -e
+
+# summary of how this script can be called:
+#        * <postrm> `remove'
+#        * <postrm> `purge'
+#        * <old-postrm> `upgrade' <new-version>
+#        * <new-postrm> `failed-upgrade' <old-version>
+#        * <new-postrm> `abort-install'
+#        * <new-postrm> `abort-install' <old-version>
+#        * <new-postrm> `abort-upgrade' <old-version>
+#        * <disappearer's-postrm> `disappear' <overwriter>
+#          <overwriter-version>
+# for details, see http://www.debian.org/doc/debian-policy/ or
+# the debian-policy package
+
+
+case "$1" in
+    purge|remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
+    ;;
+
+    *)
+        echo "postrm called with unknown argument \`$1'" >&2
+        exit 1
+    ;;
+esac
+
+
+if [ "$1" = "purge" ] ; then
+    # Delete user; recipe from
+    # https://wiki.debian.org/AccountHandlingInMaintainerScripts
+    USERNAME=mathoid
+    if [ -x "$(command -v deluser)" ]; then
+        deluser --quiet --system $USERNAME > /dev/null || true
+    else
+        echo >&2 "not removing $USERNAME system account because deluser 
command was not found"
+    fi
+
+    # Delete directory for pid file
+    if [ -d "/var/run/mathoid" ]; then
+        rm -rf "/var/run/mathoid"
+    fi
+
+    # Delete directory for log files
+    if [ -d "/var/log/mathoid" ]; then
+        rm -rf "/var/log/mathoid"
+    fi
+fi
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+exit 0
diff --git a/debian/mathoid.preinst.debhelper b/debian/mathoid.preinst.debhelper
new file mode 100644
index 0000000..599ebf2
--- /dev/null
+++ b/debian/mathoid.preinst.debhelper
@@ -0,0 +1,14 @@
+# Automatically added by dh_installinit
+if [ "$1" = install ] || [ "$1" = upgrade ]; then
+       if [ -e "/etc/init.d/mathoid" ] && [ ! -L "/etc/init.d/mathoid" ]; then
+               if [ "`md5sum \"/etc/init.d/mathoid\" | sed -e \"s/ .*//\"`" != 
\
+                    "`dpkg-query -W -f='${Conffiles}' mathoid | sed -n -e 
\"\\\\' /etc/init.d/mathoid '{s/ obsolete$//;s/.* //p}\"`" ]
+               then
+                       echo "Obsolete conffile /etc/init.d/mathoid has been 
modified by you, renaming to .dpkg-bak"
+                       mv -f "/etc/init.d/mathoid" 
"/etc/init.d/mathoid.dpkg-bak"
+               else
+                       rm -f "/etc/init.d/mathoid"
+               fi
+       fi
+fi
+# End automatically added section
diff --git a/debian/mathoid.prerm.debhelper b/debian/mathoid.prerm.debhelper
new file mode 100644
index 0000000..e18e56c
--- /dev/null
+++ b/debian/mathoid.prerm.debhelper
@@ -0,0 +1,5 @@
+# Automatically added by dh_installinit
+if [ -e "/etc/init/mathoid.conf" ]; then
+       invoke-rc.d mathoid stop || exit $?
+fi
+# End automatically added section
diff --git a/debian/mathoid.substvars b/debian/mathoid.substvars
new file mode 100644
index 0000000..4a97bd3
--- /dev/null
+++ b/debian/mathoid.substvars
@@ -0,0 +1,2 @@
+misc:Depends=upstart-job
+perl:Depends=perl
diff --git a/debian/mathoid.upstart b/debian/mathoid.upstart
new file mode 100644
index 0000000..6f3c6a6
--- /dev/null
+++ b/debian/mathoid.upstart
@@ -0,0 +1,31 @@
+# vim: set ft=upstart:
+
+description "Mathoid HTTP service"
+
+start on (local-filesystem and net-device-up IFACE!=lo)
+stop on runlevel [!2345]
+
+# up ulimit -n a bit
+limit nofile 10000 10000
+
+setuid "mathoid"
+setgid "mathoid"
+
+env DEFAULTFILE=/etc/default/mathoid
+
+# Basic built-in defaults. Overridden by whatever
+# is defined in the DEFAULTFILE defined above.
+env NODE_PATH="/usr/lib/mathoid/node_modules"
+env MATHOID_BASE_PATH="/usr/lib/mathoid"
+env MATHOID_LOG_FILE="/var/log/mathoid/mathoid.log"
+env MATHOID_PORT="8010"
+
+respawn
+
+script
+    if [ -f "$DEFAULTFILE" ] ; then
+        . "$DEFAULTFILE"
+    fi
+    chdir "$MATHOID_BASE_PATH"
+    exec /usr/bin/nodejs mathoid.js < /dev/null >> "$MATHOID_LOG_FILE" 2>&1
+end script
diff --git a/debian/rules b/debian/rules
new file mode 100755
index 0000000..b760bee
--- /dev/null
+++ b/debian/rules
@@ -0,0 +1,13 @@
+#!/usr/bin/make -f
+# -*- makefile -*-
+# Sample debian/rules that uses debhelper.
+# This file was originally written by Joey Hess and Craig Small.
+# As a special exception, when this file is copied by dh-make into a
+# dh-make output file, you may use that output file without restriction.
+# This special exception was added by Craig Small in version 0.37 of dh-make.
+
+# Uncomment this to turn on verbose mode.
+#export DH_VERBOSE=1
+
+%:
+       dh $@ 
diff --git a/debian/source/format b/debian/source/format
new file mode 100644
index 0000000..89ae9db
--- /dev/null
+++ b/debian/source/format
@@ -0,0 +1 @@
+3.0 (native)
diff --git a/debian/upstart/mathoid.conf b/debian/upstart/mathoid.conf
new file mode 100644
index 0000000..5431a87
--- /dev/null
+++ b/debian/upstart/mathoid.conf
@@ -0,0 +1,18 @@
+# vim: set ft=upstart:
+
+# Upstart job configuration for Mathoid
+
+description "Mathoid HTTP service"
+
+start on (local-filesystems and net-device-up IFACE!=lo)
+stop on runlevel [!2345]
+
+setuid "mathoid"
+setgid "mathoid"
+
+env VCAP_APP_PORT="8010"
+
+chdir "/var/lib/mathoid/src"
+exec node mathoid.js
+
+respawn
\ No newline at end of file

-- 
To view, visit https://gerrit.wikimedia.org/r/113025
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I5f30ebebae567232778127a95bd3b3306c907af5
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/mathoid
Gerrit-Branch: master
Gerrit-Owner: Physikerwelt <w...@physikerwelt.de>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to