(file) Return to buildprod.py CVS log (file) (dir) Up to [Development] / JSOC / build

Diff for /JSOC/build/buildprod.py between version 1.1 and 1.7

version 1.1, 2015/02/02 19:17:04 version 1.7, 2015/03/30 15:17:12
Line 5  import sys
Line 5  import sys
 import os import os
 import pwd import pwd
 from subprocess import check_output, check_call, call, Popen, CalledProcessError from subprocess import check_output, check_call, call, Popen, CalledProcessError
   sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), '../base/libs/py'))
   from drmsCmdl import CmdlParser
  
 PROD_ROOTDIR = '/home/jsoc/cvs/Development' PROD_ROOTDIR = '/home/jsoc/cvs/Development'
   # PROD_ROOTDIR = '/tmp/arta'
 WAYSTATION = 'waystation' WAYSTATION = 'waystation'
 WAYSTATION_USER = 'arta' WAYSTATION_USER = 'arta'
  
Line 39  class Chdir:
Line 42  class Chdir:
         else:         else:
             return 1             return 1
  
   optD = {}
   
   try:
       parser = CmdlParser(usage='%(prog)s [ -f ]')
   
       # Optional
       parser.add_argument('-f', '--full', help='Create/re-create all links and create/re-create all localization parameter files.', dest='full', action='store_true', default=False)
   
       args = parser.parse_args()
   
       optD['full'] = args.full
   
   except Exception as exc:
       if len(exc.args) != 2:
           raise # Re-raise
   
       etype = exc.args[0]
       msg = exc.args[1]
   
       if etype == 'CmdlParser-ArgUnrecognized' or etype == 'CmdlParser-ArgBadformat' or etype == 'CmdlParser':
           raise Exception('getArgs', 'cl', 'Unable to parse command-line arguments. ' + msg + '\n' + parser.format_help())
       else:
           raise # Re-raise.
   
 # Allow only arta to modify the files in the waystation. # Allow only arta to modify the files in the waystation.
 if pwd.getpwuid(os.getuid())[0] != WAYSTATION_USER: if pwd.getpwuid(os.getuid())[0] != WAYSTATION_USER:
     sys.exit(RV_ERROR_WRONGUSER)     sys.exit(RV_ERROR_WRONGUSER)
Line 46  if pwd.getpwuid(os.getuid())[0] != WAYST
Line 73  if pwd.getpwuid(os.getuid())[0] != WAYST
 # Turn off debug builds. # Turn off debug builds.
 os.environ['JSOC_DEBUG'] = '0' os.environ['JSOC_DEBUG'] = '0'
  
   # Make sure the JSOCROOT is PROD_ROOTDIR + '/JSOC'
   os.environ['JSOCROOT'] = PROD_ROOTDIR + '/JSOC'
   
   # Unset 'GLOBALHSTAGOVERRIDE'
   del os.environ['GLOBALHSTAGOVERRIDE']
   
 try: try:
     with Chdir(PROD_ROOTDIR + '/' + WAYSTATION + '/JSOC') as ret:     with Chdir(PROD_ROOTDIR + '/' + WAYSTATION + '/JSOC') as ret:
         # os.chdir does NOT change the environment variable $PWD. But our make system relies on PWD being the current directory.         # os.chdir does NOT change the environment variable $PWD. But our make system relies on PWD being the current directory.
         os.environ['PWD'] = os.path.realpath(os.getcwd())         os.environ['PWD'] = os.path.realpath(os.getcwd())
  
           if optD['full']:
         cmdList = ['./configure']         cmdList = ['./configure']
           else:
               cmdList = ['./configure', '-d']
         check_call(cmdList)         check_call(cmdList)
  
         cmdList = ['make']          cmdList = ['/usr/bin/make']
         check_call(cmdList)         check_call(cmdList)
         cmdList = ['/usr/bin/make', 'dsds']         cmdList = ['/usr/bin/make', 'dsds']
         check_call(cmdList)         check_call(cmdList)
           if optD['full']:
               cmdList = ['/usr/bin/make', 'globalhs', 'libdtgf.a', 'libinv2d.a', 'libpkbgn.a', 'libpkbgn360d.a', 'libprojection.a',]
               check_call(cmdList)
  
         cmdList = ['chgrp', '-R', 'jsoc', '.']          cmdList = ['chgrp', '-Rh', 'jsoc', '.']
         check_call(cmdList)         check_call(cmdList)
         cmdList = ['chmod', '-R', 'g-w', '.']         cmdList = ['chmod', '-R', 'g-w', '.']
         check_call(cmdList)         check_call(cmdList)
Line 73  except ValueError:
Line 112  except ValueError:
     print('Bad arguments to make: \n' + '\n'.join(cmdList[1:]))     print('Bad arguments to make: \n' + '\n'.join(cmdList[1:]))
     sys.exit(RV_ERROR_MAKE);     sys.exit(RV_ERROR_MAKE);
 except Exception as exc: except Exception as exc:
       if len(exc.args) != 2:
     raise # Re-raise     raise # Re-raise
   
       etype = exc.args[0]
       msg = exc.args[1]
   
       if etype != 'getArgs':
           raise # Re-raise
   
       print(msg, file=sys.stderr)


Legend:
Removed from v.1.1  
changed lines
  Added in v.1.7

Karen Tian
Powered by
ViewCVS 0.9.4