source: CMTManagement/cmt_export.py@ 421

Last change on this file since 421 was 420, checked in by garonne, 18 years ago
  • Property svn:executable set to *
File size: 6.0 KB
RevLine 
[420]1#!/usr/bin/env python
2#--------------------------------#
3# Author: V.garonne #
4# Mail: garonne@lal.in2p3.fr #
5# Description: script to export #
6# a CMT release to the web site #
7#--------------------------------#
8
9import sys, os
10import string
11import commands
12import shutil
13import socket
14import tarfile, gzip
15import threading
16
17# my own stuffs
18from utils.ssh_session import *
19from p3 import decrypt
20
21#--------------------# MAIN #-------------------------#
22#if __name__ == '__main__':
23def cmt_export (svnroot, version, wwwroot):
24 # variables
25 proxy = '.cmtproxy'
26 preambule = 'cmt_export > '
27 platforms = [
28 'OSF1-alpha',
29 'Linux-i686',
30 'Linux-x86_64',
31 'Linux-ia64',
32 'SunOS-sun4u',
33 'AIX-002064874C00',
34 'Darwin-PowerMacintosh',
35 'VisualC',
36 'CYGWIN_NT-5.1-i686',
37 ''
38 ]
39
40 if not os.path.exists (proxy):
41 print preambule + 'First create the proxy'
42 sys.exit(-1)
43 pool = eval(decrypt('.cmtproxy'))
44 machine = 'OSF1-alpha'
45 host = pool[machine]['machine']
46 user = pool[machine]['user']
47 pwd = pool[machine] ['pwd']
48 session = ssh_session (user='garonne', host='lx.lal.in2p3.fr', password=pwd, verbose=1)
49
50 file = 'CMT-'+version+'.pacman'
51 print file
52 content = '''#-----------------------------------------------------------
53# Copyright Christian Arnault LAL-Orsay CNRS
54# arnault@lal.in2p3.fr
55# See the complete license in cmt_license.txt "http://www.cecill.info".
56#-----------------------------------------------------------
57
58description ('CMT %s')
59packageName ('CMT')
60version ('%s')
61
62pacmanVersionGE('3.13')
63
64{
65 platformGE ('Linux') ; downloadUntar ('http://www.cmtsite.org/%s/CMT%sLinux-i686.tar.gz', 'CMTBASE')
66 OR
67 platformGE ('Cygwin') ; downloadUntar ('http://www.cmtsite.org/%s/CMT%sCYGWIN_NT-5.1-i686.tar.gz', 'CMTBASE')
68 OR
69 downloadUntar ('http://www.cmtsite.org/%s/CMT%s.tar.gz', 'CMTBASE')
70}
71
72cd ('$CMTBASE/%s/mgr')
73shellOutputContains ('./INSTALL', 'CMT installation terminated')
74{
75 shellOutputContains ('. setup.sh; cmt version', '%s')
76 OR shell ('. setup.sh; gmake')
77}
78shellOutputContains ('. setup.sh; cmt version', '%s')
79cd ()'''%(version,version,version, version,version,version,version,version,version,version,version)
80
81 f =open (file, 'w+')
82 f.write (content)
83 f.close()
84 session.scp (file, wwwroot + '/pacman/cache/.')
85
86 # Second pacman Cache
87 path = '/afs/cern.ch/atlas/software/kits/CMT'
88 url = 'http://cern.ch/atlas-computing/links/kitsDirectory/CMT'
89 content = '''#-----------------------------------------------------------
90# Copyright Christian Arnault LAL-Orsay CNRS
91# arnault@lal.in2p3.fr
92# See the complete license in cmt_license.txt "http://www.cecill.info".
93#-----------------------------------------------------------
94
95description ('CMT %s')
96packageName ('CMT')
97version ('%s')
98
99pacmanVersionGE('3.13')
100
101{
102 platformGE ('Linux') ; downloadUntar ('http://cern.ch/atlas-computing/links/kitsDirectory/CMT/%s/CMT%sLinux-i686.tar.gz', 'CMTBASE')
103 OR
104 platformGE ('Cygwin') ; downloadUntar ('http://cern.ch/atlas-computing/links/kitsDirectory/CMT/%s/CMT%sCYGWIN_NT-5.1-i686.tar.gz', 'CMTBASE')
105 OR
106 downloadUntar ('http://cern.ch/atlas-computing/links/kitsDirectory/CMT/%s/CMT%s.tar.gz', 'CMTBASE')
107}
108
109cd ('$CMTBASE/%s/mgr')
110shellOutputContains ('./INSTALL', 'CMT installation terminated')
111{
112 shellOutputContains ('. setup.sh; cmt version', '%s')
113 OR shell ('. setup.sh; gmake')
114}
115shellOutputContains ('. setup.sh; cmt version', '%s')
116cd ()'''%(version,version,version, version,version,version,version,version,version,version,version)
117
118
119 f =open (file, 'w+')
120 f.write (content)
121 f.close()
122
123 machine = 'Linux-i686'
124 host = pool[machine]['machine']
125 user = pool[machine]['user']
126 pwd = pool[machine] ['pwd']
127 session2 = ssh_session (user=user, host=host, password=pwd, verbose=1)
128 session2.scp (file, path + '/pacman/cache/.')
129
130
131 files = [
132 'doc/CMTDoc.html',
133 'doc/CMTDoc.ps',
134 'doc/CMTDoc.pdf',
135 'doc/CMTFAQ.html',
136 'doc/CMTDownload.html',
137 'doc/ReleaseNotes.html',
138 'doc/ChangeLog.html',
139 'mgr/ChangeLog.php',
140 'doc/CMTFAQ.ps',
141 'doc/CMTFAQ.pdf'
142 ]
143
144 cmd = 'svn export '+ svnroot + version
145 print preambule + cmd
146 status, output = commands.getstatusoutput (cmd)
147 print output
148
149 #print preambule + 'Build the documentations'
150 #make doxygen, doxygen must be installed localy
151 #cmd = 'cd '+version+'/doc; rm -Rf Doxygen; doxygen'
152 #print preambule + cmd
153 #status, output = commands.getstatusoutput (cmd)
154 #print output
155 #print session.scp (version+'/doc/Doxygen', wwwroot, 'r')
156
157 session.ssh ('mkdir -p '+ wwwroot +'/'+version)
158 session2.ssh ('mkdir -p '+ path +'/'+version)
159 for file in files:
160 print session.scp (version+'/'+file, wwwroot + '/.')
161 print session.scp (version+'/'+file, wwwroot + '/'+version + '/.')
162
163 for platform in platforms:
164 file = 'CMT'+version+platform+'.tar.gz'
165 if os.path.exists(file):
166 print file
167 print session.scp (file, wwwroot + '/'+version+'/.')
168 print session2.scp (file, path + '/'+version+'/.')
169
170 cmd = 'svn co https://svn.lal.in2p3.fr:/projects/CMT/cmtsite'
171 print preambule + cmd
172 status, output = commands.getstatusoutput (cmd)
173 print output
174
175 print '\t You should manually the old release number by '+ version +' in the cmtsite/download.html file ? (y/n)'
176 choice ='y'
177 choice = raw_input('--> ')
178 if choice!='y' and choice!='Y': sys.exit(-1)
179 os.chdir('cmtsite')
180 cmd = "svn commit -m 'update the version number for download.html'"
181 print preambule + cmd
182 status, output = commands.getstatusoutput (cmd)
183 print output
184 os.chdir('..')
185 session.scp ('cmtsite/download.html', wwwroot + '/.')
186
187 # Do the Clean up
188 shutil.rmtree ('cmtsite')
189 shutil.rmtree (version)
190#----------------------- End Of File --------------------------#
Note: See TracBrowser for help on using the repository browser.