]> git.donarmstrong.com Git - debhelper.git/blob - dh_gencontrol
Merge branch 'dh_overrides'
[debhelper.git] / dh_gencontrol
1 #!/usr/bin/perl -w
2
3 =head1 NAME
4
5 dh_gencontrol - generate and install control file
6
7 =cut
8
9 use strict;
10 use Debian::Debhelper::Dh_Lib;
11
12 =head1 SYNOPSIS
13
14 B<dh_gencontrol> [S<I<debhelper options>>] [S<B<--> I<params>>]
15
16 =head1 DESCRIPTION
17
18 dh_gencontrol is a debhelper program that is responsible for generating
19 control files, and installing them into the DEBIAN directory with the
20 proper permissions.
21
22 This program is merely a wrapper around L<dpkg-gencontrol(1)>, which calls
23 it once for each package being acted on, and passes in some additional
24 useful flags.
25
26 =head1 OPTIONS
27
28 =over 4
29
30 =item B<-u>I<params>, B<--dpkg-gencontrol-params>=I<params>
31
32 =item B<--> I<params>
33
34 Pass "params" to L<dpkg-gencontrol(1)>.
35
36 =back
37
38 =cut
39
40 init(options => {
41         "dpkg-gencontrol-params=s", => \$dh{U_PARAMS},
42 });
43
44 foreach my $package (@{$dh{DOPACKAGES}}) {
45         my $tmp=tmpdir($package);
46         my $ext=pkgext($package);
47
48         my $substvars="debian/${ext}substvars";
49         
50         my $changelog=pkgfile($package,'changelog');
51         if (! $changelog) {
52                 $changelog='debian/changelog';
53         }
54
55         if ( ! -d "$tmp/DEBIAN" ) {
56                 doit("install","-o",0,"-g",0,"-d","$tmp/DEBIAN");
57         }
58
59         # avoid gratuitous warning
60         if (! -e $substvars || system("grep -q '^misc:Depends=' $substvars") != 0) {
61                 complex_doit("echo misc:Depends= >> $substvars");
62         }
63         
64         # Generate and install control file.
65         my @command="dpkg-gencontrol";
66         if (getpackages() > 1) {
67                 push @command, "-p$package";
68         }
69         doit(@command, "-l$changelog", "-T$substvars", 
70                 "-P$tmp",@{$dh{U_PARAMS}});
71
72         # This chmod is only necessary if the user sets the umask to
73         # something odd.
74         doit("chmod","644","$tmp/DEBIAN/control");
75         
76         doit("chown","0:0","$tmp/DEBIAN/control");
77 }
78
79 =head1 SEE ALSO
80
81 L<debhelper(7)>
82
83 This program is a part of debhelper.
84
85 =head1 AUTHOR
86
87 Joey Hess <joeyh@debian.org>
88
89 =cut