diff options
author | joey <joey> | 2005-03-27 16:57:47 +0000 |
---|---|---|
committer | joey <joey> | 2005-03-27 16:57:47 +0000 |
commit | 269a2b129ec031f94e54dca7f526b2127aaf599f (patch) | |
tree | 7d60401d19b18c5dcf3965b82f1347f5bb90548f | |
parent | 79fa169d452a5e548482d3aa33f2a81a99228f93 (diff) | |
download | debhelper-269a2b129ec031f94e54dca7f526b2127aaf599f.tar.gz |
r1743: releasing version 4.2.324.2.32
-rw-r--r-- | Debian/Debhelper/Dh_Lib.pm | 35 | ||||
-rw-r--r-- | debian/changelog | 10 | ||||
-rwxr-xr-x | dh_installdeb | 32 | ||||
-rwxr-xr-x | dh_installdebconf | 11 |
4 files changed, 55 insertions, 33 deletions
diff --git a/Debian/Debhelper/Dh_Lib.pm b/Debian/Debhelper/Dh_Lib.pm index f013dee1..5ae611c6 100644 --- a/Debian/Debhelper/Dh_Lib.pm +++ b/Debian/Debhelper/Dh_Lib.pm @@ -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 diff --git a/debian/changelog b/debian/changelog index f42c8256..3fc9669e 100644 --- a/debian/changelog +++ b/debian/changelog @@ -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. diff --git a/dh_installdeb b/dh_installdeb index 9832d102..519afb0c 100755 --- a/dh_installdeb +++ b/dh_installdeb @@ -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 diff --git a/dh_installdebconf b/dh_installdebconf index ebf6a131..85772144 100755 --- a/dh_installdebconf +++ b/dh_installdebconf @@ -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 '') { |