Skip to content

Idempotent build: file-entities.php #201

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Dec 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@
manual.xml
version.xml
sources.xml
entities/file-entities.ent
temp/
# File use to generate entities by configure script
fileModHistory.php
scripts/file-entities.php


# A plece for all temporary or generated files (idempotent build)
temp/
46 changes: 33 additions & 13 deletions configure.php
Original file line number Diff line number Diff line change
Expand Up @@ -134,16 +134,6 @@ function abspath($path) // {{{
return str_replace('\\', '/', function_exists('realpath') ? realpath($path) : $path);
} // }}}

function quietechorun($e) // {{{
{
// enclose in "" on Windows for PHP < 5.3
if (is_windows() && phpversion() < '5.3') {
$e = '"'.$e.'"';
}

passthru($e);
} // }}}

function find_file($file_array) // {{{
{
$paths = explode(PATH_SEPARATOR, getenv('PATH'));
Expand Down Expand Up @@ -327,6 +317,19 @@ function getFileModificationHistory(): array {
return $history_file;
}

if ( true ) # Initial clean up
{
$dir = escapeshellarg( __DIR__ );
$cmd = "git -C $dir clean temp -fdx --quiet";
$ret = 0;
passthru( $cmd , $ret );
if ( $ret != 0 )
{
echo "doc-base/temp clean up FAILED.\n";
exit( 1 );
}
}

$srcdir = dirname(__FILE__);
$workdir = $srcdir;
$basedir = $srcdir;
Expand Down Expand Up @@ -635,7 +638,6 @@ function getFileModificationHistory(): array {
// Notice how doing it this way results in generating less than half as many files.
$infiles = array(
'manual.xml.in',
'scripts/file-entities.php.in',
);

// Show local repository status to facilitate debug
Expand Down Expand Up @@ -736,9 +738,27 @@ function getFileModificationHistory(): array {

globbetyglob("{$ac['basedir']}/scripts", 'make_scripts_executable');

$redir = ($ac['quiet'] == 'yes') ? ' > ' . (is_windows() ? 'nul' : '/dev/null') : '';

quietechorun("\"{$ac['PHP']}\" -q \"{$ac['basedir']}/scripts/file-entities.php\"{$redir}");
{ # file-entities.php

$cmd = array();
$cmd[] = $ac['PHP'];
$cmd[] = __DIR__ . "/scripts/file-entities.php";
if ( $ac["LANG"] != "en" )
$cmd[] = $ac["LANG"];
if ( $ac['CHMENABLED'] == 'yes' )
$cmd[] = '--chmonly';
foreach ( $cmd as & $part )
$part = escapeshellarg( $part );
$ret = 0;
$cmd = implode( ' ' , $cmd );
passthru( $cmd , $ret );
if ( $ret != 0 )
{
echo "doc-base/scripts/file-entities.php FAILED.\n";
exit( 1 );
}
}


checking("for if we should generate a simplified file");
Expand Down
2 changes: 1 addition & 1 deletion manual.xml.in
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

<!-- These are language independent -->
<!ENTITY % frontpage.entities SYSTEM "../@EN_DIR@/contributors.ent">
<!ENTITY % file.entities SYSTEM "./entities/file-entities.ent">
<!ENTITY % file.entities SYSTEM "./temp/file-entities.ent">

<!-- Include all external DTD parts defined previously -->
%global.entities;
Expand Down
Loading
Loading