llvm.org GIT mirror llvm / 99e865a
Reinstate the SVN capability without requiring Date::Parse. As before the SVN Repository is only used if requested with -usesvn option otherwise it uses CVS. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35721 91177308-0d34-0410-b5e6-96231b3b80d8 Reid Spencer 12 years ago
1 changed file(s) with 166 addition(s) and 75 deletion(s). Raw diff Collapse all Expand all
4444 # -gccpath Path to gcc/g++ used to build LLVM
4545 # -cvstag Check out a specific CVS tag to build LLVM (useful for
4646 # testing release branches)
47 # -usesvn Check code out from a subversion repository. With no
48 # argument, use the standard repository. An argument specifies
49 # the repository URL to use.
50 # -svnurl Specify the SVN URL where LLVM can be found
4751 # -target Specify the target triplet
4852 # -cflags Next argument specifies that C compilation options that
4953 # override the default.
9094 #
9195 ##############################################################
9296 my $HOME = $ENV{'HOME'};
97 my $SVNURL = $ENV{"SVNURL"};
98 $SVNURL = 'svn://anon@hlvm.org:3691/llvm.svn' unless $SVNURL;
9399 my $CVSRootDir = $ENV{'CVSROOT'};
94100 $CVSRootDir = "/home/vadve/shared/PublicCVS" unless $CVSRootDir;
95101 my $BuildDir = $ENV{'BUILDDIR'};
115121 $CONFIGUREARGS="";
116122 $nickname="";
117123 $NOTEST=0;
124 $USESVN=0;
118125 $NORUNNINGTESTS=0;
119126 $MAKECMD="make";
120127 $SUBMITSERVER = "llvm.org";
162169 else { $GCCPATH=""; }
163170 if (/^-cvstag/) { $CVSCOOPT .= " -r $ARGV[0]"; shift; next; }
164171 else { $CVSCOOPT="";}
172 if (/^-usesvn/) { $USESVN = 1; }
173 if (/^-svnurl/) { $SVNURL = $ARGV[0]; shift; next; }
165174 if (/^-target/) { $CONFIGUREARGS .= " --target=$ARGV[0]";
166175 shift; next; }
167176 if (/^-cflags/) { $MAKEOPTS = "$MAKEOPTS C.Flags=\'$ARGV[0]\'";
224233 ##############################################################
225234 my $Prefix = "$WebDir/$DATE";
226235 my $BuildLog = "$Prefix-Build-Log.txt";
227 my $CVSLog = "$Prefix-CVS-Log.txt";
236 my $COLog = "$Prefix-CVS-Log.txt";
228237 my $OldenTestsLog = "$Prefix-Olden-tests.txt";
229238 my $SingleSourceLog = "$Prefix-SingleSource-ProgramTest.txt.gz";
230239 my $MultiSourceLog = "$Prefix-MultiSource-ProgramTest.txt.gz";
241250
242251 if ($VERBOSE) {
243252 print "INITIALIZED\n";
244 print "CVS Root = $CVSRootDir\n";
253 if ($USESVN) {
254 print "SVN URL = $SVNURL\n";
255 } else {
256 print "CVS Root = $CVSRootDir\n";
257 }
258 print "COLog = $COLog\n";
245259 print "BuildDir = $BuildDir\n";
246260 print "WebDir = $WebDir\n";
247261 print "Prefix = $Prefix\n";
248 print "CVSLog = $CVSLog\n";
249262 print "BuildLog = $BuildLog\n";
250263 }
251264
476489 print "Build directory exists! Removing it\n";
477490 }
478491 system "rm -rf $BuildDir";
479 mkdir $BuildDir or die "Could not create CVS checkout directory $BuildDir!";
492 mkdir $BuildDir or die "Could not create checkout directory $BuildDir!";
480493 } else {
481494 if ( $VERBOSE ) {
482495 print "Build directory exists!\n";
483496 }
484497 }
485498 } else {
486 mkdir $BuildDir or die "Could not create CVS checkout directory $BuildDir!";
487 }
488 }
489 ChangeDir( $BuildDir, "CVS checkout directory" );
490
491
492 ##############################################################
493 #
494 # Check out the llvm tree, saving CVS messages to the cvs log...
495 #
496 ##############################################################
497 my $CVSOPT = "";
498 # Use compression if going over ssh.
499 $CVSOPT = "-z3"
500 if $CVSRootDir =~ /^:ext:/;
501 my $CVSCMD = "$NICE cvs $CVSOPT -d $CVSRootDir co -P $CVSCOOPT";
499 mkdir $BuildDir or die "Could not create checkout directory $BuildDir!";
500 }
501 }
502 ChangeDir( $BuildDir, "checkout directory" );
503
504
505 ##############################################################
506 #
507 # Check out the llvm tree, using either SVN or CVS
508 #
509 ##############################################################
502510 if (!$NOCHECKOUT) {
503511 if ( $VERBOSE ) {
504512 print "CHECKOUT STAGE:\n";
505 print "( time -p $CVSCMD llvm; cd llvm/projects ; $CVSCMD llvm-test ) " .
506 "> $CVSLog 2>&1\n";
507 }
508 system "( time -p $CVSCMD llvm; cd llvm/projects ; " .
509 "$CVSCMD llvm-test ) > $CVSLog 2>&1";
510 ChangeDir( $BuildDir , "CVS Checkout directory") ;
511 }
513 }
514 if ($USESVN) {
515 my $SVNCMD = "$NICE svn co $SVNURL";
516 if ($VERBOSE) {
517 print "( time -p $SVNCMD/llvm/trunk llvm; cd llvm/projects ; " .
518 "$SVNCMD/llvm-test/trunk llvm-test ) > $COLog 2>&1\n";
519 system "( time -p $SVNCMD/llvm/trunk llvm; cd llvm/projects ; " .
520 "$SVNCMD/llvm-test/trunk llvm-test ) > $COLog 2>&1\n";
521 }
522 } else {
523 my $CVSOPT = "";
524 $CVSOPT = "-z3" # Use compression if going over ssh.
525 if $CVSRootDir =~ /^:ext:/;
526 my $CVSCMD = "$NICE cvs $CVSOPT -d $CVSRootDir co -P $CVSCOOPT";
527 print "( time -p $CVSCMD llvm; cd llvm/projects ; " .
528 "$CVSCMD llvm-test ) > $COLog 2>&1";
529 system "( time -p $CVSCMD llvm; cd llvm/projects ; " .
530 "$CVSCMD llvm-test ) > $COLog 2>&1";
531 }
532 }
533 ChangeDir( $BuildDir , "Checkout directory") ;
512534 ChangeDir( "llvm" , "llvm source directory") ;
513535
514536 ##############################################################
518540 # This can probably be put on the server side
519541 #
520542 ##############################################################
521 my $CVSCheckoutTime_Wall = GetRegex "([0-9.]+)", `grep '^real' $CVSLog`;
522 my $CVSCheckoutTime_User = GetRegex "([0-9.]+)", `grep '^user' $CVSLog`;
523 my $CVSCheckoutTime_Sys = GetRegex "([0-9.]+)", `grep '^sys' $CVSLog`;
524 my $CVSCheckoutTime_CPU = $CVSCheckoutTime_User + $CVSCheckoutTime_Sys;
525
526 my $NumFilesInCVS = `egrep '^U' $CVSLog | wc -l` + 0;
527 my $NumDirsInCVS =
528 `egrep '^cvs (checkout|server|update):' $CVSLog | wc -l` + 0;
543 my $CheckoutTime_Wall = GetRegex "([0-9.]+)", `grep '^real' $COLog`;
544 my $CheckoutTime_User = GetRegex "([0-9.]+)", `grep '^user' $COLog`;
545 my $CheckoutTime_Sys = GetRegex "([0-9.]+)", `grep '^sys' $COLog`;
546 my $CheckoutTime_CPU = $CVSCheckoutTime_User + $CVSCheckoutTime_Sys;
547
548 my $NumFilesInCVS = 0;
549 my $NumDirsInCVS = 0;
550 if ($USESVN) {
551 $NumFilesInCVS = `egrep '^A' $COLog | wc -l` + 0;
552 $NumDirsInCVS = `sed -e 's#/[^/]*$##' $COLog | sort | uniq | wc -l` + 0;
553 } else {
554 $NumFilesInCVS = `egrep '^U' $COLog | wc -l` + 0;
555 $NumDirsInCVS = `egrep '^cvs (checkout|server|update):' $COLog | wc -l` + 0;
556 }
529557
530558 ##############################################################
531559 #
535563 #
536564 ##############################################################
537565
566 # This just computes a reasonably accurate #of seconds since 2000. It doesn't
567 # have to be perfect as its only used for comparing date ranges within a couple
568 # of days.
569 sub ConvertToSeconds {
570 my ($sec, $min, $hour, $day, $mon, $yr) = @_;
571 my $Result = ($yr - 2000) * 12;
572 $Result += $mon;
573 $Result *= 31;
574 $Result += $day;
575 $Result *= 24;
576 $Result += $hour;
577 $Result *= 60;
578 $Result += $min;
579 $Result *= 60;
580 $Result += $sec;
581 return $Result;
582 }
583
538584 my (%AddedFiles, %ModifiedFiles, %RemovedFiles, %UsersCommitted, %UsersUpdated);
539585
540 if(!$NOCVSSTATS){
541
542 if ($VERBOSE) { print "CVS HISTORY ANALYSIS STAGE\n"; }
543 @CVSHistory = split "\n", `cvs history -D '1 day ago' -a -xAMROCGUW`;
586 if (!$NOCVSSTATS) {
587 if ($VERBOSE) { print "CHANGE HISTORY ANALYSIS STAGE\n"; }
588
589 if ($USESVN) {
590 @SVNHistory = split /
591 # Skip very first entry because it is the XML header cruft
592 shift @SVNHistory;
593 my $Now = time();
594 foreach $Record (@SVNHistory) {
595 my @Lines = split "\n", $Record;
596 my ($Author, $Date, $Revision);
597 # Get the date and see if its one we want to process.
598 my ($Year, $Month, $Day, $Hour, $Min, $Sec);
599 if ($Lines[3] =~ /(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})/){
600 $Year = $1; $Month = $2; $Day = $3; $Hour = $4; $Min = $5; $Sec = $6;
601 }
602 my $Then = ConvertToSeconds($Sec, $Min, $Hour, $Day, $Month, $Year);
603 # Get the current date and compute when "yesterday" is.
604 my ($NSec, $NMin, $NHour, $NDay, $NMon, $NYear) = gmtime();
605 my $Now = ConvertToSeconds( $NSec, $NMin, $NHour, $NDay, $NMon, $NYear);
606 if (($Now - 24*60*60) > $Then) {
607 next;
608 }
609 if ($Lines[1] =~ / revision="([0-9]*)">/) {
610 $Revision = $1;
611 }
612 if ($Lines[2] =~ /([^<]*)<\/author>/) {
613 $Author = $1;
614 }
615 $UsersCommitted{$Author} = 1;
616 $Date = $Year . "-" . $Month . "-" . $Day;
617 $Time = $Hour . ":" . $Min . ":" . $Sec;
618 print "Rev: $Revision, Author: $Author, Date: $Date, Time: $Time\n";
619 for ($i = 6; $i < $#Lines; $i += 2 ) {
620 if ($Lines[$i] =~ /^ action="(.)">([^<]*)
621 if ($1 == "A") {
622 $AddedFiles{$2} = 1;
623 } elsif ($1 == 'D') {
624 $RemovedFiles{$2} = 1;
625 } elsif ($1 == 'M' || $1 == 'R' || $1 == 'C') {
626 $ModifiedFiles{$2} = 1;
627 } else {
628 print "UNMATCHABLE: $Lines[$i]\n";
629 }
630 }
631 }
632 }
633 } else {
634 @CVSHistory = split "\n", `cvs history -D '1 day ago' -a -xAMROCGUW`;
544635 #print join "\n", @CVSHistory; print "\n";
545636
546 my $DateRE = '[-/:0-9 ]+\+[0-9]+';
637 my $DateRE = '[-/:0-9 ]+\+[0-9]+';
547638
548639 # Loop over every record from the CVS history, filling in the hashes.
549 foreach $File (@CVSHistory) {
550 my ($Type, $Date, $UID, $Rev, $Filename);
551 if ($File =~ /([AMRUGC]) ($DateRE) ([^ ]+) +([^ ]+) +([^ ]+) +([^ ]+)/) {
552 ($Type, $Date, $UID, $Rev, $Filename) = ($1, $2, $3, $4, "$6/$5");
553 } elsif ($File =~ /([W]) ($DateRE) ([^ ]+)/) {
554 ($Type, $Date, $UID, $Rev, $Filename) = ($1, $2, $3, "", "");
555 } elsif ($File =~ /([O]) ($DateRE) ([^ ]+) +([^ ]+)/) {
556 ($Type, $Date, $UID, $Rev, $Filename) = ($1, $2, $3, "", "$4/");
557 } else {
558 print "UNMATCHABLE: $File\n";
559 next;
560 }
561 # print "$File\nTy = $Type Date = '$Date' UID=$UID Rev=$Rev File = '$Filename'\n";
562
563 if ($Filename =~ /^llvm/) {
564 if ($Type eq 'M') { # Modified
565 $ModifiedFiles{$Filename} = 1;
566 $UsersCommitted{$UID} = 1;
567 } elsif ($Type eq 'A') { # Added
568 $AddedFiles{$Filename} = 1;
569 $UsersCommitted{$UID} = 1;
570 } elsif ($Type eq 'R') { # Removed
571 $RemovedFiles{$Filename} = 1;
572 $UsersCommitted{$UID} = 1;
573 } else {
574 $UsersUpdated{$UID} = 1;
575 }
576 }
577 }
578
579 my $TestError = 1;
580
640 foreach $File (@CVSHistory) {
641 my ($Type, $Date, $UID, $Rev, $Filename);
642 if ($File =~ /([AMRUGC]) ($DateRE) ([^ ]+) +([^ ]+) +([^ ]+) +([^ ]+)/) {
643 ($Type, $Date, $UID, $Rev, $Filename) = ($1, $2, $3, $4, "$6/$5");
644 } elsif ($File =~ /([W]) ($DateRE) ([^ ]+)/) {
645 ($Type, $Date, $UID, $Rev, $Filename) = ($1, $2, $3, "", "");
646 } elsif ($File =~ /([O]) ($DateRE) ([^ ]+) +([^ ]+)/) {
647 ($Type, $Date, $UID, $Rev, $Filename) = ($1, $2, $3, "", "$4/");
648 } else {
649 print "UNMATCHABLE: $File\n";
650 next;
651 }
652 # print "$File\nTy = $Type Date = '$Date' UID=$UID Rev=$Rev File = '$Filename'\n";
653
654 if ($Filename =~ /^llvm/) {
655 if ($Type eq 'M') { # Modified
656 $ModifiedFiles{$Filename} = 1;
657 $UsersCommitted{$UID} = 1;
658 } elsif ($Type eq 'A') { # Added
659 $AddedFiles{$Filename} = 1;
660 $UsersCommitted{$UID} = 1;
661 } elsif ($Type eq 'R') { # Removed
662 $RemovedFiles{$Filename} = 1;
663 $UsersCommitted{$UID} = 1;
664 } else {
665 $UsersUpdated{$UID} = 1;
666 }
667 }
668 }
669
670 my $TestError = 1;
671 } #$USESVN
581672 }#!NOCVSSTATS
582673
583674 my $CVSAddedFiles = join "\n", sort keys %AddedFiles;
9431034
9441035 my @CVS_DATA;
9451036 my $cvs_data;
946 @CVS_DATA = ReadFile "$CVSLog";
1037 @CVS_DATA = ReadFile "$COLog";
9471038 $cvs_data = join("\n", @CVS_DATA);
9481039
9491040 my @BUILD_DATA;
9891080 'nickname' => $nickname,
9901081 'dejagnutime_wall' => $DejagnuWallTime,
9911082 'dejagnutime_cpu' => $DejagnuTime,
992 'cvscheckouttime_wall' => $CVSCheckoutTime_Wall,
993 'cvscheckouttime_cpu' => $CVSCheckoutTime_CPU,
1083 'cvscheckouttime_wall' => $CheckoutTime_Wall,
1084 'cvscheckouttime_cpu' => $CheckoutTime_CPU,
9941085 'configtime_wall' => $ConfigWallTime,
9951086 'configtime_cpu'=> $ConfigTime,
9961087 'buildtime_wall' => $BuildWallTime,