Index: tbroadcast/v2/cmt/requirements
===================================================================
--- tbroadcast/v2/cmt/requirements	(revision 242)
+++ tbroadcast/v2/cmt/requirements	(revision 243)
@@ -8,2 +8,4 @@
 
 path_append PYTHONPATH  "${tbroadcast_root}/python"
+
+action tbroadcast "tbroadcast $(cmt_args)"
Index: tbroadcast/v2/python/tbroadcast.py
===================================================================
--- tbroadcast/v2/python/tbroadcast.py	(revision 242)
+++ tbroadcast/v2/python/tbroadcast.py	(revision 243)
@@ -12,4 +12,5 @@
 import string
 import random
+import os.path
 import commands
 import traceback
@@ -25,12 +26,44 @@
 class Scheduler:
 
-    def __init__(self, num_workers=20):
+    def __init__(self, num_workers=20, file=None, ignore_cycles=False, local=False, output=None):
         self.pool            = ThreadPool(num_workers=num_workers)
         self.current_package = self.get_current_package()
+        self.current_project = {'name': None, 'path': None, 'version': None}
         self.packages        = {}  
         self.counter         = 0
         self.semaphore       = BoundedSemaphore(1)
+        self.local           = local
+        self.ignore_cycles   = ignore_cycles
+        self.output          = output
+        if output is not None:
+            if not os.path.exists (output):
+                print "path",output,"no exits"        
+                sys.exit(-1)
+            if not os.path.isdir(output):
+                print "path",output,"no a valid directory"        
+                sys.exit(-1)            
+                
+        self.get_current_project()
+        self.instanciate_packages (file)
+        if self.local: self.get_local_graph()
         self.check_cycles()
-        self.instanciate_packages ()
+
+    def get_current_project(self):
+        cmd = 'cmt show projects | grep current'
+        status, output = commands.getstatusoutput (cmd)
+        if status != 0:
+            print output
+            sys.exit(-1)    
+        lines = string.split(output, '\n')
+        for line in lines:            
+            if line!='' and line [0] != '#':                            
+                item  = string.split (line, ' ')
+                self.current_project ['name']    = item[0]
+                self.current_project ['version'] = item[1]
+                self.current_project ['path']    = item[3][:-1]
+                version =  self.current_project ['path'][len(self.current_project ['path'])-len(self.current_project ['version'] ):]
+                if  self.current_project ['version'] == version:
+                    self.current_project ['path'] =  os.path.normpath(self.current_project ['path'][:-len(self.current_project ['version'] )])
+                #print self.current_project     
         
     def get_counter(self):
@@ -42,5 +75,5 @@
         
     def check_cycles (self):
-        cmd = 'cmt show cycles'
+        cmd = 'cmt -private show cycles'
         cycle_found = False
         status, output = commands.getstatusoutput (cmd)
@@ -49,12 +82,35 @@
             sys.exit(-1)    
         lines = string.split(output, '\n')
+        cycles = list ()
         for line in lines:            
-            if line!='' and line [0] != '#':            
-                if not cycle_found:
-                    cycle_found = True
-                    print "# Error: cycles found, not possible to execute broadcast with threads. See the followings packages:"
-                print line
-        if cycle_found:
-            sys.exit(-1)
+            if line!='' and line [0] != '#':                    
+               cycles.append (string.split(line)) 
+        cercles =list()        
+        for cycle in cycles:
+            cycleInProject = True
+            for package in cycle:            
+                if not self.packages.has_key(package):
+                    cycleInProject = False        
+            if cycleInProject: 
+              cercles.append(cycle)
+        if len(cercles):
+            if not self.ignore_cycles:
+                print "# Error: cycles found, not possible to execute broadcast with threads. Please correct the following cycles:"
+                for cycle in cercles:
+                    loop = ""                    
+                    for package in cycle:
+                        loop = loop + package + ' -> '
+                    print loop + '...'
+                sys.exit(-1)       
+            else:
+                print "# Warning: There are cycles and you have selected the automatic suppress cycles mode"
+                for cycle in cercles:
+                    loop = ""                    
+                    for package in cycle:
+                        loop = loop + package + ' -> '                     
+                    if cycle[0] in self.packages[cycle[len(cycle)-1]]['uses']:
+                        print '## In cycle: '+loop + '..., we suppress the dependency '+ cycle[len(cycle)-1]+'->'+cycle[0]
+                        self.packages[cycle[len(cycle)-1]]['uses'].remove(cycle[0])
+#                sys.exit(-1)
 
     def format_uses (self, content):
@@ -63,5 +119,5 @@
         lines   = list()
         for ligne in lignes:
-           if ligne [0] == '#' and ligne[:5] != "#CMT>" and ligne not in ['# Selection :','#']:
+           if ligne [0] == '#' and ligne[:5] != "#CMT>" and ligne[:10] != "# Required" and ligne not in ['# Selection :','#']:
                lines.append(ligne)
         lines.reverse()
@@ -118,10 +174,17 @@
                         print str(result)
                         sys.exit(-1) 
-                    self.packages[result[0]]['path'] = full_path
-    
+                    self.packages[result[0]]['path'] = os.path.normpath(full_path)
+                    commonprefix = os.path.commonprefix([self.packages[result[0]]['path'], self.current_project ['path']])
+                    if os.path.normpath(commonprefix) == self.current_project ['path']:                    
+                        #print result[0], ' belong to project', self.current_project ['name']
+                        self.packages[result[0]]['current_project'] = True
+
     def get_uses(self, content):        
         # initiates variables
         lignes = self.format_uses(content)
-        self.packages [self.current_package] = {'version': '*', 'client': list(),'uses': list(), 'status': 'waiting', 'path': os.getcwd()}
+        if not len(lignes): return
+        self.packages [self.current_package] = {'version': '*', 'client': list(),
+                                                'uses': list(), 'status': 'waiting', 
+                                                'current_project': True, 'path': os.getcwd()}
         previous_client = self.current_package
         previous_level  = 0
@@ -134,6 +197,8 @@
                 version = string.split (ligne)[3]                              
                 if not self.packages.has_key (name):
-                  self.packages [name] = {'version': version, 'uses': list(), 'client': list(), 'status': 'waiting', 'path': None}
-                if name not in self.packages[previous_client]['uses']:
+                  self.packages [name] = {'version': version, 'uses': list(), 
+                                          'client': list(), 'status': 'waiting', 
+                                          'current_project': False, 'path': None}
+                if name not in self.packages[previous_client]['uses']:# and name != previous_client:
                    self.packages[previous_client]['uses'].append (name)                
                 level_stack.append({'name':previous_client,'level':previous_level})
@@ -144,17 +209,19 @@
                     #print ligne
                     current_level = string.find(ligne, 'use')
-                        
+                                            
             #self.packages [previous_client]['status'] ='queued'
             # restore the level
-            item = level_stack.pop()                
-            while item['level'] >= current_level:
-                 item = level_stack.pop()
-            previous_client = item['name']
-            previous_level  = item['level']
+            if len(lignes):
+                if len(level_stack):                        
+                    item = level_stack.pop()                
+                    while item['level'] >= current_level and len(level_stack):
+                             item = level_stack.pop()
+                    previous_client = item['name']
+                    previous_level  = item['level']
             #print previous_client, '-->',string.split (ligne)[2]
 
     def instanciate_packages(self, file=None):
         # We create the schedule of the work units
-        print '# First, we initialize the DAG by parsing cmt show uses'
+        print '# First, we initialize the DAG by parsing "cmt show uses"'
         if file is None:
             cmd  = 'cmt show uses'
@@ -170,18 +237,27 @@
         #self.simulate_execution()
 
+    def get_local_graph(self):
+        To_remove = list()
+        for key in self.packages:
+            if self.packages[key]['current_project']== False:
+                for selected in self.packages:
+                    if key in self.packages[selected]['uses']:
+                       self.packages[selected]['uses'].remove(key)
+                To_remove.append (key) 
+        for item in To_remove:
+            self.packages.pop(item)
+
     def simulate_execution(self):
        ok = True
-       indice = 1
+       indice = 1                     
        while ok:
            runnable  = list()
-           checkable = list()
            for key in self.packages:
                if  self.packages[key]['status']!='done':
                    if len(self.packages[key]['uses']) == 0:
-                       runnable.append(key)
+                       runnable.append(key)                                              
            if len(runnable):
                print '\n#--------------------------------------------------------------'
                print "# Execute parallel actions within packages " + str(runnable) 
-           #print 'checkable:',checkable
            for selected in runnable:       
                print '#--------------------------------------------------------------'
@@ -334,5 +410,12 @@
       print '#--------------------------------------------------------------'
       cmd = arg['cmd']
-      status, output, error, pythonError  = exeCommand(cmd,  iTimeout = 10)      
+      status, output, error, pythonError  = exeCommand(cmd)#,iTimeout = 3600)
+      if self.output is not None:
+         f = open (self.output+'/'+arg['package']+'_output.log', 'w+')
+         f.write (output)
+         f.close()
+         f = open (self.output+'/'+arg['package']+'_error.log', 'w+') 
+         f.write (str(error))
+         f.close() 
       self.suppress_work_unit (arg['package'])
       self.set_work_unit_status (arg['package'], 'done')
Index: tbroadcast/v2/scripts/tbroadcast
===================================================================
--- tbroadcast/v2/scripts/tbroadcast	(revision 242)
+++ tbroadcast/v2/scripts/tbroadcast	(revision 243)
@@ -19,35 +19,52 @@
     print '#   <command>: command to execute'
     print '# global options :'
-    print '#   -nb=<num_worker>]     : Total number of threads'
+    print '#   -check                : Check execution (deadlocks)'
+    print '#   -f=<file>             : Input file'
+    print '#   -help                 : Print help'
+    print '#   -local                : '
+    print '#   -ignore_cycles        : '
+    print '#   -nb=<num_worker>      : Total number of threads'
+    print '#   -output=<location>    : Output directory to store output files with the form <package>.log'
+    print '#   -print                : Print dependency graph' 
     print '#   -test                 : Simulate execution'
-    print '#   -check                : Check execution (deadlocks)'
-    print '#   -print                : Print dependency graph'    
-    print '#   -help]                : Print help'
 
 if __name__ == '__main__':
     # Default options
-    num_worker  = 20
-    command     = ''
-    test        = False
-    check       = False
-    print_graph = False
+    num_worker    = 20
+    command       = ''
+    test          = False
+    check         = False
+    print_graph   = False
+    local         = False
+    ignore_cycles = False
+    output        = None
+    file          = None
     for arg in sys.argv[1:len(sys.argv)]:            
          if arg[0]=='-':
              option = string.split(arg,'=')[0]
              if option == '-nb':
-                num_worker = int (string.split(arg,'=')[1])         
-             elif option == '-test':
-                 test = True   
+                num_worker = int (string.split(arg,'=')[1]) 
+             if option == '-f':
+                file = string.split(arg,'=')[1]
+             if option == '-output':
+                output = string.split(arg,'=')[1]
+             if option == '-local':
+                 local= True
+             if option == '-ignore_cycles':             
+                 ignore_cycles = True
+             if option == '-help':    
+                  usage()
+                  sys.exit(-1)      
+                              
+             if option == '-test':
+                     test = True   
              elif option == '-check':
-                 check = True   
+                     check = True   
              elif option == '-print':
-                 print_graph = True   
-             else:
-                usage()
-                sys.exit(-1)      
+                     print_graph = True   
          else:
               command = arg
 
-    master = Scheduler (num_workers=num_worker)    
+    master = Scheduler (num_workers=num_worker, file=file, ignore_cycles=ignore_cycles, local=local, output=output)
     if test:
         master.simulate_execution()
