gitmodules: Make git submodule paths absolute wip/absolute-submodules
authorBen Gamari <ben@smart-cactus.org>
Tue, 19 Feb 2019 07:02:09 +0000 (02:02 -0500)
committerBen Gamari <ben@well-typed.com>
Fri, 15 Mar 2019 17:01:22 +0000 (13:01 -0400)
Several people have requested this change. I was weakly on the side of
keeping them relative but ultimately it just doesn't matter much one way
or the other.

.gitlab-ci.yml
.gitlab/fix-submodules.py [deleted file]
.gitmodules

index 483fd89..b73b4d8 100644 (file)
@@ -1,14 +1,12 @@
 variables:
   GIT_SSL_NO_VERIFY: "1"
 
+  GIT_SUBMODULE_STRATEGY: normal
+
   # Commit of ghc/ci-images repository from which to pull Docker images
   DOCKER_REV: 6d19c3adc1f5c28c82aed8c5b1ac40931ac60f3f
 
 before_script:
-  - python3 .gitlab/fix-submodules.py
-  - git submodule sync --recursive
-  - git submodule update --init --recursive
-  - git checkout .gitmodules
   - "git fetch https://gitlab.haskell.org/ghc/ghc-performance-notes.git refs/notes/perf:refs/notes/perf || true"
 
 stages:
@@ -81,10 +79,6 @@ validate-x86_64-linux-deb8-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
     - "git fetch https://gitlab.haskell.org/ghc/ghc-performance-notes.git refs/notes/perf:refs/notes/perf || true"
   tags:
     - x86_64-linux
@@ -95,10 +89,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
   tags:
     - x86_64-linux
   script:
@@ -172,10 +162,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
     - "git fetch https://gitlab.haskell.org/ghc/ghc-performance-notes.git refs/notes/perf:refs/notes/perf || true"
 
     - bash .gitlab/darwin-init.sh
@@ -197,10 +183,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
     - "git fetch https://gitlab.haskell.org/ghc/ghc-performance-notes.git refs/notes/perf:refs/notes/perf || true"
 
     - bash .circleci/prepare-system.sh
@@ -401,10 +383,6 @@ release-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
     - "git fetch https://gitlab.haskell.org/ghc/ghc-performance-notes.git refs/notes/perf:refs/notes/perf || true"
     - bash .gitlab/win32-init.sh
   after_script:
diff --git a/.gitlab/fix-submodules.py b/.gitlab/fix-submodules.py
deleted file mode 100755 (executable)
index 548e960..0000000
+++ /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()
index 4de91b6..d6a02eb 100644 (file)
 [submodule "libraries/binary"]
        path = libraries/binary
-       url = ../packages/binary.git
+       url = https://gitlab.haskell.org/ghc/packages/binary.git
        ignore = untracked
 [submodule "libraries/bytestring"]
        path = libraries/bytestring
-       url = ../packages/bytestring.git
+       url = https://gitlab.haskell.org/ghc/packages/bytestring.git
        ignore = untracked
 [submodule "libraries/Cabal"]
        path = libraries/Cabal
-       url = ../packages/Cabal.git
+       url = https://gitlab.haskell.org/ghc/packages/Cabal.git
        ignore = untracked
 [submodule "libraries/containers"]
        path = libraries/containers
-       url = ../packages/containers.git
+       url = https://gitlab.haskell.org/ghc/packages/containers.git
        ignore = untracked
 [submodule "libraries/haskeline"]
        path = libraries/haskeline
-       url = ../packages/haskeline.git
+       url = https://gitlab.haskell.org/ghc/packages/haskeline.git
        ignore = untracked
 [submodule "libraries/pretty"]
        path = libraries/pretty
-       url = ../packages/pretty.git
+       url = https://gitlab.haskell.org/ghc/packages/pretty.git
        ignore = untracked
 [submodule "libraries/terminfo"]
        path = libraries/terminfo
-       url = ../packages/terminfo.git
+       url = https://gitlab.haskell.org/ghc/packages/terminfo.git
        ignore = untracked
 [submodule "libraries/transformers"]
        path = libraries/transformers
-       url = ../packages/transformers.git
+       url = https://gitlab.haskell.org/ghc/packages/transformers.git
        ignore = untracked
 [submodule "libraries/xhtml"]
        path = libraries/xhtml
-       url = ../packages/xhtml.git
+       url = https://gitlab.haskell.org/ghc/packages/xhtml.git
        ignore = untracked
 [submodule "libraries/Win32"]
        path = libraries/Win32
-       url = ../packages/Win32.git
+       url = https://gitlab.haskell.org/ghc/packages/Win32.git
        ignore = untracked
 [submodule "libraries/time"]
        path = libraries/time
-       url = ../packages/time.git
+       url = https://gitlab.haskell.org/ghc/packages/time.git
        ignore = untracked
 [submodule "libraries/array"]
        path = libraries/array
-       url = ../packages/array.git
+       url = https://gitlab.haskell.org/ghc/packages/array.git
        ignore = untracked
 [submodule "libraries/deepseq"]
        path = libraries/deepseq
-       url = ../packages/deepseq.git
+       url = https://gitlab.haskell.org/ghc/packages/deepseq.git
        ignore = untracked
 [submodule "libraries/directory"]
        path = libraries/directory
-       url = ../packages/directory.git
+       url = https://gitlab.haskell.org/ghc/packages/directory.git
        ignore = untracked
 [submodule "libraries/filepath"]
        path = libraries/filepath
-       url = ../packages/filepath.git
+       url = https://gitlab.haskell.org/ghc/packages/filepath.git
        ignore = untracked
 [submodule "libraries/hpc"]
        path = libraries/hpc
-       url = ../packages/hpc.git
+       url = https://gitlab.haskell.org/ghc/packages/hpc.git
        ignore = untracked
 [submodule "libraries/parsec"]
        path = libraries/parsec
-       url = ../packages/parsec.git
+       url = https://gitlab.haskell.org/ghc/packages/parsec.git
        ignore = untracked
 [submodule "libraries/text"]
        path = libraries/text
-       url = ../packages/text.git
+       url = https://gitlab.haskell.org/ghc/packages/text.git
        ignore = untracked
 [submodule "libraries/mtl"]
        path = libraries/mtl
-       url = ../packages/mtl.git
+       url = https://gitlab.haskell.org/ghc/packages/mtl.git
        ignore = untracked
 [submodule "libraries/process"]
        path = libraries/process
-       url = ../packages/process.git
+       url = https://gitlab.haskell.org/ghc/packages/process.git
        ignore = untracked
 [submodule "libraries/unix"]
        path = libraries/unix
-       url = ../packages/unix.git
+       url = https://gitlab.haskell.org/ghc/packages/unix.git
        ignore = untracked
        branch = 2.7
 [submodule "libraries/stm"]
        path = libraries/stm
-       url = ../packages/stm.git
+       url = https://gitlab.haskell.org/ghc/packages/stm.git
        ignore = untracked
 [submodule "utils/haddock"]
        path = utils/haddock
-       url = ../haddock.git
+       url = https://gitlab.haskell.org/ghc/haddock.git
        ignore = untracked
        branch = ghc-head
 [submodule "nofib"]
        path = nofib
-       url = ../nofib.git
+       url = https://gitlab.haskell.org/ghc/nofib.git
        ignore = untracked
 [submodule "utils/hsc2hs"]
        path = utils/hsc2hs
-       url = ../hsc2hs.git
+       url = https://gitlab.haskell.org/ghc/hsc2hs.git
        ignore = untracked
 [submodule "libffi-tarballs"]
        path = libffi-tarballs
-       url = ../libffi-tarballs.git
+       url = https://gitlab.haskell.org/ghc/libffi-tarballs.git
        ignore = untracked
 [submodule "gmp-tarballs"]
        path = libraries/integer-gmp/gmp/gmp-tarballs
-       url = ../gmp-tarballs.git
+       url = https://gitlab.haskell.org/ghc/gmp-tarballs.git