[Debian-l10n-commits] r2855 - in /pootle/trunk/debian: README.Debian install-pootle-examples po/templates.pot pootle.config pootle.config.in pootle.dirs pootle.install pootle.postinst rules templates

themill-guest at users.alioth.debian.org themill-guest at users.alioth.debian.org
Thu Feb 9 23:04:20 UTC 2012


Author: themill-guest
Date: Thu Feb  9 23:04:20 2012
New Revision: 2855

URL: http://svn.debian.org/wsvn/?sc=1&rev=2855
Log:
Conditionally install sample po with helper script

* Only install the sample po files if requested in postinst; default is
  to install terminology and tutorial projects as that is what upstream
  believes is a reasonable default.
* Install the po files using a non-privileged helper to get the permissions
  right without using chown -R and without being vulnerable to symlink attacks.
* Installing the po files via a help means that dpkg and the local pootle
  aren't fighting over control of the files.

Added:
    pootle/trunk/debian/install-pootle-examples   (with props)
Modified:
    pootle/trunk/debian/README.Debian
    pootle/trunk/debian/po/templates.pot
    pootle/trunk/debian/pootle.config
    pootle/trunk/debian/pootle.config.in
    pootle/trunk/debian/pootle.dirs
    pootle/trunk/debian/pootle.install
    pootle/trunk/debian/pootle.postinst
    pootle/trunk/debian/rules
    pootle/trunk/debian/templates

Modified: pootle/trunk/debian/README.Debian
URL: http://svn.debian.org/wsvn/pootle/trunk/debian/README.Debian?rev=2855&op=diff
==============================================================================
--- pootle/trunk/debian/README.Debian (original)
+++ pootle/trunk/debian/README.Debian Thu Feb  9 23:04:20 2012
@@ -19,6 +19,15 @@
 This file may contain passwords, in which case you should restrict the
 access to this file; however, note that it should be readable by the
 user running either PootleServer or the WSGI web app.
+
+The post-installation script offers the option of copying some sample
+translation projects into the new Pootle installation. It is highly recommended
+that the "terminology" and "tutorial" projects are copied in this way as they
+provide benefits to the end users of Pootle. You may manually copy po files
+into their correct locations and give them the correct file permissions by
+running, as the user that your pootle installation uses:
+
+    /usr/share/pootle/install-pootle-examples terminology tutorial
 
 3.  Check web server configuration
 

Added: pootle/trunk/debian/install-pootle-examples
URL: http://svn.debian.org/wsvn/pootle/trunk/debian/install-pootle-examples?rev=2855&op=file
==============================================================================
--- pootle/trunk/debian/install-pootle-examples (added)
+++ pootle/trunk/debian/install-pootle-examples Thu Feb  9 23:04:20 2012
@@ -1,0 +1,96 @@
+#!/bin/bash
+##########################################################################
+# Copy the po files for an example pootle project from the location
+# specified in the package to the location where pootle will look for
+# them.
+#
+# Copyright © Stuart Prescott 2012 <stuart+debian at nanonanonano.net>
+# Available under the same terms as Pootle itself (GPLv2 or later).
+##########################################################################
+# TODO:
+# * consider handling upgrades with msgmerge or the translate-toolkit
+#   equivalent
+##########################################################################
+
+# set -x
+set -u
+set -e
+
+DESTDIR=/var/lib/pootle/po
+SRCDIR=/usr/share/pootle/po
+POOTLE_USER=www-data
+POOTLE_GROUP=www-data
+. /etc/default/pootle
+
+showhelp() {
+  echo "Usage: $(basename $0) project_name [ project_name ... ]
+
+  Copy each project to $DESTDIR, ensuring that the file ownership and
+  permissions are sensible according to the pootle installation. In this case,
+  the user will be set to '$POOTLE_USER' and the group to '$POOTLE_GROUP'.
+
+  This utility is designed to be run as that user and not as root.
+
+  Available projects are:
+"
+  if [ -x /usr/bin/find ]; then
+    (cd "$SRCDIR"; find -maxdepth 1 -type d -a \! -name '.' -printf '%f\n')
+  else
+    (cd "$SRCDIR"; ls -1)
+  fi
+  exit 1
+}
+
+[ $# -lt 1 ] && showhelp
+[ "$1" = '-h' -o "$1" = '--help' ] && showhelp
+
+if [ "`id -u`" -eq 0 ]; then
+  if [ "$POOTLE_USER" != "root" ]; then
+    echo "Note: $(basename $0) is not intended to be run as root."
+    echo "Running as $POOTLE_USER instead."
+    su "$POOTLE_USER" -c "$0 $@"
+  else
+    echo "Error: it looks like POOTLE_USER is configured to be root in /etc/default/pootle"
+    echo "Are you insane? Cowardly refusing to do anything in this situation."
+    exit 1
+  fi
+elif [ "`id -un`" != "$POOTLE_USER" ]; then
+  echo "Error: this utility should be run as the user that Pootle will run as."
+  echo "This is currently configured to be '$POOTLE_USER' in /etc/default/pootle."
+  exit 1
+fi
+
+
+shopt -s nullglob
+
+
+installpo() {
+  local dest=$1 src=$2 po
+  install -m 775 -o "$POOTLE_USER" -g "$POOTLE_GROUP" -d "$dest"
+  for po in "$src"/*.po "$src"/*.pot; do
+    install -m 664 -o "$POOTLE_USER" -g "$POOTLE_GROUP" -t "$dest" "$po"
+  done
+}
+
+for project in "$@"; do
+  for language_dir in "$SRCDIR/$project/"*; do
+    if [ ! -d "$language_dir" ]; then
+      # odd... there should only be directories at that level
+      continue
+    fi
+    language=$(basename "$language_dir")
+    dest="$DESTDIR/$project/$language"
+    #install -m 775 -o "$POOTLE_USER" -g "$POOTLE_GROUP" -d "$dest"
+
+    installpo "$dest" "$language_dir"
+
+    for i in "$language_dir/"*; do
+      if [ -d "$i" ]; then
+        subdest="$dest/$(basename $i)"
+        #install -m 775 -o "$POOTLE_USER" -g "$POOTLE_GROUP" -d "$subdest"
+        installpo "$subdest" "$i"
+      fi
+    done
+  done
+done
+

Propchange: pootle/trunk/debian/install-pootle-examples
------------------------------------------------------------------------------
    svn:executable = *

Modified: pootle/trunk/debian/po/templates.pot
URL: http://svn.debian.org/wsvn/pootle/trunk/debian/po/templates.pot?rev=2855&op=diff
==============================================================================
--- pootle/trunk/debian/po/templates.pot (original)
+++ pootle/trunk/debian/po/templates.pot Thu Feb  9 23:04:20 2012
@@ -1,13 +1,14 @@
-# Translation of pootle debconf templates into LANGUAGE
-# Copyright (C) 2011 Stuart Prescott
-# This file is distributed under the same license as the pootle package.
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR <EMAIL at ADDRESS>, YEAR.
 #
 #, fuzzy
 msgid ""
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
 "Report-Msgid-Bugs-To: pootle at packages.debian.org\n"
-"POT-Creation-Date: 2011-10-28 01:17+0100\n"
+"POT-Creation-Date: 2012-02-06 00:42+0000\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL at ADDRESS>\n"
 "Language-Team: LANGUAGE <LL at li.org>\n"
@@ -69,3 +70,20 @@
 "configured to run Pootle. Specify \"standalone\" to run the PootleServer on "
 "its own or \"none\" to perform manual configuration later."
 msgstr ""
+
+#. Type: multiselect
+#. Description
+#: ../templates:4001
+msgid "Install standard projects:"
+msgstr ""
+
+#. Type: multiselect
+#. Description
+#: ../templates:4001
+msgid ""
+"Pootle comes with a number of standard translation projects:\n"
+" - terminology: provides hints to translators to help keep terminology\n"
+"   consistent (recommended)\n"
+" - tutorial: help new users become familiar with pootle (recommended)\n"
+" - pootle: the translations of the pootle application itself"
+msgstr ""

Modified: pootle/trunk/debian/pootle.config
URL: http://svn.debian.org/wsvn/pootle/trunk/debian/pootle.config?rev=2855&op=diff
==============================================================================
--- pootle/trunk/debian/pootle.config (original)
+++ pootle/trunk/debian/pootle.config Thu Feb  9 23:04:20 2012
@@ -51,7 +51,7 @@
 if [ -f /usr/share/dbconfig-common/dpkg/config ]; then
     write_config_script
     #dbc_debug=true
-    dbc_first_version="2.1.6-1~bpo60+1"
+    dbc_first_version="2.1.6-1"
     dbc_load_include="exec:$CONFIG_SCRIPT"
     dbc_dbtypes="mysql, pgsql, sqlite3"
     dbc_authmethod_user="password"
@@ -96,4 +96,5 @@
 
 db_input medium pootle/server-username || true
 db_input medium pootle/server-groupname || true
+db_input low pootle/install-examples || true
 db_go || true

Modified: pootle/trunk/debian/pootle.config.in
URL: http://svn.debian.org/wsvn/pootle/trunk/debian/pootle.config.in?rev=2855&op=diff
==============================================================================
--- pootle/trunk/debian/pootle.config.in (original)
+++ pootle/trunk/debian/pootle.config.in Thu Feb  9 23:04:20 2012
@@ -66,4 +66,5 @@
 
 db_input medium pootle/server-username || true
 db_input medium pootle/server-groupname || true
+db_input low pootle/install-examples || true
 db_go || true

Modified: pootle/trunk/debian/pootle.dirs
URL: http://svn.debian.org/wsvn/pootle/trunk/debian/pootle.dirs?rev=2855&op=diff
==============================================================================
--- pootle/trunk/debian/pootle.dirs (original)
+++ pootle/trunk/debian/pootle.dirs Thu Feb  9 23:04:20 2012
@@ -1,5 +1,5 @@
 etc/pootle
 usr/sbin
 usr/share/doc/pootle
-usr/share/pootle
+usr/share/pootle/po
 var/lib/pootle

Modified: pootle/trunk/debian/pootle.install
URL: http://svn.debian.org/wsvn/pootle/trunk/debian/pootle.install?rev=2855&op=diff
==============================================================================
--- pootle/trunk/debian/pootle.install (original)
+++ pootle/trunk/debian/pootle.install Thu Feb  9 23:04:20 2012
@@ -1,5 +1,6 @@
 debian/dbconfig.template /usr/share/pootle/
 debian/apache2.conf /usr/share/pootle/
+debian/install-pootle-examples /usr/share/pootle/
 debian/mysql /usr/share/dbconfig-common/data/pootle/install/
 debian/localsettings.py.default.md5sum /usr/share/pootle/
 CREDITS /usr/share/doc/pootle/

Modified: pootle/trunk/debian/pootle.postinst
URL: http://svn.debian.org/wsvn/pootle/trunk/debian/pootle.postinst?rev=2855&op=diff
==============================================================================
--- pootle/trunk/debian/pootle.postinst (original)
+++ pootle/trunk/debian/pootle.postinst Thu Feb  9 23:04:20 2012
@@ -112,6 +112,14 @@
     done
 }
 
+copy_example_files() {
+    local example
+    db_get pootle/install-examples || true
+    for example in $(echo $RET | sed s/,//); do
+        su "$POOTLE_USER" -p -c "/usr/share/pootle/install-pootle-examples $example"
+    done
+}
+
 apache2_install() {
     # only enable WSGI config if libapache2-mod-wsgi is to be installed
     if [ -e /usr/lib/apache2/modules/mod_wsgi.so ]; then
@@ -162,6 +170,7 @@
         configure_memcached
         if [ -z "$2" ]; then
             # new installation
+            copy_example_files
             if [ $dbc_install != 'false' ]; then
                 su $POOTLE_USER -p -c "
                   django-admin syncdb --settings pootle.settings --noinput

Modified: pootle/trunk/debian/rules
URL: http://svn.debian.org/wsvn/pootle/trunk/debian/rules?rev=2855&op=diff
==============================================================================
--- pootle/trunk/debian/rules (original)
+++ pootle/trunk/debian/rules Thu Feb  9 23:04:20 2012
@@ -21,6 +21,7 @@
 	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
+	mv $(d)/var/lib/pootle/po/* $(d)/usr/share/pootle/po/
 
 
 # Regenerate the pootle.config file from the shell script

Modified: pootle/trunk/debian/templates
URL: http://svn.debian.org/wsvn/pootle/trunk/debian/templates?rev=2855&op=diff
==============================================================================
--- pootle/trunk/debian/templates (original)
+++ pootle/trunk/debian/templates Thu Feb  9 23:04:20 2012
@@ -27,3 +27,14 @@
  Please choose the web server, if any, that should be automatically configured
  to run Pootle. Specify "standalone" to run the PootleServer on its own or
  "none" to perform manual configuration later.
+
+Template: pootle/install-examples
+Type: multiselect
+Choices: terminology, tutorial, pootle
+Default: terminology, tutorial
+_Description: Install standard projects:
+ Pootle comes with a number of standard translation projects:
+  - terminology: provides hints to translators to help keep terminology
+    consistent (recommended)
+  - tutorial: help new users become familiar with pootle (recommended)
+  - pootle: the translations of the pootle application itself




More information about the Debian-l10n-commits mailing list