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

Diff for /JSOC/build/buildprod.py between version 1.4 and 1.10

version 1.4, 2015/02/13 18:57:34 version 1.10, 2016/05/24 18:29:23
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' # PROD_ROOTDIR = '/tmp/arta'
Line 40  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 50  os.environ['JSOC_DEBUG'] = '0'
Line 76  os.environ['JSOC_DEBUG'] = '0'
 # Make sure the JSOCROOT is PROD_ROOTDIR + '/JSOC' # Make sure the JSOCROOT is PROD_ROOTDIR + '/JSOC'
 os.environ['JSOCROOT'] = 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())
  
           # Set 'GLOBALHSTAGOVERRIDE'
           if 'GLOBALHSTAGOVERRIDE' in os.environ:
               del os.environ['GLOBALHSTAGOVERRIDE']
           os.environ['GLOBALHSTAGOVERRIDE'] = 'globalhs'
   
           if optD['full']:
               cmdList = ['./configure']
           else:
         cmdList = ['./configure', '-d']         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']:
               # Unset 'GLOBALHSTAGOVERRIDE'
               if 'GLOBALHSTAGOVERRIDE' in os.environ:
                   del os.environ['GLOBALHSTAGOVERRIDE']
  
         cmdList = ['chgrp', '-R', 'jsoc', '.']              cmdList = ['/usr/bin/make', 'globalhs',]
               check_call(cmdList)
   
           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 80  except ValueError:
Line 118  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
   
       etype = exc.args[0]
       msg = exc.args[1]
   
       if etype != 'getArgs':
     raise # Re-raise     raise # Re-raise
   
       print(msg, file=sys.stderr)


Legend:
Removed from v.1.4  
changed lines
  Added in v.1.10

Karen Tian
Powered by
ViewCVS 0.9.4