Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 22 additions & 22 deletions mkconcore.py
Original file line number Diff line number Diff line change
Expand Up @@ -706,7 +706,7 @@ def cleanup_script_files():
for node in nodes_dict:
containername,sourcecode = nodes_dict[node].split(':')
if len(sourcecode)!=0 and sourcecode.find(".")!=-1: #3/28/21
dockername,langext = sourcecode.split(".")
dockername,langext = sourcecode.rsplit(".", 1)
dockerfile_path = os.path.join(outdir, "src", f"Dockerfile.{dockername}")
if not os.path.exists(dockerfile_path): # 3/30/21
try:
Expand Down Expand Up @@ -750,7 +750,7 @@ def cleanup_script_files():
for node in nodes_dict:
containername,sourcecode = nodes_dict[node].split(':')
if len(sourcecode)!=0 and sourcecode.find(".")!=-1: #3/28/21
dockername,langext = sourcecode.split(".")
dockername,langext = sourcecode.rsplit(".", 1)
fbuild.write("mkdir docker-"+dockername+"\n")
fbuild.write("cd docker-"+dockername+"\n")
fbuild.write("cp ../src/Dockerfile."+dockername+" Dockerfile\n")
Expand Down Expand Up @@ -788,7 +788,7 @@ def cleanup_script_files():
# Use safe_container
frun.write(DOCKEREXE+' run --name='+safe_container+volswr[i]+volsro[i]+" "+DOCKEREPO+"/docker-"+shlex.quote(sourcecode)+"&\n")
else:
dockername,langext = sourcecode.split(".")
dockername,langext = sourcecode.rsplit(".", 1)
logging.debug(f"Generating Docker run command for {dockername}: {DOCKEREXE} run --name={containername+volswr[i]+volsro[i]} docker-{dockername}")
# Use safe_container
frun.write(DOCKEREXE+' run --name='+safe_container+volswr[i]+volsro[i]+" docker-"+shlex.quote(dockername)+"&\n")
Expand All @@ -800,8 +800,8 @@ def cleanup_script_files():
for node in nodes_dict:
containername,sourcecode = nodes_dict[node].split(':')
if len(sourcecode)!=0:
#dockername,langext = sourcecode.split(".")
dockername = sourcecode.split(".")[0] # 3/28/21
#dockername,langext = sourcecode.rsplit(".", 1)
dockername = sourcecode.rsplit(".", 1)[0] # 3/28/21
safe_container = shlex.quote(containername)
fstop.write(DOCKEREXE+' stop '+safe_container+"\n")
fstop.write(DOCKEREXE+' rm '+safe_container+"\n")
Expand All @@ -813,7 +813,7 @@ def cleanup_script_files():
for node in nodes_dict:
containername,sourcecode = nodes_dict[node].split(':')
if len(sourcecode)!=0:
dockername = sourcecode.split(".")[0] #3/28/21
dockername = sourcecode.rsplit(".", 1)[0] #3/28/21
writeedges = volswr[i]
while writeedges.find(":") != -1:
#scape volume path using shlex.quote for Docker commands (defense-in-depth)
Expand All @@ -833,7 +833,7 @@ def cleanup_script_files():
for node in nodes_dict:
containername,sourcecode = nodes_dict[node].split(':')
if len(sourcecode)!=0:
dockername = sourcecode.split(".")[0] #3/28/21
dockername = sourcecode.rsplit(".", 1)[0] #3/28/21
writeedges = volswr[i]
while writeedges.find(":") != -1:
fmaxtime.write(' -v ')
Expand All @@ -850,7 +850,7 @@ def cleanup_script_files():
for node in nodes_dict:
containername,sourcecode = nodes_dict[node].split(':')
if len(sourcecode)!=0:
dockername = sourcecode.split(".")[0] #3/28/21
dockername = sourcecode.rsplit(".", 1)[0] #3/28/21
writeedges = volswr[i]
while writeedges.find(":") != -1:
fmaxtime.write('sudo docker cp concore.maxtime concore:/')
Expand All @@ -876,7 +876,7 @@ def cleanup_script_files():
for node in nodes_dict:
containername,sourcecode = nodes_dict[node].split(':')
if len(sourcecode)!=0:
dockername = sourcecode.split(".")[0] #3/28/21
dockername = sourcecode.rsplit(".", 1)[0] #3/28/21
writeedges = volswr[i]
while writeedges.find(":") != -1:
fparams.write(' -v ')
Expand All @@ -893,7 +893,7 @@ def cleanup_script_files():
for node in nodes_dict:
containername,sourcecode = nodes_dict[node].split(':')
if len(sourcecode)!=0:
dockername = sourcecode.split(".")[0] #3/28/21
dockername = sourcecode.rsplit(".", 1)[0] #3/28/21
writeedges = volswr[i]
while writeedges.find(":") != -1:
fparams.write('sudo docker cp concore.params concore:/')
Expand All @@ -918,7 +918,7 @@ def cleanup_script_files():
for node in nodes_dict:
containername,sourcecode = nodes_dict[node].split(':')
if len(sourcecode)!=0:
dockername = sourcecode.split(".")[0] #3/28/21
dockername = sourcecode.rsplit(".", 1)[0] #3/28/21
writeedges = volswr[i]
while writeedges.find(":") != -1:
funlock.write(' -v ')
Expand All @@ -935,7 +935,7 @@ def cleanup_script_files():
for node in nodes_dict:
containername,sourcecode = nodes_dict[node].split(':')
if len(sourcecode)!=0:
dockername = sourcecode.split(".")[0] #3/28/21
dockername = sourcecode.rsplit(".", 1)[0] #3/28/21
writeedges = volswr[i]
while writeedges.find(":") != -1:
funlock.write('sudo docker cp ~/concore.apikey concore:/')
Expand All @@ -955,7 +955,7 @@ def cleanup_script_files():
for node in nodes_dict:
containername,sourcecode = nodes_dict[node].split(':')
if len(sourcecode)!=0 and sourcecode.find(".")!=-1: #3/28/21
dockername,langext = sourcecode.split(".")
dockername,langext = sourcecode.rsplit(".", 1)
# safe_container added to debug line (POSIX)
safe_container = shlex.quote(containername)
safe_image = shlex.quote("docker-" + dockername) # escape docker image name
Expand Down Expand Up @@ -984,7 +984,7 @@ def cleanup_script_files():
if sourcecode.find(".")==-1:
logging.error("cannot pull container "+sourcecode+" with control core type "+concoretype) #3/28/21
quit()
dockername,langext = sourcecode.split(".")
dockername,langext = sourcecode.rsplit(".", 1)
fbuild.write('mkdir '+containername+"\n")
source_subdir = os.path.dirname(sourcecode).replace("\\", "/")
if source_subdir:
Expand Down Expand Up @@ -1041,7 +1041,7 @@ def cleanup_script_files():
containername,sourcecode = edges_dict[edges][0].split(':')
outcount[nodes_num[edges_dict[edges][0]]] += 1
if len(sourcecode)!=0:
dockername,langext = sourcecode.split(".")
dockername,langext = sourcecode.rsplit(".", 1)
fbuild.write('cd '+containername+"\n")
if concoretype=="windows":
fbuild.write("mklink /J out"+str(outcount[nodes_num[edges_dict[edges][0]]])+" ..\\"+str(edges)+"\n")
Expand All @@ -1054,7 +1054,7 @@ def cleanup_script_files():
for node in nodes_dict:
containername,sourcecode = nodes_dict[node].split(':')
if len(sourcecode)!=0:
dockername,langext = sourcecode.split(".")
dockername,langext = sourcecode.rsplit(".", 1)
fbuild.write('cd '+containername+"\n")
for pair in indir[i]:
volname,dirname = pair.split(':/')
Expand All @@ -1075,7 +1075,7 @@ def cleanup_script_files():
for node in nodes_dict:
containername,sourcecode = nodes_dict[node].split(':')
if len(sourcecode)!=0:
dockername,langext = sourcecode.split(".")
dockername,langext = sourcecode.rsplit(".", 1)
if not (langext in ["py","m","sh","cpp","v"]): # 6/22/21
logging.error(f"Extension .{langext} is unsupported")
quit()
Expand Down Expand Up @@ -1191,7 +1191,7 @@ def cleanup_script_files():
for node in nodes_dict:
containername,sourcecode = nodes_dict[node].split(':')
if len(sourcecode)!=0:
dockername = sourcecode.split(".")[0] # 3/28/21
dockername = sourcecode.rsplit(".", 1)[0] # 3/28/21
if concoretype=="windows":
q_container = f'"{containername}"'
fstop.write('cmd /C '+q_container+"\\concorekill\n")
Expand All @@ -1209,7 +1209,7 @@ def cleanup_script_files():
for node in nodes_dict:
containername,sourcecode = nodes_dict[node].split(':')
if len(sourcecode)!=0:
dockername = sourcecode.split(".")[0] #3/28/21
dockername = sourcecode.rsplit(".", 1)[0] #3/28/21
writeedges = volswr[i]
while writeedges.find(":") != -1:
path_part = writeedges.split(":")[0].split("-v")[1].strip()
Expand All @@ -1229,7 +1229,7 @@ def cleanup_script_files():
for node in nodes_dict:
containername,sourcecode = nodes_dict[node].split(':')
if len(sourcecode)!=0:
dockername = sourcecode.split(".")[0] #3/28/21
dockername = sourcecode.rsplit(".", 1)[0] #3/28/21
writeedges = volswr[i]
while writeedges.find(":") != -1:
path_part = writeedges.split(":")[0].split("-v")[1].strip()
Expand All @@ -1247,7 +1247,7 @@ def cleanup_script_files():
for node in nodes_dict:
containername,sourcecode = nodes_dict[node].split(':')
if len(sourcecode)!=0:
dockername = sourcecode.split(".")[0] #3/28/21
dockername = sourcecode.rsplit(".", 1)[0] #3/28/21
writeedges = volswr[i]
while writeedges.find(":") != -1:
path_part = writeedges.split(":")[0].split("-v")[1].strip()
Expand All @@ -1265,7 +1265,7 @@ def cleanup_script_files():
for node in nodes_dict:
containername,sourcecode = nodes_dict[node].split(':')
if len(sourcecode)!=0:
dockername = sourcecode.split(".")[0] #3/28/21
dockername = sourcecode.rsplit(".", 1)[0] #3/28/21
writeedges = volswr[i]
while writeedges.find(":") != -1:
path_part = writeedges.split(":")[0].split("-v")[1].strip()
Expand Down