Bug#911185: commit hash not found in translation-check header breaks the wml build

Laura Arjona Reina <[email protected]>
Newsgroups gmane.linux.debian.devel.www
Message-ID <2abfa064-3b88-c994-cebb-67104f68d1a0__47394.9522282512$1539728078$gmane$org@debian.org>
Package: www.debian.org
Severity: wishlist

Dear all
When there is a mistake in the hash of the translation-check header in a
wml file, the build fails. Here's an example when doing "make" with a
wml file with a translation-check header containing "test" instead of
the git hash:

wml -q -D CUR_YEAR=2018 -o UNDEFuES:index.es.html@g+w   index.wml
ePerl:Error: Perl runtime error (interpreter rc=0)

---- Contents of STDERR channel: ---------
count_changes() ERROR: commit rev1 test not found in revisions of
../..//english/reports/index.wml
------------------------------------------
** WML:Break: Error in Pass 3 (rc=1).
../../Makefile.common:119: recipe for target 'index.es.html' failed

I wonder if we'd like that instead of failing, the script would handle
this issue and build the page using the tag "originalolder" (then, the
translated file would be available, with a warning "Wrong translation
version!").

I'm attaching a patch that generates this behavior, but I have some
concerns:

* I'm not sure if we should change all the occurrences in the code where
a commit is not found from failure to this behaviour (see the diff, 4
occurrences)
* I'm not sure if we want that, or we prefer that the build fails and
make the CI not ignore these errors (then I guess the person committing
the file with wrong translation hash would get a mail, and hopefully fix
the file. If the page is built, maybe these kind of issues pass by
unnoticed).

Comments?

-- 
Laura Arjona Reina
https://wiki.debian.org/LauraArjona
VCS_git.pm.diff (text/x-patch, 1.4 KB)
diff --git a/Perl/Local/VCS_git.pm b/Perl/Local/VCS_git.pm
index 9c76c0ba969..6f065f290a3 100644
--- a/Perl/Local/VCS_git.pm
+++ b/Perl/Local/VCS_git.pm
@@ -467,12 +467,12 @@ sub cmp_rev
 	}
 	if ($pos1 == -1) {
 	    # Not found
-	    print STDERR "ERROR: commit rev1 $rev1 not found in revisions of $file\n";
-	    $ret = undef;
+	    $self->_debug("WARNING: commit rev1 $rev1 not found in revisions of $file\n");
+	    $ret = -1;
 	} elsif ($pos2 == -1) {
 	    # Not found
-	    print STDERR "ERROR: commit rev2 $rev2 not found in revisions of $file\n";
-	    $ret = undef;
+	    $self->_debug("WARNING: commit rev2 $rev2 not found in revisions of $file\n");
+	    $ret = -1;
 	} elsif ($pos1 == $pos2) {
 	    $ret = 0;
 	} elsif ($pos1 < $pos2) {
@@ -562,12 +562,12 @@ sub count_changes
 	}
 	if ($pos1 == -1) {
 	    # Not found
-	    print STDERR "count_changes() ERROR: commit rev1 $rev1 not found in revisions of $file\n";
-	    $ret = undef;
+	    $self->_debug("count_changes() WARNING: commit rev1 $rev1 not found in revisions of $file\n");
+	    $ret = -1;
 	} elsif ($pos2 == -1) {
 	    # Not found
-	    print STDERR "count_changes() ERROR: commit rev2 $rev2 not found in revisions of $file\n";
-	    $ret = undef;
+	    $self->_debug("count_changes() WARNING: commit rev2 $rev2 not found in revisions of $file\n");
+	    $ret = -1;
 	} else {
 	    $ret = $pos1 - $pos2;
 	}
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.