diff options
author | Eudyptula <eitan@mosenkis.net> | 2009-06-16 20:05:50 -0400 |
---|---|---|
committer | Eudyptula <eitan@mosenkis.net> | 2009-06-16 20:05:50 -0400 |
commit | 24f5009d377e7cca46f923bc8d3ed54de598993e (patch) | |
tree | 435756b6a592503b321def03668bb666b3799be3 | |
parent | Got up to emerging system, started on child process logging (diff) | |
download | ingenue-24f5009d377e7cca46f923bc8d3ed54de598993e.tar.gz ingenue-24f5009d377e7cca46f923bc8d3ed54de598993e.tar.bz2 ingenue-24f5009d377e7cca46f923bc8d3ed54de598993e.zip |
Integrated log_command and tried emerge system; added PORTAGE_TMPDIR to the target environment
-rw-r--r-- | backend/functions/build.php | 14 | ||||
-rw-r--r-- | backend/functions/execution.php | 10 | ||||
-rw-r--r-- | steps | 3 |
3 files changed, 19 insertions, 8 deletions
diff --git a/backend/functions/build.php b/backend/functions/build.php index 6ef5fa2..503a318 100644 --- a/backend/functions/build.php +++ b/backend/functions/build.php @@ -5,7 +5,8 @@ $conf['cflags']='-march=nocona -O2 -pipe'; $conf['cxxflags']=$build['cflags']; $conf['chost']='x86_64-pc-linux-gnu'; $conf['port_logdir']='$W/log'; -$conf['emerge_default_opts']='-K --color=y'; +$conf['emerge_default_opts']='-t -k --color=y'; +$conf['portage_tmpdir']='$W/tmp'; $profile='/etc/make.profile'; // This is the main function that carries out a build from start to finish function build() { @@ -24,6 +25,7 @@ function build() { fatal(log_status('Creating '.C.'/etc', mkdir(C.'/etc', 0700))); fatal(log_status('Creating '.C.'/etc/portage', mkdir(C.'/etc/portage', 0700))); fatal(log_status('Creating '.W.'/log', mkdir(W.'/log', 0700))); + fatal(log_status('Creating '.W.'/tmp', mkdir(W.'/tmp', 0700))); $makeconf='W="'.W.'"'."\n"; foreach ($conf as $name => $val) { $makeconf.=strtoupper($name).'="'.$val.'"'."\n"; @@ -31,8 +33,12 @@ function build() { fatal(log_status('Writing '.C.'/make.conf:'."\n".indent($makeconf), file_put_contents(C.'/etc/make.conf', $makeconf))); unset($makeconf); fatal(log_status('Making make.profile symlink to '.$profile, symlink($profile, C.'/etc/make.profile'))); - $envstring='PORTAGE_CONFIGROOT='.C.' ROOT='.I.' '; - passthru($envstring.'emerge --info'); - passthru($envstring.'emerge --color=y -pv system'); + $env=array( + 'PORTAGE_CONFIGROOT' => C, + 'ROOT' => I + ); + fatal(log_command($id, 'emerge --info', null, $env)!=0); + fatal(log_command($id, 'emerge -pv system', null, $env)!=0); + fatal(log_command($id, 'fakeroot -- emerge -v system', null, $env)!=0); } ?> diff --git a/backend/functions/execution.php b/backend/functions/execution.php index 75d9da8..e1d64b4 100644 --- a/backend/functions/execution.php +++ b/backend/functions/execution.php @@ -11,16 +11,19 @@ function log_command($id, $command, $path=null, $env=null) { } while (true) { $status=proc_get_status($p); - $s=stream_select(array($pipes[1], $pipes[2]), array(), array(), 1); + // We have to set these all to variables because stream_select requires pass by reference + $null=null; + $outs=array($pipes[1], $pipes[2]); + $s=stream_select($outs, $null, $null, 1); if ($s) { $c=stream_get_contents($pipes[2]); // TODO this really needs to go to the DB and carry metadata if ($c) { - log_msg($c); // STDERR + log_msg($c, false); // STDERR } $c=stream_get_contents($pipes[1]); if ($c) { - log_msg($c); // STDOUT + log_msg($c, false); // STDOUT } } if ($status['running'] === false) { @@ -32,5 +35,6 @@ function log_command($id, $command, $path=null, $env=null) { } $exit_status=proc_close($p); // Handle end status + return $exit_status; } ?> @@ -8,7 +8,8 @@ generate a fake CONF_ROOT with /etc/make.profile (linked based on target arch) a CXXFLAGS=? CHOST=... MAKEOPTS=? - PORT_LOGDIR=... + PORT_LOGDIR=... (create me) + PORT_TMPDIR=... (create me) FEATURES=ccache? tmerge -p system (check that it doesn't mention unavailable packages) # Possibly merge with tmerge system |