]> git.donarmstrong.com Git - debhelper.git/blobdiff - dh_installexamples
Fix typo in French translation, about debian/package.README.Debian files.
[debhelper.git] / dh_installexamples
index 7c004265577b3cc1e1f66f7bdd2280610f3b667d..3e5e0893faac5e17d390661a6363ecaf10e42232 100755 (executable)
@@ -11,7 +11,7 @@ use Debian::Debhelper::Dh_Lib;
 
 =head1 SYNOPSIS
 
-  dh_installexamples [debhelper options] [-A] [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
@@ -53,6 +58,8 @@ directory, it will install the complete contents of the directory.
 init();
 
 foreach my $package (@{$dh{DOPACKAGES}}) {
+       next if is_udeb($package);
+
        my $tmp=tmpdir($package);
        my $file=pkgfile($package,"examples");
        
@@ -65,19 +72,37 @@ 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 .= ' -and ! \( '.$dh{EXCLUDE_FIND}.' \)';
+               }
+               
+               foreach my $example (@examples) {
+                       next if excludefile($example);
+                       if (-d $example && $exclude) {
+                               my $basename = basename($example);
+                               my $dir = ($basename eq '.') ? $example : "$example/..";
+                               my $pwd=`pwd`;
+                               chomp $pwd;
+                               my $exclude2 = '-type f'.$exclude;
+                               complex_doit("cd '$dir' && find '$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");
+                       }
+               }
        }
 }
 
 =head1 SEE ALSO
 
-L<debhelper(1)>
+L<debhelper(7)>
 
 This program is a part of debhelper.