From: Cédric Aguerre Date: Tue, 18 Oct 2016 16:34:43 +0000 (+0200) Subject: Fix submodules for pleiade X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=dc7fee7a4c9e6b455ebea9c753e7f50b91124b4e;p=tools%2Fpvdeliv.git Fix submodules for pleiade --- diff --git a/scripts/salome_download.py b/scripts/salome_download.py index 4ead437..e59244a 100644 --- a/scripts/salome_download.py +++ b/scripts/salome_download.py @@ -45,7 +45,32 @@ def __extractSrcFromArchive(srcLoc,srcDir,pattern): 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)) @@ -58,6 +83,8 @@ def __extractSrcFromGit(gitLoc,srcDir,pattern): 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() @@ -69,23 +96,57 @@ def __extractSrcFromGit(gitLoc,srcDir,pattern): 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): @@ -93,7 +154,7 @@ 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)