X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=darcs-all;h=6e48377c20c6bf5123de793144b58cc91b8f403b;hb=111cd8e022e516e6ba6200687150dc02171b8b75;hp=bb417060e51b3e9c0f01cef1da5adcb47a4ed012;hpb=cc002579bf0b49bd5a5f2a00dd7100c94a3f81e9;p=ghc-hetmet.git diff --git a/darcs-all b/darcs-all index bb41706..6e48377 100644 --- a/darcs-all +++ b/darcs-all @@ -2,6 +2,26 @@ use strict; +# Usage: +# +# ./darcs-all [-q] [-s] [--dph] [--extra] [--nofib] [--testsuite] get [darcs get flags] +# This gets the GHC core repos, if they do not already exist. +# -q says to be quite, and -s to be silent. +# --dph, --extra, --nofib, --testsuite also get the dph library, +# extralibs, nofib and testsuite +# repos respectively +# The darcs get flag you are most likely to want is --complete. By +# default we pass darcs the --partial flag. +# +# ./darcs-all [-q] [-s] cmd [darcs cmd flags] +# This runs the darcs "cmd" command, with any flags you give, in all +# of the repos you have checked out. e.g. +# ./darcs-all pull +# ./darcs-all -q send --dry-run +# -q says to be quite, and -s to be silent. + +$| = 1; # autoflush stdout after each print, to avoid output after die + # Figure out where to get the other repositories from, # based on where this GHC repo came from. my $defaultrepo = `cat _darcs/prefs/defaultrepo`; @@ -17,7 +37,7 @@ if ($defaultrepo =~ /^...*:/) { $defaultrepo_base =~ s#/[^/]+/?$##; $checked_out_tree = 0; } -elsif ($defaultrepo =~ /^(\.\.)?\//) { +elsif ($defaultrepo =~ /^\/|\.\.\/|.:(\/|\\)/) { # Local filesystem, either absolute or relative path # (assumes a checked-out tree): $defaultrepo_base = $defaultrepo; @@ -55,13 +75,15 @@ sub darcsall { my $localpath; my $path; my $tag; - - darcs @_; + my @repos; open IN, "< packages" or die "Can't open packages file"; - while () { + @repos = ; + close IN; + + foreach (@repos) { chomp; - if (/^([^ ]+) +(?:([^ ]+) +)?([^ ]+)/) { + if (/^([^# ]+) +(?:([^ ]+) +)?([^ ]+) +([^ ]+)$/) { $localpath = $1; $tag = defined($2) ? $2 : ""; @@ -75,11 +97,10 @@ sub darcsall { message "== $localpath repo not present; skipping"; } } - elsif (! /^$/) { + elsif (! /^(#.*)?$/) { die "Bad line: $_"; } } - close IN; } sub darcsget { @@ -88,6 +109,7 @@ sub darcsget { my $remotepath; my $path; my $tag; + my @repos; if (! grep /(?:--complete|--partial)/, @_) { warning("adding --partial, to override use --complete"); @@ -98,9 +120,12 @@ sub darcsget { } open IN, "< packages" or die "Can't open packages file"; - while () { + @repos = ; + close IN; + + foreach (@repos) { chomp; - if (/^([^ ]+) +(?:([^ ]+) +)?([^ ]+)/) { + if (/^([^ ]+) +(?:([^ ]+) +)?([^ ]+) +([^ ]+)$/) { $localpath = $1; $tag = defined($2) ? $2 : ""; $remotepath = $3; @@ -109,7 +134,12 @@ sub darcsget { $path = "$defaultrepo_base/$localpath"; } else { - $path = "$defaultrepo_base/$remotepath"; + if ($remotepath =~ /^http:/) { + $path = $remotepath; + } + else { + $path = "$defaultrepo_base/$remotepath"; + } } if (($tag eq "") || defined($tags{$tag})) { @@ -121,11 +151,10 @@ sub darcsget { } } } - elsif (! /^$/) { + elsif (! /^(#.*)?$/) { die "Bad line: $_"; } } - close IN; } sub main { @@ -143,11 +172,10 @@ sub main { elsif ($arg eq "-s") { $verbose = 0; } - # --ci says we grab cabal-install repo, and the libraries it needs - # with 'get'. + # --dph says we grab the dph libs with 'get'. # It has no effect on the other commands. - elsif ($arg eq "--ci") { - $tags{"ci"} = 1; + elsif ($arg eq "--dph") { + $tags{"dph"} = 1; } # --extra says we grab the extra libs with 'get'. # It has no effect on the other commands.