diff options
author | 2009-06-26 12:57:57 -0400 | |
---|---|---|
committer | 2009-06-26 12:57:57 -0400 | |
commit | 4699a267d7099a4d42dd25c625cb50a6ff5777c7 (patch) | |
tree | be7b9b461951696ee693aa32b1262953abc114c8 /backend | |
parent | Added signal handling and logging; wrote init script; added other nice daemon... (diff) | |
download | ingenue-4699a267d7099a4d42dd25c625cb50a6ff5777c7.tar.gz ingenue-4699a267d7099a4d42dd25c625cb50a6ff5777c7.tar.bz2 ingenue-4699a267d7099a4d42dd25c625cb50a6ff5777c7.zip |
Changed task to have an index based on build instead of unique id, added description field
Diffstat (limited to 'backend')
-rwxr-xr-x | backend/backend.php | 2 | ||||
-rw-r--r-- | backend/functions/build.php | 17 |
2 files changed, 9 insertions, 10 deletions
diff --git a/backend/backend.php b/backend/backend.php index 4d53b6d..5d5fb6b 100755 --- a/backend/backend.php +++ b/backend/backend.php @@ -46,7 +46,7 @@ if (file_put_contents($pidfile, posix_getpid())) $unlinkpidfile=true; require_once(SHARED.'/include/dbinit.php'); while (true) { - // TODO check first for builds that need to be resumed + // TODO check first for builds that need to be resumed (and figure out how to resume things) $r=$S['pdo']->query('SELECT * FROM `builds` WHERE `status`="build/ready" ORDER BY `ctime` ASC LIMIT 1'); if ($r->rowCount()) { $build=new sql_build($r->fetch(PDO::FETCH_ASSOC)); diff --git a/backend/functions/build.php b/backend/functions/build.php index df07fdc..8037913 100644 --- a/backend/functions/build.php +++ b/backend/functions/build.php @@ -35,22 +35,21 @@ function build(&$build) { 'PORTAGE_CONFIGROOT' => $C, 'PATH' => $_ENV['PATH'] ); - sql_task::execute_task('emerge --info', $build, true, null, $env); - sql_task::execute_task('emerge -p system', $build, true, null, $env); - sql_task::execute_task('emerge system', $build, true, null, $env); + sql_task::execute_command('Log portage setup', 'emerge --info', $build, true, null, $env); + sql_task::execute_command('Install base system', 'emerge system', $build, true, null, $env); if (isset($opts['install_packages'])) { $pkgs=array(); foreach (explode(' ', $opts['install_packages']) as $atom) { $pkgs[]=escapeshellarg($atom); } - sql_task::execute_task('emerge -p '.implode(' ', $pkgs), $build, true, null, $env); - foreach ($pkgs as $atom) { - sql_task::execute_task('emerge '.$atom, $build, true, null, $env); - } + if (count($pkgs) > 1) + sql_task::execute_command('Check that extra packages will install', 'emerge -p '.implode(' ', $pkgs), $build, true, null, $env); + foreach ($pkgs as $atom) + sql_task::execute_command('Install extra package '.$atom, 'emerge '.$atom, $build, true, null, $env); } - sql_task::execute_task("tar -p --same-owner -czvf '$W/image.tar.gz' -C '$W/image' .", $build, true, null, $env); + sql_task::execute_command('Compress finished image as tar/gzip', "tar -p --same-owner -czvf '$W/image.tar.gz' -C '$W/image' .", $build, true, null, $env); rename($W.'/image.tar.gz', COMPLETED.'/build-'.$build->id.'.tar.gz'); - sql_task::execute_task('rm -rf "'.$W.'"', $build, true, null, $env); + sql_task::execute_command('Delete work directory', 'rm -rf "'.$W.'"', $build, true, null, $env); return COMPLETED.'/build-'.$build->id.'.tar.gz'; } ?> |