4 Created on Wed Nov 20 15:56:47 EST 2019
12 import multiprocessing
as mp
18 "login" :
"seadasdev201",
19 "initStr" :
"source .bash_profile && source /opt/rh/devtoolset-7/enable",
32 "login" :
"analysis401",
33 "initStr" :
"source .profile",
38 "name" :
"macosx_intel",
40 "initStr" :
"source .bash_profile",
41 "exitStr" :
" && fix_mac_rpath.py"
45 firstRunStr =
" && if [ ! -d ocssw ]; then mkdir ocssw; fi && if [ ! -d ocssw/share ]; then mkdir ocssw/share; fi && if [ ! -d ocssw/testdata ]; then mkdir ocssw/testdata; fi && if [ ! -d ocssw/var ]; then mkdir ocssw/var; fi && if [ ! -d ocssw/opt ]; then mkdir ocssw/opt; fi"
46 saveOcsswStr =
" && rm -rf saveOcssw && mkdir saveOcssw && cd ocssw && mv share testdata var ../saveOcssw"
47 restoreOcsswStr =
" && rm -rf share/modis && mv ../saveOcssw/share ../saveOcssw/testdata ../saveOcssw/var ."
48 saveOptStr =
" && mv opt ../saveOcssw"
49 restoreOptStr =
" && mv ../saveOcssw/opt ."
50 getOcsswStr =
" && cd && rm -rf ocssw && git clone https://oceandata.sci.gsfc.nasa.gov/rcs/obpg/ocssw.git && cd ocssw && source OCSSW_bash.env"
51 getSubmodulesStr =
" && git submodule init && git submodule update"
52 buildOptStr =
" && ./get_lib3_src.sh && cd opt/src && ./BuildIt.py && cd ../.."
53 buildOcsswStr =
" && mkdir build && cd build && cmake .. -DBUILD_ALL=1 && make -j 20 install"
54 getViirsStr =
" && cd && rm -rf viirs_l1 && git clone https://oceandata.sci.gsfc.nasa.gov/rcs/viirs/viirs_l1.git && cd viirs_l1"
55 buildViirsStr =
" && mkdir build && cd build && cmake .. && make -j 20 install"
56 getFocsStr =
" && cd && rm -rf focs && git clone https://oceandata.sci.gsfc.nasa.gov/rcs/obpg/focs.git && cd focs"
57 buildFocsStr =
" && mkdir build && cd build && cmake .. && make -j 20 install"
60 def doIt(cmd, logFilename, out):
61 logFile = open(logFilename,
"w")
62 result = subprocess.run(cmd, shell=
True, stderr=subprocess.STDOUT, stdout=logFile)
64 out.put(result.returncode)
70 parser = argparse.ArgumentParser(description=
"Build OCSSW on all of our architectures")
71 parser.add_argument(
"-t",
"--tag", default=
None,
72 help=
"git tag or branch that you want to build")
73 parser.add_argument(
"-a",
"--arch", default=
None,
74 help=
"comma separated list of architectures that you want to build (linux_64,odps,macosx_intel)")
75 parser.add_argument(
"--build_opt", default=
False, action=
"store_true",
76 help=
"build opt (lib3) first")
79 args = parser.parse_args()
84 for info
in machineInfo:
85 machineList.append(info[
"name"])
86 archList = args.arch.split(
',')
88 if arch
not in machineList:
89 print(
"Architecture", arch,
"is not in the list of supported architectures")
98 for info
in machineInfo:
100 if info[
"name"]
not in args.arch:
104 runList.append(info[
"name"])
105 print(
"\n---making", info[
"name"])
107 commandLine =
"ssh " + info[
"login"] +
' "' + info[
"initStr"] + firstRunStr + saveOcsswStr
108 if not args.build_opt:
109 commandLine += saveOptStr
110 commandLine += getOcsswStr
112 commandLine +=
" && git checkout " + args.tag
113 commandLine += getSubmodulesStr
115 commandLine += buildOptStr
117 commandLine += restoreOptStr
118 commandLine += restoreOcsswStr
119 commandLine +=
" && rm -rf ../saveOcssw"
120 commandLine += buildOcsswStr
123 commandLine += getViirsStr
125 commandLine +=
" && git checkout " + args.tag
126 commandLine += getSubmodulesStr
127 commandLine += buildViirsStr
130 commandLine += getFocsStr
132 commandLine +=
" && git checkout " + args.tag
133 commandLine += getSubmodulesStr
134 commandLine += buildFocsStr
136 commandLine += info[
"exitStr"]
139 logFilename =
"build." + info[
"name"] +
".log"
141 processes.append(mp.Process(target=doIt, args=(commandLine, logFilename, output)))
144 print(
"Architecture", args.arch,
"is not valid")
147 print(
"Starting Processes")
153 print(
"Waiting for Processes")
159 print(
"Checking results")
168 print(runList[count],
"return code =", tmp)
170 print(runList[count],
"Success")
175 print(
"Everyting completed successfully.")
180 if __name__ ==
"__main__":