]> git.donarmstrong.com Git - debhelper.git/commitdiff
r1743: releasing version 4.2.32 4.2.32
authorjoey <joey>
Sun, 27 Mar 2005 16:57:47 +0000 (16:57 +0000)
committerjoey <joey>
Sun, 27 Mar 2005 16:57:47 +0000 (16:57 +0000)
Debian/Debhelper/Dh_Lib.pm
debian/changelog
dh_installdeb
dh_installdebconf

index f013dee1bc784e89c6cfb3b55c86cacb700e9884..5ae611c62c6e5dd7f837b4046317b7a7d0db4226 100644 (file)
@@ -14,7 +14,7 @@ use vars qw(@ISA @EXPORT %dh);
            &pkgfile &pkgext &pkgfilename &isnative &autoscript &filearray
            &filedoublearray &getpackages &basename &dirname &xargs %dh
            &compat &addsubstvar &delsubstvar &excludefile &package_arch
-           &is_udeb &udeb_filename);
+           &is_udeb &udeb_filename &debhelper_script_subst);
 
 my $max_compat=4;
 
@@ -612,18 +612,21 @@ sub getpackages {
        return @list;
 }
 
+# Returns the arch a package will build for.
 sub package_arch {
        my $package=shift;
        
        return $package_arches{$package} eq 'all' ? "all" : buildarch();
 }
 
+# Return true if a given package is really a udeb.
 sub is_udeb {
        my $package=shift;
        
        return $package_types{$package} eq 'udeb';
 }
 
+# Generates the filename that is used for a udeb package.
 sub udeb_filename {
        my $package=shift;
        
@@ -634,4 +637,34 @@ sub udeb_filename {
        return "${package}_${version}_$filearch.udeb";
 }
 
+# Handles #DEBHELPER# substitution in a script; also can generate a new
+# script from scratch if none exists but there is a .debhelper file for it.
+sub debhelper_script_subst {
+       my $package=shift;
+       my $script=shift;
+       
+       my $tmp=tmpdir($package);
+       my $ext=pkgext($package);
+       my $file=pkgfile($package,$script);
+
+       if ($file ne '') {
+               if (-f "debian/$ext$script.debhelper") {
+                       # Add this into the script, where it has #DEBHELPER#
+                       complex_doit("perl -pe 's~#DEBHELPER#~qx{cat debian/$ext$script.debhelper}~eg' < $file > $tmp/DEBIAN/$script");
+               }
+               else {
+                       # Just get rid of any #DEBHELPER# in the script.
+                       complex_doit("sed s/#DEBHELPER#// < $file > $tmp/DEBIAN/$script");
+               }
+               doit("chown","0:0","$tmp/DEBIAN/$script");
+               doit("chmod",755,"$tmp/DEBIAN/$script");
+       }
+       elsif ( -f "debian/$ext$script.debhelper" ) {
+               complex_doit("printf '#!/bin/sh\nset -e\n' > $tmp/DEBIAN/$script");
+               complex_doit("cat debian/$ext$script.debhelper >> $tmp/DEBIAN/$script");
+               doit("chown","0:0","$tmp/DEBIAN/$script");
+               doit("chmod",755,"$tmp/DEBIAN/$script");
+       }
+}
+
 1
index f42c82566214cc11b89a110b602605d94a2bbfc4..3fc9669e68876fb13c8159b1edaa21a238c92b0b 100644 (file)
@@ -1,3 +1,13 @@
+debhelper (4.2.32) unstable; urgency=low
+
+  * Patch from Fabio Tranchitella to add support for #DEBHELPER# substitutions
+    in config files, although nothing in debhelper itself uses such
+    substitutions, third-party addons may. Closes: #301657
+  * Factor out a debhelper_script_subst from dh_installdeb and
+    dh_installdebconf.
+
+ -- Joey Hess <joeyh@debian.org>  Sun, 27 Mar 2005 11:29:01 -0500
+
 debhelper (4.2.31) unstable; urgency=low
 
   * Updated dh_installmime Spanish translation.
index 9832d1020fd30d5a21d3e76283a5bd6676b58b37..519afb0c8fea168db3ac0a52866067bc1e5a84be 100755 (executable)
@@ -46,7 +46,6 @@ init();
 
 foreach my $package (@{$dh{DOPACKAGES}}) {
        my $tmp=tmpdir($package);
-       my $ext=pkgext($package);
 
        if (! -d "$tmp/DEBIAN") {
                doit("install","-o",0,"-g",0,"-d","$tmp/DEBIAN");
@@ -62,34 +61,9 @@ foreach my $package (@{$dh{DOPACKAGES}}) {
                next;           
        }
        
-       # Install debian install scripts.
-       # If any .debhelper files exist, add them into the scripts.
-       foreach my $file (qw{postinst preinst prerm postrm}) {
-               my $f=pkgfile($package,$file);
-               if ($f) {
-                       if (-f "debian/$ext$file.debhelper") {
-                               # Add this into the script, where it has
-                               # #DEBHELPER#
-                               complex_doit("perl -pe 's~#DEBHELPER#~qx{cat debian/$ext$file.debhelper}~eg' < $f > $tmp/DEBIAN/$file");
-                       }
-                       else {
-                               # Just get rid of any #DEBHELPER# in the 
-                               # script.
-                               complex_doit("sed s/#DEBHELPER#// < $f > $tmp/DEBIAN/$file");
-                       }
-                       doit("chown","0:0","$tmp/DEBIAN/$file");
-                       doit("chmod",755,"$tmp/DEBIAN/$file");
-               }
-               else {
-                       # Auto-generate script header and add .debhelper
-                       # content to it.
-                       if (-f "debian/$ext$file.debhelper") {
-                               complex_doit("printf '#!/bin/sh\nset -e\n' > $tmp/DEBIAN/$file");
-                               complex_doit("cat debian/$ext$file.debhelper >> $tmp/DEBIAN/$file");
-                               doit("chown","0:0","$tmp/DEBIAN/$file");
-                               doit("chmod",755,"$tmp/DEBIAN/$file");
-                       }
-               }
+       # Install debian scripts.
+       foreach my $script (qw{postinst preinst prerm postrm}) {
+               debhelper_script_subst($package, $script);
        }
 
        # Install non-executable files
index ebf6a13123090c0943bf5e24711fb327fba30c8d..8577214495fdc4bcd169c66cd5f09851045645ac 100755 (executable)
@@ -24,6 +24,12 @@ that works.
 
 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 filesmay be created 
+by other debhelper programs, 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).
@@ -83,9 +89,8 @@ foreach my $package (@{$dh{DOPACKAGES}}) {
                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)) {
+               debhelper_script_subst($package, "config");
        }
        
        if ($templates ne '') {