source: CMTManagement/cmt_finalize_release.py

Last change on this file was 420, checked in by garonne, 17 years ago
  • Property svn:executable set to *
File size: 4.6 KB
Line 
1#!/usr/bin/env python
2#--------------------------------#
3# Author: V.garonne              #
4# Mail: garonne@lal.in2p3.fr     #
5# Description: script to create  #
6# automaticaly a release         #
7#--------------------------------#
8
9import pexpect
10import sys, os
11import string
12import commands
13import shutil
14import socket
15import tarfile, gzip
16
17# my own stuffs
18from utils.ssh_session import *
19
20def cmt_finalize_release (root, version):
21    svnroot   = root + '/HEAD'
22    path      = 'tmp/CMT/'
23    preambule = 'build_release > '
24    hostname  =  socket.gethostname()
25    tarballs  =  list()
26    platforms = [
27    'OSF1-alpha',
28    'Linux-i686', 
29    'Linux-x86_64', 
30    'Linux-ia64',
31    'SunOS-sun4u', 
32    'AIX-002064874C00', 
33    'VisualC',
34    'CYGWIN_NT-5.1-i686',   
35    'Darwin-PowerMacintosh'
36    ]
37    here      =  os.getcwd()
38           
39#     do a new fresh temp directory   
40    if os.path.exists('tmp'):
41        shutil.rmtree('tmp')
42    os.makedirs (path)
43    os.chdir    (path)
44
45# first do a checkout of the HEAD
46    print  preambule +'first do a svn co of the last version'   
47    cmd    = 'svn co '+ svnroot
48    print preambule + cmd
49    status, output = commands.getstatusoutput (cmd)
50    if status:
51        print output
52#       
53#     User Questions
54    print  preambule + 'Before doing a CMT release, did you check that :'
55    print '\t You have change manually the old release number by '+ version +' in the doc/CMTDoc.xml file ? (y/n)'
56    choice ='y'
57    choice    = raw_input('--> ')
58    if choice!='y' and choice!='Y': sys.exit(-1)
59    print '\t and the CMT requirements file (only when major release changes) ? (y/n)'
60    choice    = raw_input('--> ')
61    if choice!='y' and choice!='Y': sys.exit(-1)
62    print  preambule + 'now we can proceed to the release' 
63#
64    print  preambule + 'Build the documentations'
65    #make doxygen, doxygen must be installed localy
66    cmd    =  'cd HEAD/doc; rm -Rf Doxygen; doxygen'
67    print preambule + cmd
68    status, output = commands.getstatusoutput (cmd)
69    print output
70    # make the pdf, htlm2ps must be installed
71    cmd    = 'cd HEAD/mgr; make pdf; make gendoc'
72    print preambule + cmd
73    status, output = commands.getstatusoutput (cmd)
74    print output
75
76    print '\t You should change manually the ReleaseNotes.html '
77    choice    = raw_input('--> ')
78    if choice!='y' and choice!='Y': sys.exit(-1)
79     
80    print preambule + 'commit version to the HEAD'
81    os.chdir('HEAD')
82    cmd = "svn commit -m 'version "+ version +"'"
83    print preambule + cmd
84    status, output = commands.getstatusoutput (cmd)
85    print output
86    os.chdir('..')
87   
88    print  preambule + 'Tag version', version
89    cmd = "svn copy -m 'move HEAD' "  + svnroot + ' ' + root + '/' + version
90    print preambule + cmd
91    status, output = commands.getstatusoutput (cmd)
92    print output   
93    shutil.rmtree('HEAD')
94   
95    cmd = "svn  co " + root + '/' + version
96    print preambule + cmd
97    status, output = commands.getstatusoutput (cmd)
98    print output   
99    os.chdir    (version)
100
101    # User Question
102    content = '''
103//-----------------------------------------------------------
104// Copyright Christian Arnault LAL-Orsay CNRS
105// arnault@lal.in2p3.fr
106// See the complete license in cmt_license.txt "http://www.cecill.info".
107//-----------------------------------------------------------
108
109#ifndef __cmt_version_h__
110#define __cmt_version_h__
111
112#define CMTVERSION "%s"
113
114#endif
115    '''%(version)
116   
117
118    print preambule + 'Change the version number in the cmt_version.h file'
119    f = open ('source/cmt_version.h', 'w+')
120    f.write (content)
121    f.close ()
122
123    print '\t Prepare the ../doc/download.html file'
124    f = open ('doc/CMTDownload1.html','r')
125    content = f.read ()
126    f.close
127    content = content + '  <tr><td><a href="CMT%s.tar.gz">Source kit</a> </td></tr>\n'%(version)
128    for platform in platforms:
129        content = content + '  <tr><td><a href="CMT%s%s.tar.gz">%s</a> </td></tr>\n'%(version, platform, platform)   
130    f = open ('doc/CMTDownload2.html','r')
131    content = content + f.read ()
132    f.close   
133    f = open ('doc/CMTDownload.html', 'w+')
134    f.write (content)
135    f.close ()   
136    cmd = "svn add " + 'doc/CMTDownload.html'
137    print preambule + cmd
138    status, output = commands.getstatusoutput (cmd)
139    print output
140
141    print preambule + 'commit version'
142    cmd = "svn commit -m 'version "+ version +"'"
143    print preambule + cmd
144    status, output = commands.getstatusoutput (cmd)
145    print output
146    os.chdir      (here)
147    shutil.rmtree ('tmp')
148
149#--------------------# MAIN #-------------------------#
150if __name__ == '__main__': 
151    pass
152#----------------------- End Of File --------------------------#
Note: See TracBrowser for help on using the repository browser.