+#!/usr/bin/perl -w
+
+use strict;
+
+my @top_dirs = ("nofib", "testsuite");
+
+# Figure out where to get the other repositories from,
+# based on where this GHC repo came from.
+my $defaultrepo = `cat _darcs/prefs/defaultrepo`;
+chomp $defaultrepo;
+my $defaultrepo_base;
+my $defaultrepo_lib;
+
+if ($defaultrepo =~ /^...*:/) {
+ # HTTP or SSH
+ # Above regex says "at least two chars before the :", to avoid
+ # catching Win32 drives ("C:\").
+ $defaultrepo_base = $defaultrepo;
+ $defaultrepo_base =~ s#/[^/]+/?$##;
+ $defaultrepo_lib = "$defaultrepo_base/packages";
+}
+elsif ($defaultrepo =~ /^\//) {
+ # Local filesystem, absolute path (assumes a checked-out tree):
+ $defaultrepo_base = $defaultrepo;
+ $defaultrepo_lib = "$defaultrepo/libraries";
+}
+elsif ($defaultrepo =~ /^..\//) {
+ # Local filesystem, relative path (assumes a checked-out tree):
+ $defaultrepo_base = $defaultrepo;
+ $defaultrepo_lib = "$defaultrepo/libraries";
+}
+else {
+ die "Couldn't work out defaultrepo";
+}