[Midnightbsd-cvs] mports: Tools/lib: Update to the devel version of the next milestone.

ctriv at midnightbsd.org ctriv at midnightbsd.org
Fri Nov 16 00:29:40 EST 2007


Log Message:
-----------
Update to the devel version of the next milestone.  The ports table is now
the cross product of the archs and the ports.  This makes the rest of the
schema much more natural. 

There is now a ready_ports view in the database.

A snap table has been added.  This will be used to keep nodes on the right 
version of the mports tree.

Modified Files:
--------------
    mports/Tools/lib:
        Magus.pm (r1.2 -> r1.3)
    mports/Tools/lib/Magus:
        Index.pm (r1.6 -> r1.7)
        Lock.pm (r1.2 -> r1.3)
        Log.pm (r1.2 -> r1.3)
        OutcomeRules.pm (r1.3 -> r1.4)
        Port.pm (r1.9 -> r1.10)
        Result.pm (r1.4 -> r1.5)
        SubResult.pm (r1.6 -> r1.7)

Added Files:
-----------
    mports/Tools/lib/Magus:
        Snap.pm (r1.1)

Removed Files:
-------------
    mports/Tools/lib/Magus:
        Cluster.pm
        Task.pm
    mports/Tools/lib/Magus/Task:
        UpdateMports.pm
        Wait.pm

-------------- next part --------------
Index: Magus.pm
===================================================================
RCS file: /home/cvs/mports/Tools/lib/Magus.pm,v
retrieving revision 1.2
retrieving revision 1.3
diff -L Tools/lib/Magus.pm -L Tools/lib/Magus.pm -u -r1.2 -r1.3
--- Tools/lib/Magus.pm
+++ Tools/lib/Magus.pm
@@ -4,7 +4,8 @@
 use warnings;
 
 BEGIN {
-  our $Root = '/usr/magus';
+  our $Root  = '/usr/magus';
+  our @Archs = qw(i386 amd64);
 }
 
 
@@ -28,7 +29,7 @@
 BEGIN {
   $Machine = Magus::Machine->retrieve(
     name => $Magus::Config{'Machine'}
-  );
+  ) || die "Invalid machine: $Magus::Config{Machine}\n";
 }
 
 
--- Tools/lib/Magus/Task.pm
+++ /dev/null
@@ -1,83 +0,0 @@
-package Magus::Task;
-#
-# Copyright (c) 2007 Chris Reinhardt. All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are
-# met:
-#
-# 1. Redistributions of source code must retain the above copyright notice
-#    this list of conditions and the following disclaimer.
-#
-# 2. Redistributions in binary form must reproduce the above copyright
-#    notice, this list of conditions and the following disclaimer in the
-#    documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
-# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
-# AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-# $MidnightBSD: mports/Tools/lib/Magus/Task.pm,v 1.2 2007/10/29 17:07:45 ctriv Exp $
-# 
-# MAINTAINER=   ctriv at MidnightBSD.org
-#
-
-
-
-use base qw(Magus::DBI);
-use strict;
-use warnings;
-
-use Magus::Task::Wait         ();
-use Magus::Task::UpdateMports ();
-
-
-__PACKAGE__->table('tasks');
-__PACKAGE__->columns(All => qw/id type machine started completed/);
-
-__PACKAGE__->has_a(machine => 'Magus::Machine');
-
-sub construct {
-  my ($class, @args) = @_;
-  
-  my $self = $class->SUPER::construct(@args);
-  
-  my $subclass = join('::', ref $self, $self->type);
-  
-  bless $self, $subclass;
-  
-  return $self;
-}
-
-__PACKAGE__->mk_classdata('callbacks');
-
-sub set_callbacks {
-  my ($class, %cbs) = @_;
-  
-  $class->callbacks(\%cbs);
-}
-
-sub is_complete {
-  my ($self) = @_;
-  
-  my $dbh   = $self->db_Main();
-  my $table = $self->table;
-  my $id    = $self->id;
-  
-  my ($complete) = $dbh->selectrow_array("SELECT completed FROM $table WHERE id=?", undef, $id);
-  return $complete;
-}
-
-
-
-
-1;
-__END__
-
Index: SubResult.pm
===================================================================
RCS file: /home/cvs/mports/Tools/lib/Magus/SubResult.pm,v
retrieving revision 1.6
retrieving revision 1.7
diff -L Tools/lib/Magus/SubResult.pm -L Tools/lib/Magus/SubResult.pm -u -r1.6 -r1.7
--- Tools/lib/Magus/SubResult.pm
+++ Tools/lib/Magus/SubResult.pm
@@ -35,7 +35,8 @@
 use base qw(Magus::DBI);
 
 __PACKAGE__->table('subresults');
-__PACKAGE__->columns(Primary => qw/result phase type name msg/);
+__PACKAGE__->columns(All => qw/id result phase type name msg/);
+__PACKAGE__->has_a(result => 'Magus::Result');
 
 
 
Index: Log.pm
===================================================================
RCS file: /home/cvs/mports/Tools/lib/Magus/Log.pm,v
retrieving revision 1.2
retrieving revision 1.3
diff -L Tools/lib/Magus/Log.pm -L Tools/lib/Magus/Log.pm -u -r1.2 -r1.3
--- Tools/lib/Magus/Log.pm
+++ Tools/lib/Magus/Log.pm
@@ -36,7 +36,6 @@
 
 __PACKAGE__->table('logs');
 __PACKAGE__->columns(Essential => qw/result phase data/);
-__PACKAGE__->has_a(result => 'Magus::Result');
 
 
 1;
Index: Port.pm
===================================================================
RCS file: /home/cvs/mports/Tools/lib/Magus/Port.pm,v
retrieving revision 1.9
retrieving revision 1.10
diff -L Tools/lib/Magus/Port.pm -L Tools/lib/Magus/Port.pm -u -r1.9 -r1.10
--- Tools/lib/Magus/Port.pm
+++ Tools/lib/Magus/Port.pm
@@ -37,32 +37,16 @@
 use base 'Magus::DBI';
 
 __PACKAGE__->table('ports');
-__PACKAGE__->columns(Essential => qw(name version license pkgname));
+
+__PACKAGE__->columns(Essential => qw(id name arch version license pkgname));
 __PACKAGE__->columns(All       => qw(description));
+__PACKAGE__->columns(Stringify => qw(name));
+
 __PACKAGE__->has_many(depends => [ 'Magus::Depend' => 'dependency' ] => 'port');
 __PACKAGE__->has_many(results => 'Magus::Result');
 __PACKAGE__->has_many(categories => [ 'Magus::PortCategory' => 'category' ]);
 
-__PACKAGE__->set_sql(ready_ports => <<END_OF_SQL);
-SELECT ports.* FROM ports 
-WHERE 
-    (name NOT IN (SELECT port FROM locks WHERE arch=?)) 
-  AND 
-    (name NOT IN (SELECT port FROM results WHERE arch=? AND version=ports.version)) 
-  AND 
-    (
-      (name NOT IN (SELECT port FROM depends)) 
-      OR 
-      (name NOT IN (
-        SELECT port FROM depends 
-        WHERE 
-          (dependency NOT IN (SELECT port FROM results JOIN ports ON ports.name=results.port AND ports.version=results.version WHERE arch=? AND (summary="pass" OR summary="warn")))
-          OR
-          (dependency IN (SELECT port FROM locks WHERE arch=?))
-        )
-      )
-    )
-END_OF_SQL
+__PACKAGE__->set_sql(ready_ports => 'SELECT __ESSENTIAL__ FROM ready_ports WHERE arch=?');
 
 =head2 Magus::Port->get_ready_port;
 
@@ -90,7 +74,7 @@
 sub get_ready_port {
   my $arch = $Magus::Machine->arch;
   
-  return shift->search_ready_ports(($Magus::Machine->arch) x 4)->next;
+  return shift->search_ready_ports($arch)->next;
 }
   
 
@@ -115,7 +99,7 @@
 
 sub current_result {
   my ($self) = @_;
-  return $self->results(arch => $Magus::Machine->arch, version => $self->version)->next;
+  return $self->results(version => $self->version)->next;
 }
 
 =head2 $port->all_depends
@@ -212,9 +196,10 @@
     $result->delete;
   }
   
+  my $version = $self->version || '???';
+  
   $result = $self->add_to_results({
-    version => $self->version || '???',
-    arch    => $Magus::Machine->arch,
+    version => $version,
     machine => $Magus::Machine,
     summary => $summary,
   });
--- Tools/lib/Magus/Cluster.pm
+++ /dev/null
@@ -1,86 +0,0 @@
-package Magus::Cluster;
-#
-# Copyright (c) 2007 Chris Reinhardt. All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are
-# met:
-#
-# 1. Redistributions of source code must retain the above copyright notice
-#    this list of conditions and the following disclaimer.
-#
-# 2. Redistributions in binary form must reproduce the above copyright
-#    notice, this list of conditions and the following disclaimer in the
-#    documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
-# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
-# AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-# $MidnightBSD: mports/Tools/lib/Magus/Cluster.pm,v 1.3 2007/11/05 18:56:46 ctriv Exp $
-# 
-# MAINTAINER=   ctriv at MidnightBSD.org
-#
-
-
-
-use strict;
-use warnings;
-
-
-sub halt {
-  _send_tasks('Wait');
-}
-
-sub resume {
-  foreach my $task (Magus::Task->search(type => 'Wait', started => 1)) {
-    $task->completed(1);
-    $task->update;
-  }
-}
-
-
-sub run_task {
-  my ($type) = @_;
-  
-  _send_tasks($type);
-  
-  my $running_count = 1;
-  
-  while ($running_count > 0) {
-    $running_count = Magus::Task->search(type => $type, completed => 0)->count;  
-    sleep(5);
-  }
-}
-  
-   
-sub _send_tasks {
-  my ($type) = @_;
-
-  my $count = 0;  
-  foreach my $machine (Magus::Machine->retrieve_all) {
-    next if $machine->id == $Magus::Machine->id;
-  
-    Magus::Task->insert({
-      machine => $machine,
-      type    => $type
-    });
-    
-    $count++;
-  }
-  
-  while (Magus::Task->search(type => $type, started => 1)->count != $count) {
-    sleep(1);
-  }
-}
-
-1;
-__END__
-
Index: OutcomeRules.pm
===================================================================
RCS file: /home/cvs/mports/Tools/lib/Magus/OutcomeRules.pm,v
retrieving revision 1.3
retrieving revision 1.4
diff -L Tools/lib/Magus/OutcomeRules.pm -L Tools/lib/Magus/OutcomeRules.pm -u -r1.3 -r1.4
--- Tools/lib/Magus/OutcomeRules.pm
+++ Tools/lib/Magus/OutcomeRules.pm
@@ -101,7 +101,7 @@
 use base qw(Magus::OutcomeRules::Base);
 
 sub IncompleteInstall :error {
-  m/^\t.* not installed.\n$/m 
+  m/^\s+.* not installed.\n$/m
     && return "A file in the plist wasn't installed in the fake dir or the final dir.";
 }
 
@@ -111,7 +111,7 @@
 }
 
 sub FakedOutsideDestdir :error {
-  m:^\t.* installed in /:m
+  m:^\s+.* installed in /:m
     && return "A file was installed in the final dir instead of the fake dir.";
 }
 
--- /dev/null
+++ Tools/lib/Magus/Snap.pm
@@ -0,0 +1,59 @@
+package Magus::Snap;
+#
+# Copyright (c) 2007 Chris Reinhardt. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+# 1. Redistributions of source code must retain the above copyright notice
+#    this list of conditions and the following disclaimer.
+#
+# 2. Redistributions in binary form must reproduce the above copyright
+#    notice, this list of conditions and the following disclaimer in the
+#    documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+# AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# $MidnightBSD: mports/Tools/lib/Magus/Snap.pm,v 1.1 2007/11/16 05:29:37 ctriv Exp $
+# 
+# MAINTAINER=   ctriv at MidnightBSD.org
+#
+
+use strict;
+use warnings;
+use base qw(Magus::DBI);
+
+
+__PACKAGE__->table('snaps');
+__PACKAGE__->columns(Essential => qw/id created/);
+
+__PACKAGE__->set_sql(latest_snaps => 'SELECT __ESSENTIAL__ FROM __TABLE__ ORDER BY id DESC');
+
+
+sub latest {
+  my ($class) = @_;
+  
+  return $class->search_latest_snaps->next;
+}  
+
+sub tarball {
+  my ($self) = @_;
+  my $id = $self->id;
+  
+  return "$Magus::Config{MasterDataDir}/$Magus::Config{MportsSnapDir}/$id.tar.bz2"
+}
+
+
+1;
+__END__
+
Index: Index.pm
===================================================================
RCS file: /home/cvs/mports/Tools/lib/Magus/Index.pm,v
retrieving revision 1.6
retrieving revision 1.7
diff -L Tools/lib/Magus/Index.pm -L Tools/lib/Magus/Index.pm -u -r1.6 -r1.7
--- Tools/lib/Magus/Index.pm
+++ Tools/lib/Magus/Index.pm
@@ -37,55 +37,61 @@
 use YAML qw(Load);
  
 sub sync {
-  my ($class) = @_;
+  my ($class, $root) = @_;
   my %visited;
-  my $root = "$Magus::Config{MasterDataDir}/$Magus::Config{MportsCvsDir}";
+  
+  $root ||= "$Magus::Config{MasterDataDir}/$Magus::Config{MportsCvsDir}";
+  
   local $| = 1;
-
+  
+  my %depends;
   
   recurse_ports {
-    print @_, "...";
-    
-    my $yaml = `PORTSDIR=$root BATCH=1 PACKAGE_BUILDING=1 MAGUS=1 make describe-yaml`;
-    my %dump;
+    print @_, "... ";
     
-    eval {
-      %dump = %{ Load($yaml) };
-    };
+    foreach my $arch (@Magus::Archs) {          
+      my $yaml = `ARCH=$arch PORTSDIR=$root BATCH=1 PACKAGE_BUILDING=1 MAGUS=1 make describe-yaml`;
+      my %dump;
+      
+      eval {
+        %dump = %{ Load($yaml) };
+      };
+      
+      if ($@) {
+        warn "Unable to parse yaml for $_[0]: $@\n";
+        return;
+      }
+      
+      my $port = Magus::Port->find_or_create({ name => $dump{name}, arch => $arch });
+      
+      $port->version($dump{version});
+      $port->description($dump{description});
+      $port->pkgname($dump{pkgname});
+      $port->license($dump{license});
+      $port->update;
+      
+        # We only have one depend type, merge into a unique list
+      my %portdepends;
+      while (my ($type, $deps) = each %{$dump{'depends'}}) {
+        foreach my $dep (@$deps) {
+          $portdepends{$dep}++;
+        }
+      }
+      
+      $depends{$port->id} = [keys %portdepends];
+      
+      $class->sync_categories(\%dump, $port, $arch);
+      
+      if ($dump{is_interactive} && !$port->current_result) {
+        print "\n\tIGNORE set.  Marking as skippped.";
+        $port->set_result_skip(index => IsInteractive => "Port is marked as interactive.");
+      }
     
-    if ($@) {
-      warn "Unable to parse yaml for $_[0]: $@\n";
-      return;
+      print "$arch ";
+      $visited{$port->id}++;
     }
-    
-    my $port = Magus::Port->find_or_create({ name => $dump{name} });
-    
-    $port->version($dump{version});
-    $port->description($dump{description});
-    $port->pkgname($dump{pkgname});
-    $port->license($dump{license});
-    $port->update;
-    
-    $class->sync_depends(\%dump, $port);
-    $class->sync_categories(\%dump, $port);
-    
-    if ($dump{is_interactive} && !$port->current_result) {
-      print "\n\tIGNORE set.  Marking as skippped.\n";
-      $port->set_result_skip(index => IsInteractive => "Port is marked as interactive.");
-    }
-  
-    print " done\n";
-    $visited{$port->name}++;
-  } root    => $root,
-    nochdir => sub { 
-      (my $name = $_[0]) =~ s:.*/(.*?/.*?)$:$1:;
-      my $port = Magus::Port->find_or_create({name => $name});
-
-      $port->set_result_fail(index => BadDirMakefile => "$port does not exist but is in the directory makefile.");
-
-      $visited{$name}++;
-      print "\n\tUnable to chdir to  $_[0].  Marking as failure.\n";
-    };      
+    print "done.\n";
+  } root    => $root;
 
   my $ports = Magus::Port->retrieve_all;
   
@@ -93,17 +99,44 @@
   # from the database.
   print "Checking for deleted ports...";
   while (my $port = $ports->next) {
-    if (!$visited{$port->name}) {
-      print "\n\t$port";
+    if (!$visited{$port->id}) {
+      print "\n\t$port (" . $port->arch . ")";
       $port->delete;
     }
   }
   print "done\n";
+  
+  #
+  # finally we build the depends table.
+  #
+  Magus::Depend->db_Main->do('DELETE FROM depends');
+  
+  print "Rebuilding depends list... \n";
+  
+  PORT: while (my ($id, $depends) = each %depends) {
+    my $port = Magus::Port->retrieve($id) || die "Got an invalid port in the depends list! ($id)";
+    
+    for (@$depends) {
+      my $depend = Magus::Port->retrieve(name => $_, arch => $port->arch);
+      
+      if (!$depend) {
+        print "\tMissing depend for $port: $depend\n";
+        $port->set_result_fail(index => 'NonExistantDepend' => qq(depend "$_" does not exist.));
+        next PORT;
+      }
+      
+      $port->add_to_depends({ 
+        dependency => $depend
+      });    
+    }    
+  }
+  
+  print "done.";
 }
 
 
 sub sync_categories {
-    my ($class, $dump, $port) = @_;
+    my ($class, $dump, $port, $arch) = @_;
     
     Magus::PortCategory->search(port => $port)->delete_all;
     
@@ -113,23 +146,6 @@
     }
 }
   
-sub sync_depends {
-  my ($class, $dump, $port) = @_;
-  
-  # We only have one depend type, merge into a unique list
-  my %depends;
-  while (my ($type, $deps) = each %{$dump->{'depends'}}) {
-    foreach my $dep (@$deps) {
-      $depends{$dep}++;
-    }
-  }
-  
-  Magus::Depend->search(port => $port)->delete_all;
-  
-  foreach my $dep (keys %depends) {
-    $port->add_to_depends({ dependency => $dep });
-  }
-}  
        
 
    
Index: Lock.pm
===================================================================
RCS file: /home/cvs/mports/Tools/lib/Magus/Lock.pm,v
retrieving revision 1.2
retrieving revision 1.3
diff -L Tools/lib/Magus/Lock.pm -L Tools/lib/Magus/Lock.pm -u -r1.2 -r1.3
--- Tools/lib/Magus/Lock.pm
+++ Tools/lib/Magus/Lock.pm
@@ -36,7 +36,7 @@
 use warnings;
 
 __PACKAGE__->table('locks');
-__PACKAGE__->columns(Essential => qw(id port arch machine));
+__PACKAGE__->columns(Essential => qw(id port machine));
 
 __PACKAGE__->has_a(machine => "Magus::Machine");
 __PACKAGE__->has_a(port    => "Magus::Port");
@@ -61,7 +61,6 @@
     $lock = $class->insert({
       port    => $port,
       machine => $Magus::Machine,
-      arch    => $Magus::Machine->arch
     });
   };
   
@@ -95,6 +94,16 @@
   return $lock;
 }
 
+#
+# depreacted method
+#
+use Carp qw(cluck);
+sub arch {
+  my ($self) = @_;
+  cluck("Use of deprecated method: " . ref $self . "->arch. Use ->machine->arch instead.");
+  return $self->machine->arch;
+}
+
 1;
 __END__
 
Index: Result.pm
===================================================================
RCS file: /home/cvs/mports/Tools/lib/Magus/Result.pm,v
retrieving revision 1.4
retrieving revision 1.5
diff -L Tools/lib/Magus/Result.pm -L Tools/lib/Magus/Result.pm -u -r1.4 -r1.5
--- Tools/lib/Magus/Result.pm
+++ Tools/lib/Magus/Result.pm
@@ -37,14 +37,24 @@
 
 
 __PACKAGE__->table('results');
-__PACKAGE__->columns(All => qw/id port version summary machine arch/);
+__PACKAGE__->columns(All => qw/id port version summary machine/);
 
 __PACKAGE__->has_a(port => 'Magus::Port');
 __PACKAGE__->has_a(machine => 'Magus::Machine');
-__PACKAGE__->has_many(subresults => 'Magus::SubResult' => 'result');
-__PACKAGE__->has_many(logs       => 'Magus::Log');
+__PACKAGE__->has_many(subresults => 'Magus::SubResult');
+__PACKAGE__->might_have(log       => 'Magus::Log' => 'data');
 
 
+#
+# depreacted method
+#
+use Carp qw(cluck);
+sub arch {
+  my ($self) = @_;
+  cluck("Use of deprecated method: " . ref $self . "->arch. Use ->machine->arch instead.");
+  return $self->machine->arch;
+}
+
 1;
 __END__
 
--- Tools/lib/Magus/Task/UpdateMports.pm
+++ /dev/null
@@ -1,72 +0,0 @@
-package Magus::Task::UpdateMports;
-#
-# Copyright (c) 2007 Chris Reinhardt. All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are
-# met:
-#
-# 1. Redistributions of source code must retain the above copyright notice
-#    this list of conditions and the following disclaimer.
-#
-# 2. Redistributions in binary form must reproduce the above copyright
-#    notice, this list of conditions and the following disclaimer in the
-#    documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
-# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
-# AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-# $MidnightBSD: mports/Tools/lib/Magus/Task/UpdateMports.pm,v 1.3 2007/11/02 18:43:43 ctriv Exp $
-# 
-# MAINTAINER=   ctriv at MidnightBSD.org
-#
-
-
-
-use base qw(Magus::Task);
-use strict;
-use warnings;
-
-use File::Path qw(rmtree);
-
-=head1 Magus::Task::UpdateMports
-
-This task updates /usr/mports, using C<MasterMportsTarBall>.
-
-=cut
-
-
-
-sub exec {  
-  my ($self) = @_;
-
-  $self->started(1); $self->update;
-  
-  $self->callbacks->{'log'}->('Updating mports tree');
-  
-  chdir("/usr") || die "Couldn't CD to user: $!";
-  
-  my $scp = "/usr/bin/scp $Magus::Config{MasterMportsTarBall} $Magus::Config{MportsTarBall}";
-  system($scp) == 0 || die "$scp returned non-zero: $?";  
-
-  rmtree("mports") || die "Couldn't delete /usr/mports: $!";
-  
-  my $tar = "/usr/bin/tar xf $Magus::Config{MportsTarBall}";
-  system($tar) == 0 || die "$tar returned non-zero: $?";
-  
-  $self->callbacks->{'log'}->("Restarting process.");
-  $self->callbacks->{'restart'}->();
-}
-
-
-1;
-__END__
-
--- Tools/lib/Magus/Task/Wait.pm
+++ /dev/null
@@ -1,79 +0,0 @@
-package Magus::Task::Wait;
-#
-# Copyright (c) 2007 Chris Reinhardt. All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are
-# met:
-#
-# 1. Redistributions of source code must retain the above copyright notice
-#    this list of conditions and the following disclaimer.
-#
-# 2. Redistributions in binary form must reproduce the above copyright
-#    notice, this list of conditions and the following disclaimer in the
-#    documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
-# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
-# AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-# $MidnightBSD: mports/Tools/lib/Magus/Task/Wait.pm,v 1.2 2007/10/29 17:07:45 ctriv Exp $
-# 
-# MAINTAINER=   ctriv at MidnightBSD.org
-#
-
-
-
-use base qw(Magus::Task);
-use strict;
-use warnings;
-
-
-=head1 Magus::Task::Wait
-
-This task is a special case. All other tasks are started, and once the node
-is done, the node marks the task as complete.  The wait task is started, and
-the node will sleep until the I<master> marks the task as complete.  This
-way the master can halt the cluster as needed.
-
-=cut
-
-
-sub exec {
-  my ($self) = @_;
-  
-  $self->started(1); $self->update;
-
-  $self->callbacks->{'log'}->("Halted");
-  
-  while (1) {
-    sleep(1);
-    
-    #
-    # Run other tasks
-    #
-    if (my @torun = Magus::Task->retrieve_from_sql('machine=? AND id!=? AND started=0 AND completed=0', $Magus::Machine, $self->id)) {
-      $_->exec for @torun;
-    }
-    
-    if ($self->is_complete) {
-      last;
-    }
-  }
-  
-  $self->delete;
-}
-
-
-
-
-1;
-__END__
-


More information about the Midnightbsd-cvs mailing list