From f9af30f856b0e6f78d6857fc6d69db3495bb1635 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=96mer=20Sinan=20A=C4=9Facan?= Date: Tue, 23 Jul 2019 06:36:03 +0300 Subject: Remove fix-submodules.py Now that we have absolute paths for submodules (since a76b233d) we no longer need this script. --- .gitlab-ci.yml | 7 ------- .gitlab/fix-submodules.py | 53 ----------------------------------------------- 2 files changed, 60 deletions(-) delete mode 100755 .gitlab/fix-submodules.py diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 9a081fd159..16ae89c3e4 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -12,7 +12,6 @@ variables: GIT_DEPTH: 0 before_script: - - python3 .gitlab/fix-submodules.py - git submodule sync --recursive - git submodule update --init --recursive - git checkout .gitmodules @@ -217,7 +216,6 @@ validate-x86_64-linux-deb9-hadrian: before_script: # workaround for docker permissions - sudo chown ghc:ghc -R . - - python3 .gitlab/fix-submodules.py - git submodule sync --recursive - git submodule update --init --recursive - git checkout .gitmodules @@ -232,7 +230,6 @@ hadrian-ghc-in-ghci: before_script: # workaround for docker permissions - sudo chown ghc:ghc -R . - - python3 .gitlab/fix-submodules.py - git submodule sync --recursive - git submodule update --init --recursive - git checkout .gitmodules @@ -313,7 +310,6 @@ validate-x86_64-darwin: TEST_ENV: "x86_64-darwin" before_script: - git clean -xdf && git submodule foreach git clean -xdf - - python3 .gitlab/fix-submodules.py - git submodule sync --recursive - git submodule update --init --recursive - git checkout .gitmodules @@ -347,7 +343,6 @@ validate-x86_64-darwin: TEST_ENV: "x86_64-darwin" before_script: - git clean -xdf && git submodule foreach git clean -xdf - - python3 .gitlab/fix-submodules.py - git submodule sync --recursive - git submodule update --init --recursive - git checkout .gitmodules @@ -379,7 +374,6 @@ validate-x86_64-darwin: - x86_64-linux before_script: - git clean -xdf && git submodule foreach git clean -xdf - - python3 .gitlab/fix-submodules.py - git submodule sync --recursive - git submodule update --init --recursive - git checkout .gitmodules @@ -684,7 +678,6 @@ validate-x86_64-linux-fedora27: set TEMP=%cd%\tmp - set PATH=C:\msys64\usr\bin;%PATH% - - python .gitlab/fix-submodules.py - git submodule sync --recursive - git submodule update --init --recursive - git checkout .gitmodules diff --git a/.gitlab/fix-submodules.py b/.gitlab/fix-submodules.py deleted file mode 100755 index 548e960c2a..0000000000 --- a/.gitlab/fix-submodules.py +++ /dev/null @@ -1,53 +0,0 @@ -#!/usr/bin/env python3 - -""" -Fix submodule upstream URLs. This ensures that CI builds of GHC forks -clone their submodules from its usual location. Otherwise users would need to -fork all submodules before their CI builds would succeed. -""" - -from pathlib import Path -import re - -x = open('.gitmodules').read() -x = re.sub(r"url *= *\.\.", "url = https://gitlab.haskell.org/ghc", x) -open('.gitmodules', 'w').write(x) - -import subprocess - -def get_configs(config_file): - args = ['git', 'config', '-f', config_file.as_posix(), '--list'] - out = subprocess.check_output(args) - configs = {} - for line in out.decode('UTF-8').split('\n'): - if '=' in line: - k,v = line.split('=') - configs[k] = v - - return configs - -def set_config(config_file, key, value): - args = ['git', 'config', '-f', config_file.as_posix(), '--replace', key, value] - subprocess.check_call(args) - -upstreams = { - 'utils/haddock': 'https://github.com/haskell/haddock' -} - -modules_config = Path('.gitmodules') - -def main(): - for k,v in get_configs(modules_config).items(): - match = re.match('submodule\.(.+)\.url', k) - if match is not None: - submod = match.group(1) - if submod in upstreams: - url = upstreams[submod] - else: - url = re.sub('\.\.', 'https://gitlab.haskell.org/ghc', v) - - print('Using {submod} from {url}'.format(submod=submod, url=url)) - set_config(modules_config, k, url) - -if __name__ == '__main__': - main() -- cgit v1.2.1