summaryrefslogtreecommitdiff
path: root/.gitlab
diff options
context:
space:
mode:
authorÖmer Sinan Ağacan <omeragacan@gmail.com>2019-07-23 06:36:03 +0300
committerMarge Bot <ben+marge-bot@smart-cactus.org>2019-07-23 11:44:38 -0400
commitf9af30f856b0e6f78d6857fc6d69db3495bb1635 (patch)
treebf79270bfebf178ec405eee35cebe114644a6739 /.gitlab
parent4c7a84627556cda9491300ba61f3060e357bc3ac (diff)
downloadhaskell-f9af30f856b0e6f78d6857fc6d69db3495bb1635.tar.gz
Remove fix-submodules.py
Now that we have absolute paths for submodules (since a76b233d) we no longer need this script.
Diffstat (limited to '.gitlab')
-rwxr-xr-x.gitlab/fix-submodules.py53
1 files changed, 0 insertions, 53 deletions
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()