X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=external%2Ffetch_sources.py;h=7b8dbe448888de23d2104a157af8cf92fa725471;hb=1688e00fec6b0dada816ce94157e33420edb72dd;hp=3913a06432bbd50d830065f2db2949fd39a880f2;hpb=ec4472b5269acbf9faea3eb49d1052ce868f9013;p=platform%2Fupstream%2FVK-GL-CTS.git diff --git a/external/fetch_sources.py b/external/fetch_sources.py index 3913a06..7b8dbe4 100644 --- a/external/fetch_sources.py +++ b/external/fetch_sources.py @@ -229,54 +229,15 @@ class SourceFile (Source): writeBinaryFile(dstPath, data) class GitRepo (Source): - def __init__(self, httpsUrl, sshUrl, revision, baseDir, extractDir = "src", removeTags = []): + def __init__(self, httpsUrl, sshUrl, revision, baseDir, extractDir = "src", removeTags = [], patch = ""): Source.__init__(self, baseDir, extractDir) self.httpsUrl = httpsUrl self.sshUrl = sshUrl self.revision = revision self.removeTags = removeTags + self.patch = patch - def detectProtocol(self, cmdProtocol = None): - # reuse parent repo protocol - proc = subprocess.Popen(['git', 'ls-remote', '--get-url', 'origin'], stdout=subprocess.PIPE, universal_newlines=True) - (stdout, stderr) = proc.communicate() - - if proc.returncode != 0: - raise Exception("Failed to execute 'git ls-remote origin', got %d" % proc.returncode) - if (stdout[:3] == 'ssh') or (stdout[:3] == 'git'): - protocol = 'ssh' - else: - # remote 'origin' doesn't exist, assume 'https' as checkout protocol - protocol = 'https' - return protocol - - def selectUrl(self, cmdProtocol = None): - try: - if cmdProtocol == None: - protocol = self.detectProtocol(cmdProtocol) - else: - protocol = cmdProtocol - except: - # fallback to https on any issues - protocol = 'https' - - if protocol == 'ssh': - if self.sshUrl != None: - url = self.sshUrl - else: - assert self.httpsUrl != None - url = self.httpsUrl - else: - assert protocol == 'https' - url = self.httpsUrl - - assert url != None - return url - - def update (self, cmdProtocol = None, force = False): - fullDstPath = os.path.join(EXTERNAL_DIR, self.baseDir, self.extractDir) - - url = self.selectUrl(cmdProtocol) + def checkout(self, url, fullDstPath, force): if not os.path.exists(os.path.join(fullDstPath, '.git')): execute(["git", "clone", "--no-checkout", url, fullDstPath]) @@ -285,23 +246,44 @@ class GitRepo (Source): for tag in self.removeTags: proc = subprocess.Popen(['git', 'tag', '-l', tag], stdout=subprocess.PIPE) (stdout, stderr) = proc.communicate() - if proc.returncode == 0: + if len(stdout) > 0: execute(["git", "tag", "-d",tag]) force_arg = ['--force'] if force else [] execute(["git", "fetch"] + force_arg + ["--tags", url, "+refs/heads/*:refs/remotes/origin/*"]) execute(["git", "checkout"] + force_arg + [self.revision]) + + if(self.patch != ""): + patchFile = os.path.join(EXTERNAL_DIR, self.patch) + execute(["git", "reset", "--hard", "HEAD"]) + execute(["git", "apply", patchFile]) finally: popWorkingDir() + def update (self, cmdProtocol, force = False): + fullDstPath = os.path.join(EXTERNAL_DIR, self.baseDir, self.extractDir) + url = self.httpsUrl + backupUrl = self.sshUrl + + # If url is none then start with ssh + if cmdProtocol == 'ssh' or url == None: + url = self.sshUrl + backupUrl = self.httpsUrl + + try: + self.checkout(url, fullDstPath, force) + except: + if backupUrl != None: + self.checkout(backupUrl, fullDstPath, force) + def postExtractLibpng (path): shutil.copy(os.path.join(path, "scripts", "pnglibconf.h.prebuilt"), os.path.join(path, "pnglibconf.h")) PACKAGES = [ SourcePackage( - "http://zlib.net/zlib-1.2.11.tar.gz", - "zlib-1.2.11.tar.gz", - "c3e5e9fdd5004dcb542feda5ee4f0ff0744628baf8ed2dd5d66f8ca1197cb1a1", + "http://zlib.net/zlib-1.2.12.tar.gz", + "zlib-1.2.12.tar.gz", + "91844808532e5ce316b3c010929493c0244f3d37593afd6de04f71821d5136d9", "zlib"), SourcePackage( "http://prdownloads.sourceforge.net/libpng/libpng-1.6.27.tar.gz", @@ -315,31 +297,36 @@ PACKAGES = [ "e7b5f0aa5b1b0eadc63a1c624c0ca7f5af133aa857d6a4271b0ef3d0bdb6868e", "renderdoc"), GitRepo( - "https://gitlab.khronos.org/spirv/spirv-tools.git", - "git@gitlab.khronos.org:spirv/spirv-tools.git", - "49ced6a8d7b61a487a36fba91ae3294c47352aeb", + "https://github.com/KhronosGroup/SPIRV-Tools.git", + "git@github.com:KhronosGroup/SPIRV-Tools.git", + "b930e734ea198b7aabbbf04ee1562cf6f57962f0", "spirv-tools"), GitRepo( - "https://gitlab.khronos.org/GLSL/glslang.git", - "git@gitlab.khronos.org:GLSL/glslang.git", - "463e8ef3f555c7b648a826b37519b093ab3daca5", + "https://github.com/KhronosGroup/glslang.git", + "git@github.com:KhronosGroup/glslang.git", + "7dda6a6347b0bd550e202942adee475956ef462a", "glslang", removeTags = ["master-tot"]), GitRepo( "https://github.com/KhronosGroup/SPIRV-Headers.git", - None, - "b42ba6d92faf6b4938e6f22ddd186dbdacc98d78", + "git@github.com:KhronosGroup/SPIRV-Headers.git", + "b765c355f488837ca4c77980ba69484f3ff277f5", "spirv-headers"), GitRepo( - "https://gitlab.khronos.org/vulkan/vulkan.git", - "git@gitlab.khronos.org:vulkan/vulkan.git", - "a19a491443b0f244de88a869b5b0559243b5c214", + "https://github.com/KhronosGroup/Vulkan-Docs.git", + "git@github.com:KhronosGroup/Vulkan-Docs.git", + "9b5562187a8ad72c171410b036ceedbc450153ba", "vulkan-docs"), GitRepo( "https://github.com/google/amber.git", - None, - "615ab4863f7d2e31d3037d0c6a0f641fd6fc0d07", + "git@github.com:google/amber.git", + "8b145a6c89dcdb4ec28173339dd176fb7b6f43ed", "amber"), + GitRepo( + "https://github.com/open-source-parsers/jsoncpp.git", + "git@github.com:open-source-parsers/jsoncpp.git", + "9059f5cad030ba11d37818847443a53918c327b1", + "jsoncpp"), ] def parseArgs (): @@ -352,7 +339,7 @@ def parseArgs (): parser.add_argument('--insecure', dest='insecure', action='store_true', default=False, help="Disable certificate check for external sources." " Minimum python version required " + versionsForInsecureStr) - parser.add_argument('--protocol', dest='protocol', default=None, choices=['ssh', 'https'], + parser.add_argument('--protocol', dest='protocol', default='https', choices=['ssh', 'https'], help="Select protocol to checkout git repositories.") parser.add_argument('--force', dest='force', action='store_true', default=False, help="Pass --force to git fetch and checkout commands")