Skip to content

Commit

Permalink
aaaaaaaaaaaaaaaaaaaaa
Browse files Browse the repository at this point in the history
  • Loading branch information
thesamesam committed Aug 19, 2024
1 parent 3598a75 commit ff2a0b3
Showing 1 changed file with 4 additions and 67 deletions.
71 changes: 4 additions & 67 deletions ci/ciimage/ubuntu-rolling/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -82,75 +82,12 @@ cp LICENSE /usr/share/doc/zig
cd ..
rm -rf "$ZIG_BASE"

cd /
# Hack for https://github.com/linux-test-project/lcov/issues/245
# https://github.com/linux-test-project/lcov/commit/bf135caf5f626e02191c42bd2773e08a0bb9b7e5
patch -p1 <<-EOF
--- a/usr/bin/genhtml
+++ b/usr/bin/genhtml
@@ -5971,11 +5971,35 @@ sub gen_html()
$no_prefix = 1;
}
} else {
- my $msg = "Using user-specified filename prefix ";
- for my $i (0 .. $#dir_prefix) {
- $dir_prefix[$i] =~ s/$lcovutil::dirseparator+$//;
+ my $msg = "Using user-specified filename prefix ";
+ my $dirs = $current_data->directories();
+ my $i = 0;
+ # somewhat of a hack: the layout code doesn't react well when
+ # the 'prefix' directory contains source files (as opposed to
+ # containing a directory which contains source files).
+ # Rather than trying to handle that special case, just munge the
+ # prefix to be something we like better.
+ while ($i <= $#dir_prefix) {
+ my $p = $dir_prefix[$i];
+ # remove redundant /'s
+ $p =~ s/$lcovutil::dirseparator+$//;
+ $p = substr($p, 0, -1)
+ if $lcovutil::dirseparator eq substr($p, -1);
+ while (exists($dirs->{$p}) && $p) {
+ $p = File::Basename::dirname($p);
+ }
+ unless ($p) {
+ lcovutil::info("skipping prefix $dir_prefix[$i]\n");
+ splice(@dir_prefix, $i, 1);
+ next;
+ }
+ lcovutil::info(
+ "using prefix '$p' (rather than '$dir_prefix[$i]')\n")
+ if ($p ne $dir_prefix[$i]);
+ $dir_prefix[$i] = $p;
$msg .= ", " unless 0 == $i;
- $msg .= "\"" . $dir_prefix[$i] . "\"";
+ $msg .= "\"" . $p . "\"";
+ ++$i;
}
info($msg . "\n");
}
--- a/usr/lib/lcov/lcovutil.pm
+++ b/usr/lib/lcov/lcovutil.pm
@@ -5213,6 +5213,19 @@ sub files
return keys %{$self->[FILES]};
}
+sub directories
+{
+ my $self = shift;
+ # return hash of directories whcih contain source files
+ my %dirs;
+ foreach my $f ($self->files()) {
+ my $d = File::Basename::dirname($f);
+ $dirs{$d} = [] unless exists($dirs{$d});
+ push(@{$dirs{$d}}, $f);
+ }
+ return \%dirs;
+}
+
sub file_exists
{
my ($self, $name) = @_;
EOF
# XXX: Drop this once Ubuntu has lcov-2.1*
git clone https://github.com/linux-test-project/lcov
cd lcov
make install

# cleanup
apt-get -y clean
Expand Down

0 comments on commit ff2a0b3

Please sign in to comment.