Building/Rebuilding: darcs-all-30032009.diff
| File darcs-all-30032009.diff, 3.3 KB (added by claus, 3 years ago) |
|---|
-
darcs-all
old new 52 52 53 53 my %tags; 54 54 55 my %warnings; 56 my %conflicts; 57 my %missing; 58 55 59 sub message { 56 60 if ($verbose >= 2) { 57 61 print "@_\n"; … … 66 70 67 71 sub darcs { 68 72 message "== running darcs @_"; 69 system ("darcs", @_) == 0 73 74 # run darcs, track std and err output 75 open(DARCS,"darcs @_ 2>&1 |") 76 or $ignore_failure 77 or die "can't start darcs: $?"; 78 79 # keep per-package record of warnings, errors and conflicts 80 my $previous = ""; 81 while (<DARCS>) { 82 if (/^Warning/ || /^darcs/ || /^realdarcs/ || /^Backing/) { 83 $warnings{$_[$#_]} .= $_; 84 } elsif ($previous =~ /^We have conflicts/) { 85 $conflicts{$_[$#_]} .= $_; 86 } 87 $previous = $_; 88 print $_; 89 } 90 close(DARCS) 70 91 or $ignore_failure 71 or die "darcs failed : $?";92 or die "darcs failed ($!): $?"; 72 93 } 73 94 74 95 sub darcsall { 75 96 my $localpath; 76 97 my $path; 77 98 my $tag; 99 my %modtime; 78 100 my @repos; 79 101 102 # read and close packages before calling darcs, which might 103 # try to update that file 80 104 open IN, "< packages" or die "Can't open packages file"; 105 106 # keep track of who we are 107 $modtime{"darcs-all"} = (stat("darcs-all"))[9]; 108 $modtime{"packages"} = (stat("packages"))[9]; 81 109 @repos = <IN>; 82 110 close IN; 83 111 … … 89 117 90 118 if (-d "$localpath/_darcs") { 91 119 darcs (@_, "--repodir", $localpath); 120 121 # if we have updated ourselves, all bets are off 122 if ($localpath eq ".") { 123 my $darcs_all_mod = ((stat("darcs-all"))[9] != $modtime{"darcs-all"}); 124 my $packages_mod = ((stat("packages"))[9] != $modtime{"packages"}); 125 if ($darcs_all_mod || $packages_mod) { 126 summary(); 127 die "'darcs-all' ".($darcs_all_mod?"(changed)":""). 128 " or 'packages' ".($packages_mod?"(changed)":"")." updated;\n". 129 "please re-run your darcs-all command"; 130 } 131 } 92 132 } 93 133 elsif ($tag eq "") { 94 134 message "== Required repo $localpath is missing! Skipping"; 135 $missing{$localpath} = "(required repo!)"; 95 136 } 96 137 else { 97 138 message "== $localpath repo not present; skipping"; 139 $missing{$localpath} = "(optional '$tag' repo)"; 98 140 } 99 141 } 100 142 elsif (! /^(#.*)?$/) { 101 143 die "Bad line: $_"; 102 144 } 103 145 } 146 summary(); 147 } 148 149 # summarize warnings and conflicts 150 sub summary { 151 my $package; 152 if (scalar(%warnings)) { 153 print "\n-- there are Warnings\n"; 154 foreach $package (keys%warnings) { 155 print "-- Warnings for $package:\n$warnings{$package}\n"; 156 } 157 } 158 if (scalar(%conflicts)) { 159 print "\n-- there are Conflicts\n"; 160 foreach $package (keys%conflicts) { 161 print "-- Conflicts in $package:\n$conflicts{$package}\n"; 162 } 163 } 164 if (scalar(%missing)) { 165 print "\n-- there are missing packages:\n"; 166 foreach $package (keys%missing) { 167 print "$package $missing{$package}\n"; 168 } 169 } 104 170 } 105 171 106 172 sub darcsget {
