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: $?";
59 open IN, "< packages" or die "Can't open packages file";
62 if (/^([^# ]+) +(?:([^ ]+) +)?([^ ]+) +([^ ]+)$/) {
64 $tag = defined($2) ? $2 : "";
66 if (-d "$localpath/_darcs") {
67 darcs (@_, "--repodir", $localpath);
70 message "== Required repo $localpath is missing! Skipping";
73 message "== $localpath repo not present; skipping";
76 elsif (! /^(#.*)?$/) {
90 if (! grep /(?:--complete|--partial)/, @_) {
91 warning("adding --partial, to override use --complete");
92 $r_flags = [@_, "--partial"];
98 open IN, "< packages" or die "Can't open packages file";
101 if (/^([^ ]+) +(?:([^ ]+) +)?([^ ]+) +([^ ]+)$/) {
103 $tag = defined($2) ? $2 : "";
106 if ($checked_out_tree) {
107 $path = "$defaultrepo_base/$localpath";
110 $path = "$defaultrepo_base/$remotepath";
113 if (($tag eq "") || defined($tags{$tag})) {
115 warning("$localpath already present; omitting");
118 darcs (@$r_flags, $path, $localpath);
122 elsif (! /^(#.*)?$/) {
130 if (! -d "_darcs" || ! -d "compiler") {
131 die "error: darcs-all must be run from the top level of the ghc tree."
136 # We handle -q here as well as lower down as we need to skip over it
137 # if it comes before the darcs command
141 elsif ($arg eq "-s") {
144 # --dph says we grab the dph libs with 'get'.
145 # It has no effect on the other commands.
146 elsif ($arg eq "--dph") {
149 # --extra says we grab the extra libs with 'get'.
150 # It has no effect on the other commands.
151 elsif ($arg eq "--extra") {
152 $tags{"extralibs"} = 1;
154 # --nofib tells get to also grab the nofib repo.
155 # It has no effect on the other commands.
156 elsif ($arg eq "--nofib") {
159 # --testsuite tells get to also grab the testsuite repo.
160 # It has no effect on the other commands.
161 elsif ($arg eq "--testsuite") {
162 $tags{"testsuite"} = 1;
166 if (grep /^-q$/, @_) {
174 die "What do you want to do?";
177 if ($command eq "get") {
181 if ($command =~ /^(?:w|wh|wha|what|whats|whatsn|whatsne|whatsnew)$/) {
182 # Hack around whatsnew failing if there are no changes