Package: pootle
Version: 2.0.5-0.1
Severity: wishlist

Pootle should run on mysql or postgresql for optimal performance.
attached patch to use dbconfig-common for configuring database.
Index: debian/control
===================================================================
--- debian/control	(revision 2328)
+++ debian/control	(working copy)
@@ -13,7 +13,7 @@
 Package: pootle
 Architecture: all
 Pre-Depends: python-django
-Depends: ${misc:Depends}, ${python:Depends}, translate-toolkit (>= 1.5.2), adduser, python-lxml, libjs-jquery, python-django-registration, python-django-djblets
+Depends: ${misc:Depends}, ${python:Depends}, translate-toolkit (>= 1.5.2), adduser, python-lxml, libjs-jquery, python-django-registration, python-django-djblets, dbconfig-common
 Recommends: python-xapian, zip, python-levenshtein, iso-codes, cherrypy
 XB-Python-Version: ${python:Versions}
 Description: Web-based translation and translation management tool
Index: debian/pootle.postinst
===================================================================
--- debian/pootle.postinst	(revision 2328)
+++ debian/pootle.postinst	(working copy)
@@ -5,6 +5,18 @@
 
 set -e
 
+#dbc_first_version="2.0.5-2"
+dbc_generate_include='template:/etc/pootle/dbconfig.py'
+dbc_generate_include_args=' -o template_infile=/usr/share/doc/pootle/dbconfig.template'
+dbc_generate_include_owner='root:pootle'
+dbc_generate_include_perms='640'
+dbc_pgsql_createdb_encoding='UTF8'
+
+. /usr/share/debconf/confmodule
+# source dbconfig-common stuff');
+. /usr/share/dbconfig-common/dpkg/postinst
+dbc_go pootle $@
+
 POOTLE_USER=pootle
 POOTLE_GROUP=pootle
 POOTLE_HOME=/var/lib/pootle
Index: debian/dbconfig.template
===================================================================
--- debian/dbconfig.template	(revision 0)
+++ debian/dbconfig.template	(revision 0)
@@ -0,0 +1,9 @@
+DATABASE_ENGINE = '_DBC_DBTYPE_'                 # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
+DATABASE_NAME = '_DBC_DBNAME_'                   # Or path to database file if using sqlite3.
+DATABASE_USER = '_DBC_DBUSER_'                   # Not used with sqlite3.
+DATABASE_PASSWORD = '_DBC_DBPASS_'               # Not used with sqlite3.
+DATABASE_HOST = '_DBC_DBSERVER_'                   # Set to empty string for localhost. Not used with sqlite3.
+DATABASE_PORT = '_DBC_DBPORT_'                   # Set to empty string for default. Not used with sqlite3.
+
+if DATABASE_ENGINE == 'pgsql':
+   DATABASE_ENGINE = 'postgresql_psycopg2'
Index: debian/pootle.postrm
===================================================================
--- debian/pootle.postrm	(revision 0)
+++ debian/pootle.postrm	(revision 0)
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+set -e
+#set -x
+
+if [ -f /usr/share/debconf/confmodule ]; then
+        . /usr/share/debconf/confmodule
+fi
+if [ -f /usr/share/dbconfig-common/dpkg/postrm ]; then
+        . /usr/share/dbconfig-common/dpkg/postrm 
+        dbc_go db-test-multidbtype $@
+fi
+
+if [ "$1" = "purge" ]; then
+        rm -f /etc/pootle/dbconfig.py
+        if which ucf >/dev/null 2>&1; then
+                ucf --purge /etc/pootle/dbconfig.py
+                ucfr --purge pootle /etc/pootle/dbconfig.py
+        fi
+fi
+
+#DEBHELPER#
Index: debian/pootle.prerm
===================================================================
--- debian/pootle.prerm	(revision 2328)
+++ debian/pootle.prerm	(working copy)
@@ -1,6 +1,10 @@
 #!/bin/sh
 set -e
-    
+
+. /usr/share/debconf/confmodule
+. /usr/share/dbconfig-common/dpkg/prerm 
+dbc_go pootle $@
+   
 # dh_installdeb will replace this with shell code automatically
 # generated by other debhelper scripts.
 
Index: debian/changelog
===================================================================
--- debian/changelog	(revision 2328)
+++ debian/changelog	(working copy)
@@ -1,3 +1,10 @@
+pootle (2.0.5-0.2) unstable; urgency=low
+  * Non-maintainer upload with maintainer's agreement
+  * debian/pootle.config, debian/pootle.postinst, debian/pootle.prerm,
+    debian.pootle.postrm: Use dbconfig-common to configure database
+
+ -- Alaa Abd El Fattah <a...@translate.org.za>  Mon, 26 Jul 2010 17:15:10 +0200
+
 pootle (2.0.5-0.1) unstable; urgency=low
 
   * Non-maintainer upload with maintainer's agreement
Index: debian/patches/debian_use_dbconfig.patch
===================================================================
--- debian/patches/debian_use_dbconfig.patch	(revision 0)
+++ debian/patches/debian_use_dbconfig.patch	(revision 0)
@@ -0,0 +1,16 @@
+--- a/localsettings.py    (revision 2328)
++++ b/localsettings.py    (working copy)
+@@ -16,12 +16,8 @@
+ 
+ 
+ # Database configuration
+-DATABASE_ENGINE = 'sqlite3'                 # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
+-DATABASE_NAME = working_path('dbs/pootle.db') # Or path to database file if using sqlite3.
+-DATABASE_USER = ''                          # Not used with sqlite3.
+-DATABASE_PASSWORD = ''                      # Not used with sqlite3.
+-DATABASE_HOST = ''                          # Set to empty string for localhost. Not used with sqlite3.
+-DATABASE_PORT = ''                          # Set to empty string for default. Not used with sqlite3.
++# load debian dbconfig
++execfile(config_path("dbconfig.py"))
+ 
+ STATS_DB_PATH = working_path('dbs/stats.db') # None means the default path
Index: debian/patches/series
===================================================================
--- debian/patches/series	(revision 2328)
+++ debian/patches/series	(working copy)
@@ -3,3 +3,4 @@
 #pootle_continue_after_po_failure.patch
 #import_old_config.patch
 debian_remove_external
+debian_use_dbconfig.patch
\ No newline at end of file
Index: debian/pootle.config
===================================================================
--- debian/pootle.config	(revision 0)
+++ debian/pootle.config	(revision 0)
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+set -e
+
+. /usr/share/debconf/confmodule
+
+if [ -f /usr/share/dbconfig-common/dpkg/config ]; then
+        dbc_dbtypes="mysql, pgsql"
+        dbc_authmethod_user="password"
+        #dbc_first_version="2.0.5-2"
+        . /usr/share/dbconfig-common/dpkg/config 
+        dbc_go pootle $@
+fi
Index: debian/pootle.install
===================================================================
--- debian/pootle.install	(revision 2328)
+++ debian/pootle.install	(working copy)
@@ -1 +1,3 @@
 debian/pootle.prefs debian/users.prefs /etc/pootle/
+debian/dbconfig.template /usr/share/doc/pootle/
+

Reply via email to