summaryrefslogtreecommitdiff
path: root/dh_installexamples
diff options
context:
space:
mode:
authorjoey <joey>2002-02-17 17:52:47 +0000
committerjoey <joey>2002-02-17 17:52:47 +0000
commit5221e81cc5f195b32758617409cdc39e12277b82 (patch)
tree16cca2fc42f87c00168665693b0626e5d09f72d0 /dh_installexamples
parent8e0691a21799ddf303419876e0681df88cfcf56e (diff)
r510: * Thanks to Benjamin Drieu <benj@debian.org>, dh_installdocs -X now works.
I had to modify his patch to use cp --parents, since -P spews warnings now. Also, I made it continue to use cp -a if nothing is excluded, which is both faster, and means this patch is less likely to break anything if it turns out to be buggy. Also, stylistic changes. Closes: #40649 * Implemented -X for dh_installexamples as well. * dh_clean -X substvars will also work now. Closes: #66890
Diffstat (limited to 'dh_installexamples')
-rwxr-xr-xdh_installexamples30
1 files changed, 26 insertions, 4 deletions
diff --git a/dh_installexamples b/dh_installexamples
index fae33012..f53dbc97 100755
--- a/dh_installexamples
+++ b/dh_installexamples
@@ -11,7 +11,7 @@ use Debian::Debhelper::Dh_Lib;
=head1 SYNOPSIS
-B<dh_installexamples> [S<I<debhelper options>>] [B<-A>] [S<I<file ...>>]
+B<dh_installexamples> [S<I<debhelper options>>] [B<-A>] [B<-X>I<item>] [S<I<file ...>>]
=head1 DESCRIPTION
@@ -40,12 +40,17 @@ acted on.
Install these files as examples into the first package acted on. (Or into
all packages if -A is specified.)
+=item B<-Xitem>, B<--exclude=item>
+
+Exclude files that contain "item" anywhere in their filename from
+being installed.
+
=back
=head1 NOTES
Note that dh_installexamples will happily copy entire directory hierarchies
-if you ask it to (it uses cp -a internally). If it is asked to install a
+if you ask it to (similar to cp -a). If it is asked to install a
directory, it will install the complete contents of the directory.
=cut
@@ -65,13 +70,30 @@ foreach my $package (@{$dh{DOPACKAGES}}) {
if (($package eq $dh{FIRSTPACKAGE} || $dh{PARAMS_ALL}) && @ARGV) {
push @examples, @ARGV;
}
-
+
if (@examples) {
if (! -d "$tmp/usr/share/doc/$package/examples") {
doit("install","-d","$tmp/usr/share/doc/$package/examples");
}
- doit("cp","-a",@examples,"$tmp/usr/share/doc/$package/examples");
+ my $exclude = '';
+ if ($dh{EXCLUDE_FIND}) {
+ $exclude = ' \( ! '.$dh{EXCLUDE_FIND}.' \)';
+ }
+
+ foreach my $example (@examples) {
+ next if excludefile($example);
+ if (-d $example && $exclude) {
+ my ($dir_basename) = basename($example);
+ # Pity there's no cp --exclude ..
+ my $pwd=`pwd`;
+ chomp $pwd;
+ complex_doit("cd $example/.. && find $dir_basename -type f$exclude -exec cp --parents -dp {} $pwd/$tmp/usr/share/doc/$package/examples \\;");
+ }
+ else {
+ doit("cp", "-a", $example, "$tmp/usr/share/doc/$package/examples");
+ }
+ }
}
}