[Midnightbsd-cvs] mports: lib/Magus: We now use the mports tree specified in the config

ctriv at midnightbsd.org ctriv at midnightbsd.org
Mon Nov 5 11:54:49 EST 2007


Log Message:
-----------
We now use the mports tree specified in the config file as the master root.
Delete entries from the database when they are no longer in the dir
makefiles.
Mark ports as failed if they don't exist but are in the dir makefile.
Be a bit verbose about what is going on.

Modified Files:
--------------
    mports/Tools/lib/Magus:
        Index.pm (r1.4 -> r1.5)
        Port.pm (r1.7 -> r1.8)

-------------- next part --------------
Index: Port.pm
===================================================================
RCS file: /home/cvs/mports/Tools/lib/Magus/Port.pm,v
retrieving revision 1.7
retrieving revision 1.8
diff -LTools/lib/Magus/Port.pm -LTools/lib/Magus/Port.pm -u -r1.7 -r1.8
--- Tools/lib/Magus/Port.pm
+++ Tools/lib/Magus/Port.pm
@@ -213,7 +213,7 @@
   }
   
   $result = $self->add_to_results({
-    version => $self->version,
+    version => $self->version || '???',
     arch    => $Magus::Machine->arch,
     machine => $Magus::Machine,
     summary => $summary,
Index: Index.pm
===================================================================
RCS file: /home/cvs/mports/Tools/lib/Magus/Index.pm,v
retrieving revision 1.4
retrieving revision 1.5
diff -LTools/lib/Magus/Index.pm -LTools/lib/Magus/Index.pm -u -r1.4 -r1.5
--- Tools/lib/Magus/Index.pm
+++ Tools/lib/Magus/Index.pm
@@ -34,13 +34,17 @@
 
 use Mport::Utils qw(make_var recurse_ports);
   
-use Fatal qw(chdir);
 use YAML qw(Load);
  
 sub sync {
   my ($class) = @_;
+  my %visited;
+  
+  local $| = 1;
   
   recurse_ports {
+    print @_, "...";
+    
     my $yaml = `BATCH=1 PACKAGE_BUILDING=1 MAGUS=1 make describe-yaml`;
     my %dump;
     
@@ -64,18 +68,36 @@
     $class->sync_depends(\%dump, $port);
     $class->sync_categories(\%dump, $port);
     
-    if ($dump{is_interactive}) {
+    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    => "$Magus::Config{MasterDataDir}/$Magus::Config{MportsCvsDir}",
+    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";
+    };      
+
   my $ports = Magus::Port->retrieve_all;
   
+  # if the port is in the database, but not in the tree, then we need to delete it
+  # from the database.
+  print "Checking for deleted ports...";
   while (my $port = $ports->next) {
-    unless (-d $port->origin) {
-      $port->set_result_fail(index => BadDirMakefile => "$port does not exist but is in the directory makefile.");
+    if (!$visited{$port->name}) {
+      print "\n\t$port";
+      $port->delete;
     }
   }
+  print "done\n";
 }
 
 


More information about the Midnightbsd-cvs mailing list