61
61
# Copy any additional files
63
63
my @extra_files = split ",", $control{'Extra-Files'} || "";
64
my %install_files = ();
65
for (split "\n", $control{'Files'} || "") {
66
$install_files{$2} = $1 if m/^\s*(\S+)\s+(\S+)\s*$/;
68
my %create_files = ();
69
for (@{$control{'File'} || []}) {
70
if (m/^\s*(\S+)\n(.*)$/s) {
73
$b =~ s/^[.]([.]*)$/$1/mg;
74
$create_files{$f} = $b;
78
mkdir "$builddir/install", 0755;
79
open INSTALL, '>', "$builddir/debian/install" or
80
die "Cannot open $builddir/debian/installfor writing: $!\n";
81
foreach my $target (keys %install_files, keys %create_files) {
85
if ($target =~ m/^(preinst|postinst|prerm|postrm)$/) {
86
$destination = "debian/$target";
89
$destination = "install/$cnt";
90
mkdir "$builddir/$destination" unless -d "$builddir/$destination";
91
$destination .= "/" . basename($target);
93
} while ( -e "$builddir/$destination" );
94
print INSTALL "$destination " . dirname($target) . "\n";
96
if (defined $install_files{$target}) {
97
my $file = $install_files{$target};
98
copy $file, "$builddir/$destination" or
99
die "Cannot copy $file to $builddir/$destination: $!\n";
101
open CREATE, ">", "$builddir/$destination" or
102
die "Cannot create file $builddir/$destination: $!\n";
103
print CREATE $create_files{$target};
65
110
mkdir "$builddir/docs", 0755;
66
111
open DOCS, '>', "$builddir/debian/docs" or
133
177
sub read_control_file {
134
178
my ($builddir, $control, $specific_arch, $file) = @_;
137
182
open($in, "$builddir/debian/control.in") or
138
183
die "Cannot open control file: $!\n";
139
read_control_file_section($in, $control) or
184
read_control_file_section($in, \@control) or
140
185
die "error: empty control file\n";
157
204
open($in, $file) or
158
205
die "Cannot open control file $file: $!\n";
160
read_control_file_section($in, $control) or
208
read_control_file_section($in, \@control) or
161
209
die "error: empty control file\n";
212
for (my $i = 0; $i < $#control; $i += 2) {
213
my $k = $control[$i];
214
my $v = $control[$i+1];
217
$vv = $control->{$k} if defined $control->{$k};
219
$control->{$k} = $vv;
164
225
# Fix Source: entry
165
226
$control->{'Source'} = $control->{'Package'};
180
next if (m/^\s*$/ or m/^\s*#/);
241
next if (m/^\s*$/ or m/^#/);
183
244
if (/^(\S+)\s*:\s*(.*?)\s*$/) {
184
245
($cf,$v) = (ucfirst lc $1, $2);
185
246
$cf =~ s/(?<=-)([a-z])/uc $1/eg;
186
$pfields->{$cf} = $v;
247
push @{$pfields}, $cf, $v;
187
248
} elsif (/^(\s+\S.*)$/) {
189
250
defined($cf) or die "syntax error in control file: no field specified\n";
190
$pfields->{$cf} .= "\n$v";
251
$pfields->[-1] .= "\n$v";
192
253
die "syntax error in control file: $_\n";
244
305
sub make_changelog {
245
306
my ($builddir, $control) = @_;
246
my ($version, $date);
307
my ($version, $suite, $date);
248
309
$version = $control->{'Version'} || "1.0";
249
chomp ($date = qx(822-date));
310
$suite = $control->{'Suite'} || "unstable";
311
chomp ($date = qx(date -R));
251
313
open OUT, '>', "$builddir/debian/changelog" or
252
314
die "Couldn't write changelog: $!\n";
253
315
print OUT <<EOINPUT;
254
$control->{Package} ($version) unstable; urgency=low
316
$control->{Package} ($version) $suite; urgency=low