~bzr/ubuntu/jaunty/debhelper/builddeps-ppa

« back to all changes in this revision

Viewing changes to dh_bugfiles

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2009-04-24 19:22:46 UTC
  • Revision ID: james.westby@ubuntu.com-20090424192246-ytzyl3azu8bosewc
Tags: 7.2.8ubuntu1
* Merge with Debian unstable. Remaining Ubuntu changes:
  - dh_installudev: Default priority is now 40 by default, the target
    directory is /lib/udev/rules.d, and rules use '-' as separator instead of
    '_'.  Remove files from /etc/udev/rules.d unless they are user modified;
    if modified and of default priority, take care to rename.
    This should eventually go to Debian as well, see Debian #491117.
  - dh_auto_install: add "--install-layout=deb" to setup.py install calls
    (new Python 2.6 policy).
* dh_installxfonts: Drop versioned dependency for xfonts-utils. This
  was only necessary for dapper backports, but since dapper desktop goes
  EOL in two months, and we haven't done dapper backports in ages, this is
  just an unnecessary delta.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/perl -w
 
2
 
 
3
=head1 NAME
 
4
 
 
5
dh_bugfiles - install bug reporting customization files into package build directories
 
6
 
 
7
=cut
 
8
 
 
9
use strict;
 
10
use Debian::Debhelper::Dh_Lib;
 
11
 
 
12
=head1 SYNOPSIS
 
13
 
 
14
B<dh_bugfiles> [B<-A>] [S<I<debhelper options>>]
 
15
 
 
16
=head1 DESCRIPTION
 
17
 
 
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.
 
21
 
 
22
This helper program installs the following files if they are found:
 
23
 
 
24
=over 3
 
25
 
 
26
=item B<debian/package.bug-script>
 
27
 
 
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.
 
34
 
 
35
=item B<debian/package.bug-control>
 
36
 
 
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.
 
40
 
 
41
=item B<debian/package.bug-presubj>
 
42
 
 
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.
 
47
 
 
48
=back
 
49
 
 
50
=head1 OPTIONS
 
51
 
 
52
=over 4
 
53
 
 
54
=item B<-A>, B<--all>
 
55
 
 
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.
 
59
 
 
60
=back
 
61
 
 
62
=cut
 
63
 
 
64
init();
 
65
 
 
66
# Types of bug files this debhelper program handles.
 
67
# Hash value is the name of the pkgfile of the respective
 
68
# type.
 
69
my %bugfile_types = (
 
70
        "script" => "bug-script",
 
71
        "control" => "bug-control",
 
72
        "presubj" => "bug-presubj",
 
73
);
 
74
 
 
75
foreach my $package (@{$dh{DOPACKAGES}}) {
 
76
        next if is_udeb($package);
 
77
 
 
78
        my $tmp=tmpdir($package);
 
79
        my $dir="$tmp/usr/share/bug/$package";
 
80
        
 
81
        # Gather information which bug files are available for the
 
82
        # package in question
 
83
        my %bugfiles=();
 
84
        while (my ($type, $pkgfilename) = each(%bugfile_types)) {
 
85
                my $file=pkgfile($package,$pkgfilename);
 
86
                if ($file) {
 
87
                        $bugfiles{$type}=$file;
 
88
                } elsif (-f "debian/$pkgfilename" && $dh{PARAMS_ALL}) {
 
89
                        $bugfiles{$type}="debian/$pkgfilename";
 
90
                }
 
91
        }
 
92
        
 
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);
 
97
        }
 
98
        elsif (scalar(keys(%bugfiles)) > 0) {
 
99
                if (-f $dir) {
 
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");
 
104
                }
 
105
                elsif (! -d $dir) {
 
106
                        doit("install","-d",$dir);
 
107
                }
 
108
                while (my ($type, $srcfile) = each(%bugfiles)) {
 
109
                        doit("install","-p","-m644",$srcfile, "$dir/$type");
 
110
                }
 
111
        }
 
112
        
 
113
        # Ensure that the bug script is executable
 
114
        if (-f $dir) {
 
115
                chmod 0755, $dir;
 
116
        }
 
117
        elsif (-f "$dir/script") {
 
118
                chmod 0755, "$dir/script";
 
119
        }
 
120
}
 
121
 
 
122
=head1 SEE ALSO
 
123
 
 
124
F</usr/share/doc/reportbug/README.developers.gz>
 
125
 
 
126
L<debhelper(1)>
 
127
 
 
128
This program is a part of debhelper.
 
129
 
 
130
=head1 AUTHOR
 
131
 
 
132
Modestas Vainius <modestas@vainius.eu>
 
133
 
 
134
=cut