7 # ./darcs-all [-q] [-s] [--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 # --nofib, --testsuite also get the nofib and testsuite repos respectively
11 # The darcs get flag you are most likely to want is --complete. By
12 # default we pass darcs the --partial flag.
14 # ./darcs-all [-q] [-s] cmd [darcs cmd flags]
15 # This runs the darcs "cmd" command, with any flags you give, in all
16 # of the repos you have checked out. e.g.
18 # ./darcs-all -q send --dry-run
19 # -q says to be quite, and -s to be silent.
21 $| = 1; # autoflush stdout after each print, to avoid output after die
23 # Figure out where to get the other repositories from,
24 # based on where this GHC repo came from.
25 my $defaultrepo = `cat _darcs/prefs/defaultrepo`;
30 if ($defaultrepo =~ /^...*:/) {
32 # Above regex says "at least two chars before the :", to avoid
33 # catching Win32 drives ("C:\").
34 $defaultrepo_base = $defaultrepo;
35 $defaultrepo_base =~ s#/[^/]+/?$##;
36 $checked_out_tree = 0;
38 elsif ($defaultrepo =~ /^\/|\.\.\/|.:(\/|\\)/) {
39 # Local filesystem, either absolute or relative path
40 # (assumes a checked-out tree):
41 $defaultrepo_base = $defaultrepo;
42 $checked_out_tree = 1;
45 die "Couldn't work out defaultrepo";
49 my $ignore_failure = 0;
61 print "warning: @_\n";
66 message "== running darcs @_";
67 system ("darcs", @_) == 0
69 or die "darcs failed: $?";
78 open IN, "< packages" or die "Can't open packages file";
84 if (/^([^# ]+) +(?:([^ ]+) +)?([^ ]+) +([^ ]+)$/) {
86 $tag = defined($2) ? $2 : "";
88 if (-d "$localpath/_darcs") {
89 darcs (@_, "--repodir", $localpath);
92 message "== Required repo $localpath is missing! Skipping";
95 message "== $localpath repo not present; skipping";
98 elsif (! /^(#.*)?$/) {
112 if (! grep /(?:--complete|--partial)/, @_) {
113 warning("adding --partial, to override use --complete");
114 $r_flags = [@_, "--partial"];
120 open IN, "< packages" or die "Can't open packages file";
126 if (/^([^ ]+) +(?:([^ ]+) +)?([^ ]+) +([^ ]+)$/) {
128 $tag = defined($2) ? $2 : "";
131 if ($checked_out_tree) {
132 $path = "$defaultrepo_base/$localpath";
135 if ($remotepath =~ /^http:/) {
139 $path = "$defaultrepo_base/$remotepath";
143 if (($tag eq "") || defined($tags{$tag})) {
145 warning("$localpath already present; omitting");
148 darcs (@$r_flags, $path, $localpath);
152 elsif (! /^(#.*)?$/) {
159 if (! -d "_darcs" || ! -d "compiler") {
160 die "error: darcs-all must be run from the top level of the ghc tree."
165 # We handle -q here as well as lower down as we need to skip over it
166 # if it comes before the darcs command
170 elsif ($arg eq "-s") {
173 # --nofib tells get to also grab the nofib repo.
174 # It has no effect on the other commands.
175 elsif ($arg eq "--nofib") {
178 # --testsuite tells get to also grab the testsuite repo.
179 # It has no effect on the other commands.
180 elsif ($arg eq "--testsuite") {
181 $tags{"testsuite"} = 1;
185 if (grep /^-q$/, @_) {
193 die "What do you want to do?";
196 if ($command eq "get") {
200 if ($command =~ /^(?:w|wh|wha|what|whats|whatsn|whatsne|whatsnew)$/) {
201 # Hack around whatsnew failing if there are no changes