r85326 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r85325‎ | r85326 | r85327 >
Date:12:27, 4 April 2011
Author:tstarling
Status:ok
Tags:
Comment:
* Change --config to -c, the long form is broken in HEAD
* "hphp --version" gives two lines when run on a git tree, make it into one.
* Use make -j
Modified paths:
  • /trunk/phase3/maintenance/hiphop/make (modified) (history)
  • /trunk/phase3/maintenance/hiphop/run-server (modified) (history)

Diff [purge]

Index: trunk/phase3/maintenance/hiphop/run-server
@@ -3,7 +3,7 @@
44 sourceDir=`dirname "$0"`
55
66 "$sourceDir"/build/persistent/mediawiki-hphp \
7 - --config="$sourceDir/server.conf" \
 7+ -c "$sourceDir/server.conf" \
88 --mode=server \
99 --port=8080
1010
Index: trunk/phase3/maintenance/hiphop/make
@@ -31,7 +31,7 @@
3232
3333 # Create a function that provides the HipHop compiler version, and
3434 # doesn't exist when MediaWiki is invoked in interpreter mode.
35 - $version = trim( `hphp --version` );
 35+ $version = str_replace( PHP_EOL, ' ', trim( `hphp --version` ) );
3636 file_put_contents(
3737 "$buildDir/HipHopCompilerVersion.php",
3838 "<" . "?php\n" .
@@ -48,7 +48,7 @@
4949 ' --input-dir=' . wfEscapeShellArg( $IP ) .
5050 ' --input-list=' . wfEscapeShellArg( "$sourceDir/file-list.small" ) .
5151 ' --inputs=' . wfEscapeShellArg( "$buildDir/HipHopCompilerVersion.php" ) .
52 - ' --config=' . wfEscapeShellArg( "$sourceDir/compiler.conf" ) .
 52+ ' -c ' . wfEscapeShellArg( "$sourceDir/compiler.conf" ) .
5353 ' --parse-on-demand=false' .
5454 ' --program=mediawiki-hphp' .
5555 ' --output-dir=' . wfEscapeShellArg( $outDir ) .
@@ -137,8 +137,23 @@
138138 passthru( $cmd );
139139 }
140140
 141+ # Determine appropriate make concurrency
 142+ # Compilation can take a lot of memory, let's assume that that is limiting.
 143+ $mem = false;
 144+ foreach ( file( '/proc/meminfo' ) as $line ) {
 145+ if ( preg_match( '/^MemTotal:\s+(\d+)\s+kB/', $line, $m ) ) {
 146+ $mem = intval( $m[1] );
 147+ break;
 148+ }
 149+ }
 150+ if ( $mem ) {
 151+ $procs = floor( $mem / 1000000 );
 152+ } else {
 153+ $procs = 1;
 154+ }
 155+
141156 # Run make. This is the slow step.
142 - passthru( 'make' );
 157+ passthru( 'make -j' . wfEscapeShellArg( $procs ) );
143158
144159 $elapsed = time() - $startTime;
145160

Status & tagging log