From 6acd7f22222118dc5f51c251bd0078edbe280e87 Mon Sep 17 00:00:00 2001 From: joey Date: Sun, 19 May 2002 03:06:41 +0000 Subject: r522: * Set DH_ALWAYS_EXCLUDE=CVS and debhelper will exclude CVS directories from processing by any command that takes a -X option, and dh_builddeb will also go in and rm -rf any that still sneak into the build tree. * dh_install: A patch from Eric Dorland adds support for --sourcedir, which allows debian/package.files files to be moved over to debian/package.install, and just work. Closes: #146847 * dh_movefiles: don't do file tests in no-act mode. Closes: #144573 * dh_installdebconf: pass --drop-old-templates to debconf-mergetemplate. Means debhelper has to depend on debconf-utils 1.1.1. --- Debian/Debhelper/Dh_Getopt.pm | 9 +-------- Debian/Debhelper/Dh_Lib.pm | 16 +++++++++++++++- debhelper.pod | 13 +++++++++++++ debian/changelog | 14 ++++++++++++++ debian/control | 2 +- debian/rules | 4 +--- dh_builddeb | 3 +++ dh_install | 17 +++++++++++++++++ dh_installdebconf | 8 ++++---- dh_movefiles | 2 +- examples/rules.multi2 | 1 - 11 files changed, 70 insertions(+), 19 deletions(-) diff --git a/Debian/Debhelper/Dh_Getopt.pm b/Debian/Debhelper/Dh_Getopt.pm index 81d20618..16851a04 100644 --- a/Debian/Debhelper/Dh_Getopt.pm +++ b/Debian/Debhelper/Dh_Getopt.pm @@ -177,13 +177,6 @@ sub parseopts { } @{$options{DOPACKAGES}}=@package_list; - # Generate EXCLUDE_FIND. - $options{EXCLUDE_FIND}=''; - foreach (@{$options{EXCLUDE}}) { - $options{EXCLUDE_FIND}.="-regex .*".quotemeta($_).".* -or "; - } - $options{EXCLUDE_FIND}=~s/ -or $//; - # If there are no packages to act on now, it's an error. if (! defined $options{DOPACKAGES} || ! @{$options{DOPACKAGES}}) { error("I have no package to build"); @@ -203,7 +196,7 @@ sub parseopts { @ARGV=@{$options{ARGV}} if exists $options{ARGV}; return %options; -} +} sub import { # Enable bundling of short command line options. diff --git a/Debian/Debhelper/Dh_Lib.pm b/Debian/Debhelper/Dh_Lib.pm index 0ed7c477..0f910f1d 100644 --- a/Debian/Debhelper/Dh_Lib.pm +++ b/Debian/Debhelper/Dh_Lib.pm @@ -43,6 +43,20 @@ sub init { %dh=Debian::Debhelper::Dh_Getopt::parseopts(); } + # Another way to set excludes. + if (exists $ENV{DH_ALWAYS_EXCLUDE} && length $ENV{DH_ALWAYS_EXCLUDE}) { + push @{$dh{EXCLUDE}}, $ENV{DH_ALWAYS_EXCLUDE}; + } + + # Generate EXCLUDE_FIND. + if ($dh{EXCLUDE}) { + $dh{EXCLUDE_FIND}=''; + foreach (@{$dh{EXCLUDE}}) { + $dh{EXCLUDE_FIND}.="-regex ".escape_shell(".*$_.*")." -or "; + } + } + $dh{EXCLUDE_FIND}=~s/ -or $//; + # Check to see if DH_VERBOSE environment variable was set, if so, # make sure verbose is on. if (defined $ENV{DH_VERBOSE} && $ENV{DH_VERBOSE} ne "") { @@ -92,7 +106,7 @@ sub escape_shell { if ($word=~/\s/) { # Escape only a few things since it will be quoted. # Note we use double quotes because you cannot - # escape ' in qingle quotes, while " can be escaped + # escape ' in single quotes, while " can be escaped # in double. # This does make -V"foo bar" turn into "-Vfoo bar", # but that will be parsed identically by the shell diff --git a/debhelper.pod b/debhelper.pod index d8efb529..67cfbe73 100644 --- a/debhelper.pod +++ b/debhelper.pod @@ -354,6 +354,19 @@ older debhelpers will ignore it and do things you don't want them to. One very good way to set DH_OPTIONS is by using "Target-specific Variable Values" in your debian/rules file. See the make documentation for details on doing this. +=item DH_ALWAYS_EXCLUDE + +If set, this adds the value the variable is set to to the -X options of all +commands that support the -X option. Moreover, dh_builddeb will rm -rf +anything that matches the value in your package build tree. + +This can be useful if you are doing a build from a CVS source tree, in +which case setting DH_ALWAYS_EXCLUDE=CVS will prevent any CVS directories +from sneaking into the package you build. Or, if a package has a source +tarball that (unwisely) includes CVS directories, you might want to export +DH_ALWAYS_EXCLUDE=CVS in debian/rules, to make it take effect wherever +your package is built. + =back =head1 SEE ALSO diff --git a/debian/changelog b/debian/changelog index 22328b36..72ccbbe9 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,17 @@ +debhelper (4.0.4) unstable; urgency=low + + * Set DH_ALWAYS_EXCLUDE=CVS and debhelper will exclude CVS directories + from processing by any command that takes a -X option, and dh_builddeb + will also go in and rm -rf any that still sneak into the build tree. + * dh_install: A patch from Eric Dorland adds support for + --sourcedir, which allows debian/package.files files to be moved over to + debian/package.install, and just work. Closes: #146847 + * dh_movefiles: don't do file tests in no-act mode. Closes: #144573 + * dh_installdebconf: pass --drop-old-templates to debconf-mergetemplate. + Means debhelper has to depend on debconf-utils 1.1.1. + + -- Joey Hess Sat, 18 May 2002 21:38:03 -0400 + debhelper (4.0.3) unstable; urgency=low * Corrects misbuild with CVS dirs in deb. Closes: #146576 diff --git a/debian/control b/debian/control index 24e91324..c97b8c6f 100644 --- a/debian/control +++ b/debian/control @@ -2,7 +2,7 @@ Source: debhelper Section: devel Priority: optional Maintainer: Joey Hess -Build-Depends-Indep: perl (>= 5.6.1), fileutils (>= 4.0-2.1), file (>= 3.23-1), debconf-utils +Build-Depends-Indep: perl (>= 5.6.1), fileutils (>= 4.0-2.1), file (>= 3.23-1), debconf-utils (>= 1.1.1) Standards-Version: 3.5.6.1 Package: debhelper diff --git a/debian/rules b/debian/rules index a9b6bae1..af24fb5f 100755 --- a/debian/rules +++ b/debian/rules @@ -83,10 +83,8 @@ binary-indep: build ./dh_perl ./dh_installdeb ./dh_gencontrol - # Clean up CVS directories copied in if I build from CVS tree. - find debian/debhelper -type d -name CVS | xargs rm -rf ./dh_md5sums - ./dh_builddeb + ./dh_builddeb -v # Update the debhelper web page. Not intended for use by anyone except the # author. diff --git a/dh_builddeb b/dh_builddeb index d259b016..07029c07 100755 --- a/dh_builddeb +++ b/dh_builddeb @@ -59,6 +59,9 @@ else { foreach my $package (@{$dh{DOPACKAGES}}) { my $tmp=tmpdir($package); + if (exists $ENV{DH_ALWAYS_EXCLUDE} && length $ENV{DH_ALWAYS_EXCLUDE}) { + complex_doit("find $tmp -name $ENV{DH_ALWAYS_EXCLUDE} | xargs rm -rf"); + } doit("dpkg","--build",$tmp,"$dh{DESTDIR}$dh{FILENAME}",@{$dh{U_PARAMS}}); } diff --git a/dh_install b/dh_install index 019d0f1b..4aa7142d 100755 --- a/dh_install +++ b/dh_install @@ -65,6 +65,18 @@ Note that if you list only a filename on a line by itself in a debian/package.install file, with no explicit destination, then dh_install will automatically guess the destination even if this flag is not set. +=item B<--sourcedir=dir> + +Makes all source files relative to "dir". If this is specified, it is akin +to all the source files having "dir" prepended to them. By default, "dir" +is '.'. + +To make dh_install behave like the old dh_movefiles, move your +package.files file to package.install and call dh_install with +"--sourcedir=debian/tmp" appended to the command. This will +approximate dh_movefiles behaviour, except it will copy files instead +of moving them. + =item I Lists files (or directories) to install and where to install them to. @@ -81,12 +93,15 @@ my $ret=0; foreach my $package (@{$dh{DOPACKAGES}}) { my $tmp=tmpdir($package); my $file=pkgfile($package,"install"); + my $srcdir = '.'; my @install; if ($file) { @install=filedoublearray($file); # no globbing yet } + $srcdir = $dh{SOURCEDIR} if defined $dh{SOURCEDIR}; + if (($package eq $dh{FIRSTPACKAGE} || $dh{PARAMS_ALL}) && @ARGV) { push @install, [@ARGV]; } @@ -114,6 +129,8 @@ foreach my $package (@{$dh{DOPACKAGES}}) { $dest=dirname($dest); } + $src = "$srcdir/$src"; # do this now, to avoid the parsing above + # Make sure the destination directory exists. if (! -e "$tmp/$dest") { doit("install","-d","$tmp/$dest"); diff --git a/dh_installdebconf b/dh_installdebconf index 2b6bdc70..0d83eea0 100755 --- a/dh_installdebconf +++ b/dh_installdebconf @@ -31,14 +31,14 @@ Note that if you use debconf, your package probably needs to depend on it =head1 LOCALIZED TEMPLATE FILES Debconf also supports localized template files, and this program has some -support to aid working with them. You may find it easiest to keep the -translations in separate files, and merge them only at build time. See +support to aid working with them. It is best to keep the translations in +separate files, and merge them only at build time. See L and L for details. This program will automatically call debconf-mergetemplate and merge templates on the fly if it finds your template files are accompanied by translated files that have the same name as the template file, with a -dot and a locale name repended. +dot and a locale name prepended. For example, if you have a German translation, debian/package.templates.de is merged with debian/package.templates. @@ -84,7 +84,7 @@ foreach my $package (@{$dh{DOPACKAGES}}) { # Are there translated templates too? my @trans=(glob("$templates.??"), glob("$templates.??_??")); if (@trans) { - complex_doit("debconf-mergetemplate @extraparams @trans $templates > $tmp/DEBIAN/templates"); + complex_doit("debconf-mergetemplate --drop-old-templates @extraparams @trans $templates > $tmp/DEBIAN/templates"); chmod 0644, "$tmp/DEBIAN/templates"; chown 0, 0, "$tmp/DEBIAN/templates"; } diff --git a/dh_movefiles b/dh_movefiles index 6a33cc90..97427b8d 100755 --- a/dh_movefiles +++ b/dh_movefiles @@ -121,7 +121,7 @@ foreach my $package (@{$dh{DOPACKAGES}}) { doit("rm","-f","debian/movelist"); foreach (@tomove) { my $file=$_; - if (! -e $file && ! -l $file) { + if (! -e $file && ! -l $file && ! $dh{NO_ACT}) { $ret=1; warning("$file not found (supposed to put it in $package)"); } diff --git a/examples/rules.multi2 b/examples/rules.multi2 index edde0b8d..042cdd28 100755 --- a/examples/rules.multi2 +++ b/examples/rules.multi2 @@ -64,7 +64,6 @@ binary-common: # dh_installcron # dh_installinfo # dh_undocumented - dh_installman dh_strip dh_link dh_compress -- cgit v1.2.3