Index: /CMTManagement/cmt_build_binaries
===================================================================
--- /CMTManagement/cmt_build_binaries	(revision 420)
+++ /CMTManagement/cmt_build_binaries	(revision 420)
@@ -0,0 +1,186 @@
+#!/usr/bin/env python
+#--------------------------------#
+# Author: V.garonne              #
+# Mail: garonne@lal.in2p3.fr     #
+# Description: script to build   #
+# binaries and the tarball on a  #
+# certain host                   #
+#--------------------------------#
+
+import os, sys, commands, string, glob
+import shutil
+
+def checkPythonVersion (major=1,minor=5):    
+    version      = float(str(major) +'.'+ str(minor))
+    if string.find(sys.version, '1.5') != -1:
+        thisversion = float(1.5)
+    else:
+        thisversion  = float(str(sys.version_info[0]) + '.' + str(sys.version_info[1]))
+    if    version > thisversion:
+    # try to find the good python version >= 2.3
+        paths = string.split(os.environ['PATH'],':')
+        print 'hmmm look for the appropriate python version, this one is',\
+        thisversion,'and the required version is python >=', version    
+        pythons = []      
+        for path in paths:
+            pythons = glob.glob1(path, 'python*')
+            for python in pythons:
+                cmd = python +' -c "import sys; print sys.version"'
+                status, thisversion = commands.getstatusoutput(cmd)
+                if string.find(thisversion, '1.5') != -1:
+                    thisversion = float(1.5)
+                else:
+                    cmd = python +' -c "import sys; print sys.version_info"'
+                    status, thisversion = commands.getstatusoutput(cmd)
+                    thisversion         = eval (str(thisversion))
+                    thisversion         = float(str(thisversion[0]) +'.'+ str(thisversion[1]))
+                if (thisversion >= version):
+                    print 'found and load', python
+                    sys.argv.insert (0, python)
+                    os.execvp       (python, sys.argv)  
+        print 'The appropriate version of python >=' + str(version) + ' is not here, check your PATH variable or install it'
+        sys.exit(-1)
+checkPythonVersion (2,2)
+
+# for package version dependant
+import tarfile
+import urllib
+
+# My own python 'tar -xvzf' in waiting python 2.5...
+def extractall(tarball, path="."):
+    tar         = tarfile.open(tarball)
+    directories = []
+    for tarinfo in tar:
+        if tarinfo.isdir():
+                try:
+                    os.makedirs(os.path.join(path, tarinfo.name), 0777)
+                except EnvironmentError:
+                    pass
+                directories.append(tarinfo)
+        else:
+            tar.extract(tarinfo, path)
+
+    # Reverse sort directories.
+    directories.sort   (lambda a, b: cmp(a.name, b.name))
+    directories.reverse()
+
+    # Set correct owner, mtime and filemode on directories.
+    for tarinfo in directories:
+        path = os.path.join(path, tarinfo.name)
+        tar.chown(tarinfo, path)
+        #tar.utime(tarinfo, path)
+        #tar.chmod(tarinfo, path)
+    tar.close()
+
+        
+#--------------------# MAIN #-------------------------#
+if __name__ == '__main__':  
+  
+    # Check arguments
+    checkPythonVersion(2,2)
+    if len(sys.argv) != 3:
+        print sys.arvg[0], '<version>' , '<platform>'
+        sys.exit(-1)
+    else:    
+        version   = sys.argv[1]
+        platform  = sys.argv[2]
+        
+    preambule = 'cmt_build_binaries >'
+    tarball   = "CMT"+version+".tar.gz"
+    www       = "http://www.cmtsite.org"
+    here      = os.getcwd()
+    
+    # get or untar CMT source tarball
+    if not os.path.exists(tarball):
+        print preambule + 'the CMT tarball is not here'
+        print preambule + 'try to get it from the web site '+ www 
+        h = urllib.urlretrieve(www + '/' + version + '/' + tarball, tarball)
+        if not os.path.exists(tarball):    
+            print preambule + 'the CMT tarball is still not here'
+            sys.exit(-1)
+    
+    # get real platform name
+    if not (platform == 'VisualC' and sys.platform == 'cygwin'):        
+        sysname  = os.uname() [0]
+        machine  = os.uname() [4]
+        platform = sysname + '-' + machine
+        platform = string.replace (platform, ' ','')
+    print preambule,'platform =', platform
+   
+    if os.path.exists('CMT'):
+        try:
+            shutil.rmtree('CMT')    
+        except:
+            pass
+    print preambule + " untar "+tarball+" source tarball"
+    extractall(tarball=tarball)
+    
+    
+    # configure, compile and create bin tarball
+    if platform == 'VisualC':
+        f = open ('cmtnmake','w+')
+        content = 'call rlogin.bat\n' 
+        content = content + 'cd CMT\\'+version+'\mgr\n' 
+        content = content + 'call INSTALL.bat\n'
+        content = content + 'call setup.bat\n'
+        content = content + 'nmake /f nmake\n'
+        f.write (content)
+        f.close()        
+        cmd = 'cmd < cmtnmake'  
+    else:
+        os.chdir ("CMT/" + version + "/mgr")
+        cmd= 'tcsh -c " ./INSTALL; source setup.csh ;'   
+        if sys.platform == 'darwin':         
+            cmd = cmd + 'make'
+        elif sys.platform == 'cygwin':
+            cmd = cmd + 'make'
+        elif sys.platform == 'VisualC':
+            cmd = cmd + 'setup.bat;'
+            cmd = cmd + 'nmake /f nmake'
+        else:
+            cmd = cmd + 'gmake STATIC=1'
+        cmd = cmd + '"'
+    print  preambule + cmd 
+    status, output = commands.getstatusoutput (cmd)
+    print   output
+    if platform == 'VisualC':
+       os.remove('cmtnmake')
+    
+    print  preambule + ' first do the clean up for preparing archive'
+    os.chdir(here)
+    # first do the clean up
+    files = ['cmt_deps', 'last-rebuild', 'CMT_setup.make', 'cmt_dependencies.make']
+    for file in files:
+        if os.path.exists      ('CMT/'+version+'/'+platform +'/' + file):
+            if os.path.isdir   ('CMT/'+version+'/'+platform +'/' + file):
+                shutil.rmtree  ('CMT/'+version+'/'+platform +'/' + file)
+            else:
+                os.remove      ('CMT/'+version+'/'+platform +'/' + file)
+
+    if platform =='VisualC':
+        shutil.rmtree ('CMT/'+version+'/'+platform+'/cmt' )
+    else:
+        if os.path.exists ('CMT/'+version+'/'+platform +'/cmt'):
+            os.remove ('CMT/'+version+'/'+platform +'/cmt')
+            os.chdir('CMT/'+version+'/'+platform +'/')
+            os.symlink ('cmt.exe', 'cmt')
+            os.chdir(here)
+        files = glob.glob1('CMT/'+version+'/'+platform, '*.o')
+        for file in files:
+            print preambule + 'remove  CMT/'+version+'/'+platform + '/' +file
+            os.remove ('CMT/'+version+'/'+platform + '/' +file)
+                    
+    print  preambule + ' do the tarball for ' + platform
+    namelist = ['mgr', 'src', platform]
+#    if platform == 'Linux-i686':
+#            os.chdir('CMT/'+version)
+#            os.symlink ('Linux-i686', 'Linux-x86_64') 
+#            os.chdir(here)
+#            namelist.append('Linux-x86_64') 
+            
+    tar      = tarfile.open("CMT"+version+platform+".tar.gz", "w:gz")
+    for name in namelist:
+        print preambule + ' add the file ' + name + ' to the bin archive'
+        tar.add(name='CMT/'+version+'/'+ name, arcname='CMT'+'/'+version+'/'+name)
+    tar.close()
+#------------------------------- End of File --------------------------------------#
Index: /CMTManagement/cmt_build_release
===================================================================
--- /CMTManagement/cmt_build_release	(revision 420)
+++ /CMTManagement/cmt_build_release	(revision 420)
@@ -0,0 +1,51 @@
+#!/usr/bin/env python
+#--------------------------------#
+# Author: V.garonne              #
+# Mail: garonne@lal.in2p3.fr     #
+# Description: script to create  #
+# automaticaly a release         #
+#--------------------------------#
+
+import pexpect
+import sys, os
+import string
+import commands
+import shutil
+import socket
+import tarfile, gzip
+# 1,$ s/bla/bli/g
+
+# CMT stuff
+from cmt_finalize_release import *
+from cmt_create_srctar    import *
+from cmt_create_bintar    import *
+from cmt_export           import *
+from cmt_export_binaries  import *
+
+#--------------------# MAIN #-------------------------#
+if __name__ == '__main__':
+
+    # variables
+    svnroot   = 'https://svn.lal.in2p3.fr:/projects/CMT/CMT/'    
+    wwwroot   = '/www/Web/htdocs/cmtsite/'
+    # for testing
+    #svnroot   = 'file:///Users/garonne/EspaceDeTravail/repository/CMT/CMT/'
+    #wwwroot   = '/users/dsksi/garonne/cmtsite'
+    #version   = 'v1r18p20051101'
+    #version   = 'v1r18p20051108'
+    #version   = 'v1r18p20060301'
+    #version   = 'v1r18p20060505'
+    #version   = 'v1r18p20060606'
+    #version   = 'v1r18p20061003'
+    #version   = 'v1r19'
+    #version   = 'v1r20'
+    #version   = 'v1r20p20070208'
+    version   = 'v1r20p20070524'
+    
+    # main functions
+    cmt_finalize_release (root=svnroot , version=version)
+    #cmt_create_srctar    (svnroot=svnroot, version=version)
+    #cmt_create_bintar    (version=version)
+    #cmt_export           (svnroot=svnroot, version=version, wwwroot=wwwroot)
+    #cmt_export_binaries  (version=version)
+#--------------------#  EoF #-------------------------#
Index: /CMTManagement/cmt_create_bintar.py
===================================================================
--- /CMTManagement/cmt_create_bintar.py	(revision 420)
+++ /CMTManagement/cmt_create_bintar.py	(revision 420)
@@ -0,0 +1,161 @@
+#!/usr/bin/env python
+#--------------------------------#
+# Author: V.garonne              #
+# Mail: garonne@lal.in2p3.fr     #
+# Description: script to create  #
+# automaticaly a release         #
+#--------------------------------#
+
+import pexpect
+import sys, os
+import string
+import commands
+import shutil
+import socket
+import tarfile, gzip
+import threading
+
+# my own stuffs
+from utils.ssh_session import *
+from p3                import decrypt
+
+#--------------------# For the Multi-threaded version #-------------------------#
+class constructor (threading.Thread):
+
+  # static counter
+  counter = 1
+  def __init__(self, host, user, pwd, version, machine):
+    self.host        = host
+    self.user        = user
+    self.pwd         = pwd
+    self.version     = version
+    self.machine     = machine
+    print self.host, self.user, self.pwd  
+    self.number      = constructor.counter     
+    constructor.counter = constructor.counter + 1
+    threading.Thread.__init__(self, target=self.run)
+    
+  def run (self):
+        hostname  =  socket.gethostname()
+        # first do a ssh connection    
+        preambule = 'create_bintar '+ str(constructor.counter) +' > '
+        if self.host != hostname:
+            session = ssh_session (user=self.user, host=self.host, password=self.pwd, verbose=1)
+            print session.ssh('hostname')
+        # copy the source code on the build machine
+        # in fact the input sandbox in grid terms
+        if self.host != hostname:
+            if os.path.exists ("CMT"+self.version+".tar.gz"):
+                session.scp ("CMT"+self.version+".tar.gz",'.')
+            else:
+                print preambule + "CMT"+self.version+".tar.gz" + ' not found'
+                sys.exit(-1)
+            
+            if os.path.exists ("tarfile.py"):
+                session.scp ("tarfile.py",'.')
+                
+            if os.path.exists ("cmt_build_binaries"):    
+                session.scp ("cmt_build_binaries",'.')
+            else:
+                print preambule + "cmt_build_binaries" + ' not found'
+                sys.exit(-1)
+                
+        cmd = "./cmt_build_binaries "+ self.version + " "+ self.machine
+        print preambule + cmd
+        if self.host != hostname:
+           print session.ssh(cmd)
+        else:
+            status, output = commands.getstatusoutput (cmd)
+            print output
+       
+        # get bin directory
+        file = 'CMT'+self.version+self.machine+'.tar.gz'
+        if self.host != hostname:
+            file = 'CMT'+self.version+self.machine+'.tar.gz'
+            #session.scpget  (src='CMT/'+version+'/'+machine , dst='tmp/CMT/'+version+'/.', option='r')
+            session.scpget  (file, '.')
+            # Clean up
+            cmd = 'rm -rf '+ file + ' CMT ;'
+            print preambule + cmd
+            session.ssh (cmd)
+        else:
+            
+            print preambule + 'build the pacman kit'
+            cmd = 'cd CMT/'+self.version+'/mgr/;'
+            if sys.platform == 'darwin':
+                cmd = cmd + 'make'
+            else:
+                cmd = cmd + 'gmake'
+            status, output = commands.getstatusoutput (cmd)
+            file = 'CMT-'+self.version+'.pacman'
+            #shutil.copy ('CMT/'+self.version+'/mgr/CMT.pacman', 'CMT/'+self.version+'/mgr/' + file)                                                
+            #shutil.copy ('CMT/'+self.version+'/mgr/' + file , file)
+            print output
+            #Clean up
+            shutil.rmtree('CMT')
+
+#--------------------# MAIN #-------------------------#
+#if __name__ == '__main__':  
+def cmt_create_bintar (version):
+    path      = 'tmp/CMT/'
+    proxy     = '.cmtproxy'
+    preambule = 'build_release > '
+    here      =  os.getcwd()
+    hostname  =  socket.gethostname()
+    tarballs  =  list()
+    srctar    = "CMT"+version+".tar.gz"
+    
+    if not os.path.exists (srctar):
+        print preambule + srctar + 'not exists'
+        sys.exit(-1)
+ 
+    if not os.path.exists (proxy):
+        print preambule + 'First create the proxy'
+        sys.exit(-1)
+    pool = eval(decrypt('.cmtproxy')) 
+
+#    for machine in pool:
+#       host = pool[machine]['machine']
+#       user = pool[machine]['user']
+#       pwd = pool[machine] ['pwd']
+       #print host, user, pwd, machine        
+
+    # build the binaries
+    print preambule + 'build the binaries'
+    threads = []
+#    pool = {
+            # 'Linux-i686':pool['Linux-i686'], 
+            # 'VisualC':pool['VisualC'] 
+#            'CYGWIN_NT-5.1-i686':pool['CYGWIN_NT-5.1-i686']
+#            }
+    #pool = {'Linux-x86_64':pool['Linux-x86_64']}
+    #pool = {'Darwin-PowerMacintosh':pool['Darwin-PowerMacintosh']}
+    pool = {
+           'CYGWIN_NT-5.1-i686':pool['CYGWIN_NT-5.1-i686'] ,
+            'VisualC':pool['VisualC']
+          } 
+#     'OSF1-alpha':               'Linux-i686':              'Linux-x86_64':            'SunOS-sun4u': 'AIX-002064874C00':           
+    # 'Darwin-PowerMacintosh' 'CYGWIN_NT-5.1-i686'       'VisualC'     
+
+    for machine in pool:    
+   #     print pool[machine]['machine'], pool[machine]['user'], pool[machine] ['pwd']
+        cmd = "./cmt_build_binaries "+ version + " "+ machine
+        print cmd
+    #sys.exit(-1)            
+    for machine in pool:    
+       host = pool[machine]['machine']
+       if host == '134.158.72.234' or host=='wl-72137.lal.in2p3.fr':
+           host = '134.158.72.143'
+           #host = '134.158.72.121'
+            
+       user = pool[machine]['user']
+       pwd = pool[machine] ['pwd']
+       print host, user, pwd, machine        
+       thread = constructor( host=host, user=user, pwd=pwd, version=version, machine=machine)
+       threads.append (thread)
+       thread.run()
+       #thread.start()
+
+    #for thread in threads:
+    #    thread.join ()
+#----------------------- End Of File --------------------------#
Index: /CMTManagement/cmt_create_proxy
===================================================================
--- /CMTManagement/cmt_create_proxy	(revision 420)
+++ /CMTManagement/cmt_create_proxy	(revision 420)
@@ -0,0 +1,45 @@
+#!/usr/bin/env python
+#---------------------------------#
+# Author: V.garonne               #
+# Mail: garonne@lal.in2p3.fr      #
+# Description: script to a ssh    #
+# proxy to connect severals hosts #
+# i.d. a grid-like proxy          #
+#---------------------------------#
+
+import os, string
+import getpass
+
+# my own stuffs
+from   p3 import encrypt
+  
+#--------------------# MAIN #-------------------------#
+if __name__ == '__main__':  
+#lx64slc4
+    pool = {
+    'OSF1-alpha':            {'machine':'asc.lal.in2p3.fr'},
+    'Linux-i686':            {'machine':'lxplus.cern.ch'},
+    #'Linux-x86_64':          {'machine':'h4.lal.in2p3.fr'},
+    'SunOS-sun4u':           {'machine':'ccasn.in2p3.fr'},
+    'AIX-002064874C00':      {'machine': 'ccars01.in2p3.fr' },
+    'Darwin-PowerMacintosh': {'machine':'wl-72137.lal.in2p3.fr'}, #mac-90109.lal.in2p3.fr
+    'CYGWIN_NT-5.1-i686'   : {'machine':'134.158.72.234'},
+    'VisualC'              : {'machine':'134.158.72.234'},              
+    'Linux-x86_64':          {'machine':'lxcert-amd64.cern.ch'},
+    'Linux-ia64'  :          {'machine':'lxcert-ia64.cern.ch'}
+    }
+    #134.158.72.234
+    #134.158.72.234
+    preambule = 'cmt_create_proxy > '   
+    print preambule + "Do the configuration acces of the remote machines"
+    for platform in pool:  
+       print preambule + 'Enter the parameters for machine ' + pool[platform]['machine'] 
+       user      = raw_input (preambule + ' user: ')
+       password = getpass.getpass(preambule + user+'@'+ pool[platform]['machine'] + "'s password: ")
+       pool[platform]['user'] = user
+       pool[platform]['pwd']  = password
+       
+    f = open('.cmtproxy', 'w+')
+    f.write (encrypt(str(pool)))
+    f.close()   
+#----------------------- End Of File --------------------------#
Index: /CMTManagement/cmt_create_srctar.py
===================================================================
--- /CMTManagement/cmt_create_srctar.py	(revision 420)
+++ /CMTManagement/cmt_create_srctar.py	(revision 420)
@@ -0,0 +1,60 @@
+#!/usr/bin/env python
+#--------------------------------#
+# Author: V.garonne              #
+# Mail: garonne@lal.in2p3.fr     #
+# Description: script to create  #
+# automaticaly a release         #
+#--------------------------------#
+
+import pexpect
+import sys, os
+import string
+import commands
+import shutil
+import socket
+import tarfile, gzip
+
+# my own stuffs
+from utils.ssh_session import *
+
+#lxbuild002.cern.ch
+
+#--------------------# MAIN #-------------------------#
+#if __name__ == '__main__':  
+def cmt_create_srctar (svnroot, version):
+    path      = 'tmp/CMT/'
+    preambule = 'build_release > '
+    here      =  os.getcwd()
+    hostname  =  socket.gethostname()
+    tarballs  =  list()
+    
+    # do a new fresh temp directory    
+    if os.path.exists('tmp'):
+        shutil.rmtree('tmp')
+    os.makedirs (path)
+    os.chdir    (path)
+   
+    cmd = 'svn export ' + svnroot + '/'+ version 
+    print preambule + cmd
+    status, output = commands.getstatusoutput (cmd)
+    print output
+    os.chdir(version)
+    
+    # fisrt remove .ps and .pdf
+    files = ['doc/CMTDoc.ps', 'doc/CMTFAQ.ps', 'doc/CMTDoc.pdf','doc/CMTFAQ.pdf']
+    for file in files:
+        if os.path.exists(file):
+            os.remove(file)
+            
+    # build the src tarball    
+    namelist = ['source','mgr','src','Visual','java','doc']
+    tar      = tarfile.open("../../../CMT"+version+".tar.gz", "w:gz")
+    for name in namelist:
+        print preambule + 'add the file ' + name + ' to the source archive'
+        tar.add(name=name, arcname='CMT'+'/'+version+'/'+name)
+    tar.close()
+    tarballs.append ("CMT"+version+".tar.gz")
+    os.chdir(here)
+    shutil.rmtree ('tmp')
+
+#----------------------- End Of File --------------------------#
Index: /CMTManagement/cmt_export.py
===================================================================
--- /CMTManagement/cmt_export.py	(revision 420)
+++ /CMTManagement/cmt_export.py	(revision 420)
@@ -0,0 +1,190 @@
+#!/usr/bin/env python
+#--------------------------------#
+# Author: V.garonne              #
+# Mail: garonne@lal.in2p3.fr     #
+# Description: script to export  #
+# a CMT release to the web site  #
+#--------------------------------#
+
+import sys, os
+import string
+import commands
+import shutil
+import socket
+import tarfile, gzip
+import threading
+
+# my own stuffs
+from utils.ssh_session import *
+from p3                import decrypt
+
+#--------------------# MAIN #-------------------------#
+#if __name__ == '__main__':  
+def cmt_export (svnroot, version, wwwroot):
+    # variables
+    proxy     = '.cmtproxy'
+    preambule = 'cmt_export > '
+    platforms = [
+    'OSF1-alpha',
+    'Linux-i686', 
+    'Linux-x86_64',
+    'Linux-ia64', 
+    'SunOS-sun4u', 
+    'AIX-002064874C00', 
+    'Darwin-PowerMacintosh',
+    'VisualC',
+    'CYGWIN_NT-5.1-i686',
+    ''
+    ]
+    
+    if not os.path.exists (proxy):
+        print preambule + 'First create the proxy'
+        sys.exit(-1)
+    pool    = eval(decrypt('.cmtproxy')) 
+    machine = 'OSF1-alpha'
+    host    = pool[machine]['machine']
+    user    = pool[machine]['user']
+    pwd     = pool[machine] ['pwd']
+    session = ssh_session (user='garonne', host='lx.lal.in2p3.fr', password=pwd, verbose=1)
+    
+    file = 'CMT-'+version+'.pacman'
+    print file
+    content = '''#-----------------------------------------------------------
+# Copyright Christian Arnault LAL-Orsay CNRS
+# arnault@lal.in2p3.fr
+# See the complete license in cmt_license.txt "http://www.cecill.info". 
+#-----------------------------------------------------------
+
+description ('CMT %s')
+packageName ('CMT')
+version ('%s')
+
+pacmanVersionGE('3.13')
+
+{
+    platformGE ('Linux') ; downloadUntar ('http://www.cmtsite.org/%s/CMT%sLinux-i686.tar.gz', 'CMTBASE')
+  OR 
+    platformGE ('Cygwin') ; downloadUntar ('http://www.cmtsite.org/%s/CMT%sCYGWIN_NT-5.1-i686.tar.gz', 'CMTBASE')
+  OR
+    downloadUntar ('http://www.cmtsite.org/%s/CMT%s.tar.gz', 'CMTBASE')
+}
+
+cd ('$CMTBASE/%s/mgr')
+shellOutputContains ('./INSTALL', 'CMT installation terminated')
+{
+  shellOutputContains ('. setup.sh; cmt version', '%s') 
+    OR shell ('. setup.sh; gmake') 
+}
+shellOutputContains ('. setup.sh; cmt version', '%s')
+cd ()'''%(version,version,version, version,version,version,version,version,version,version,version)
+    
+    f =open (file, 'w+')
+    f.write (content)
+    f.close()
+    session.scp  (file,  wwwroot + '/pacman/cache/.')
+
+    # Second pacman Cache
+    path = '/afs/cern.ch/atlas/software/kits/CMT'
+    url  = 'http://cern.ch/atlas-computing/links/kitsDirectory/CMT'
+    content = '''#-----------------------------------------------------------
+# Copyright Christian Arnault LAL-Orsay CNRS
+# arnault@lal.in2p3.fr
+# See the complete license in cmt_license.txt "http://www.cecill.info". 
+#-----------------------------------------------------------
+
+description ('CMT %s')
+packageName ('CMT')
+version ('%s')
+
+pacmanVersionGE('3.13')
+
+{
+    platformGE ('Linux') ; downloadUntar ('http://cern.ch/atlas-computing/links/kitsDirectory/CMT/%s/CMT%sLinux-i686.tar.gz', 'CMTBASE')
+  OR 
+    platformGE ('Cygwin') ; downloadUntar ('http://cern.ch/atlas-computing/links/kitsDirectory/CMT/%s/CMT%sCYGWIN_NT-5.1-i686.tar.gz', 'CMTBASE')
+  OR
+    downloadUntar ('http://cern.ch/atlas-computing/links/kitsDirectory/CMT/%s/CMT%s.tar.gz', 'CMTBASE')
+}
+
+cd ('$CMTBASE/%s/mgr')
+shellOutputContains ('./INSTALL', 'CMT installation terminated')
+{
+  shellOutputContains ('. setup.sh; cmt version', '%s') 
+    OR shell ('. setup.sh; gmake') 
+}
+shellOutputContains ('. setup.sh; cmt version', '%s')
+cd ()'''%(version,version,version, version,version,version,version,version,version,version,version)
+
+
+    f =open (file, 'w+')
+    f.write (content)
+    f.close()
+   
+    machine = 'Linux-i686'
+    host    = pool[machine]['machine']
+    user    = pool[machine]['user']
+    pwd     = pool[machine] ['pwd']
+    session2 = ssh_session (user=user, host=host, password=pwd, verbose=1)
+    session2.scp  (file, path + '/pacman/cache/.')    
+    
+    
+    files =  [
+    'doc/CMTDoc.html',
+	'doc/CMTDoc.ps',
+	'doc/CMTDoc.pdf',
+	'doc/CMTFAQ.html',
+	'doc/CMTDownload.html',
+	'doc/ReleaseNotes.html',
+	'doc/ChangeLog.html',
+	'mgr/ChangeLog.php',
+	'doc/CMTFAQ.ps',
+	'doc/CMTFAQ.pdf'
+             ]
+             
+    cmd = 'svn export '+ svnroot + version 
+    print preambule + cmd
+    status, output = commands.getstatusoutput (cmd)
+    print output 
+    
+    #print  preambule + 'Build the documentations'
+    #make doxygen, doxygen must be installed localy
+    #cmd    =  'cd '+version+'/doc; rm -Rf Doxygen; doxygen'
+    #print preambule + cmd 
+    #status, output = commands.getstatusoutput (cmd)
+    #print output
+    #print session.scp  (version+'/doc/Doxygen',  wwwroot, 'r')   
+    
+    session.ssh ('mkdir -p '+ wwwroot +'/'+version)
+    session2.ssh ('mkdir -p '+ path +'/'+version)
+    for file in files:    
+        print session.scp  (version+'/'+file,  wwwroot + '/.')    
+        print session.scp  (version+'/'+file,  wwwroot + '/'+version + '/.')         
+        
+    for platform in platforms:
+        file = 'CMT'+version+platform+'.tar.gz'    
+        if os.path.exists(file):
+            print file
+            print session.scp   (file,  wwwroot + '/'+version+'/.')
+            print session2.scp  (file,  path + '/'+version+'/.')
+  
+    cmd = 'svn co https://svn.lal.in2p3.fr:/projects/CMT/cmtsite'
+    print preambule + cmd 
+    status, output = commands.getstatusoutput (cmd)
+    print output
+
+    print '\t You should manually the old release number by '+ version +' in the cmtsite/download.html file ? (y/n)'
+    choice ='y'
+    choice    = raw_input('--> ')
+    if choice!='y' and choice!='Y': sys.exit(-1)
+    os.chdir('cmtsite')
+    cmd = "svn commit -m 'update the version number for download.html'"
+    print preambule + cmd 
+    status, output = commands.getstatusoutput (cmd)
+    print output
+    os.chdir('..')
+    session.scp  ('cmtsite/download.html',  wwwroot + '/.') 
+  
+    # Do the Clean up
+    shutil.rmtree ('cmtsite')
+    shutil.rmtree (version)
+#----------------------- End Of File --------------------------#
Index: /CMTManagement/cmt_export_binaries.py
===================================================================
--- /CMTManagement/cmt_export_binaries.py	(revision 420)
+++ /CMTManagement/cmt_export_binaries.py	(revision 420)
@@ -0,0 +1,117 @@
+#!/usr/bin/env python
+#--------------------------------#
+# Author: V.garonne              #
+# Mail: garonne@lal.in2p3.fr     #
+# Description: script to export  #
+# a CMT release to the web site  #
+#--------------------------------#
+
+import sys, os
+import string
+import commands
+import shutil
+import socket
+import tarfile, gzip
+import threading
+
+# my own stuffs
+from utils.ssh_session import *
+from p3                import decrypt
+
+
+# for package version dependant
+import tarfile
+
+# My own python 'tar -xvzf' in waiting python 2.5...
+def extractall(tarball, path="."):
+    tar         = tarfile.open(tarball)
+    directories = []
+    for tarinfo in tar:
+        if tarinfo.isdir():
+                try:
+                    os.makedirs(os.path.join(path, tarinfo.name), 0777)
+                except EnvironmentError:
+                    pass
+                directories.append(tarinfo)
+        else:
+            tar.extract(tarinfo, path)
+
+    # Reverse sort directories.
+    directories.sort   (lambda a, b: cmp(a.name, b.name))
+    directories.reverse()
+
+    # Set correct owner, mtime and filemode on directories.
+    for tarinfo in directories:
+        path = os.path.join(path, tarinfo.name)
+        tar.chown(tarinfo, path)
+        #tar.utime(tarinfo, path)
+        #tar.chmod(tarinfo, path)
+    tar.close()
+
+
+#--------------------# MAIN #-------------------------#
+#if __name__ == '__main__':  
+def cmt_export_binaries (version):
+    # variables
+    proxy     = '.cmtproxy'
+    preambule = 'cmt_export > '
+    platforms = [
+    'Linux-i686', 
+    'Linux-x86_64', 
+    'Linux-ia64',
+    'VisualC',
+    'CYGWIN_NT-5.1-i686',
+    'Darwin-PowerMacintosh',
+    ]
+    
+    if not os.path.exists (proxy):
+        print preambule + 'First create the proxy'
+        sys.exit(-1)
+    pool    = eval(decrypt('.cmtproxy')) 
+    machine = 'Linux-i686'
+    host    = pool[machine]['machine']
+    user    = pool[machine]['user']
+    pwd     = pool[machine] ['pwd']
+    session = ssh_session (user=user, host=host, password=pwd, verbose=1)
+    
+    for platform in platforms:
+        file = 'CMT'+version+platform+'.tar.gz'    
+        if os.path.exists(file):
+            print file
+            extractall(tarball=file)
+    
+    path = '/afs/cern.ch/sw/contrib/CMT/'
+    session.scp ('CMT/'+version, path,'r') 
+    session.ssh ('cd '+path+'/'+version+'/mgr; ./INSTALL')    
+    
+    for platform in platforms:
+        if platform != 'VisualC':
+            cmd = "ln -s "+" "+path+'/'+version+'/'+platform+'/cmt.exe'+" "+path+'/'+version+'/'+platform+'/cmt'
+            session.ssh (cmd)     
+    
+    platforms = ['OSF1-alpha',]
+    for platform in platforms:
+        file = 'CMT'+version+platform+'.tar.gz'    
+        if os.path.exists(file):
+            print file
+            extractall(tarball=file)
+            
+    machine = 'OSF1-alpha'
+    host    = "lx.lal.in2p3.fr"     # pool[machine]['machine']
+    user    = pool[machine]['user']
+    pwd     = pool[machine] ['pwd']
+    session = ssh_session (user=user, host=host, password=pwd, verbose=1)
+
+    
+    path = '/lal/CMT'
+    session.scp ('CMT/'+version, path,'r') 
+    cmd = "ln -s "+" "+path+'/'+version+'/'+platform+'/cmt.exe'+" "+path+'/'+version+'/'+platform+'/cmt'
+    session.ssh (cmd)     
+    session.ssh ('cd '+path+'/'+version+'/mgr; ./INSTALL')    
+
+    
+    shutil.rmtree ('CMT')
+    
+    
+    
+#----------------------- End Of File --------------------------#
Index: /CMTManagement/cmt_finalize_release.py
===================================================================
--- /CMTManagement/cmt_finalize_release.py	(revision 420)
+++ /CMTManagement/cmt_finalize_release.py	(revision 420)
@@ -0,0 +1,152 @@
+#!/usr/bin/env python
+#--------------------------------#
+# Author: V.garonne              #
+# Mail: garonne@lal.in2p3.fr     #
+# Description: script to create  #
+# automaticaly a release         #
+#--------------------------------#
+
+import pexpect
+import sys, os
+import string
+import commands
+import shutil
+import socket
+import tarfile, gzip
+
+# my own stuffs
+from utils.ssh_session import *
+
+def cmt_finalize_release (root, version):
+    svnroot   = root + '/HEAD'
+    path      = 'tmp/CMT/'
+    preambule = 'build_release > '
+    hostname  =  socket.gethostname()
+    tarballs  =  list()
+    platforms = [
+    'OSF1-alpha',
+    'Linux-i686', 
+    'Linux-x86_64', 
+    'Linux-ia64',
+    'SunOS-sun4u', 
+    'AIX-002064874C00', 
+    'VisualC',
+    'CYGWIN_NT-5.1-i686',    
+    'Darwin-PowerMacintosh'
+    ]
+    here      =  os.getcwd()
+           
+#     do a new fresh temp directory    
+    if os.path.exists('tmp'):
+        shutil.rmtree('tmp')
+    os.makedirs (path)
+    os.chdir    (path)
+
+# first do a checkout of the HEAD
+    print  preambule +'first do a svn co of the last version'    
+    cmd    = 'svn co '+ svnroot
+    print preambule + cmd
+    status, output = commands.getstatusoutput (cmd)
+    if status:
+        print output
+#        
+#     User Questions
+    print  preambule + 'Before doing a CMT release, did you check that :'
+    print '\t You have change manually the old release number by '+ version +' in the doc/CMTDoc.xml file ? (y/n)'
+    choice ='y'
+    choice    = raw_input('--> ')
+    if choice!='y' and choice!='Y': sys.exit(-1)
+    print '\t and the CMT requirements file (only when major release changes) ? (y/n)'
+    choice    = raw_input('--> ')
+    if choice!='y' and choice!='Y': sys.exit(-1)
+    print  preambule + 'now we can proceed to the release' 
+# 
+    print  preambule + 'Build the documentations'
+    #make doxygen, doxygen must be installed localy
+    cmd    =  'cd HEAD/doc; rm -Rf Doxygen; doxygen'
+    print preambule + cmd 
+    status, output = commands.getstatusoutput (cmd)
+    print output
+    # make the pdf, htlm2ps must be installed
+    cmd    = 'cd HEAD/mgr; make pdf; make gendoc'
+    print preambule + cmd
+    status, output = commands.getstatusoutput (cmd)
+    print output
+
+    print '\t You should change manually the ReleaseNotes.html '
+    choice    = raw_input('--> ')
+    if choice!='y' and choice!='Y': sys.exit(-1)
+      
+    print preambule + 'commit version to the HEAD'
+    os.chdir('HEAD')
+    cmd = "svn commit -m 'version "+ version +"'"
+    print preambule + cmd
+    status, output = commands.getstatusoutput (cmd)
+    print output
+    os.chdir('..')
+    
+    print  preambule + 'Tag version', version 
+    cmd = "svn copy -m 'move HEAD' "  + svnroot + ' ' + root + '/' + version
+    print preambule + cmd 
+    status, output = commands.getstatusoutput (cmd)
+    print output    
+    shutil.rmtree('HEAD')
+    
+    cmd = "svn  co " + root + '/' + version
+    print preambule + cmd
+    status, output = commands.getstatusoutput (cmd)
+    print output    
+    os.chdir    (version)
+
+    # User Question
+    content = '''
+//-----------------------------------------------------------
+// Copyright Christian Arnault LAL-Orsay CNRS
+// arnault@lal.in2p3.fr
+// See the complete license in cmt_license.txt "http://www.cecill.info". 
+//-----------------------------------------------------------
+
+#ifndef __cmt_version_h__
+#define __cmt_version_h__
+
+#define CMTVERSION "%s"
+
+#endif
+    '''%(version)
+    
+
+    print preambule + 'Change the version number in the cmt_version.h file'
+    f = open ('source/cmt_version.h', 'w+')
+    f.write (content)
+    f.close ()
+
+    print '\t Prepare the ../doc/download.html file'
+    f = open ('doc/CMTDownload1.html','r')
+    content = f.read ()
+    f.close
+    content = content + '  <tr><td><a href="CMT%s.tar.gz">Source kit</a> </td></tr>\n'%(version)
+    for platform in platforms:
+        content = content + '  <tr><td><a href="CMT%s%s.tar.gz">%s</a> </td></tr>\n'%(version, platform, platform)    
+    f = open ('doc/CMTDownload2.html','r')
+    content = content + f.read ()
+    f.close    
+    f = open ('doc/CMTDownload.html', 'w+')
+    f.write (content)
+    f.close ()    
+    cmd = "svn add " + 'doc/CMTDownload.html'
+    print preambule + cmd
+    status, output = commands.getstatusoutput (cmd)
+    print output
+
+    print preambule + 'commit version'
+    cmd = "svn commit -m 'version "+ version +"'"
+    print preambule + cmd
+    status, output = commands.getstatusoutput (cmd)
+    print output
+    os.chdir      (here)
+    shutil.rmtree ('tmp')
+
+#--------------------# MAIN #-------------------------#
+if __name__ == '__main__':  
+    pass
+#----------------------- End Of File --------------------------#
