95
96
$self->set('Srcdep Lock Dir', $self->get('Location') . '/' . $self->get_conf('SRCDEP_LOCK_DIR'));
96
97
$self->set('Install Lock', $self->get('Srcdep Lock Dir') . "/install");
99
if (basesetup($self, $self->get('Config'))) {
100
print STDERR "Failed to set up chroot\n";
98
103
my $aptconf = "/var/lib/sbuild/apt.conf";
99
104
$self->set('APT Conf', $aptconf);
108
113
$self->_setup_aptconf($F);
110
115
if (! rename $F->filename, $chroot_aptconf) {
111
die "Can't rename $F->filename to $chroot_aptconf: $!\n";
116
print STDERR "Can't rename $F->filename to $chroot_aptconf: $!\n";
114
die "Can't create $chroot_aptconf: $!";
120
print STDERR "Can't create $chroot_aptconf: $!";
117
124
# unsplit mode uses an absolute path inside the chroot, rather
230
239
my $self = shift;
231
240
my $options = shift;
233
$options->{'PIPE'} = 'in';
234
my $pipe = $self->pipe_command($options);
236
if (defined($pipe)) {
245
warn "Cannot fork: $!\n";
246
} elsif ($pid == 0) { # child
249
$in = $self->get('Defaults')->{'STREAMIN'} if
250
(defined($self->get('Defaults')) &&
251
defined($self->get('Defaults')->{'STREAMIN'}));
252
$in = $options->{'STREAMIN'} if defined($options->{'STREAMIN'});
253
if (defined($in) && $in && \*STDIN != $in) {
254
open(STDIN, '<&', $in)
255
or warn "Can't redirect stdin\n";
259
$out = $self->get('Defaults')->{'STREAMOUT'} if
260
(defined($self->get('Defaults')) &&
261
defined($self->get('Defaults')->{'STREAMOUT'}));
262
$out = $options->{'STREAMOUT'} if defined($options->{'STREAMOUT'});
263
if (defined($out) && $out && \*STDOUT != $out) {
264
open(STDOUT, '>&', $out)
265
or warn "Can't redirect stdout\n";
269
$err = $self->get('Defaults')->{'STREAMERR'} if
270
(defined($self->get('Defaults')) &&
271
defined($self->get('Defaults')->{'STREAMERR'}));
272
$err = $options->{'STREAMERR'} if defined($options->{'STREAMERR'});
273
if (defined($err) && $err && \*STDERR != $err) {
274
open(STDERR, '>&', $err)
275
or warn "Can't redirect stderr\n";
278
$self->exec_command($options);
281
debug("Pipe (PID $pid) created for: ",
282
join(" ", @{$options->{'COMMAND'}}),
246
288
# Note, do not run with $user="root", and $chroot=0, because root
314
356
my $command = $options->{'COMMAND'};
315
357
my $apt_options = $self->get('APT Options');
317
debug("APT Options: ", join(" ", @$apt_options), "\n");
359
debug("APT Options: ", join(" ", @$apt_options), "\n")
360
if defined($apt_options);
319
362
my @aptcommand = ();
320
363
if (defined($apt_options)) {