r47068 - in /trunk/libconfig-model-perl/debian: ./ dh/ po/

ddumont-guest at users.alioth.debian.org ddumont-guest at users.alioth.debian.org
Thu Nov 12 16:03:41 UTC 2009


Author: ddumont-guest
Date: Thu Nov 12 16:03:31 2009
New Revision: 47068

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=47068
Log:
First working version of dh_config_model_upgrade with debconf question

Added:
    trunk/libconfig-model-perl/debian/libconfig-model-perl.lintian-overrides
    trunk/libconfig-model-perl/debian/libconfig-model-perl.templates
      - copied, changed from r46844, trunk/libconfig-model-perl/debian/dh/templates-config-model
    trunk/libconfig-model-perl/debian/po/
    trunk/libconfig-model-perl/debian/po/POTFILES.in
    trunk/libconfig-model-perl/debian/po/templates.pot
Removed:
    trunk/libconfig-model-perl/debian/dh/templates-config-model
Modified:
    trunk/libconfig-model-perl/debian/changelog
    trunk/libconfig-model-perl/debian/control
    trunk/libconfig-model-perl/debian/dh/config-config-model
    trunk/libconfig-model-perl/debian/dh/dh_config_model_upgrade
    trunk/libconfig-model-perl/debian/dh/postinst-config-model

Modified: trunk/libconfig-model-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libconfig-model-perl/debian/changelog?rev=47068&op=diff
==============================================================================
--- trunk/libconfig-model-perl/debian/changelog (original)
+++ trunk/libconfig-model-perl/debian/changelog Thu Nov 12 16:03:31 2009
@@ -2,11 +2,17 @@
 
   [ Dominique Dumont ]
   * dh_config_model_upgrade: setup debconf question to ask whether to use
-    config-model to upgrade configuration data.
+    config-model to upgrade configuration data in target package.
 
   [ gregor herrmann ]
   * debian/control: Changed: (build-)depend on perl instead of perl-
     modules.
+
+  [ Dominique Dumont ]
+  * dh_config_model_upgrade: A template is provided for this
+    question. This template will be used and shipped with target
+    package. Added -edit_option whose value is passed verbatim to
+    config-edit command.
 
  -- Dominique Dumont <dominique.dumont at hp.com>  Mon, 05 Oct 2009 10:58:25 +0200
 

Modified: trunk/libconfig-model-perl/debian/control
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libconfig-model-perl/debian/control?rev=47068&op=diff
==============================================================================
--- trunk/libconfig-model-perl/debian/control (original)
+++ trunk/libconfig-model-perl/debian/control Thu Nov 12 16:03:31 2009
@@ -13,7 +13,8 @@
 		     libtest-exception-perl,
 		     libtest-pod-perl,
 		     libtest-warn-perl, 
- 		     liblog-log4perl-perl (>= 1.11)
+ 		     liblog-log4perl-perl (>= 1.11),
+		     po-debconf
 Maintainer: Debian Perl Group <pkg-perl-maintainers at lists.alioth.debian.org>
 Standards-Version: 3.8.3
 Vcs-Svn: svn://svn.debian.org/svn/pkg-perl/trunk/libconfig-model-perl

Modified: trunk/libconfig-model-perl/debian/dh/config-config-model
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libconfig-model-perl/debian/dh/config-config-model?rev=47068&op=diff
==============================================================================
--- trunk/libconfig-model-perl/debian/dh/config-config-model (original)
+++ trunk/libconfig-model-perl/debian/dh/config-config-model Thu Nov 12 16:03:31 2009
@@ -1,14 +1,16 @@
 #!/bin/sh
 
 set -e
-set -x
 
 # load confmodule only if required
-if [ `typeset -F db_get` != "db_get" ] ; then
+if [[ `typeset -F db_get` != "db_get" ]] ; then
     . /usr/share/debconf/confmodule
 fi
 
-db_set libconfig-model-perl/automatic-upgrade pkg_name %PACKAGE% || true
+db_x_loadtemplatefile /var/lib/dpkg/info/libconfig-model-perl.templates
+
+db_subst libconfig-model-perl/automatic-upgrade pkg_name %PACKAGE%
+
 db_input medium libconfig-model-perl/automatic-upgrade || true
 
 db_go || true

Modified: trunk/libconfig-model-perl/debian/dh/dh_config_model_upgrade
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libconfig-model-perl/debian/dh/dh_config_model_upgrade?rev=47068&op=diff
==============================================================================
--- trunk/libconfig-model-perl/debian/dh/dh_config_model_upgrade (original)
+++ trunk/libconfig-model-perl/debian/dh/dh_config_model_upgrade Thu Nov 12 16:03:31 2009
@@ -28,10 +28,12 @@
 use Debian::Debhelper::Dh_Lib ;
 
 $dh{model_name} = ''; # avoids undef warnings
+$dh{edit_option} = '';
 
 init(options => { "model_name|mn=s"    => \$dh{model_name}, 
 		  "model_package|mp=s" => \$dh{model_package},
 		  "model_version|mv=s" => \$dh{model_version},
+		  "edit_option=s"      => \$dh{edit_option},
 		}
     );
 
@@ -83,10 +85,11 @@
 
     my $model_sed = 's/%MODEL%/'.$dh{model_name}.'/ ; ' ;
     my $pack_sed  = 's/%PACKAGE%/'.$package.'/ ; ' ;
+    my $opt_sed   = 's/%OPTION%/'.$dh{edit_option}.'/ ; ' ;
 
     # calls autoscript to update pkg.postinst with config-edit command
     autoscript($package,postinst => 'postinst-config-model',
-	       $model_sed.$pack_sed ) ;
+	       $model_sed.$pack_sed.$opt_sed ) ;
 
     # ask debconf question in pre-inst
     autoscript($package, config => 'config-config-model',$pack_sed);
@@ -101,7 +104,8 @@
 =head1 SYNOPSIS
 
  dh_config_model_upgrade [ debhelper options ] [ --model_name xx ] \
-  [ --model_package xx [ --model_version yy ] ] [ -p pkg ]
+  [ --model_package xx [ --model_version yy ] ] \
+  [ --edit_option "..." ] [ -p pkg ]
 
 =head1 DESCRIPTION
 
@@ -151,6 +155,11 @@
 
 Specifies the minimal version of the package that provides the model.
 (shortcut C<--mv>)
+
+=head2 --edit_option "..."
+
+Specify a list of options or command that will be passed verbatim to
+L<config-edit> during upgrade. Be sure to use quotes.
 
 =head2 -p
 
@@ -231,6 +240,11 @@
  build:
    dh_config_model_upgrade -model_name FooBar
 
+Here's an example to avoid using Augeas when upgrading
+
+ build:
+   dh_config_model_upgrade -model_name Sshd -edit_option "-backend custom"
+
 =head1 CAVEATS
 
 Using options with a single dash (e.g. C<-model_name> instead of

Modified: trunk/libconfig-model-perl/debian/dh/postinst-config-model
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libconfig-model-perl/debian/dh/postinst-config-model?rev=47068&op=diff
==============================================================================
--- trunk/libconfig-model-perl/debian/dh/postinst-config-model (original)
+++ trunk/libconfig-model-perl/debian/dh/postinst-config-model Thu Nov 12 16:03:31 2009
@@ -8,19 +8,20 @@
 # - fire UI ?
 # - don't upgrade 
 
-set -x 
-
 # load confmodule only if required
 if [ `typeset -F db_get` != "db_get" ] ; then
     . /usr/share/debconf/confmodule
 fi
 
+db_x_loadtemplatefile /var/lib/dpkg/info/libconfig-model-perl.templates
+
+db_subst libconfig-model-perl/automatic-upgrade pkg_name %PACKAGE%
+
 # debconf question to check if user want automatic upgrade
-db_set libconfig-model-perl/automatic-upgrade pkg_name %PACKAGE% || true
-db_get medium libconfig-model-perl/automatic-upgrade || true
+db_get libconfig-model-perl/automatic-upgrade || true
 
 if [ "$RET" = true ]  
 then 
-    echo "config-model-edit is upgrading %PACKAGE configuration with model %MODEL%."
-    config-edit -model %MODEL% -ui none -save
+    echo "config-model-edit is upgrading %PACKAGE% configuration with model %MODEL%."
+    config-edit -model %MODEL% -ui none -save %OPTION%
 fi

Added: trunk/libconfig-model-perl/debian/libconfig-model-perl.lintian-overrides
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libconfig-model-perl/debian/libconfig-model-perl.lintian-overrides?rev=47068&op=file
==============================================================================
--- trunk/libconfig-model-perl/debian/libconfig-model-perl.lintian-overrides (added)
+++ trunk/libconfig-model-perl/debian/libconfig-model-perl.lintian-overrides Thu Nov 12 16:03:31 2009
@@ -1,0 +1,9 @@
+# the template file is used by package that will call
+# dh_config_model_upgrade during their build (let's call this package
+# the target package)
+
+libconfig-model-perl: no-debconf-config
+
+# and this file will be copied and used by the target package
+
+libconfig-model-perl: debconf-is-not-a-registry usr/share/debhelper/autoscripts/config-config-model

Copied: trunk/libconfig-model-perl/debian/libconfig-model-perl.templates (from r46844, trunk/libconfig-model-perl/debian/dh/templates-config-model)
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libconfig-model-perl/debian/libconfig-model-perl.templates?rev=47068&op=diff
==============================================================================
--- trunk/libconfig-model-perl/debian/dh/templates-config-model (original)
+++ trunk/libconfig-model-perl/debian/libconfig-model-perl.templates Thu Nov 12 16:03:31 2009
@@ -4,9 +4,9 @@
 Template: libconfig-model-perl/automatic-upgrade
 Type: boolean
 Default: true
-_Description: Upgrade config automatically ?
+_Description: Upgrade config automatically?
  ${pkg_name} configuration files can be upgraded automatically by merging
  your values with new recommendations from Debian. On the downside, 
- comments are not preserved. Otherwise automatic configuration upgrade
- is safe (even though still experimental)
+ comments are not preserved. Otherwise, automatic configuration upgrade
+ is safe.
 

Added: trunk/libconfig-model-perl/debian/po/POTFILES.in
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libconfig-model-perl/debian/po/POTFILES.in?rev=47068&op=file
==============================================================================
--- trunk/libconfig-model-perl/debian/po/POTFILES.in (added)
+++ trunk/libconfig-model-perl/debian/po/POTFILES.in Thu Nov 12 16:03:31 2009
@@ -1,0 +1,1 @@
+[type: gettext/rfc822deb] libconfig-model-perl.templates

Added: trunk/libconfig-model-perl/debian/po/templates.pot
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libconfig-model-perl/debian/po/templates.pot?rev=47068&op=file
==============================================================================
--- trunk/libconfig-model-perl/debian/po/templates.pot (added)
+++ trunk/libconfig-model-perl/debian/po/templates.pot Thu Nov 12 16:03:31 2009
@@ -1,0 +1,32 @@
+# 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: libconfig-model-perl at packages.debian.org\n"
+"POT-Creation-Date: 2009-11-09 13:41+0100\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"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=CHARSET\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#. Type: boolean
+#. Description
+#: ../libconfig-model-perl.templates:2001
+msgid "Upgrade config automatically?"
+msgstr ""
+
+#. Type: boolean
+#. Description
+#: ../libconfig-model-perl.templates:2001
+msgid ""
+"${pkg_name} configuration files can be upgraded automatically by merging "
+"your values with new recommendations from Debian. On the downside,  comments "
+"are not preserved. Otherwise, automatic configuration upgrade is safe."
+msgstr ""




More information about the Pkg-perl-cvs-commits mailing list