[Debian-l10n-commits] r2798 - in /pootle/trunk/debian: control localsettings.py.default.md5sum localsettingsreader pootle.config pootle.config.in pootle.install pootle.postinst pootle.postrm rules
themill-guest at users.alioth.debian.org
themill-guest at users.alioth.debian.org
Wed Nov 16 16:09:44 UTC 2011
Author: themill-guest
Date: Wed Nov 16 16:09:43 2011
New Revision: 2798
URL: http://svn.debian.org/wsvn/?sc=1&rev=2798
Log:
Handle localsettings config through UCF
* use ucf on localsettings.py
* import existing settings directly into dbconfig rather than trying
to guess them
Added:
pootle/trunk/debian/localsettings.py.default.md5sum
pootle/trunk/debian/localsettingsreader
pootle/trunk/debian/pootle.config.in
- copied, changed from r2797, pootle/trunk/debian/pootle.config
Modified:
pootle/trunk/debian/control
pootle/trunk/debian/pootle.config
pootle/trunk/debian/pootle.install
pootle/trunk/debian/pootle.postinst
pootle/trunk/debian/pootle.postrm
pootle/trunk/debian/rules
Modified: pootle/trunk/debian/control
URL: http://svn.debian.org/wsvn/pootle/trunk/debian/control?rev=2798&op=diff
==============================================================================
--- pootle/trunk/debian/control (original)
+++ pootle/trunk/debian/control Wed Nov 16 16:09:43 2011
@@ -13,7 +13,7 @@
Package: pootle
Architecture: all
Pre-Depends: python-django
-Depends: ${misc:Depends}, ${python:Depends}, translate-toolkit (>= 1.9.0), adduser, python-lxml, libjs-jquery, libjs-jquery-cookie, libjs-json, python-django-registration, python-django-south, dbconfig-common, libapache2-mod-wsgi | httpd | python-cherrypy, lsb-base
+Depends: ${misc:Depends}, ${python:Depends}, translate-toolkit (>= 1.9.0), adduser, python-lxml, libjs-jquery, libjs-jquery-cookie, libjs-json, python-django-registration, python-django-south, dbconfig-common, libapache2-mod-wsgi | httpd | python-cherrypy, lsb-base, ucf
Recommends: python-xapian, zip, python-levenshtein, iso-codes, mysql-client | postgresql-client | sqlite3, python-mysqldb | python-psycopg2 | sqlite3, mysql-server | postgresql | sqlite3
Suggests: python-aeidon
Conflicts: python-django-djblets
Added: pootle/trunk/debian/localsettings.py.default.md5sum
URL: http://svn.debian.org/wsvn/pootle/trunk/debian/localsettings.py.default.md5sum?rev=2798&op=file
==============================================================================
--- pootle/trunk/debian/localsettings.py.default.md5sum (added)
+++ pootle/trunk/debian/localsettings.py.default.md5sum Wed Nov 16 16:09:43 2011
@@ -1,0 +1,2 @@
+2d8c6d3f804d47c294925f922ab9d952 squeeze/2.0.5-0.3
+
Added: pootle/trunk/debian/localsettingsreader
URL: http://svn.debian.org/wsvn/pootle/trunk/debian/localsettingsreader?rev=2798&op=file
==============================================================================
--- pootle/trunk/debian/localsettingsreader (added)
+++ pootle/trunk/debian/localsettingsreader Wed Nov 16 16:09:43 2011
@@ -1,0 +1,30 @@
+#!/usr/bin/python
+# Read in a pootle configuration to bootstrap dbconfig-common
+# Included in the pootle.config file by debian/rules based on the
+# debian/localsettingsreader in the source pacakge
+#
+# Released under the same terms as pootle
+# Copyright (c) Stuart Prescott 2011
+
+import os
+import sys
+try:
+ execfile('/etc/pootle/localsettings.py')
+except:
+ sys.exit(1)
+
+DATABASE_BASEPATH=''
+if DATABASE_ENGINE == 'postgresql_psycopg2':
+ DATABASE_ENGINE = 'pgsql'
+elif DATABASE_ENGINE == 'sqlite3':
+ db = DATABASE_NAME
+ DATABASE_NAME = os.path.basename(db)
+ DATABASE_BASEPATH = os.path.dirname(db)
+
+print 'dbc_dbuser="%s"' % DATABASE_USER
+print 'dbc_dbpass="%s"' % DATABASE_PASSWORD
+print 'dbc_dbname="%s"' % DATABASE_NAME
+print 'dbc_dbserver="%s"' % DATABASE_HOST
+print 'dbc_dbport="%s"' % DATABASE_PORT
+print 'dbc_dbtype="%s"' % DATABASE_ENGINE
+print 'dbc_basepath="%s"' % DATABASE_BASEPATH
Modified: pootle/trunk/debian/pootle.config
URL: http://svn.debian.org/wsvn/pootle/trunk/debian/pootle.config?rev=2798&op=diff
==============================================================================
--- pootle/trunk/debian/pootle.config (original)
+++ pootle/trunk/debian/pootle.config Wed Nov 16 16:09:43 2011
@@ -4,26 +4,64 @@
. /usr/share/debconf/confmodule
+write_config_script() {
+ # create a script to read config files prior to unpack
+ CONFIG_SCRIPT=$(mktemp -t pootle-readconfig.XXXXXXXX) || exit 1
+ trap "rm $CONFIG_SCRIPT; exit 1" INT QUIT
+ chmod 700 $CONFIG_SCRIPT
+ cat > $CONFIG_SCRIPT <<'EOF'
+#!/usr/bin/python
+# Read in a pootle configuration to bootstrap dbconfig-common
+# Included in the pootle.config file by debian/rules based on the
+# debian/localsettingsreader in the source pacakge
+#
+# Released under the same terms as pootle
+# Copyright (c) Stuart Prescott 2011
+
+import os
+import sys
+try:
+ execfile('/etc/pootle/localsettings.py')
+except:
+ sys.exit(1)
+
+DATABASE_BASEPATH=''
+if DATABASE_ENGINE == 'postgresql_psycopg2':
+ DATABASE_ENGINE = 'pgsql'
+elif DATABASE_ENGINE == 'sqlite3':
+ db = DATABASE_NAME
+ DATABASE_NAME = os.path.basename(db)
+ DATABASE_BASEPATH = os.path.dirname(db)
+
+print 'dbc_dbuser="%s"' % DATABASE_USER
+print 'dbc_dbpass="%s"' % DATABASE_PASSWORD
+print 'dbc_dbname="%s"' % DATABASE_NAME
+print 'dbc_dbserver="%s"' % DATABASE_HOST
+print 'dbc_dbport="%s"' % DATABASE_PORT
+print 'dbc_dbtype="%s"' % DATABASE_ENGINE
+print 'dbc_basepath="%s"' % DATABASE_BASEPATH
+
+EOF
+}
+
[ -r /etc/default/pootle ] && . /etc/default/pootle
POOTLE_HOME=/var/lib/pootle
if [ -f /usr/share/dbconfig-common/dpkg/config ]; then
- if [ -f /var/lib/pootle/dbs/pootle.db ]; then
- # if there is an existing sqlite installation then prefer that option
- dbc_dbtypes="sqlite3, mysql, pgsql"
- else
- dbc_dbtypes="mysql, pgsql, sqlite3"
- fi
+ write_config_script
+ dbc_debug=true
+ dbc_first_version="2.1.6-1~bpo60+1"
+ dbc_load_include="exec:$CONFIG_SCRIPT"
+ dbc_dbtypes="mysql, pgsql, sqlite3"
dbc_authmethod_user="password"
- dbc_first_version="2.0.5-2"
dbc_basepath=$POOTLE_HOME/dbs
. /usr/share/dbconfig-common/dpkg/config
dbc_go pootle $@
+ rm $CONFIG_SCRIPT
fi
-if [ -x /etc/init.d/pootle ] && \
- /etc/init.d/pootle status | grep -q "server running"; then
+if [ -x /etc/init.d/pootle ] && /etc/init.d/pootle status | grep -vq "disabled" >/dev/null; then
db_set pootle/webserver standalone
elif [ -f /etc/apache2/apache2.conf ]; then
db_set pootle/webserver apache2
Copied: pootle/trunk/debian/pootle.config.in (from r2797, pootle/trunk/debian/pootle.config)
URL: http://svn.debian.org/wsvn/pootle/trunk/debian/pootle.config.in?rev=2798&op=diff
==============================================================================
--- pootle/trunk/debian/pootle.config (original)
+++ pootle/trunk/debian/pootle.config.in Wed Nov 16 16:09:43 2011
@@ -4,26 +4,34 @@
. /usr/share/debconf/confmodule
+write_config_script() {
+ # create a script to read config files prior to unpack
+ CONFIG_SCRIPT=$(mktemp -t pootle-readconfig.XXXXXXXX) || exit 1
+ trap "rm $CONFIG_SCRIPT; exit 1" INT QUIT
+ chmod 700 $CONFIG_SCRIPT
+ cat > $CONFIG_SCRIPT <<'EOF'
+#localsettingsreader#
+EOF
+}
+
[ -r /etc/default/pootle ] && . /etc/default/pootle
POOTLE_HOME=/var/lib/pootle
if [ -f /usr/share/dbconfig-common/dpkg/config ]; then
- if [ -f /var/lib/pootle/dbs/pootle.db ]; then
- # if there is an existing sqlite installation then prefer that option
- dbc_dbtypes="sqlite3, mysql, pgsql"
- else
- dbc_dbtypes="mysql, pgsql, sqlite3"
- fi
+ write_config_script
+ dbc_debug=true
+ dbc_first_version="2.1.6-1~bpo60+1"
+ dbc_load_include="exec:$CONFIG_SCRIPT"
+ dbc_dbtypes="mysql, pgsql, sqlite3"
dbc_authmethod_user="password"
- dbc_first_version="2.0.5-2"
dbc_basepath=$POOTLE_HOME/dbs
. /usr/share/dbconfig-common/dpkg/config
dbc_go pootle $@
+ rm $CONFIG_SCRIPT
fi
-if [ -x /etc/init.d/pootle ] && \
- /etc/init.d/pootle status | grep -q "server running"; then
+if [ -x /etc/init.d/pootle ] && /etc/init.d/pootle status | grep -vq "disabled" >/dev/null; then
db_set pootle/webserver standalone
elif [ -f /etc/apache2/apache2.conf ]; then
db_set pootle/webserver apache2
Modified: pootle/trunk/debian/pootle.install
URL: http://svn.debian.org/wsvn/pootle/trunk/debian/pootle.install?rev=2798&op=diff
==============================================================================
--- pootle/trunk/debian/pootle.install (original)
+++ pootle/trunk/debian/pootle.install Wed Nov 16 16:09:43 2011
@@ -1,3 +1,4 @@
debian/dbconfig.template /usr/share/doc/pootle/
debian/apache2.conf /usr/share/pootle/conf/
debian/mysql /usr/share/dbconfig-common/data/pootle/install/
+debian/localsettings.py.default.md5sum /usr/share/pootle/
Modified: pootle/trunk/debian/pootle.postinst
URL: http://svn.debian.org/wsvn/pootle/trunk/debian/pootle.postinst?rev=2798&op=diff
==============================================================================
--- pootle/trunk/debian/pootle.postinst (original)
+++ pootle/trunk/debian/pootle.postinst Wed Nov 16 16:09:43 2011
@@ -16,7 +16,8 @@
db_get pootle/server-groupname || true
POOTLE_GROUP=${RET-www-data}
-dbc_first_version="2.0.5-2"
+dbc_debug=true
+dbc_first_version="2.1.6-1~bpo60+1"
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="$POOTLE_USER:$POOTLE_GROUP"
@@ -38,6 +39,11 @@
$POOTLE_USER
echo "..done"
fi
+}
+
+merge_config() {
+ ucf --debconf-ok /usr/share/pootle/localsettings.py.default /etc/pootle/localsettings.py
+ ucfr pootle /etc/pootle/localsettings.py
}
set_permissions() {
@@ -143,6 +149,7 @@
create_user_group
dbc_go pootle $@
+ merge_config
set_permissions
configure_memcached
if [ -z "$2" ]; then
Modified: pootle/trunk/debian/pootle.postrm
URL: http://svn.debian.org/wsvn/pootle/trunk/debian/pootle.postrm?rev=2798&op=diff
==============================================================================
--- pootle/trunk/debian/pootle.postrm (original)
+++ pootle/trunk/debian/pootle.postrm Wed Nov 16 16:09:43 2011
@@ -12,11 +12,16 @@
fi
if [ "$1" = "purge" ]; then
- rm -f /etc/pootle/dbconfig.py /etc/pootle/debian_config.py
- if which ucf >/dev/null 2>&1; then
- ucf --purge /etc/pootle/dbconfig.py
- ucfr --purge pootle /etc/pootle/dbconfig.py
- fi
+ rm -f /etc/pootle/debian_config.py
+ for f in /etc/pootle/dbconfig.py \
+ /etc/pootle/localsettings.py
+ do
+ rm -f "$f"
+ if which ucf >/dev/null 2>&1; then
+ ucf --purge "$f"
+ ucfr --purge pootle "$f"
+ fi
+ done
fi
#DEBHELPER#
Modified: pootle/trunk/debian/rules
URL: http://svn.debian.org/wsvn/pootle/trunk/debian/rules?rev=2798&op=diff
==============================================================================
--- pootle/trunk/debian/rules (original)
+++ pootle/trunk/debian/rules Wed Nov 16 16:09:43 2011
@@ -16,4 +16,12 @@
# Pootle includes a copy of some javascript libraries
rm $(d)/usr/share/pootle/html/js/jquery/jquery.min.js $(d)/usr/share/pootle/html/js/jquery/jquery.cookie.js #$(d)/usr/share/pootle/html/js/json2.min.js
mv $(d)/usr/share/doc/pootle/wsgi.py $(d)/usr/share/pootle/wsgi.py
+ mv $(d)/etc/pootle/localsettings.py $(d)/usr/share/pootle/localsettings.py.default
+
+# Regenerate the pootle.config file from the shell script
+# pootle.config.in and the python script localsettingsreader.
+# (to be run by the maintainer as required, not automatically)
+pootle.config: pootle.config.in localsettingsreader rules
+ perl -pe 's~#localsettingsreader#~qx{cat localsettingsreader}~e' \
+ < pootle.config.in > pootle.config
More information about the Debian-l10n-commits
mailing list