Package: debhelper
Version: 4.2.31
Severity: wishlist
Tags: patch

Hi Joey, as you suggested me on debian-devel, here there is a patch 
to support debhelper script substitutions in debian/config script.
I hope to see it in debhelper soon, because as I told you on the 
list I need it for the dh-zope and zope-common packages.

Thanks for your work,
Fabio Tranchitella

-- System Information:
Debian Release: 3.1
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: i386 (i686)
Kernel: Linux 2.6.8-2-686
Locale: [EMAIL PROTECTED], [EMAIL PROTECTED] (charmap=ISO-8859-15) (ignored: 
LC_ALL set to [EMAIL PROTECTED])

Versions of packages debhelper depends on:
ii  binutils                      2.15-5     The GNU assembler, linker and bina
ii  coreutils [fileutils]         5.2.1-2    The GNU core utilities
ii  debconf-utils                 1.4.30.11  debconf utilities
ii  dpkg-dev                      1.10.27    Package building tools for Debian
ii  file                          4.12-1     Determines file type using "magic"
ii  html2text                     1.3.2a-1   An advanced HTML to text converter
ii  perl                          5.8.4-8    Larry Wall's Practical Extraction 
ii  po-debconf                    0.8.22     manage translated Debconf template

-- no debconf information
--- usr/bin/dh_installdebconf.orig      2005-03-27 15:53:44.000000000 +0200
+++ usr/bin/dh_installdebconf   2005-03-27 16:23:00.774976528 +0200
@@ -24,6 +24,13 @@
 
 Files named debian/package.config and debian/package.templates are
 installed into the DEBIAN directory in the package build directory.
+If a file named debian/package.script.debhelper exists, the contents
+of that file are merged into the config script as follows: If the script 
+exists, then anywhere in it that "#DEBHELPER#" appears, the text of the 
+.debhelper file is inserted. If the script does not exist, then a script 
+is generated from the .debhelper file. The .debhelper files are created 
+by other debhelper programs, such as L<dh_installmenu(1)>, and are shell 
+script fragments.
 
 Note that if you use debconf, your package probably needs to depend on it
 (it will be added to ${misc:Depends} by this program).
@@ -78,14 +85,32 @@
        my $tmp=tmpdir($package);
        my $config=pkgfile($package,"config");
        my $templates=pkgfile($package,"templates");
+       my $ext=pkgext($package);
 
        if (! -d "$tmp/DEBIAN") {
                doit("install","-o",0,"-g",0,"-d","$tmp/DEBIAN");
        }
 
-       if (! is_udeb($package) && $config ne '') {
-               doit("install", "-o", 0, "-g", 0, "-m", 755, "-p",
-                    $config, "$tmp/DEBIAN/config");
+       if (! is_udeb($package)) {
+               if ($config ne '') {
+                       if (-f "debian/${ext}config.debhelper") {
+                               # Add this into the script, where it has
+                               # #DEBHELPER#
+                               complex_doit("perl -pe 's~#DEBHELPER#~qx{cat 
debian/${ext}config.debhelper}~eg' < $config > $tmp/DEBIAN/config");
+                       }
+                       else {
+                               # Just get rid of any #DEBHELPER# in the
+                               # script.
+                               complex_doit("sed s/#DEBHELPER#// < $config > 
$tmp/DEBIAN/config");
+                       }
+                       doit("chown","0:0","$tmp/DEBIAN/config");
+                       doit("chmod",755,"$tmp/DEBIAN/config");
+               } elsif ( -f "debian/${ext}config.debhelper" ) {
+                       complex_doit("printf '#!/bin/sh\nset -e\n' > 
$tmp/DEBIAN/config");
+                       complex_doit("cat debian/${ext}config.debhelper >> 
$tmp/DEBIAN/config");
+                       doit("chown","0:0","$tmp/DEBIAN/config");
+                       doit("chmod",755,"$tmp/DEBIAN/config");
+               }
        }
        
        if ($templates ne '') {

Attachment: signature.asc
Description: Digital signature

Reply via email to