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
26 =item debian/I<package>.examples
28 Lists example files or directories to be installed.
38 Install any files specified by command line parameters in ALL packages
41 =item B<-Xitem>, B<--exclude=item>
43 Exclude files that contain "item" anywhere in their filename from
48 Install these files (or directories) as examples into the first package
49 acted on. (Or into all packages if -A is specified.)
55 Note that dh_installexamples will happily copy entire directory hierarchies
56 if you ask it to (similar to cp -a). If it is asked to install a
57 directory, it will install the complete contents of the directory.
63 foreach my $package (@{$dh{DOPACKAGES}}) {
64 next if is_udeb($package);
66 my $tmp=tmpdir($package);
67 my $file=pkgfile($package,"examples");
72 @examples=filearray($file, ".");
75 if (($package eq $dh{FIRSTPACKAGE} || $dh{PARAMS_ALL}) && @ARGV) {
76 push @examples, @ARGV;
80 if (! -d "$tmp/usr/share/doc/$package/examples") {
81 doit("install","-d","$tmp/usr/share/doc/$package/examples");
85 if ($dh{EXCLUDE_FIND}) {
86 $exclude .= ' -and ! \( '.$dh{EXCLUDE_FIND}.' \)';
89 foreach my $example (@examples) {
90 next if excludefile($example);
91 if (-d $example && $exclude) {
92 my $basename = basename($example);
93 my $dir = ($basename eq '.') ? $example : "$example/..";
96 my $exclude2 = '-type f'.$exclude;
97 complex_doit("cd '$dir' && find '$basename' -type f$exclude -exec cp --parents -dp {} $pwd/$tmp/usr/share/doc/$package/examples \\;");
100 doit("cp", "-a", $example, "$tmp/usr/share/doc/$package/examples");
110 This program is a part of debhelper.
114 Joey Hess <joeyh@debian.org>