]> git.donarmstrong.com Git - debhelper.git/blob - dh_gencontrol
r478: * dh_gencontrol: Work around very strange hurd semantics
[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   dh_gencontrol [debhelper options] [-uparams] [-- 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 including "-isp". 
25
26 Note that L<dpkg-gencontrol(1)> expands certian substirution variables
27 when generating the control file (for details, see its man page). Those
28 variables are typically generated by L<dh_shlibdeps(1)> and like programs.
29 However, if you want to specify some of your own manually, you may do so,
30 by creating files named debian/package.substvars (where package is the
31 package these variables apply to). The files should be of the same form
32 output by L<dpkg-shlibdeps(1)>
33
34 =head1 OPTIONS
35
36 =over 4
37
38 =item B<-u>I<params>, B<--dpkg-gencontrol-params>I<params>
39
40 =item B<--> I<params>
41
42 Pass "params" to L<dpkg-gencontrol(1)>.
43
44 =back
45
46 =cut
47
48 init();
49
50 foreach my $package (@{$dh{DOPACKAGES}}) {
51         my $tmp=tmpdir($package);
52         my $ext=pkgext($package);
53         
54         my $changelog=pkgfile($package,'changelog');
55         if (! $changelog) {
56                 $changelog='debian/changelog';
57         }
58
59         if ( ! -d "$tmp/DEBIAN" ) {
60                 doit("install","-o",0,"-g",0,"-d","$tmp/DEBIAN");
61         }
62
63         # Merge in user-specified substvars file with debhelper generated
64         # one.
65         my $substvars=pkgfile($package,"substvars");
66         if ($substvars) {
67                 complex_doit("cat $substvars >> debian/${ext}substvars.debhelper");
68         }
69
70         # Generate and install control file.
71         doit("dpkg-gencontrol","-l$changelog","-isp","-p$package",
72                      "-Tdebian/${ext}substvars.debhelper",
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(1)>
85
86 This program is a part of debhelper.
87
88 =head1 AUTHOR
89
90 Joey Hess <joeyh@debian.org>
91
92 =cut