dgcov: also remove rpm dependency on IO::Uncompress::Gunzip

and enable option bundling
This commit is contained in:
Sergei Golubchik 2022-12-04 00:31:29 +01:00
parent 7baf24a0f8
commit 180b2bcd53

View File

@ -36,6 +36,7 @@ my $opt_skip_gcov;
my %cov;
my $file_no=0;
Getopt::Long::Configure ("bundling");
GetOptions
("v|verbose+" => \$opt_verbose,
"h|help" => \$opt_help,
@ -188,17 +189,16 @@ sub gcov_one_file {
close(FH);
}
} else {
use IO::Uncompress::Gunzip qw(gunzip $GunzipError);
require IO::Uncompress::Gunzip;
require JSON::PP;
my $gcov_file_json;
my $fname;
s/\.gcda$// if $gcc_version >= 11;
gunzip "$_.gcov.json.gz" => \$gcov_file_json or die "gunzip($_.gcov.json.gz): $GunzipError";
IO::Uncompress::Gunzip::gunzip("$_.gcov.json.gz", \$gcov_file_json)
or die "gunzip($_.gcov.json.gz): $IO::Uncompress::Gunzip::GunzipError";
my $obj= JSON::PP::decode_json $gcov_file_json;
for my $file (@{$obj->{files}}) {
$fname= $file->{file};
for my $line (@{$file->{lines}}){
$cov{$fname}->{$line->{line_number}}+= $line->{count};
$cov{$file->{file}}->{$line->{line_number}}+= $line->{count};
}
}
}