Index: trunk/ippTasks/dist.pro
===================================================================
--- trunk/ippTasks/dist.pro	(revision 25113)
+++ trunk/ippTasks/dist.pro	(revision 25429)
@@ -16,4 +16,17 @@
 $distQueue_DB = 0
 
+### list of stages
+#list of stages
+$STAGE:n = 0
+list STAGE -add "raw"
+list STAGE -add "chip"
+list STAGE -add "camera"
+list STAGE -add "fake"
+list STAGE -add "warp"
+list STAGE -add "diff"
+list STAGE -add "stack"
+
+$currentStage = 0
+
 ### Check status of tasks
 macro dist.status
@@ -78,5 +91,7 @@
 
   task.exec
-    $run = disttool -pendingcomponent
+    $run = disttool -pendingcomponent -stage $STAGE:$currentStage
+    $currentStage ++
+    if ($currentStage >= $STAGE:n) set currentStage = 0
     if ($DB:n == 0)
       option DEFAULT
@@ -85,6 +100,11 @@
       option $DB:$distToProcess_DB
       $run = $run -dbname $DB:$distToProcess_DB
-      $distToProcess_DB ++
-      if ($distToProcess_DB >= $DB:n) set distToProcess_DB = 0
+
+      # only increment the database number after we have gone through all of
+      # the stages
+      if ($currentStage == 0)
+          $distToProcess_DB ++
+          if ($distToProcess_DB >= $DB:n) set distToProcess_DB = 0
+      end
     end
     add_poll_args run
