7 # ./darcs-all [-q] [-s] [--dph] [--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, --nofib, --testsuite also get the dph library, nofib and
11 # testsuite repos respectively
12 # The darcs get flag you are most likely to want is --complete. By
13 # default we pass darcs the --partial flag.
15 # ./darcs-all [-q] [-s] cmd [darcs cmd flags]
16 # This runs the darcs "cmd" command, with any flags you give, in all
17 # of the repos you have checked out. e.g.
19 # ./darcs-all -q send --dry-run
20 # -q says to be quite, and -s to be silent.
22 $| = 1; # autoflush stdout after each print, to avoid output after die
24 # Figure out where to get the other repositories from,
25 # based on where this GHC repo came from.
26 my $defaultrepo = `cat _darcs/prefs/defaultrepo`;
31 if ($defaultrepo =~ /^...*:/) {
33 # Above regex says "at least two chars before the :", to avoid
34 # catching Win32 drives ("C:\").
35 $defaultrepo_base = $defaultrepo;
36 $defaultrepo_base =~ s#/[^/]+/?$##;
37 $checked_out_tree = 0;
39 elsif ($defaultrepo =~ /^\/|\.\.\/|.:(\/|\\)/) {
40 # Local filesystem, either absolute or relative path
41 # (assumes a checked-out tree):
42 $defaultrepo_base = $defaultrepo;
43 $checked_out_tree = 1;
46 die "Couldn't work out defaultrepo";
50 my $ignore_failure = 0;
62 print "warning: @_\n";
67 message "== running darcs @_";
68 system ("darcs", @_) == 0
70 or die "darcs failed: $?";
79 open IN, "< packages" or die "Can't open packages file";
85 if (/^([^# ]+) +(?:([^ ]+) +)?([^ ]+) +([^ ]+)$/) {
87 $tag = defined($2) ? $2 : "";
89 if (-d "$localpath/_darcs") {
90 darcs (@_, "--repodir", $localpath);
93 message "== Required repo $localpath is missing! Skipping";
96 message "== $localpath repo not present; skipping";
99 elsif (! /^(#.*)?$/) {
113 if (! grep /(?:--complete|--partial)/, @_) {
114 warning("adding --partial, to override use --complete");
115 $r_flags = [@_, "--partial"];
121 open IN, "< packages" or die "Can't open packages file";
127 if (/^([^ ]+) +(?:([^ ]+) +)?([^ ]+) +([^ ]+)$/) {
129 $tag = defined($2) ? $2 : "";
132 if ($checked_out_tree) {
133 $path = "$defaultrepo_base/$localpath";
136 if ($remotepath =~ /^http:/) {
140 $path = "$defaultrepo_base/$remotepath";
144 if (($tag eq "") || defined($tags{$tag})) {
146 warning("$localpath already present; omitting");
149 darcs (@$r_flags, $path, $localpath);
153 elsif (! /^(#.*)?$/) {
160 if (! -d "_darcs" || ! -d "compiler") {
161 die "error: darcs-all must be run from the top level of the ghc tree."
166 # We handle -q here as well as lower down as we need to skip over it
167 # if it comes before the darcs command
171 elsif ($arg eq "-s") {
174 # --dph says we grab the dph libs with 'get'.
175 # It has no effect on the other commands.
176 elsif ($arg eq "--dph") {
179 # --nofib tells get to also grab the nofib repo.
180 # It has no effect on the other commands.
181 elsif ($arg eq "--nofib") {
184 # --testsuite tells get to also grab the testsuite repo.
185 # It has no effect on the other commands.
186 elsif ($arg eq "--testsuite") {
187 $tags{"testsuite"} = 1;
191 if (grep /^-q$/, @_) {
199 die "What do you want to do?";
202 if ($command eq "get") {
206 if ($command =~ /^(?:w|wh|wha|what|whats|whatsn|whatsne|whatsnew)$/) {
207 # Hack around whatsnew failing if there are no changes