[Midnightbsd-cvs] mports: lib/Magus: Add reset and note_event methods to Magus::Port Add
ctriv at midnightbsd.org
ctriv at midnightbsd.org
Fri Mar 14 14:43:15 EDT 2008
Log Message:
-----------
Add reset and note_event methods to Magus::Port
Add time field to Magus::Event.
Modified Files:
--------------
mports/Tools/lib/Magus:
Event.pm (r1.1 -> r1.2)
Port.pm (r1.15 -> r1.16)
-------------- next part --------------
Index: Port.pm
===================================================================
RCS file: /home/cvs/mports/Tools/lib/Magus/Port.pm,v
retrieving revision 1.15
retrieving revision 1.16
diff -L Tools/lib/Magus/Port.pm -L Tools/lib/Magus/Port.pm -u -r1.15 -r1.16
--- Tools/lib/Magus/Port.pm
+++ Tools/lib/Magus/Port.pm
@@ -48,6 +48,7 @@
__PACKAGE__->has_many(categories => [ 'Magus::PortCategory' => 'category' ]);
__PACKAGE__->has_many(events => 'Magus::Event');
+
__PACKAGE__->set_sql(ready_ports => 'SELECT __ESSENTIAL__ FROM ready_ports WHERE run=?');
@@ -193,12 +194,28 @@
$self->add_to_events({
machine => $Magus::Machine,
type => $status,
- name => $name,
msg => $msg,
phase => $phase,
});
}
+=head2 $port->reset();
+
+Returns the port to a pristine untested state.
+
+=cut
+
+sub reset {
+ my ($self) = @_;
+
+ $self->events->delete_all;
+
+ if (my $log = Magus::Log->retrive(port => $self)) {
+ $log->delete;
+ }
+
+ $self->status('untested');
+}
=head2 $port->log
@@ -214,5 +231,22 @@
my $log = Magus::Log->retrieve(port => $self) or return;
return $self->{__log} = $log->data;
}
+
+=head2 $port->note_event(type => $msg);
+
+Add an event to the port of the given type with the given message
+
+=cut
+
+sub note_event {
+ my ($self, $type, $msg) = @_;
+
+ $self->add_to_events({
+ machine => $Magus::Machine,
+ type => $type,
+ msg => $msg,
+ });
+}
+
1;
__END__
Index: Event.pm
===================================================================
RCS file: /home/cvs/mports/Tools/lib/Magus/Event.pm,v
retrieving revision 1.1
retrieving revision 1.2
diff -L Tools/lib/Magus/Event.pm -L Tools/lib/Magus/Event.pm -u -r1.1 -r1.2
--- Tools/lib/Magus/Event.pm
+++ Tools/lib/Magus/Event.pm
@@ -35,11 +35,21 @@
use base qw(Magus::DBI);
__PACKAGE__->table('events');
-__PACKAGE__->columns(All => qw/id port phase type name msg machine/);
+__PACKAGE__->columns(All => qw/id port phase type name msg machine time/);
__PACKAGE__->has_a(port => 'Magus::Port');
__PACKAGE__->has_a(machine => 'Magus::Machine');
+=head2 types
+
+ fail
+ warn
+ info
+ internal
+ skip
+
+=cut
+
1;
More information about the Midnightbsd-cvs
mailing list