]> git.donarmstrong.com Git - debhelper.git/blob - dh_installexamples
r431: pod over for the night
[debhelper.git] / dh_installexamples
1 #!/usr/bin/perl -w
2
3 =head1 NAME
4
5 dh_installexamples - install example files into package build directories
6
7 =cut
8
9 use strict;
10 use Debian::Debhelper::Dh_Lib;
11
12 =head1 SYNOPSIS
13
14   dh_installexamples [debhelper options] [-A] [file ...]
15
16 =head1 DESCRIPTION
17
18 dh_installexamples is a debhelper program that is responsible for
19 installing examples into usr/share/doc/package/examples in package
20 build directories.
21
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.
26
27 Files named debian/package.examples can list other files to be installed.
28
29 =head1 OPTIONS
30
31 =over 4
32
33 =item B<-A>, B<--all>
34
35 Install any files specified by command line parameters in ALL packages
36 acted on.
37
38 =item I<file ...>
39
40 Install these files as examples into the first package acted on. (Or into
41 all packages if -A is specified.)
42
43 =back
44
45 =head1 NOTES
46
47 Note that dh_installexamples will happily copy entire directory hierarchies
48 if you ask it to (it uses cp -a internally). If it is asked to install a
49 directory, it will install the complete contents of the directory.
50
51 =cut
52
53 init();
54
55 foreach my $package (@{$dh{DOPACKAGES}}) {
56         my $tmp=tmpdir($package);
57         my $file=pkgfile($package,"examples");
58         
59         my @examples;
60         
61         if ($file) {
62                 @examples=filearray($file, ".");
63         }       
64
65         if (($package eq $dh{FIRSTPACKAGE} || $dh{PARAMS_ALL}) && @ARGV) {
66                 push @examples, @ARGV;
67         }
68
69         if (@examples) {
70                 if (! -d "$tmp/usr/share/doc/$package/examples") {
71                         doit("install","-d","$tmp/usr/share/doc/$package/examples");
72                 }
73                 
74                 doit("cp","-a",@examples,"$tmp/usr/share/doc/$package/examples");
75         }
76 }
77
78 =head1 SEE ALSO
79
80 L<debhelper(1)>
81
82 This program is a part of debhelper.
83
84 =head1 AUTHOR
85
86 Joey Hess <joeyh@debian.org>
87
88 =cut