cvs: peardoc /scripts pearwebbuild.php

From: Date: Mon, 08 Dec 2008 20:40:02 +0000
Subject: cvs: peardoc /scripts pearwebbuild.php
Groups: php.pear.doc 
Request: Send a blank email to pear-doc+get-11311@lists.php.net to get a copy of this message
cweiske Mon Dec 8 20:40:02 2008 UTC Modified files: /peardoc/scripts pearwebbuild.php Log: use unix cmdline tools for bzipping and zipping instead of php53 only phar http://cvs.php.net/viewvc.cgi/peardoc/scripts/pearwebbuild.php?r1=1.6&r2=1.7&diff_format=u Index: peardoc/scripts/pearwebbuild.php diff -u peardoc/scripts/pearwebbuild.php:1.6 peardoc/scripts/pearwebbuild.php:1.7 --- peardoc/scripts/pearwebbuild.php:1.6 Mon Dec 8 18:28:34 2008 +++ peardoc/scripts/pearwebbuild.php Mon Dec 8 20:40:02 2008 @@ -1,11 +1,11 @@ <?php /** * Script to build the documentation for pearweb - * + * * This script runs the configure scripts, and generates the bightml, chunked, and pearweb * files for use in the pearweb project. * Currently at http://ucommbieber.unl.edu/peardoc/build/, rsync://ucommbieber.unl.edu/peardoc - * + * * Usage: php pearwebuild.php [updatecvs [updatephd]] */ $cwd = getcwd(); @@ -35,58 +35,65 @@ shell_exec($pear_executable.' upgrade -f '.dirname(dirname(dirname(__FILE__))).'/phd/package.xml'); } -@unlink(dirname(__FILE__).'/build.log'); chdir(dirname(dirname(__FILE__))); +passthru('rm -rf build/ && mkdir build'); logAndEcho("Starting Build\n".date('Y-m-d H:i:s')); -foreach (array('de', 'en', 'es', 'fr', 'hu', 'ja', 'nl', 'pl', 'ru') as $lang) { +$langs = glob('??{,_??}', GLOB_ONLYDIR | GLOB_BRACE); +foreach ($langs as $lang) { logAndEcho("Building peardoc/$lang with php configure.php --lang=$lang"); exec("$php_executable configure.php --lang=$lang", $output, $return); if ($return == 0) { if ($lang == 'en') { logAndEcho("Building pearweb package tocs"); - shell_exec("$php_executable scripts/pearwebpackagetocs.php >> scripts/build.log"); + shell_exec("$php_executable scripts/pearwebpackagetocs.php >> build/build.log"); } - - logAndEcho("Now running phd for $lang"); - - shell_exec("$phd_executable -f xhtml -t pearbightml -o build/$lang -d giant.xml >> scripts/build.log"); - - logAndEcho('Creating pearbightml downloadable file'); - $zipfilename = "build/$lang/pear_manual_$lang.html.phar"; - $phar = new Phar($zipfilename); - $phar->addFile("build/$lang/pear_manual_en.html", "pear_manual_$lang.html"); - @unlink("build/$lang/pear_manual_$lang.html.tar.bz2"); - $phar->convertToData(Phar::TAR, Phar::BZ2, '.html.tar.bz2'); - - // Remove the .phar - @unlink("build/$lang/pear_manual_$lang.html.phar"); - - shell_exec("$phd_executable -f xhtml -t pearchunkedhtml -o build/$lang -d giant.xml >> scripts/build.log"); - - $zipfilename = "build/$lang/pear_manual_$lang.phar"; - - logAndEcho('Creating pearchunked downloadable zip'); - - $phar = new Phar($zipfilename); - $phar->buildFromDirectory('build/'.$lang.'/html'); - @unlink("build/$lang/pear_manual_$lang.zip"); - $phar->convertToData(Phar::ZIP); - @unlink("build/$lang/pear_manual_$lang.tar.bz2"); - $phar->convertToData(Phar::TAR, Phar::BZ2); + logAndEcho("Now running phd for $lang"); - // Remove the .phar - @unlink("build/$lang/pear_manual_$lang.phar"); + //bightml + logAndEcho(' Rendering and bzipping pearbightml downloadable file'); + shell_exec("$phd_executable -f xhtml -t pearbightml -o build/$lang -d giant.xml >> build/build.log"); + passthru('bzip2' + . ' ' . escapeshellarg("build/$lang/pear_manual_en.html") + . ' --stdout' + . ' > ' + . escapeshellarg("build/$lang/pear_manual_$lang.html.bz2") + ); + passthru( + "cd build/$lang/ &&" + . 'zip' + . ' ' . escapeshellarg("pear_manual_$lang.html.zip") + . ' ' . escapeshellarg("pear_manual_en.html") + ); + + //chunkedhtml + logAndEcho(' Rendering and bzipping pearchunked downloadable zip'); + shell_exec("$phd_executable -f xhtml -t pearchunkedhtml -o build/$lang -d giant.xml >> build/build.log"); + passthru( + "cd build/$lang/ && mv html pear_manual_$lang && " + . 'tar cj --to-stdout' + . ' ' . escapeshellarg("pear_manual_$lang") + . ' > ' + . escapeshellarg("pear_manual_$lang.tar.bz2") + ); + passthru( + "cd build/$lang/ &&" + . 'zip -r' + . ' ' . escapeshellarg("pear_manual_$lang.zip") + . ' ' + . escapeshellarg("pear_manual_$lang") + ); + //pearweb shell_exec("$phd_executable -f xhtml -t pearweb -o build/$lang -d giant.xml >> scripts/build.log"); - + // Remove chm build until we can get a chm compiler going. //shell_exec("$phd_executable -f xhtml -t pearchm -o build/$lang -d giant.xml >> scripts/build.log"); - logAndEcho("Finished peardoc/$lang"); + logAndEcho(" Finished peardoc/$lang"); } else { logAndEcho('Error configuring:'); logAndEcho(implode("\n", $output)); @@ -94,11 +101,11 @@ } } -logAndEcho("Build complete\n".date('Y-m-d H:i:s')); +logAndEcho("Build complete\n" . date('Y-m-d H:i:s')); -function logAndEcho($message, $logfile = 'build.log') +function logAndEcho($message) { echo $message.PHP_EOL; - file_put_contents(dirname(__FILE__).'/'.$logfile, $message.PHP_EOL, FILE_APPEND); + file_put_contents('build/build.log', $message.PHP_EOL, FILE_APPEND); }

« previous php.pear.doc (#11311) next »