5 dh_bugfiles - install bug reporting customization files into package build directories
10 use Debian::Debhelper::Dh_Lib;
14 B<dh_bugfiles> [B<-A>] [S<I<debhelper options>>]
18 dh_bugfiles is a debhelper program that is responsible for installing
19 bug reporting customization files (bug scripts and/or bug control files
20 and/or presubj files) into package build directories.
22 This helper program installs the following files if they are found:
26 =item B<debian/package.bug-script>
28 It is the script to be run by the bug reporting program for generating a bug
29 report template. This file is installed as F<usr/share/bug/package> in the
30 package build directory if no other types of bug reporting customization
31 files are going to be installed for the package in question. Otherwise,
32 this file is installed as F<usr/share/bug/package/script>. Finally, the
33 installed script is given execute permissions.
35 =item B<debian/package.bug-control>
37 It is the bug control file containing some directions for the bug reporting
38 tool. This file is installed as F<usr/share/bug/package/control> in the
39 package build directory.
41 =item B<debian/package.bug-presubj>
43 The contents of this file are displayed to the user by the bug reporting
44 tool before allowing the user to write a bug report on the package to the
45 Debian Bug Tracking System. This file is installed as
46 F<usr/share/bug/package/control> in the package build directory.
56 Install debian/bug-* files to ALL packages acted on when respective
57 debian/package.bug-* files do not exist. Normally, debian/bug-* will
58 be installed to the first package only.
66 # Types of bug files this debhelper program handles.
67 # Hash value is the name of the pkgfile of the respective
70 "script" => "bug-script",
71 "control" => "bug-control",
72 "presubj" => "bug-presubj",
75 foreach my $package (@{$dh{DOPACKAGES}}) {
76 next if is_udeb($package);
78 my $tmp=tmpdir($package);
79 my $dir="$tmp/usr/share/bug/$package";
81 # Gather information which bug files are available for the
84 while (my ($type, $pkgfilename) = each(%bugfile_types)) {
85 my $file=pkgfile($package,$pkgfilename);
87 $bugfiles{$type}=$file;
88 } elsif (-f "debian/$pkgfilename" && $dh{PARAMS_ALL}) {
89 $bugfiles{$type}="debian/$pkgfilename";
93 # If there is only a bug script to install, install it as
94 # usr/share/bug/$package (unless this path is a directory)
95 if (! -d $dir && scalar(keys(%bugfiles)) == 1 && exists $bugfiles{script}) {
96 doit("install","-D","-p","-m755",$bugfiles{script},$dir);
98 elsif (scalar(keys(%bugfiles)) > 0) {
100 # Move usr/share/bug/$package to usr/share/bug/$package/script
101 doit("mv", $dir, "${dir}.tmp");
102 doit("install","-d",$dir);
103 doit("mv", "${dir}.tmp", "$dir/script");
106 doit("install","-d",$dir);
108 while (my ($type, $srcfile) = each(%bugfiles)) {
109 doit("install","-p","-m644",$srcfile, "$dir/$type");
113 # Ensure that the bug script is executable
117 elsif (-f "$dir/script") {
118 chmod 0755, "$dir/script";
124 F</usr/share/doc/reportbug/README.developers.gz>
128 This program is a part of debhelper.
132 Modestas Vainius <modestas@vainius.eu>