Talking with Neil about ghc build issues off list, I was reminded that my local darcs-all still differs from the standard one. I have occasionally posted it here, and small bits have made it into therepo, but I don't really know why the main changes haven't made it.
So I'm asking for comments: if you find these changes useful, andthey work for you, perhaps they get included; if you don't find these changes useful, I'll just keep them to myself!-). The changes, again:
- if darcs-all or packages have changed, stop the script and
ask the user to restart the darcs-all command, instead of
continuing with outdated information
- try summarizing any darcs warnings (file permission issues, ..),
conflicts, and missing repos at the end of the run, so that
they do not get lost if one keeps a verbose log
Claus
hunk ./darcs-all 55
+my %warnings;
+my %conflicts;
+my %missing;
+
hunk ./darcs-all 73
- system ("darcs", @_) == 0
+
+ # run darcs, track std and err output
+ open(DARCS,"darcs @_ 2>&1 |")
+ or $ignore_failure
+ or die "can't start darcs: $?";
+
+ # keep per-package record of warnings, errors and conflicts
+ my $previous = "";
+ while (<DARCS>) {
+ if (/^Warning/ || /^darcs/ || /^realdarcs/ || /^Backing/) {
+ $warnings{$_[$#_]} .= $_;
+ } elsif ($previous =~ /^We have conflicts/) {
+ $conflicts{$_[$#_]} .= $_;
+ }
+ $previous = $_;
+ print $_;
+ }
+ close(DARCS)
hunk ./darcs-all 92
- or die "darcs failed: $?";
+ or die "darcs failed ($!): $?";
hunk ./darcs-all 99
+ my %modtime;
hunk ./darcs-all 102
+ # read and close packages before calling darcs, which might
+ # try to update that file
hunk ./darcs-all 105
+
+ # keep track of who we are
+ $modtime{"darcs-all"} = (stat("darcs-all"))[9];
+ $modtime{"packages"} = (stat("packages"))[9];
hunk ./darcs-all 120
+
+ # if we have updated ourselves, all bets are off
+ if ($localpath eq ".") {
+ my $darcs_all_mod = ((stat("darcs-all"))[9] !=
$modtime{"darcs-all"});
+ my $packages_mod = ((stat("packages"))[9] !=
$modtime{"packages"});
+ if ($darcs_all_mod || $packages_mod) { [_$_]
+ summary();
+ die "'darcs-all' ".($darcs_all_mod?"(changed)":"").
+ " or 'packages' ".($packages_mod?"(changed)":"")."
updated;\n".
+ "please re-run your darcs-all command"; [_$_]
+ }
+ }
hunk ./darcs-all 135
+ $missing{$localpath} = "(required repo!)";
hunk ./darcs-all 139
+ $missing{$localpath} = "(optional '$tag' repo)";
hunk ./darcs-all 146
+ summary();
+}
+
+# summarize warnings and conflicts
+sub summary {
+ my $package;
+ if (scalar(%warnings)) {
+ print "\n-- there are Warnings\n";
+ foreach $package (keys%warnings) { [_$_]
+ print "-- Warnings for $package:\n$warnings{$package}\n";
+ }
+ }
+ if (scalar(%conflicts)) {
+ print "\n-- there are Conflicts\n"; [_$_]
+ foreach $package (keys%conflicts) { [_$_]
+ print "-- Conflicts in $package:\n$conflicts{$package}\n";
+ }
+ }
+ if (scalar(%missing)) {
+ print "\n-- there are missing packages:\n";
+ foreach $package (keys%missing) {
+ print "$package $missing{$package}\n";
+ }
+ }
darcs-all
Description: Binary data
_______________________________________________ Cvs-ghc mailing list [email protected] http://www.haskell.org/mailman/listinfo/cvs-ghc
