7 # ./darcs-all [-q] [-s] [--dph] [--extra] [--nofib] [--testsuite] get [darcs get flags]
8 # This gets the GHC core repos, if they do not already exist.
9 # -q says to be quite, and -s to be silent.
10 # --dph, --extra, --nofib, --testsuite also get the dph library,
11 # extralibs, nofib and testsuite
13 # The darcs get flag you are most likely to want is --complete. By
14 # default we pass darcs the --partial flag.
16 # ./darcs-all [-q] [-s] cmd [darcs cmd flags]
17 # This runs the darcs "cmd" command, with any flags you give, in all
18 # of the repos you have checked out. e.g.
20 # ./darcs-all -q send --dry-run
21 # -q says to be quite, and -s to be silent.
23 $| = 1; # autoflush stdout after each print, to avoid output after die
25 # Figure out where to get the other repositories from,
26 # based on where this GHC repo came from.
27 my $defaultrepo = `cat _darcs/prefs/defaultrepo`;
32 if ($defaultrepo =~ /^...*:/) {
34 # Above regex says "at least two chars before the :", to avoid
35 # catching Win32 drives ("C:\").
36 $defaultrepo_base = $defaultrepo;
37 $defaultrepo_base =~ s#/[^/]+/?$##;
38 $checked_out_tree = 0;
40 elsif ($defaultrepo =~ /^\/|\.\.\/|.:(\/|\\)/) {
41 # Local filesystem, either absolute or relative path
42 # (assumes a checked-out tree):
43 $defaultrepo_base = $defaultrepo;
44 $checked_out_tree = 1;
47 die "Couldn't work out defaultrepo";
51 my $ignore_failure = 0;
63 print "warning: @_\n";
68 message "== running darcs @_";
69 system ("darcs", @_) == 0
71 or die "darcs failed: $?";
80 open IN, "< packages" or die "Can't open packages file";
86 if (/^([^# ]+) +(?:([^ ]+) +)?([^ ]+) +([^ ]+)$/) {
88 $tag = defined($2) ? $2 : "";
90 if (-d "$localpath/_darcs") {
91 darcs (@_, "--repodir", $localpath);
94 message "== Required repo $localpath is missing! Skipping";
97 message "== $localpath repo not present; skipping";
100 elsif (! /^(#.*)?$/) {
114 if (! grep /(?:--complete|--partial)/, @_) {
115 warning("adding --partial, to override use --complete");
116 $r_flags = [@_, "--partial"];
122 open IN, "< packages" or die "Can't open packages file";
128 if (/^([^ ]+) +(?:([^ ]+) +)?([^ ]+) +([^ ]+)$/) {
130 $tag = defined($2) ? $2 : "";
133 if ($checked_out_tree) {
134 $path = "$defaultrepo_base/$localpath";
137 if ($remotepath =~ /^http:/) {
141 $path = "$defaultrepo_base/$remotepath";
145 if (($tag eq "") || defined($tags{$tag})) {
147 warning("$localpath already present; omitting");
150 darcs (@$r_flags, $path, $localpath);
154 elsif (! /^(#.*)?$/) {
161 if (! -d "_darcs" || ! -d "compiler") {
162 die "error: darcs-all must be run from the top level of the ghc tree."
167 # We handle -q here as well as lower down as we need to skip over it
168 # if it comes before the darcs command
172 elsif ($arg eq "-s") {
175 # --dph says we grab the dph libs with 'get'.
176 # It has no effect on the other commands.
177 elsif ($arg eq "--dph") {
180 # --extra says we grab the extra libs with 'get'.
181 # It has no effect on the other commands.
182 elsif ($arg eq "--extra") {
183 $tags{"extralibs"} = 1;
185 # --nofib tells get to also grab the nofib repo.
186 # It has no effect on the other commands.
187 elsif ($arg eq "--nofib") {
190 # --testsuite tells get to also grab the testsuite repo.
191 # It has no effect on the other commands.
192 elsif ($arg eq "--testsuite") {
193 $tags{"testsuite"} = 1;
197 if (grep /^-q$/, @_) {
205 die "What do you want to do?";
208 if ($command eq "get") {
212 if ($command =~ /^(?:w|wh|wha|what|whats|whatsn|whatsne|whatsnew)$/) {
213 # Hack around whatsnew failing if there are no changes