Skip to content

Commit

Permalink
Revcheck deduplication: ignore, regex, xml.
Browse files Browse the repository at this point in the history
  • Loading branch information
André L F S Bacci committed Nov 6, 2024
1 parent 324f48c commit 60b5f1e
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 17 deletions.
15 changes: 8 additions & 7 deletions scripts/translation/lib/RevcheckIgnore.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,26 +42,27 @@ public static function ignore( $filename ) : bool
if ( str_contains( $filename , "/versions.xml" ) )
return true;

// Only in English
// Only in English, autogenerated, marked not translatable

if ( $filename == "contributors.ent" )
return true;
if ( $filename == "contributors.xml" )
return true;
if ( $filename == "appendices/license.xml" )
return true;
if ( $filename == "appendices/license.xml" )
return true;
if ( $filename == "appendices/extensions.xml" )
return true;
if ( $filename == "appendices/reserved.constants.xml" )
return true;
if ( $filename == "reference/datetime/timezones.xml" )
return true;
if ( str_starts_with( $filename , 'chmonly/') )
return true;
if ( str_ends_with( $filename , '/book.developer.xml') )
return true;

if ( IGNORE_EXTENSIONS_XML )
if ( str_ends_with( $filename , '/extension.xml') ) // wrong
return true;
if ( IGNORE_CHMONLY_DIR )
if ( str_starts_with( $filename , 'chmonly/') ) // possibly wrong
return true;

// Only in translations

Expand Down
6 changes: 3 additions & 3 deletions scripts/translation/lib/RevcheckRun.php
Original file line number Diff line number Diff line change
Expand Up @@ -217,13 +217,13 @@ private function parseTranslationXml() : void
$this->revData->lang = $this->targetDir;
$this->revData->date = date("r");

$xml = XmlUtil::loadFile( $this->targetDir . '/translation.xml' );
$dom = XmlUtil::loadFile( $this->targetDir . '/translation.xml' );

$this->revData->intro =
$xml->getElementsByTagName( 'intro' )[0]->textContent
$dom->saveXML( $dom->getElementsByTagName( 'intro' )[0] )
?? "No intro available for the {$lang} translation of the manual.";

$persons = $xml->getElementsByTagName( 'person' );
$persons = $dom->getElementsByTagName( 'person' );
foreach( $persons as $person )
{
$nick = $person->getAttribute( 'nick' );
Expand Down
6 changes: 3 additions & 3 deletions scripts/translation/lib/RevtagParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,11 @@ public static function parseComment( DOMNode $node , RevtagInfo $ret , $filename

if ( str_starts_with( $text , "EN-" ) )
{
// /EN-Revision:\s*(\S+)\s*Maintainer:\s*(\S+)\s*Status:\s*(\S+)/ // restrict maintainer without spaces
// /EN-Revision:\s*(\S+)\s*Maintainer:\s(.*?)\sStatus:\s*(\S+)/ // accepts maintainer with spaces
// /EN-Revision:\s*(\S+)\s*Maintainer:\s*(\S+)\s*Status:\s*(\S+)/ // restrict maintainer without spaces
// /EN-Revision:\s*(\S+)\s*Maintainer:\s(.*?)\sStatus:\s*(\S+)/ // accepts maintainer with spaces

$match = array();
$regex = "/EN-Revision:\s*(\S+)\s*Maintainer:\s*(\S+)\s*Status:\s*(\S+)/";
$regex = "/EN-Revision:\s*(\S+)\s*Maintainer:\s(.*?)\sStatus:\s*(\S+)/";
if ( preg_match( $regex , $text , $match ) )
{
$ret->revision = trim( $match[1] );
Expand Down
26 changes: 22 additions & 4 deletions scripts/translation/lib/backport.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,30 @@

// Constants

const IGNORE_CHMONLY_DIR = true;
const IGNORE_EXTENSIONS_XML = true;
const STATUS_COUNT_MISMATCH = true;
const LOOSE_SKIP_REVCHECK = true;
const FIXED_SKIP_REVCHECK = true;

// Documentation

/* # IGNORE_CHMONLY_DIR
The chmonly/ dir contains files that appears to be
translatable. See recent efforts to re-enabling
CHM build: https://github.com/php/doc-base/pull/163
*/

/* # IGNORE_EXTENSIONS_XML
The actual revcheck ignores any files called extensions.xml,
but are at least two of translated files with this name.
- appendices/migration56/extensions.xml
- install/windows/legacy/extensions.xml
*/

/* # STATUS_COUNT_MISMATCH
The actual revcheck counts "outdated" files in two different ways;
Expand All @@ -31,14 +49,14 @@
was added here.
Also, NotInEnTree is missing on first case, and files
in this situation goes uncounted...
in this situation goes uncounted.
Also, RevTagProblem is counted towards as Old, but it
is impossible to generate diffs with invalid hashes... */
Also, RevTagProblem is counted towards as Old, but files
are show in revtag missing/problem list, and is
impossible to generate diffs with invalid hashes... */

assert( STATUS_COUNT_MISMATCH || ! STATUS_COUNT_MISMATCH );


/* # LOOSE_SKIP_REVCHECK
Consider the output of: git show f80105b4fc1196bd8d5fecb98d686b580b1ff65d
Expand Down

0 comments on commit 60b5f1e

Please sign in to comment.