]> git.donarmstrong.com Git - debhelper.git/blob - dh_gencontrol
releasing version 7.4.8
[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<--> I<params>
31
32 Pass "params" to L<dpkg-gencontrol(1)>.
33
34 =item B<-u>I<params>, B<--dpkg-gencontrol-params>=I<params>
35
36 This is another way to pass I<params> to L<dpkg-deb(1)>.
37 It is deprecated; use B<--> instead.
38
39 =back
40
41 =cut
42
43 init(options => {
44         "dpkg-gencontrol-params=s", => \$dh{U_PARAMS},
45 });
46
47 foreach my $package (@{$dh{DOPACKAGES}}) {
48         my $tmp=tmpdir($package);
49         my $ext=pkgext($package);
50
51         my $substvars="debian/${ext}substvars";
52         
53         my $changelog=pkgfile($package,'changelog');
54         if (! $changelog) {
55                 $changelog='debian/changelog';
56         }
57
58         if ( ! -d "$tmp/DEBIAN" ) {
59                 doit("install","-o",0,"-g",0,"-d","$tmp/DEBIAN");
60         }
61
62         # avoid gratuitous warning
63         if (! -e $substvars || system("grep -q '^misc:Depends=' $substvars") != 0) {
64                 complex_doit("echo misc:Depends= >> $substvars");
65         }
66         
67         # Generate and install control file.
68         my @command="dpkg-gencontrol";
69         if (getpackages() > 1) {
70                 push @command, "-p$package";
71         }
72         doit(@command, "-l$changelog", "-T$substvars", 
73                 "-P$tmp",@{$dh{U_PARAMS}});
74
75         # This chmod is only necessary if the user sets the umask to
76         # something odd.
77         doit("chmod","644","$tmp/DEBIAN/control");
78         
79         doit("chown","0:0","$tmp/DEBIAN/control");
80 }
81
82 =head1 SEE ALSO
83
84 L<debhelper(7)>
85
86 This program is a part of debhelper.
87
88 =head1 AUTHOR
89
90 Joey Hess <joeyh@debian.org>
91
92 =cut