Index: /tbroadcast/v2/python/tbroadcast.py
===================================================================
--- /tbroadcast/v2/python/tbroadcast.py	(revision 240)
+++ /tbroadcast/v2/python/tbroadcast.py	(revision 241)
@@ -13,4 +13,5 @@
 import commands
 import traceback
+from threading import BoundedSemaphore
 
 from threadpool import WorkRequest
@@ -24,10 +25,20 @@
 
     def __init__(self, num_workers=20):
-        self.pool     = ThreadPool(num_workers=num_workers)
-        self.packages = {}  
+        self.pool            = ThreadPool(num_workers=num_workers)
+        self.current_package = self.get_current_package()
+        self.packages        = {}  
+        self.counter         = 0
+        self.semaphore       = BoundedSemaphore(1)
         self.check_cycles()
         self.instanciate_packages ()      
-
-
+        self.reduce_graph ()
+        
+    def get_counter(self):
+        self.semaphore.acquire ()        
+        self.counter = self.counter + 1
+        value = self.counter 
+        self.semaphore.release()
+        return value
+        
     def check_cycles (self):
         cmd = 'cmt show cycles'
@@ -56,6 +67,5 @@
             sys.exit(-1)    
         lines = string.split(output, '\n')
-        current_package = self.get_current_package()
-        self.packages [current_package] = {'version': '*', 'dependencies': list(), 'status': 'waiting', 'path':os.getcwd()}
+        self.packages [self.current_package] = {'version': '*', 'dependencies': list(), 'status': 'waiting', 'path':os.getcwd(), 'indice':1}
         indice  = 1
         for line in lines:
@@ -63,10 +73,11 @@
                 name    = string.split (line)[2]
                 version = string.split (line)[3]
-                if name not in self.packages[current_package]['dependencies']:
-                   self.packages[current_package]['dependencies'].append (name)                
+                if name not in self.packages[self.current_package]['dependencies']:
+                   self.packages[self.current_package]['dependencies'].append (name)                
                    #print '\n#', indice,':: add package', name
                    indice = indice + 1
                 if not self.packages.has_key (name):
-                   self.packages [name] = {'version': version, 'dependencies': list(), 'status': 'waiting', 'path': None}               
+                   self.packages [name] = {'version': version, 'dependencies': list(), 'status': 'waiting', 'path': None, 'indice':indice}               
+                   indice = indice + 1
                    found = False
                    for ligne in lines:
@@ -87,4 +98,9 @@
                     if len(result)==4:
                         name, version, offset, path = string.split (line[4:len(line)], " ")
+                        #print name, version, offset, path
+                        #print path[1:-1] + '/' + offset + '/' +name + '/' + version + '/cmt'
+                        if path == '(no_auto_imports)':
+                            path   = offset
+                            offset = ''
                         if os.path.exists(path[1:-1] + '/' + offset + '/' +name + '/' + version + '/cmt'):
                             full_path = path[1:-1] + '/' + offset + '/' +name + '/' + version + '/cmt'
@@ -155,4 +171,41 @@
             print key, '-->', self.packages[key] ['dependencies'],',', self.packages[key] ['status']                       
 
+    def print_status(self, status):
+        print '# ------------------------' 
+        print '# package --> dependencies' 
+        print '# ------------------------' 
+        i = 1
+        for key in self.packages.keys():
+            if self.packages[key] ['status'] == status:
+                print i , key, '-->', self.packages[key] ['dependencies'],',', self.packages[key] ['status']                 
+                i = i + 1
+                
+    def reduce_graph(self):
+        packages     = {}
+        dependencies = list ()                
+        dependencies.append (self.current_package)                
+        space = ' '
+        #print '-->', self.current_package
+        packages[self.current_package] = list()
+        for package in self.packages[self.current_package]['dependencies']:
+            if package not in dependencies:
+                dependencies.append(package)            
+                packages[self.current_package].append(package)
+                packages[package] = list()                        
+                #print '  -->', package
+                limit = True
+                for paquetage in self.packages[package]['dependencies']:
+                    if paquetage not in dependencies:                        
+                        space = space + ' '
+                        #print space, paquetage
+                        dependencies.append (paquetage)
+                        packages[package].append (paquetage)
+            else:
+                packages[package] = list()                                
+                space = ''        
+        for key in packages:
+            #print key, packages[key]
+            self.packages[key]['dependencies'] = packages[key]
+            
     def is_work_unit_waiting (self, name):
         return self.packages[name] ['status'] == 'waiting'
@@ -183,5 +236,5 @@
             if name in self.packages[key]['dependencies']:
                 self.packages[key]['dependencies'].remove(name)
-                
+
     def add_work_unit (self, name, cmd):
         if self.is_work_unit_waiting (name):
@@ -204,7 +257,12 @@
 
     def execute_all(self,command):
+        #self.print_dependencies ()
         self.execute (command)
         self.wait()
-        ##while self.is_work_units(): 
+        #self.print_dependencies ()
+        #self.print_status (status='waiting')        
+        #print self.is_work_units()
+        #while self.is_work_units(): 
+        #            self.wait()            
         
     def wait (self):
@@ -226,5 +284,5 @@
       os.chdir(path)        
       print '#--------------------------------------------------------------'
-      print '# Now trying ['+ arg['cmd']+'] in ' + path
+      print '# ('+str(self.get_counter())+'/'+str(len(self.packages))+') Now trying ['+ arg['cmd']+'] in ' + path
       print '#--------------------------------------------------------------'
       cmd = arg['cmd']
@@ -245,3 +303,3 @@
       print '#--------------------------------------------------------------'    
       sys.exit(-1)
-#--------- EoF --------#    
+#--------- EoF --------#
Index: /tbroadcast/v2/scripts/tbroadcast
===================================================================
--- /tbroadcast/v2/scripts/tbroadcast	(revision 240)
+++ /tbroadcast/v2/scripts/tbroadcast	(revision 241)
@@ -37,5 +37,5 @@
               command = arg
 
-    master = Scheduler (num_workers=num_worker)        
+    master = Scheduler (num_workers=num_worker)
     master.execute_all (command)
 
