diff options
author | Eudyptula <eitan@mosenkis.net> | 2009-07-27 12:00:35 -0400 |
---|---|---|
committer | Eudyptula <eitan@mosenkis.net> | 2009-07-27 12:00:35 -0400 |
commit | 809b4020f160fb89449256b631581ddd84d3b031 (patch) | |
tree | 3854ccc540aeac39733ed4f818322b7f084704db | |
parent | Reorganized log URLs; little update to routing.csv format (diff) | |
download | ingenue-809b4020f160fb89449256b631581ddd84d3b031.tar.gz ingenue-809b4020f160fb89449256b631581ddd84d3b031.tar.bz2 ingenue-809b4020f160fb89449256b631581ddd84d3b031.zip |
Remove pointless links from tasks, builds; Log env fed to tasks; Add masked indicator back to package selection
-rw-r--r-- | frontend/classes/wizard_api.php | 6 | ||||
-rw-r--r-- | frontend/modules/gentoo/step4.php | 4 | ||||
-rw-r--r-- | shared/classes/build.php | 28 | ||||
-rw-r--r-- | shared/classes/task.php | 14 | ||||
-rw-r--r-- | todo | 9 |
5 files changed, 35 insertions, 26 deletions
diff --git a/frontend/classes/wizard_api.php b/frontend/classes/wizard_api.php index f4c672e..46814b5 100644 --- a/frontend/classes/wizard_api.php +++ b/frontend/classes/wizard_api.php @@ -413,14 +413,14 @@ class wizard_layered_checkbox_array extends wizard_checkbox_array { } private function format_label(&$array, $label='%p', $path, $name) { $arg=$array; - $label=str_replace(array('%p', '%n'), array($path, $name), $label); + $out=str_replace(array('%p', '%n'), array($path, $name), $label); if (strpos($label, '$')) { while (is_array(current($arg))) { $arg=current($arg); } - $label=eval("extract(\$arg, EXTR_PREFIX_INVALID, 'var_');\nreturn <<<_XQ1\n$label\n_XQ1;\n"); + $out=eval("extract(\$arg, EXTR_PREFIX_INVALID, 'var_');\n".(strpos($label, 'return')===0?$out:"return <<<_XQ1\n$out\n_XQ1").";\n"); } - return htmlentities($label); + return strpos($label, 'return')===0?$out:htmlentities($out); } private static function b36($n) { return base_convert($n, 10, 36); diff --git a/frontend/modules/gentoo/step4.php b/frontend/modules/gentoo/step4.php index b5b95df..3e2e73a 100644 --- a/frontend/modules/gentoo/step4.php +++ b/frontend/modules/gentoo/step4.php @@ -5,8 +5,8 @@ $meta=array( array('id' => 'plist', 'autosize'=> true), array('delim' => '', 'tag' => 'div', 'label' => '%n', 'collapsed' => true), array('delim' => '/', 'tag' => 'div', 'label' => '%p', 'collapsed' => true), - array('delim' => '-', 'tag' => 'div', 'label' => '%p: $desc', 'checkbox' => '%p', 'collapsed' => true, 'search' => true), - array('tag' => 'div', 'label' => '=%p', 'checkbox' => '=%p', 'search' => true) + array('delim' => '-', 'tag' => 'div', 'label' => 'return "%p: $desc".($masked?" <span style=\"color: red\">[MASKED]</span>":"")', 'checkbox' => '%p', 'collapsed' => true, 'search' => true), + array('tag' => 'div', 'label' => 'return "=%p".($masked?" <span style=\"color: red\">[MASKED]</span>":"")', 'checkbox' => '=%p', 'search' => true) ); $this->layered_checkbox_array('install_packages', 'p', null, $pkgs, ' ', $meta); ?> diff --git a/shared/classes/build.php b/shared/classes/build.php index b086bd4..4e11407 100644 --- a/shared/classes/build.php +++ b/shared/classes/build.php @@ -60,40 +60,44 @@ class sql_build extends conf_build_common { $html.="<span class=\"status queued\">[Queued ($num/$total)]</span>"; } elseif ($this->status == -127) { $html.='<span class="status successful">[uploading]</span>'; - if ($OoA) $links['Build log']=url("build/$this->id"); + if ($OoA) $links['Build log']="build/$this->id"; } elseif ($this->status < 0) { // TODO Build stage X $html.='<span class="status building">[building]</span>'; if ($OoA) { - //$links['Watch']=url("build/$this->id/live"); - $links['Build Log']=url("build/$this->id"); + //$links['Watch']="build/$this->id/live"; + $links['Build Log']="build/$this->id"; } } elseif ($this->status == 0) { $r=$S['pdo']->query('SELECT COUNT(*) as `count`, MAX(`time`) as `time` FROM `downloads` WHERE `build`="'.$this->id.'"')->fetch(PDO::FETCH_ASSOC); $d=($OoA && $r['count']?'<a href="'.url("build/$this->id/history").'">':'').$r['count'].' download'.($r['count'] != 1?'s':'').($r['count']?($OoA?'</a>':'').'<br/><span class="time">(last at '.date($format, $r['time']).')</span>':''); $html.='<span class="downloads">'.$d.'</span><span class="status successful">[successful]</span>'; - $links['Download image']=url("build/$this->id/download"); - if ($OoA) $links['Build log']=url("build/$this->id"); + $links['Download image']="build/$this->id/download"; + if ($OoA) $links['Build log']="build/$this->id"; } elseif ($this->status == 127) { $html.='<span class="status failed">[upload failed]</span>'; - if ($OoA) $links['Build log']=url("build/$this->id"); + if ($OoA) $links['Build log']="build/$this->id"; } elseif ($this->status == 126) { $html.='<span class="status failed">[failed]</span>'; if ($OoA) { - //$links['View output of failed command']=url("build/$this->id/failure"); - $links['Build log']=url("build/$this->id"); + //$links['View output of failed command']="build/$this->id/failure"; + $links['Build log']="build/$this->id"; } } else { $html.='<span class="status failed">[failed: got signal '.$this->status.']</span>'; - if ($OoA) $links['Build log']=url("build/$this->id"); + if ($OoA) $links['Build log']="build/$this->id"; } if ($this->status >= 0 || $this->status == -128) // Finished or queued - $links['Delete']=url("build/$this->id/delete"); + $links['Delete']="build/$this->id/delete"; if ($links) { foreach ($links as $label => $url) { - $links[$label]='<a href="'.$url.'">'.htmlentities($label).'</a>'; + if ($S['request'] == $url) + unset($links[$label]); + else + $links[$label]='<a href="'.url($url).'">'.htmlentities($label).'</a>'; } - $html.='<br/><span class="links">'.implode(' • ', $links).'</span>'; + if ($links) + $html.='<br/><span class="links">'.implode(' • ', $links).'</span>'; } if (isset($this->ctime)) { $html.='<div class="time">Submitted for build at: <span class="time">'.date($format, $this->ctime).'</span><br/>'; diff --git a/shared/classes/task.php b/shared/classes/task.php index 1112b0a..cdcd15c 100644 --- a/shared/classes/task.php +++ b/shared/classes/task.php @@ -28,6 +28,9 @@ class sql_task extends sql_row_obj { 'command' => array ( 'type' => 'TEXT' ), + 'env' => array ( + 'type' => 'TEXT' + ), 'start' => array ( 'type' => 'INT', 'length' => 10, @@ -45,7 +48,9 @@ class sql_task extends sql_row_obj { ); function display() { - $html='<div class="task"><div class="description">'.htmlentities($this->description).'</div><div class="info">[<a href="'.url("build/$this->build/$this->order").'">log</a>] '.($this->command?'<span class="command">'.htmlentities($this->command).'</span> ':''); + global $S; + $link="build/$this->build/$this->order"; + $html='<div class="task"><div class="description">'.htmlentities($this->description).'</div><div class="info">'.($S['request'] == $link || strpos($S['request'], "$link/") === 0?'':'[<a href="'.url($link).'">log</a>] ').($this->command?'<span class="command"'.($this->env?' title="'.htmlentities(str_replace("\n", '; ', $this->env)).'"':'').'>'.htmlentities($this->command).'</span> ':''); if (isset($this->start)) { if (isset($this->finish)) { $html.='<span class="status '; @@ -80,6 +85,13 @@ class sql_task extends sql_row_obj { } elseif (isset($this->start)) { throw_exception('task has already executed: start is '.$this->start); } + if (isset($env)) { + $str=array(); + foreach ($env as $name => $val) { + $str[]=$name.'='.escapeshellarg($val); + } + $this->env=implode("\n", $str); + } $this->type='exec'; debug('Executing '.$this->command.'...'); $descriptorspec=array( @@ -1,13 +1,7 @@ Write a live git ebuild -Have builds and tasks not give links to logs if we're already viewing the logs -Consider logging env. passed to tasks, path if we ever use it -Add a statistics page 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) -Separate variables we got from the URL from the rest, stop using $request, instead keep super globals and strip slashes on them -Add masked indicator back to package selector, support ~arch installation -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 builds/task +Support ~arch installation (when ~arch not in ACCEPT_KEYWORDS) Move bundler selection out of gentoo module and generalize it Allow config viewing for builds, not just configurations Add `flags` column to configurations, builds, use it to implement public and private things @@ -21,4 +15,3 @@ Add option to remove default runscripts Add option to add arbitrary runscripts Add option to upload a kernel Add option to upload an arbitrary tar.gz/bz2 to be unzipped over the finished image -*** Fix backend url() function *** |