X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=blobdiff_plain;f=push-all;h=ef4dbc8d53150cceb5c6fb9aa0f2844c4cf01c94;hp=a5c20629cdcf7589758b998090cf8bbc812ada72;hb=c4ec8f2a77894af1c6160c4e8ad5625ab62f0bea;hpb=813725ad928c03af656822aeadbcca0dc0b3ced4 diff --git a/push-all b/push-all index a5c2062..ef4dbc8 100644 --- a/push-all +++ b/push-all @@ -2,8 +2,6 @@ use strict; -my @top_dirs = ("nofib", "testsuite"); - my $reporoot; my $verbose = 1; @@ -11,8 +9,8 @@ my $ignore_failure = 0; # --checked-out says we are pushing to a checked out tree my $checked_out = 0; -# --core-only says we only want to push corelibs, not extralibs -my $core_only = 0; +# --push or --pull or --send? +my $push_pull_send = "push"; sub message { if ($verbose) { @@ -32,32 +30,53 @@ sub darcs { } sub darcs_push { - darcs ("push", "--no-set-default", @_); + darcs ($push_pull_send, "--no-set-default", @_); } sub pushall { my $dir; - my $ghcrepo = $checked_out ? $reporoot : "$reporoot/ghc"; - darcs_push ($ghcrepo, @_); - for $dir (@top_dirs) { - if (-d $dir && -d "$dir/_darcs") { - darcs_push ("$reporoot/$dir", @_, "--repodir", $dir); - } - else { - message "== $dir not present or not a repository; skipping"; - } - } - my $library_lists = $core_only - ? "libraries/core-packages" - : "libraries/core-packages libraries/extra-packages"; - for my $pkg (`cat $library_lists`) { - chomp $pkg; - $dir = "libraries/$pkg"; - if (-d "$dir") { - darcs_push ("$reporoot/$dir", @_, "--repodir", "$dir"); + my $localpath; + my $remotepath; + my $path; + my $tag; + my @repos; + + open IN, "< packages" or die "Can't open packages file"; + @repos = ; + close IN; + + REPO: foreach (@repos) { + chomp; + if (/^([^# ]+) +(?:([^ ]+) +)?([^ ]+) +([^ ]+)$/) { + $localpath = $1; + $tag = defined($2) ? $2 : ""; + $remotepath = $3; + + if ($checked_out) { + $path = "$reporoot/$localpath"; + } + else { + if ($remotepath =~ /^http:/) { + message "Ignoring $localpath; remote is http URL"; + next REPO; + } + else { + $path = "$reporoot/$remotepath"; + } + } + + if (-d "$localpath/_darcs") { + darcs_push ($path, @_, "--repodir", $localpath); + } + elsif ($tag eq "") { + message "== Required repo $localpath is missing! Skipping"; + } + else { + message "== $localpath repo not present; skipping"; + } } - else { - warning("$pkg doesn't exist, use 'darcs-all get' to get it"); + elsif (! /^(#.*)?$/) { + die "Bad line: $_"; } } } @@ -81,8 +100,14 @@ sub main { elsif ($arg eq "--checked-out") { $checked_out = 1; } - elsif ($arg eq "--core-only") { - $core_only = 1; + elsif ($arg eq "--push") { + $push_pull_send = "push"; + } + elsif ($arg eq "--pull") { + $push_pull_send = "pull"; + } + elsif ($arg eq "--send") { + $push_pull_send = "send"; } else { $reporoot = $arg;