This is the complete patch for lua-cjson package.
Working but bit dirty.
commit d132c9795237b1ad22afdba8cfb8cdece9648fe0
Author: Zhou Mo <cdlumin...@gmail.com>
Date:   Tue Mar 15 09:03:05 2016 +0000

    integrate luarocks support for lua-cjson

diff --git a/debian/changelog b/debian/changelog
index ee923a5..8ac65b0 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,13 @@
+lua-cjson (2.1.0+dfsg-2.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Add luarocks support.
+    + lua-cjson.docs: also ship rockspec file.
+    + lua-cjson.postinst: prepare luarocks files.
+    + lua-cjson.postrm: remove luarocks files on removal.
+
+ -- Zhou Mo <cdlumin...@gmail.com>  Tue, 15 Mar 2016 08:45:50 +0000
+
 lua-cjson (2.1.0+dfsg-2) unstable; urgency=low
 
   * Add debian/watch file.
diff --git a/debian/lua-cjson.docs b/debian/lua-cjson.docs
new file mode 100644
index 0000000..8cd1f68
--- /dev/null
+++ b/debian/lua-cjson.docs
@@ -0,0 +1 @@
+lua-cjson-2.1.0-1.rockspec
diff --git a/debian/lua-cjson.postinst b/debian/lua-cjson.postinst
new file mode 100644
index 0000000..201536c
--- /dev/null
+++ b/debian/lua-cjson.postinst
@@ -0,0 +1,31 @@
+#!/bin/sh
+set -e
+
+prepare_luarocks ()
+{
+  local rockdir
+  rockdir='/usr/lib/luarocks/rocks/lua-cjson/2.1.0-1/'
+  mkdir -p $rockdir
+  echo 'rock_manifest = {}' > $rockdir/rock_manifest
+  cp /usr/share/doc/lua-cjson/lua-cjson-2.1.0-1.rockspec $rockdir
+  if [ -x /usr/bin/luarocks-admin ]; then
+    luarocks-admin make-manifest --local-tree --tree=/usr
+  fi
+}
+
+case "$1" in
+    configure) prepare_luarocks
+    ;;
+
+    abort-upgrade|abort-remove|abort-deconfigure)
+    ;;
+
+    *)
+        echo "postinst called with unknown argument \`$1'" >&2
+        exit 1
+    ;;
+esac
+
+#DEBHELPER#
+
+exit 0
diff --git a/debian/lua-cjson.prerm b/debian/lua-cjson.prerm
new file mode 100644
index 0000000..1e7c2e0
--- /dev/null
+++ b/debian/lua-cjson.prerm
@@ -0,0 +1,27 @@
+#!/bin/sh
+set -e
+
+remove_luarocks ()
+{
+  if [ -x /usr/bin/luarocks ]; then
+  	luarocks remove lua-cjson --local-tree --tree=/usr
+  fi
+}
+
+case "$1" in
+    remove|upgrade|deconfigure) remove_luarocks
+    ;;
+
+    failed-upgrade)
+    ;;
+
+    *)
+        echo "prerm called with unknown argument \`$1'" >&2
+        exit 1
+    ;;
+esac
+
+
+#DEBHELPER#
+
+exit 0

Reply via email to