[commit: ghc] master: Build system: detect when user cloned from GitHub (554be5e)

git at git.haskell.org git at git.haskell.org
Tue Sep 8 08:03:38 UTC 2015


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/554be5e7959da47ba28fe36b403b9af3210448c1/ghc

>---------------------------------------------------------------

commit 554be5e7959da47ba28fe36b403b9af3210448c1
Author: Thomas Miedema <thomasmiedema at gmail.com>
Date:   Mon Sep 7 15:28:30 2015 +0200

    Build system: detect when user cloned from GitHub
    
    Cloning the ghc repository from GitHub doesn't work out of the box. It
    requires installing some special url rewrites into ~/.gitconfig. The
    build fails mysteriously if you forget. This patch tries to detect when
    you cloned from GitHub, and warns you if you didn't set those url
    rewrites.
    
    This hopefully lowers to barrier to contribute to GHC by a tiny bit. At
    least one /r/haskell user ran into this recently.
    
    Test Plan:
    cloned from github, ran ./boot, saw the message. Installed url
    rewrites, and ran ./boot again, didn't see the message.
    
    Reviewed by: austin
    
    Differential Revision: https://phabricator.haskell.org/D1230


>---------------------------------------------------------------

554be5e7959da47ba28fe36b403b9af3210448c1
 boot | 34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)

diff --git a/boot b/boot
index 7bcc7a1..2ce7acb 100755
--- a/boot
+++ b/boot
@@ -53,6 +53,40 @@ sub sanity_check_tree {
     my $tag;
     my $dir;
 
+    if (-d ".git"  &&
+        system("git config remote.origin.url | grep github.com > /dev/null") == 0 &&
+        system("git config --get-regexp '^url.*github.com/.*/packages-.insteadOf' > /dev/null") != 0) {
+        # If we cloned from github, make sure the url rewrites are set.
+        # Otherwise 'git submodule update --init' prints confusing errors.
+        die <<EOF;
+It seems you cloned this repository from GitHub. But your git config files
+don't contain the url rewrites that are needed to make this work (GitHub
+doesn't support '/' in repository names, so we use a different naming scheme
+for the submodule repositories there).
+
+Please run the following commands first:
+
+  git config --global url."git://github.com/ghc/packages-".insteadOf     git://github.com/ghc/packages/
+  git config --global url."http://github.com/ghc/packages-".insteadOf    http://github.com/ghc/packages/
+  git config --global url."https://github.com/ghc/packages-".insteadOf   https://github.com/ghc/packages/
+  git config --global url."ssh://git\@github.com/ghc/packages-".insteadOf ssh://git\@github.com/ghc/packages/
+  git config --global url."git\@github.com:/ghc/packages-".insteadOf      git\@github.com:/ghc/packages/
+
+And then:
+
+  git submodule update --init
+  ./boot
+
+Or start over, and clone the GHC repository from the haskell server:
+
+  git clone --recursive git://git.haskell.org/ghc.git
+
+For more information, see:
+  * https://ghc.haskell.org/trac/ghc/wiki/Newcomers or
+  * https://ghc.haskell.org/trac/ghc/wiki/Building/GettingTheSources#CloningfromGitHub
+EOF
+    }
+
     # Check that we have all boot packages.
     open PACKAGES, "< packages";
     while (<PACKAGES>) {



More information about the ghc-commits mailing list