os.rmdir(tmpDir)
return ret
-def __extractSrcFromGit(gitLoc,srcDir,pattern):
+internal_submodules = {
+ 'ThirdParty/IceT/vtkicet':
+ 'https://git.forge.pleiade.edf.fr/git/prerequisites-salome.icet.git',
+ 'ThirdParty/QtTesting/vtkqttesting':
+ 'https://git.forge.pleiade.edf.fr/git/prerequisites-salome.QtTesting.git',
+ 'ThirdParty/protobuf/vtkprotobuf':
+ 'https://git.forge.pleiade.edf.fr/git/prerequisites-salome.protobuf.git',
+ 'Utilities/VisItBridge':
+ 'https://git.forge.pleiade.edf.fr/git/prerequisites-salome.visitbridge.git',
+ 'VTK':
+ 'https://git.forge.pleiade.edf.fr/git/prerequisites-salome.vtk.git',
+ }
+external_submodules = {
+ 'ThirdParty/IceT/vtkicet': 'https://gitlab.kitware.com/icet/icet.git',
+ 'ThirdParty/QtTesting/vtkqttesting': 'https://github.com/Kitware/QtTesting.git',
+ 'ThirdParty/protobuf/vtkprotobuf': 'https://gitlab.kitware.com/paraview/protobuf.git',
+ 'Utilities/VisItBridge': 'https://gitlab.kitware.com/paraview/visitbridge.git',
+ 'VTK': 'https://gitlab.kitware.com/vtk/vtk.git',
+ }
+
+def __extractSrcFromGit(gitLoc,srcDir,pattern,use_pleiade_mirrors=False):
+ submodules = external_submodules
+ if use_pleiade_mirrors:
+ submodules = internal_submodules
+ print submodules
+
print "Connecting to git repository: ", gitLoc[0]
zz=AutoChdir(srcDir)
assert(isinstance(gitLoc,tuple))
p=subprocess.Popen("GIT_SSL_NO_VERIFY=true git clone %s"%(gitLoc[0]), shell=True,stdout=subprocess.PIPE,stderr=subprocess.PIPE)
p_out,p_err=p.communicate()
return p.returncode, p_out, p_err
+
+ # Clone
tries=0
while True:
_status,_out,_err = __connect()
tries = tries+1
pass
assert(_status==0)
+
+ # Update git config
+ for key, val in submodules.items():
+ if val != "":
+ local_command = "git config "
+ local_command += "-f .gitmodules "
+ local_command += "submodule.%s.url %s" % (key, val)
+ p=subprocess.Popen(local_command,cwd=dirGitLoc,shell=True,stdout=subprocess.PIPE,stderr=subprocess.PIPE)
+ p.communicate()
+
else:
+
+ # Update git config
+ for key, val in submodules.items():
+ if val != "":
+ local_command = "git config "
+ local_command += "-f .gitmodules "
+ local_command += "submodule.%s.url %s" % (key, val)
+ p=subprocess.Popen(local_command,cwd=dirGitLoc,shell=True,stdout=subprocess.PIPE,stderr=subprocess.PIPE)
+ p.communicate()
+
+ # Fetch
print("Fetching %s..."%dirGitLoc)
assert(os.path.exists(os.path.join(dirGitLoc,".git")))
- p=subprocess.Popen(["git","fetch"],cwd=dirGitLoc,stdout=subprocess.PIPE,stderr=subprocess.PIPE)
+ p=subprocess.Popen(["git","fetch","--prune"],cwd=dirGitLoc,stdout=subprocess.PIPE,stderr=subprocess.PIPE)
+ p.communicate()
+ p=subprocess.Popen(["git","fetch","--tags"],cwd=dirGitLoc,stdout=subprocess.PIPE,stderr=subprocess.PIPE)
p.communicate()
pass
+ pass
+
+ # Checkout
p=subprocess.Popen(["git","checkout",gitLoc[1]],cwd=dirGitLoc,stdout=subprocess.PIPE,stderr=subprocess.PIPE)
p_out,p_err=p.communicate()
if p.returncode != 0:
msg = "Error in checkout\n" + p_err
raise Exception(msg)
+
+ # Init and Update submodules
if dirGitLoc in ["ParaView", "prerequisites-salome.paraview"]:
- p=subprocess.Popen(["git","submodule","update","--init"],cwd=dirGitLoc,stdout=subprocess.PIPE,stderr=subprocess.PIPE)
- p_out,p_err=p.communicate()
+ p=subprocess.Popen(["git","submodule","update","--init","--recursive"],cwd=dirGitLoc,stdout=subprocess.PIPE,stderr=subprocess.PIPE)
+ p.communicate()
+ if p.returncode != 0:
+ msg = "Error in submodule update\n" + p_err
+ raise Exception(msg)
+ p=subprocess.Popen(["git","checkout","--",".gitmodules"],cwd=dirGitLoc,stdout=subprocess.PIPE,stderr=subprocess.PIPE)
+ p.communicate()
if p.returncode != 0:
msg = "Error in submodule update\n" + p_err
raise Exception(msg)
+
return ret
def extractSrc(srcDir,pattern,config):
if isinstance(srcLoc,str):
return __extractSrcFromArchive(srcLoc,srcDir,pattern)
elif isinstance(srcLoc,tuple):
- return __extractSrcFromGit(srcLoc,srcDir,pattern)
+ return __extractSrcFromGit(srcLoc,srcDir,pattern, config["use_pleiade_mirrors"])
else:
raise Exception("Unrecognized localization of source : %s"%srcLoc)