From: Yury Gribov Date: Tue, 18 Jul 2017 15:39:39 +0000 (+0000) Subject: mklog: Fix extraction of changed file name. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=883b0e467ad1e7c9af9131b026b4446d571f3caa;p=gcc.git mklog: Fix extraction of changed file name. 2017-07-17 Yury Gribov * mklog: Fix extraction of changed file name. From-SVN: r250314 --- diff --git a/contrib/ChangeLog b/contrib/ChangeLog index 46e8a8284a1..35bd9e2f232 100644 --- a/contrib/ChangeLog +++ b/contrib/ChangeLog @@ -1,3 +1,7 @@ +2017-07-17 Yury Gribov + + * mklog: Fix extraction of changed file name. + 2017-07-17 Georg-Johann Lay * gcc_update (files_and_dependencies) diff --git a/contrib/mklog b/contrib/mklog index 61126280f1f..ff20cf1ba0f 100755 --- a/contrib/mklog +++ b/contrib/mklog @@ -1,5 +1,5 @@ #!/usr/bin/perl -# Copyright (C) 2012-2014 Free Software Foundation, Inc. +# Copyright (C) 2012-2017 Free Software Foundation, Inc. # # This file is part of GCC. # @@ -195,8 +195,20 @@ foreach (@diff_lines) { } elsif($right eq '/dev/null') { $filename = $left; } else { - print STDERR "Error: failed to parse diff for $left and $right\n"; - exit 1; + my @ldirs = split /[\/\\]/, $left; + my @rdirs = split /[\/\\]/, $right; + + $filename = ''; + while ((my $l = pop @ldirs) && (my $r = pop @rdirs)) { + last if ($l ne $r); + $filename = "$l/$filename"; + } + $filename =~ s/\/$//; + + if (!$filename) { + print STDERR "Error: failed to parse diff for $left and $right\n"; + exit 1; + } } $left = $right = undef; ($clname, $relname) = get_clname ($filename);