~noskcaj/ubuntu/saucy/debhelper/saucy

1 by Joey Hess
dh_install: delay globbing until after destintations have been found.
1
#!/usr/bin/perl -w
2
3
=head1 NAME
4
1.4.21 by Joey Hess, Joey Hess, Valery Perrin
[ Joey Hess ]
5
dh_builddeb - build Debian binary packages
1 by Joey Hess
dh_install: delay globbing until after destintations have been found.
6
7
=cut
8
9
use strict;
10
use Debian::Debhelper::Dh_Lib;
11
12
=head1 SYNOPSIS
13
2 by Sebastien Bacher
dh_scrollkeeper: don't display the output (Warty #336).
14
B<dh_builddeb> [S<I<debhelper options>>] [B<--destdir=>I<directory>] [B<--filename=>I<name>] [S<B<--> I<params>>]
1 by Joey Hess
dh_install: delay globbing until after destintations have been found.
15
16
=head1 DESCRIPTION
17
1.4.21 by Joey Hess, Joey Hess, Valery Perrin
[ Joey Hess ]
18
B<dh_builddeb> simply calls L<dpkg-deb(1)> to build a Debian package or
1 by Joey Hess
dh_install: delay globbing until after destintations have been found.
19
packages.
20
1.4.51 by Joey Hess
* Fix versioned dependency on dpkg for xz options. Closes: #672895
21
It supports building multiple binary packages in parallel, when enabled by
22
DEB_BUILD_OPTIONS.
23
1 by Joey Hess
dh_install: delay globbing until after destintations have been found.
24
=head1 OPTIONS
25
26
=over 4
27
28
=item B<--destdir=>I<directory>
29
1.4.21 by Joey Hess, Joey Hess, Valery Perrin
[ Joey Hess ]
30
Use this if you want the generated F<.deb> files to be put in a directory
31
other than the default of "F<..>".
1 by Joey Hess
dh_install: delay globbing until after destintations have been found.
32
2 by Sebastien Bacher
dh_scrollkeeper: don't display the output (Warty #336).
33
=item B<--filename=>I<name>
1 by Joey Hess
dh_install: delay globbing until after destintations have been found.
34
35
Use this if you want to force the generated .deb file to have a particular
36
file name. Does not work well if more than one .deb is generated!
37
38
=item B<--> I<params>
39
2 by Sebastien Bacher
dh_scrollkeeper: don't display the output (Warty #336).
40
Pass I<params> to L<dpkg-deb(1)> when it is used to build the
1 by Joey Hess
dh_install: delay globbing until after destintations have been found.
41
package.
42
1.4.3 by Joey Hess
* The makefile buildsystem (and derived buildsystems cmake, autoconf, etc)
43
=item B<-u>I<params>
44
45
This is another way to pass I<params> to L<dpkg-deb(1)>.
46
It is deprecated; use B<--> instead.
47
1 by Joey Hess
dh_install: delay globbing until after destintations have been found.
48
=back
49
50
=cut
51
1.2.5 by Joey Hess
* dh_installmodules: Give files in /etc/modprobe.d a .conf
52
init(options => {
53
	"filename=s" => \$dh{FILENAME},
1.3.1 by Joey Hess
* Add ant buildsystem support. Closes: #537021
54
	"destdir=s" => \$dh{DESTDIR},
1.2.5 by Joey Hess
* dh_installmodules: Give files in /etc/modprobe.d a .conf
55
});
1 by Joey Hess
dh_install: delay globbing until after destintations have been found.
56
57
# Set the default destination directory.
58
if (! defined $dh{DESTDIR}) {
59
	$dh{DESTDIR}='..';
60
}
61
62
if (! defined $dh{FILENAME}) {
63
	$dh{FILENAME}='';
64
}
65
else {
66
	$dh{FILENAME}="/$dh{FILENAME}";
67
}
68
1.4.34 by Joey Hess
* dh: Now you can use override_dh_command-arch and override_dh_command-indep
69
my $max_procs=get_buildoption("parallel") || 1;
1.4.29 by Joey Hess
* Typo fixes. Closes: #632662
70
71
my $processes=1;
72
my $exit=0;
73
sub reap {
74
	if (wait == -1) {
75
		$processes=0;
76
	}
77
	else {
78
		$processes--;
79
		$exit=1 if $? != 0;
80
	}
81
}
82
1 by Joey Hess
dh_install: delay globbing until after destintations have been found.
83
foreach my $package (@{$dh{DOPACKAGES}}) {
1.4.29 by Joey Hess
* Typo fixes. Closes: #632662
84
	my $pid=fork();
85
	if (! defined $pid) {
86
		error("fork failed! $!");
87
	}
88
	if ($pid) { # parent
89
		$processes++;
90
		reap while $processes > $max_procs;
91
		next;
92
	}
93
94
	# child
1 by Joey Hess
dh_install: delay globbing until after destintations have been found.
95
	my $tmp=tmpdir($package);
2 by Sebastien Bacher
dh_scrollkeeper: don't display the output (Warty #336).
96
	if (exists $ENV{DH_ALWAYS_EXCLUDE} && length $ENV{DH_ALWAYS_EXCLUDE}) {
26 by Colin Watson
* Resynchronise with Debian. Remaining changes:
97
		if (! compat(5)) {
98
			complex_doit("find $tmp $dh{EXCLUDE_FIND} | xargs rm -rf");
99
		}
100
		else {
38 by Martin Pitt
* Merge with Debian unstable. Remaining Ubuntu changes:
101
			# Old broken code here for compatibility. Does not
26 by Colin Watson
* Resynchronise with Debian. Remaining changes:
102
			# remove everything.
103
			complex_doit("find $tmp -name $_ | xargs rm -rf")
104
				foreach split(":", $ENV{DH_ALWAYS_EXCLUDE});
105
		}
2 by Sebastien Bacher
dh_scrollkeeper: don't display the output (Warty #336).
106
	}
107
	if (! is_udeb($package)) {
108
		doit("dpkg-deb", @{$dh{U_PARAMS}}, "--build", $tmp, $dh{DESTDIR}.$dh{FILENAME});
109
	}
110
	else {
111
		my $filename=$dh{FILENAME};
112
		if (! $filename) {
113
			$filename="/".udeb_filename($package);
114
		}
1.4.50 by Joey Hess
* Improve -v logging. Closes: #672448
115
		doit("dpkg-deb", "-z1", "-Zxz", "-Sextreme",
116
			@{$dh{U_PARAMS}}, "--build", $tmp, $dh{DESTDIR}.$filename);
2 by Sebastien Bacher
dh_scrollkeeper: don't display the output (Warty #336).
117
	}
1.4.29 by Joey Hess
* Typo fixes. Closes: #632662
118
	exit 0;
1 by Joey Hess
dh_install: delay globbing until after destintations have been found.
119
}
120
1.4.29 by Joey Hess
* Typo fixes. Closes: #632662
121
reap while $processes;
122
exit $exit;
123
1 by Joey Hess
dh_install: delay globbing until after destintations have been found.
124
=head1 SEE ALSO
125
2 by Sebastien Bacher
dh_scrollkeeper: don't display the output (Warty #336).
126
L<debhelper(7)>
1 by Joey Hess
dh_install: delay globbing until after destintations have been found.
127
128
This program is a part of debhelper.
129
130
=head1 AUTHOR
131
132
Joey Hess <joeyh@debian.org>
133
134
=cut