I think what SimonPJ suggested, that the build system just gives an appropriate error message if a component is missing, would be much easier to realise.

That test already exists (Makefile check-packages:) but doesn't
seem to have followed the changes in packages file format, so it
doesn't trigger.

But moving the error report to darcs-all would get the error
message earlier; before running all of "boot;configure;make".
Indeed, darcs-all does try to report missing packages, but
is currently unaware of when it has updated itself, so again,
that test doesn't necessarily trigger.

Also, summarizing conflicts and warnings (which, in darcs,
should often be errors, like failing to remove an obsolete
directory because it wasn't cleaned completely, or failing
to apply parts of a patch because of file access issues, ..)
at the end of each darcs-all run would reduce the chances
of trying to build an inconsistent repo.

My perl is very rusty, so I'll only sketch what I had in mind,
and leave it to someone with more recent perl exposure to
see whether this (completely untested!) code can be adapted
into working code for darcs-all:

$ diff darcs-all ../darcs-all
47a48,49
    my @darcs_output;

49c51,54
<     system ("darcs", @_) == 0
---

    # run darcs, keep output
    @darcs_output = `darcs @_`;
    @darcs_output != ()
51a57,67

    # keep per-package record of warnings and conflicts
    my $previous;
    foreach (@darcs_output) {
      if (/^Warning/) {
        [EMAIL PROTECTED] .= $_;
      } elsif ($previous =~ /^We have conflicts/) {
        [EMAIL PROTECTED] .= $_;
      }
      $previous = $_;
    }
57a74
    my %modtime;
59a77,79
    # keep track of who we are
    $modtime["darcs-all"] = (stat("darcs-all"))[9];
    $modtime["packages"]  = (stat("packages"))[9];
67a88,94

                # if we have updated ourselves, all bets are off
                if (($localpath==".") &&
                    (  ((stat("darcs-all"))[9] != $modtime["darcs-all"])
                    || ((stat("packages"))[9] != $modtime["packages"])
                    ))
                    { die "darcs-all or packages updated; please re-run your 
darcs-all command"; }

The per-package records of warnings and conflicts, indexed by
$localpath (which, in sub darcs, seems to be @_[$#_]), would
need to be printed at the end of the run, and their variables be
declared somewhere. darcs seems to report both conflicts and
warnings to stdout.

Claus

"darcs-all get; darcs-all pull -a; sh validate" instead of just the  latter two.

actually, since pull might change darcs-all or packages, either of  which
may change what "darcs-all get" does, that needs to be

"darcs-all pull -a; darcs-all get; sh validate"

which, since pull might change darcs-all, directly or via packages,  becomes

"darcs pull -a; darcs-all pull -a; darcs-all get; sh validate"

which, since pull might change distclean, becomes

"make distclean; darcs pull -a; darcs-all pull -a; darcs-all get; sh  validate"

fun, isn't it?-)

It would be useful if the three middle steps were reliably automated by darcs-all. Currently, "darcs-all pull" does actually give the error message suggesting "darcs-all get" that you asked for, but only if it started from up to date darcs-all and packages in the first place.
So, "darcs-all pull" should:

1 recognize if the initial pull from the ghc repo changes darcs- all itself or packages, and either suggest to restart
  darcs-all (aborting before trying to pull the other repos), or     initiate 
that restart itself

2 possibly initiate a "darcs-all get" for missing core packages

3 keep a log, and at the end of operations, search that log for
  a missing packages
  b darcs "warnings" that indicate that the repo is in a strange
      state (renaming failed, remove directory failed,..)
  c darcs conflicts messages (listing files that need looking at)

  summarizing these bits of information (that otherwise get
  overlooked quite easily) before terminating.

Claus



_______________________________________________
Cvs-ghc mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/cvs-ghc

Reply via email to