summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEudyptula <eitan@mosenkis.net>2009-08-14 11:42:02 -0400
committerEudyptula <eitan@mosenkis.net>2009-08-14 11:42:02 -0400
commit53eb7629d4cb33f62da5fe232bf2019e1a54d4f9 (patch)
tree4c40d2ef78dfd1564934612ee81df596ec3e350b
parentCreate sql_row_with_flags class, make user, build, configuration subclasses o... (diff)
downloadingenue-53eb7629d4cb33f62da5fe232bf2019e1a54d4f9.tar.gz
ingenue-53eb7629d4cb33f62da5fe232bf2019e1a54d4f9.tar.bz2
ingenue-53eb7629d4cb33f62da5fe232bf2019e1a54d4f9.zip
Quick hack to move bundler selection out of Gentoo module and make it a build-time option; drop 'failed' column from builds and use flags instead
-rwxr-xr-xbackend/backend.php2
-rw-r--r--frontend/modules/gentoo/step3.php10
-rw-r--r--frontend/pages/builds/delete.php2
-rw-r--r--frontend/pages/configurations/manager.php30
-rw-r--r--frontend/pages/configurations/wizard.php11
-rw-r--r--shared/classes/build.php17
-rw-r--r--shared/classes/configuration.php3
-rw-r--r--todo6
8 files changed, 51 insertions, 30 deletions
diff --git a/backend/backend.php b/backend/backend.php
index 161b7b2..bb4562c 100755
--- a/backend/backend.php
+++ b/backend/backend.php
@@ -50,7 +50,7 @@ require_once(SHARED.'/include/dbinit.php');
while (true) {
// TODO check first for builds that need to be resumed (and figure out how to resume things)
while (true) {
- $r=query('SELECT * FROM `builds` WHERE `backend`="'.$S['conf']['backend_id'].'" AND `status` IN ("queued","cancel","uploading","building","bundling") AND `failed`!="true" ORDER BY `ctime` ASC LIMIT 1');
+ $r=query('SELECT * FROM `builds` WHERE `backend`="'.$S['conf']['backend_id'].'" AND `status` IN ("queued","cancel","uploading","building","bundling") AND `flags` NOT LIKE "%f%" ORDER BY `ctime` ASC LIMIT 1');
if ($r->rowCount())
break;
else {
diff --git a/frontend/modules/gentoo/step3.php b/frontend/modules/gentoo/step3.php
index 83b101c..a270767 100644
--- a/frontend/modules/gentoo/step3.php
+++ b/frontend/modules/gentoo/step3.php
@@ -39,14 +39,4 @@ if ($this->get_opt('basesystem') == 'user_prune') {
}
$this->checkbox_array('prunepkgs', 'prunepkgs', 'Remove the following packages from the base system', $pkgs);
}
-// TODO This shouldn't be a step at all, it should be in wizard.php to choose between bundlers
-// TODO This shouldn't be part of configurations, except possibly a default value. It should be for builds
-$this->select('bundler', 'bundler', 'Image type', array(
- 'tgz' => 'Tar/Gzip',
- 'tbz2' => 'Tar/Bzip2',
- 'installcd' => 'Installer CD with Tar/Bzip2',
- 'livecd' => 'LiveCD',
- 'ext2' => 'ext2',
- 'jffs2' => 'jffs2'
-));
?>
diff --git a/frontend/pages/builds/delete.php b/frontend/pages/builds/delete.php
index b92d28b..384be2d 100644
--- a/frontend/pages/builds/delete.php
+++ b/frontend/pages/builds/delete.php
@@ -25,7 +25,7 @@ function body_builds_delete(&$S) {
case 'uploading':
case 'building':
default:
- $S['build']->failed='false'; // Otherwise doesn't get noticed by backend
+ $S['build']->unset_flag('f'); // Otherwise doesn't get noticed by backend
$S['build']->status='cancel';
$S['build']->write();
echo print_success('Build queued for cancellation.');
diff --git a/frontend/pages/configurations/manager.php b/frontend/pages/configurations/manager.php
index 928ad67..e29ab88 100644
--- a/frontend/pages/configurations/manager.php
+++ b/frontend/pages/configurations/manager.php
@@ -7,13 +7,14 @@ function init_configurations_manager(&$S) {
}
function body_configurations_manager(&$S) {
echo '<h3>Configurations Manager</h3>';
- if (isset($_REQUEST['build']) && isset($_REQUEST['configuration'])) {
+ if (isset($_REQUEST['build'], $_REQUEST['configuration'])) {
$c=new sql_configuration($_REQUEST['configuration']);
- if ($c->owner!=$S['user']->id) {
+ if (!owner_or_admin($c->owner)) {
echo print_error('You do not have permission to build this configuration.');
} else {
$name=isset($_REQUEST['name'])?$_REQUEST['name']:null;
- $build=$c->build($name);
+ $bundler=isset($_REQUEST['bundler'])?$_REQUEST['bundler']:'tbz2';
+ $build=$c->build($name, $bundler);
if (is_object($build))
echo print_success('Submitted for build - <a href="'.url("build/$build->id").'">Logs</a>');
else
@@ -60,6 +61,27 @@ function body_configurations_manager(&$S) {
}
echo "</td></tr>\n";
}
- echo '</table>'.($ready?'Name (optional): <input name="name" /> <input type="submit" name="build" value="Build" />':'').'</form>';
+ echo '</table>';
+ if ($ready) {
+ echo 'Name (optional): <input name="name" /><br/>
+ Bundler: <select name="bundler">
+ <option value="tbz2">Tar/Bzip2</option>
+ <option value="tgz">Tar/Gzip</option>
+ <option value="installcd">Install CD with Tar/Bzip2</option>
+ <option value="livecd">LiveCD</option>
+ <option value="ext2">ext2</option>
+ <option value="jffs2">jffs2</option>
+ </select><br/>
+ <input type="submit" name="build" value="Build" />';
+ }
+ echo '</form>';
+ /*$this->select('bundler', 'bundler', 'Image type', array(
+ 'tgz' => 'Tar/Gzip',
+ 'tbz2' => 'Tar/Bzip2',
+ 'installcd' => 'Installer CD with Tar/Bzip2',
+ 'livecd' => 'LiveCD',
+ 'ext2' => 'ext2',
+ 'jffs2' => 'jffs2'
+ ));*/
}
?>
diff --git a/frontend/pages/configurations/wizard.php b/frontend/pages/configurations/wizard.php
index 6dc6a8e..a7fdb6d 100644
--- a/frontend/pages/configurations/wizard.php
+++ b/frontend/pages/configurations/wizard.php
@@ -54,7 +54,16 @@ function body_configurations_wizard(&$S) {
if (isset($S['wizard']['step']))
$S['wizard']['step']->output();
else
- echo print_success('Config finished!', '<form action="'.url('configurations').'" method="post"><input type="hidden" name="configuration" value="'.$configuration->id.'" />Name (optional): <input name="name" value="'.($configuration->name?htmlentities($configuration->name):'').'" /> <input type="submit" name="build" value="Build" /></form>');
+ echo print_success('Config finished!', '<form action="'.url('configurations').'" method="post"><input type="hidden" name="configuration" value="'.$configuration->id.'" />Name (optional): <input name="name" value="'.($configuration->name?htmlentities($configuration->name):'').'" /><br/>
+ Bundler: <select name="bundler">
+ <option value="tbz2">Tar/Bzip2</option>
+ <option value="tgz">Tar/Gzip</option>
+ <option value="installcd">Install CD with Tar/Bzip2</option>
+ <option value="livecd">LiveCD</option>
+ <option value="ext2">ext2</option>
+ <option value="jffs2">jffs2</option>
+ </select><br/>
+ <input type="submit" name="build" value="Build" /></form>');
} else {
echo '<form action="'.url('create').'" method="post"><h3>Request an image built</h3>Name of your configuration (optional): <input name="name" /><br/>';
if (count($S['conf']['modules']) > 1) {
diff --git a/shared/classes/build.php b/shared/classes/build.php
index 6ba6798..2484bf0 100644
--- a/shared/classes/build.php
+++ b/shared/classes/build.php
@@ -25,6 +25,11 @@ class sql_build extends conf_build_common {
'not_null' => true,
'default' => ''
),
+ 'bundler' => array (
+ 'type' => 'VARCHAR',
+ 'length' => 255,
+ 'not_null' => true
+ ),
'flags' => array (
'type' => 'VARCHAR',
'length' => 255,
@@ -49,12 +54,6 @@ class sql_build extends conf_build_common {
'length' => 4,
'unsigned' => true
),
- 'failed' => array (
- 'type' => 'ENUM',
- 'length' => '\'false\',\'true\'',
- 'not_null' => true,
- 'default' => 'false'
- ),
'ctime' => array (
'type' => 'INT',
'length' => 10,
@@ -77,7 +76,7 @@ class sql_build extends conf_build_common {
$format='D j M Y G:i:s T';
$perms=!$this->has_flag('p') || owner_or_admin($this->id);
$html='<div class="build"><span class="name">'.(isset($this->name) && strlen($this->name)?htmlentities($this->name):'Unnamed Build').'</span> ';
- if ($this->failed == 'true')
+ if ($this->has_flag('f'))
$html.='<span class="status failed">[failed]</span> ';
$links=array();
switch ($this->status) {
@@ -121,7 +120,7 @@ class sql_build extends conf_build_common {
$html.='<span class="status failed">[UNKNOWN STATUS: '.$this->status.']</span>';
}
if ($perms) {
- if ($this->status == 'canceled' || $this->status == 'queued' || $this->status == 'complete' || $this->failed == 'true')
+ if ($this->status == 'canceled' || $this->status == 'queued' || $this->status == 'complete' || $this->has_flag('f'))
$links['Delete']="build/$this->id/delete";
elseif ($this->status != 'cancel')
$links['Cancel']="build/$this->id/cancel";
@@ -259,7 +258,7 @@ class sql_build extends conf_build_common {
return $result;
}
private function failed() {
- $this->failed='true';
+ $this->set_flag('f');
$this->finish=time();
$this->write();
}
diff --git a/shared/classes/configuration.php b/shared/classes/configuration.php
index 4d7ac60..062bb73 100644
--- a/shared/classes/configuration.php
+++ b/shared/classes/configuration.php
@@ -37,7 +37,7 @@ class sql_configuration extends conf_build_common {
'default' => 0
)
);
- public function build($name=null) {
+ public function build($name, $bundler) {
$module=new module($this->module);
for ($i=1; $i<=$module->numsteps; $i++) {
$step=new wizard_step($this, $i);
@@ -51,6 +51,7 @@ class sql_configuration extends conf_build_common {
$build->init();
$build->name=$name;
$build->module=$this->module;
+ $build->bundler=$bundler;
$build->flags=$this->flags;
$opts=$this->get_opts();
$opts['configuration']=$this->id;
diff --git a/todo b/todo
index 4a5b770..b42c634 100644
--- a/todo
+++ b/todo
@@ -1,8 +1,8 @@
Add a profiles management page/backend utility
Add cleanup functions to the frontend and backend (tasks dir in backend containing scripts that can be launched through frontend)
-*** Move bundler selection out of gentoo module ***
- Only offer bundlers that will work - profiles without CD in map file can't make livecd, installcd, etc.
- Allow user to select if visible to the public
+*** Make bundler selection not hardcoded in wizard and manager ***
+Only offer bundlers that will work - profiles without CD in map file can't make livecd, installcd, etc.
+Allow user to select if configurations and builds are visible to the public
Allow config viewing for builds, not just configurations
Change `visibility` columns to `flags` in configurations, builds for expandability
Add build->configuration and configuration duplication