Fixed and simplified repository calculation, works via SSH now, too
[ghc-hetmet.git] / darcs-all
index 9efeab1..632d54d 100644 (file)
--- a/darcs-all
+++ b/darcs-all
@@ -4,8 +4,15 @@ set -e
 
 top_dirs="nofib testsuite"
 
-default_repo_root="http://darcs.haskell.org/"
-default_lib_repo_root=$default_repo_root/packages
+# Figure out where to get the other repositories from,
+# based on where this GHC repo came from.
+defaultrepo=`cat _darcs/prefs/defaultrepo`
+case $defaultrepo in
+  http://* | *@*:*)
+    defaultrepo_lib=`echo $defaultrepo | sed 's!/ghc$!!'`/packages;;
+  /*)
+    defaultrepo_lib=$defaultrepo/libraries;;
+esac
 
 quiet=NO
 
@@ -45,12 +52,6 @@ darcsget()
     *) echo "warning: adding --partial, to override use --complete"
   esac
 
-  repo_root=`cat _darcs/prefs/defaultrepo`
-  case $repo_root in
-    /*) lib_repos=$repo_root/libraries;;
-    *)  lib_repos=$default_lib_repo_root;;
-  esac
-
   cd libraries
 
   if test "$extra" = "YES"; then
@@ -63,7 +64,7 @@ darcsget()
     if test -d $pkg; then
        echo "warning: $pkg already present; omitting"
     else
-       repo=$lib_repos/$pkg
+       repo=$defaultrepo_lib/$pkg
        message "== running darcs get --partial $* $repo"
        darcs get --partial $* $repo
     fi