Annotation of FreeBSD/tinderbox/webui/module/modulePorts.php, revision 1.1.1.1.2.1
1.1 as 1: <?php
2: #-
3: # Copyright (c) 2005 Oliver Lehmann <oliver@FreeBSD.org>
4: # All rights reserved.
5: #
6: # Redistribution and use in source and binary forms, with or without
7: # modification, are permitted provided that the following conditions
8: # are met:
9: # 1. Redistributions of source code must retain the above copyright
10: # notice, this list of conditions and the following disclaimer
11: # 2. Redistributions in binary form must reproduce the above copyright
12: # notice, this list of conditions and the following disclaimer in the
13: # documentation and/or other materials provided with the distribution.
14: #
15: # THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16: # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17: # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18: # ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19: # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20: # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21: # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22: # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23: # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24: # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25: # SUCH DAMAGE.
26: #
1.1.1.1.2.1! as 27: # $Paefchen$
1.1 as 28: # $MCom: portstools/tinderbox/webui/module/modulePorts.php,v 1.11 2007/06/09 22:09:12 marcus Exp $
29: #
30:
31: class modulePorts extends module {
32:
1.1.1.1.2.1! as 33: public function display_describe_port( $port_id ) {
1.1 as 34:
35: $ports = $this->TinderboxDS->getAllPortsByPortID( $port_id );
36:
37: if( is_array( $ports ) && count( $ports ) > 0 ) {
38: $this->template_assign( 'data', $this->get_list_data( '', $ports ) );
39: $this->template_assign( 'no_list', false );
40: } else {
41: $this->template_assign( 'no_list', true );
42: }
43:
44: foreach( $ports as $port ) {
45: $build = $this->TinderboxDS->getBuildById( $port->getBuildId() );
46: $ports_tree = $this->TinderboxDS->getPortsTreeForBuild( $build );
47: if( empty( $ports_tree_ids[$ports_tree->getId()] ) ) {
48: $ports_tree_ids[$ports_tree->getId()] = 1;
49:
50: list( $cvsweb, $cvsweb_querystr ) = explode( '?', $ports_tree->getCVSwebURL(), 2 );
51:
52: if ( $cvsweb_querystr ) {
53: $cvsweb = rtrim( $cvsweb, '/' );
54: $cvsweb_querystr = '?' . $cvsweb_querystr;
55: }
56:
57: $ports_trees_links[] = array( 'name' => $ports_tree->getName(), 'cvsweb' => $cvsweb, 'cvsweb_querystr' => $cvsweb_querystr );
58: }
59: }
60:
61: $this->template_assign( 'port_comment', $ports[0]->getComment() );
62: $this->template_assign( 'port_dir', $ports[0]->getDirectory() );
63: $this->template_assign( 'port_maintainer', $ports[0]->getMaintainer() );
64: $this->template_assign( 'port_name', $ports[0]->getName() );
65: $this->template_assign( 'ports_trees_links', $ports_trees_links );
66: $this->template_assign( 'local_time', prettyDatetime( date( 'Y-m-d H:i:s' ) ) );
67:
68: return $this->template_parse( 'describe_port.tpl' );
69: }
70:
1.1.1.1.2.1! as 71: public function get_list_data( $build_name, $ports ) {
1.1 as 72: global $loguri;
73: global $errorloguri;
74: global $pkguri;
75:
76: if( empty( $build_name ) ) {
77: $different_builds = true;
78: } else {
79: $different_builds = false;
80: $build = $this->TinderboxDS->getBuildByName( $build_name );
81: $package_suffix = $this->TinderboxDS->getPackageSuffix( $build->getJailId() );
82: }
83:
84:
85: foreach( $ports as $port ) {
86: if( $different_builds == true ) {
87: $build = $this->TinderboxDS->getBuildById( $port->getBuildId() );
88: $package_suffix = $this->TinderboxDS->getPackageSuffix( $build->getJailId() );
89: $build_name = $build->getName();
90: }
91:
92: $port_id = $port->getId();
93: $port_last_built_version = $port->getLastBuiltVersion();
94: $port_logfilename = $port->getLogfileName();
95: $port_link_logfile = $loguri . '/' . $build_name . '/' . $port_logfilename;
96: $port_link_package = $pkguri . '/' . $build_name . '/All/' . $port_last_built_version . $package_suffix;
97: $port_last_run_duration = $port->getLastRunDuration();
98: $port_last_fail_reason = $port->getLastFailReason();
99:
100: switch( $port->getLastStatus() ) {
101: case 'SUCCESS':
102: $status_field_class = 'port_success';
103: $status_field_letter = ' ';
104: break;
105: case 'LEFTOVERS':
106: $status_field_class = 'port_leftovers';
107: $status_field_letter = 'L';
108: break;
109: case 'BROKEN':
110: $status_field_class = 'port_broken';
111: $status_field_letter = 'B';
112: $port_link_package = '';
113: break;
114: case 'FAIL':
115: $status_field_class = 'port_fail';
116: $status_field_letter = ' ';
117: $port_link_logfile = $errorloguri . '/' . $build_name . '/' . $port_logfilename;
118: $port_link_package = '';
119: break;
120: case 'DEPEND':
121: $status_field_class = 'port_depend';
122: $status_field_letter = ' ';
123: $port_link_logfile = '';
124: $port_link_package = '';
125: $port_last_fail_reason = $port->getLastFailedDep();
126: break;
127: case 'DUD':
128: $status_field_class = 'port_dud';
129: $status_field_letter = 'D';
130: $port_link_logfile = '';
131: $port_link_package = '';
132: break;
133: default:
134: $status_field_class = 'port_default';
135: $status_field_letter = ' ';
136: $port_link_logfile = '';
137: $port_link_package = '';
138: break;
139: }
140:
141: $data[] = array( 'build_name' => $build_name,
142: 'port_directory' => $port->getDirectory(),
143: 'port_maintainer' => prettyEmail( $port->getMaintainer() ).' ',
144: 'port_id' => $port_id,
145: 'port_last_built_version' => $port_last_built_version,
146: 'port_last_built' => prettyDatetime( $port->getLastBuilt() ),
147: 'port_last_successful_built' => prettyDatetime( $port->getLastSuccessfulBuilt() ),
148: 'port_last_fail_reason' => htmlentities( $port_last_fail_reason ),
149: 'port_last_run_duration' => $port_last_run_duration,
150: 'port_link_logfile' => $port_link_logfile,
151: 'port_link_package' => $port_link_package,
152: 'status_field_class' => $status_field_class,
153: 'status_field_letter' => $status_field_letter );
154: }
155: return $data;
156: }
157: }
1.1.1.1.2.1! as 158:
1.1 as 159: ?>