summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEudyptula <eitan@mosenkis.net>2009-07-06 21:30:44 -0400
committerEudyptula <eitan@mosenkis.net>2009-07-06 21:30:44 -0400
commit9d6006fed8317ffd3b08eaf5e10236e0f0039763 (patch)
tree0e1eed39dc6350e324410a6531489f4793d20040
parentStored all data from Packages files in the db to allow frontend/backend separ... (diff)
downloadingenue-9d6006fed8317ffd3b08eaf5e10236e0f0039763.tar.gz
ingenue-9d6006fed8317ffd3b08eaf5e10236e0f0039763.tar.bz2
ingenue-9d6006fed8317ffd3b08eaf5e10236e0f0039763.zip
Last changes for multiple backends to be (theoretically) possible
-rwxr-xr-xbackend/backend.php9
-rw-r--r--shared/config.php2
-rw-r--r--todo1
3 files changed, 10 insertions, 2 deletions
diff --git a/backend/backend.php b/backend/backend.php
index 2ee7357..78852e4 100755
--- a/backend/backend.php
+++ b/backend/backend.php
@@ -49,15 +49,22 @@ declare(ticks=1);
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)
+ $S['pdo']->query('LOCK TABLES `builds` WRITE');
$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));
$build->start=time();
$build->status='build/running';
$build->write();
+ $S['pdo']->query('UNLOCK TABLES');
log_msg('Starting build id='.$build->id);
$file=null;
try {
+ if ($conf['split_setup']) {
+ $opt=new sql_buildopt($build->id, 'backend', $conf['backend_id']);
+ $opt->write();
+ unset($opt);
+ }
$opts=$build->get_buildopts();
$module=$opts['backend_module'];
$build_proc=$module.'_build';
@@ -116,6 +123,8 @@ while (true) {
}
$build->write();
unset($build);
+ } else {
+ $S['pdo']->query('UNLOCK TABLES');
}
// log_msg('Sleeping...', false);
sleep(5);
diff --git a/shared/config.php b/shared/config.php
index ecf22fc..d48d17e 100644
--- a/shared/config.php
+++ b/shared/config.php
@@ -20,5 +20,5 @@ $conf['portdir']='/usr/portage'; // The directory conatining the portage tree to
$conf['logview_max']=1000; // The maximum number of log entries shown on one page (1000 is a good start)
$conf['split_setup']=true; // Whether the frontend and backend are running on different hosts
$conf['frontend_location']='http://soc'; // The base address of the frontend installation (for use by the backend)
-$conf['backend_name']='red'; // A name or other way of identifying this backend as opposed to other backends working for the same frontend TODO use gethostname() by default in 5.3.0
+$conf['backend_id']='red'; // A name or other way of identifying this backend as opposed to other backends working for the same frontend TODO use gethostname() by default in 5.3.0
?>
diff --git a/todo b/todo
index eb18365..ae4490c 100644
--- a/todo
+++ b/todo
@@ -21,7 +21,6 @@ Completely plan out how frontend modules should function - each step needs to re
See if I can figure any way to use classes instead of funny named functions (namespaces in 5.3.0 perhaps) - also needs to have a depend of some sort so we can make a quick-config page that doesn't show things that we don't have enough info for yet (use AJAX to show them when we're ready)
Allow backend to define bail-out functions to call when it dies (things like unmounting the ISO it was copying)
Add STDERR (maybe STDOUT) only option to log viewer
-Make multiple backends possible - avoid race condition when choosing a task; track which backend is doing which build
Simplify status to numeric on builds, configurations - varchar isn't necessary
Add config option to enable/disable user self-registration/invitations/admin-only invites
Fix the bug where refreshing a wizard page and resending data causes it to continue to the next step