Only error out on W: and Err: lines, on "apt-get update"

Otherwise, maintainer scripts that output W: or Err: lines will break
package installation on "apt-get install".
This commit is contained in:
Johannes 'josch' Schauer 2019-04-30 00:07:35 +02:00
parent c734a59f86
commit da489c6a53
Signed by untrusted user: josch
GPG key ID: F2CBA5C78FBD83E1

View file

@ -681,14 +681,18 @@ sub run_apt_progress {
'-oDpkg::Use-Pty=false', '-oDpkg::Use-Pty=false',
@debs @debs
)}; )};
my $line_has_error = sub { my $line_has_error = sub { return 0; };
# apt-get doesn't report a non-zero exit if the update failed. Thus, we if ($options->{FIND_APT_WARNINGS}) {
# have to parse its output. See #778357, #776152, #696335 and #745735 $line_has_error = sub {
# apt-get doesn't report a non-zero exit if the update failed.
# Thus, we have to parse its output. See #778357, #776152, #696335
# and #745735
if ($_[0] =~ /^(W: |Err:)/) { if ($_[0] =~ /^(W: |Err:)/) {
return 1; return 1;
} }
return 0; return 0;
}; };
}
my $line_handler = sub { my $line_handler = sub {
if ($_[0] =~ /(pmstatus|dlstatus):[^:]+:(\d+\.\d+):.*/) { if ($_[0] =~ /(pmstatus|dlstatus):[^:]+:(\d+\.\d+):.*/) {
return $2; return $2;
@ -1148,7 +1152,9 @@ sub setup {
run_hooks('setup', $options); run_hooks('setup', $options);
info "running apt-get update..."; info "running apt-get update...";
run_apt_progress({ ARGV => ['apt-get', 'update'], CHDIR => $options->{root} }); run_apt_progress({ ARGV => ['apt-get', 'update'],
CHDIR => $options->{root},
FIND_APT_WARNINGS => 1 });
# check if anything was downloaded at all # check if anything was downloaded at all
{ {