5 dh_installexamples - install example files into package build directories
10 use Debian::Debhelper::Dh_Lib;
14 B<dh_installexamples> [S<I<debhelper options>>] [B<-A>] [B<-X>I<item>] [S<I<file ...>>]
18 dh_installexamples is a debhelper program that is responsible for
19 installing examples into usr/share/doc/package/examples in package
22 Any file names specified as parameters will be installed into the first
23 package dh_installexamples is told to act on. By default, this is the first
24 binary package in debian/control, but if you use -p, -i, or -a flags, it
25 will be the first package specified by those flags.
27 Files named debian/package.examples can list other files to be installed.
35 Install any files specified by command line parameters in ALL packages
40 Install these files as examples into the first package acted on. (Or into
41 all packages if -A is specified.)
43 =item B<-Xitem>, B<--exclude=item>
45 Exclude files that contain "item" anywhere in their filename from
52 Note that dh_installexamples will happily copy entire directory hierarchies
53 if you ask it to (similar to cp -a). If it is asked to install a
54 directory, it will install the complete contents of the directory.
60 foreach my $package (@{$dh{DOPACKAGES}}) {
61 my $tmp=tmpdir($package);
62 my $file=pkgfile($package,"examples");
67 @examples=filearray($file, ".");
70 if (($package eq $dh{FIRSTPACKAGE} || $dh{PARAMS_ALL}) && @ARGV) {
71 push @examples, @ARGV;
75 if (! -d "$tmp/usr/share/doc/$package/examples") {
76 doit("install","-d","$tmp/usr/share/doc/$package/examples");
80 if ($dh{EXCLUDE_FIND}) {
81 $exclude = ' -and ! \( '.$dh{EXCLUDE_FIND}.' \)';
84 foreach my $example (@examples) {
85 next if excludefile($example);
86 if (-d $example && $exclude) {
87 my ($dir_basename) = basename($example);
88 # Pity there's no cp --exclude ..
91 complex_doit("cd $example/.. && find $dir_basename -type f$exclude -exec cp --parents -dp {} $pwd/$tmp/usr/share/doc/$package/examples \\;");
94 doit("cp", "-a", $example, "$tmp/usr/share/doc/$package/examples");
104 This program is a part of debhelper.
108 Joey Hess <joeyh@debian.org>