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: $?";
60 open IN, "< packages" or die "Can't open packages file";
66 if (/^([^# ]+) +(?:([^ ]+) +)?([^ ]+) +([^ ]+)$/) {
68 $tag = defined($2) ? $2 : "";
70 if (-d "$localpath/_darcs") {
71 darcs (@_, "--repodir", $localpath);
74 message "== Required repo $localpath is missing! Skipping";
77 message "== $localpath repo not present; skipping";
80 elsif (! /^(#.*)?$/) {
94 if (! grep /(?:--complete|--partial)/, @_) {
95 warning("adding --partial, to override use --complete");
96 $r_flags = [@_, "--partial"];
102 open IN, "< packages" or die "Can't open packages file";
108 if (/^([^ ]+) +(?:([^ ]+) +)?([^ ]+) +([^ ]+)$/) {
110 $tag = defined($2) ? $2 : "";
113 if ($checked_out_tree) {
114 $path = "$defaultrepo_base/$localpath";
117 if ($remotepath =~ /^http:/) {
121 $path = "$defaultrepo_base/$remotepath";
125 if (($tag eq "") || defined($tags{$tag})) {
127 warning("$localpath already present; omitting");
130 darcs (@$r_flags, $path, $localpath);
134 elsif (! /^(#.*)?$/) {
141 if (! -d "_darcs" || ! -d "compiler") {
142 die "error: darcs-all must be run from the top level of the ghc tree."
147 # We handle -q here as well as lower down as we need to skip over it
148 # if it comes before the darcs command
152 elsif ($arg eq "-s") {
155 # --dph says we grab the dph libs with 'get'.
156 # It has no effect on the other commands.
157 elsif ($arg eq "--dph") {
160 # --extra says we grab the extra libs with 'get'.
161 # It has no effect on the other commands.
162 elsif ($arg eq "--extra") {
163 $tags{"extralibs"} = 1;
165 # --nofib tells get to also grab the nofib repo.
166 # It has no effect on the other commands.
167 elsif ($arg eq "--nofib") {
170 # --testsuite tells get to also grab the testsuite repo.
171 # It has no effect on the other commands.
172 elsif ($arg eq "--testsuite") {
173 $tags{"testsuite"} = 1;
177 if (grep /^-q$/, @_) {
185 die "What do you want to do?";
188 if ($command eq "get") {
192 if ($command =~ /^(?:w|wh|wha|what|whats|whatsn|whatsne|whatsnew)$/) {
193 # Hack around whatsnew failing if there are no changes