Rev | Line | |
---|
[430] | 1 | #!/usr/bin/python |
---|
| 2 | |
---|
| 3 | # TODO handle dev versions as well |
---|
| 4 | |
---|
| 5 | import os |
---|
| 6 | import shutil |
---|
| 7 | import socket |
---|
| 8 | import optparse |
---|
| 9 | import re |
---|
| 10 | |
---|
| 11 | cvsDir = ':gserver:isscvs.cern.ch:/local/reps/madx' |
---|
| 12 | |
---|
| 13 | def main(): |
---|
| 14 | # expect this script to run on pcslux99 |
---|
| 15 | host = socket.gethostname() |
---|
| 16 | if not host == 'pcslux99': |
---|
| 17 | raise("expect this script to run on pcslux99") |
---|
| 18 | |
---|
| 19 | # get the release _compulsory_ option |
---|
| 20 | usage = "%prog options" |
---|
| 21 | parser = optparse.OptionParser(usage) |
---|
| 22 | parser.add_option("-r","--release",help="the release tag in the form madX_xx_yy where xx and yy are two-digit numbers",dest="release") |
---|
| 23 | (options,args) = parser.parse_args() |
---|
| 24 | if not options.release: |
---|
| 25 | raise("expect a release to be passed as compulsory option") |
---|
| 26 | # check well formedness of the release tag |
---|
| 27 | pattern = re.compile(r'^madX_\d{2}\-\d{2}$') |
---|
| 28 | m = pattern.match(options.release) |
---|
| 29 | if not m: |
---|
| 30 | raise("expect release tag to be of the form madX_xx-yy where xx and yy are two-digit numbers") |
---|
| 31 | |
---|
| 32 | |
---|
| 33 | |
---|
| 34 | |
---|
| 35 | |
---|
| 36 | initialDir = os.getcwd() |
---|
| 37 | checkout = 'cvs -d '+cvsDir+' checkout madX' |
---|
| 38 | try: |
---|
| 39 | shutil.rmtree('./madX') # clean-up the directory |
---|
| 40 | except: |
---|
| 41 | pass |
---|
| 42 | os.system(checkout) |
---|
| 43 | os.chdir('./madX') |
---|
| 44 | make = 'make' |
---|
| 45 | os.system(make) |
---|
| 46 | |
---|
| 47 | # now copy to the AFS web-folder |
---|
| 48 | |
---|
| 49 | # back to the inital dir |
---|
| 50 | os.chdir(initialDir) |
---|
| 51 | |
---|
| 52 | |
---|
| 53 | if __name__ == "__main__": |
---|
| 54 | main() |
---|
Note: See
TracBrowser
for help on using the repository browser.