5 # Figure out where to get the other repositories from,
6 # based on where this GHC repo came from.
7 my $defaultrepo = `cat _darcs/prefs/defaultrepo`;
12 if ($defaultrepo =~ /^...*:/) {
14 # Above regex says "at least two chars before the :", to avoid
15 # catching Win32 drives ("C:\").
16 $defaultrepo_base = $defaultrepo;
17 $defaultrepo_base =~ s#/[^/]+/?$##;
18 $checked_out_tree = 0;
20 elsif ($defaultrepo =~ /^\/|\.\.\/|.:(\/|\\)/) {
21 # Local filesystem, either absolute or relative path
22 # (assumes a checked-out tree):
23 $defaultrepo_base = $defaultrepo;
24 $checked_out_tree = 1;
27 die "Couldn't work out defaultrepo";
31 my $ignore_failure = 0;
43 print "warning: @_\n";
48 message "== running darcs @_";
49 system ("darcs", @_) == 0
51 or die "darcs failed: $?";
61 open IN, "< packages" or die "Can't open packages file";
64 if (/^([^ ]+) +(?:([^ ]+) +)?([^ ]+)/) {
66 $tag = defined($2) ? $2 : "";
68 if (-d "$localpath/_darcs") {
69 darcs (@_, "--repodir", $localpath);
72 message "== Required repo $localpath is missing! Skipping";
75 message "== $localpath repo not present; skipping";
78 elsif (! /^(#.*)?$/) {
92 if (! grep /(?:--complete|--partial)/, @_) {
93 warning("adding --partial, to override use --complete");
94 $r_flags = [@_, "--partial"];
100 open IN, "< packages" or die "Can't open packages file";
103 if (/^([^ ]+) +(?:([^ ]+) +)?([^ ]+)/) {
105 $tag = defined($2) ? $2 : "";
108 if ($checked_out_tree) {
109 $path = "$defaultrepo_base/$localpath";
112 $path = "$defaultrepo_base/$remotepath";
115 if (($tag eq "") || defined($tags{$tag})) {
117 warning("$localpath already present; omitting");
120 darcs (@$r_flags, $path, $localpath);
132 if (! -d "_darcs" || ! -d "compiler") {
133 die "error: darcs-all must be run from the top level of the ghc tree."
138 # We handle -q here as well as lower down as we need to skip over it
139 # if it comes before the darcs command
143 elsif ($arg eq "-s") {
146 # --dph says we grab the dph libs with 'get'.
147 # It has no effect on the other commands.
148 elsif ($arg eq "--dph") {
151 # --extra says we grab the extra libs with 'get'.
152 # It has no effect on the other commands.
153 elsif ($arg eq "--extra") {
154 $tags{"extralibs"} = 1;
156 # --nofib tells get to also grab the nofib repo.
157 # It has no effect on the other commands.
158 elsif ($arg eq "--nofib") {
161 # --testsuite tells get to also grab the testsuite repo.
162 # It has no effect on the other commands.
163 elsif ($arg eq "--testsuite") {
164 $tags{"testsuite"} = 1;
168 if (grep /^-q$/, @_) {
176 die "What do you want to do?";
179 if ($command eq "get") {
183 if ($command =~ /^(?:w|wh|wha|what|whats|whatsn|whatsne|whatsnew)$/) {
184 # Hack around whatsnew failing if there are no changes