llvm.org GIT mirror llvm / d0b0879
Prepare for Subversion migration by implementing a -usesvn to tell the script to to check out llvm and llvm-test from Subversion instead of CVS. Without this option the script will continue to check out from CVS. To specify the Subversion URL, set the SVNURL environment variable or pass -svnurl followed by the URL. For now, -svnurl will default to Reid's temporary (read-only, daily snapshot) SVN server. Try it out if you like! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35621 91177308-0d34-0410-b5e6-96231b3b80d8 Reid Spencer 13 years ago
1 changed file(s) with 159 addition(s) and 74 deletion(s). Raw diff Collapse all Expand all
0 #!/usr/bin/perl
11 use POSIX qw(strftime);
22 use File::Copy;
3 use Date::Parse;
34 use Socket;
45
56 #
4445 # -gccpath Path to gcc/g++ used to build LLVM
4546 # -cvstag Check out a specific CVS tag to build LLVM (useful for
4647 # testing release branches)
48 # -usesvn Check code out from a subversion repository. With no
49 # argument, use the standard repository. An argument specifies
50 # the repository URL to use.
51 # -svnurl Specify the SVN URL where LLVM can be found
4752 # -target Specify the target triplet
4853 # -cflags Next argument specifies that C compilation options that
4954 # override the default.
9095 #
9196 ##############################################################
9297 my $HOME = $ENV{'HOME'};
98 my $SVNURL = $ENV{"SVNURL"};
99 $SVNURL = 'svn://anon@hlvm.org:3691/llvm.svn' unless $SVNURL;
93100 my $CVSRootDir = $ENV{'CVSROOT'};
94101 $CVSRootDir = "/home/vadve/shared/PublicCVS" unless $CVSRootDir;
95102 my $BuildDir = $ENV{'BUILDDIR'};
115122 $CONFIGUREARGS="";
116123 $nickname="";
117124 $NOTEST=0;
125 $USESVN=0;
118126 $NORUNNINGTESTS=0;
119127 $MAKECMD="make";
120128 $SUBMITSERVER = "llvm.org";
162170 else { $GCCPATH=""; }
163171 if (/^-cvstag/) { $CVSCOOPT .= " -r $ARGV[0]"; shift; next; }
164172 else { $CVSCOOPT="";}
173 if (/^-usesvn/) { $USESVN = 1; }
174 if (/^-svnurl/) { $SVNURL = $ARGV[0]; shift; next; }
165175 if (/^-target/) { $CONFIGUREARGS .= " --target=$ARGV[0]";
166176 shift; next; }
167177 if (/^-cflags/) { $MAKEOPTS = "$MAKEOPTS C.Flags=\'$ARGV[0]\'";
224234 ##############################################################
225235 my $Prefix = "$WebDir/$DATE";
226236 my $BuildLog = "$Prefix-Build-Log.txt";
227 my $CVSLog = "$Prefix-CVS-Log.txt";
237 my $COLog = "$Prefix-CVS-Log.txt";
228238 my $OldenTestsLog = "$Prefix-Olden-tests.txt";
229239 my $SingleSourceLog = "$Prefix-SingleSource-ProgramTest.txt.gz";
230240 my $MultiSourceLog = "$Prefix-MultiSource-ProgramTest.txt.gz";
241251
242252 if ($VERBOSE) {
243253 print "INITIALIZED\n";
244 print "CVS Root = $CVSRootDir\n";
254 if ($USESVN) {
255 print "SVN URL = $SVNURL\n";
256 } else {
257 print "CVS Root = $CVSRootDir\n";
258 }
259 print "COLog = $COLog\n";
245260 print "BuildDir = $BuildDir\n";
246261 print "WebDir = $WebDir\n";
247262 print "Prefix = $Prefix\n";
248 print "CVSLog = $CVSLog\n";
249263 print "BuildLog = $BuildLog\n";
250264 }
251265
476490 print "Build directory exists! Removing it\n";
477491 }
478492 system "rm -rf $BuildDir";
479 mkdir $BuildDir or die "Could not create CVS checkout directory $BuildDir!";
493 mkdir $BuildDir or die "Could not create checkout directory $BuildDir!";
480494 } else {
481495 if ( $VERBOSE ) {
482496 print "Build directory exists!\n";
483497 }
484498 }
485499 } 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";
500 mkdir $BuildDir or die "Could not create checkout directory $BuildDir!";
501 }
502 }
503 ChangeDir( $BuildDir, "checkout directory" );
504
505
506 ##############################################################
507 #
508 # Check out the llvm tree, using either SVN or CVS
509 #
510 ##############################################################
502511 if (!$NOCHECKOUT) {
503512 if ( $VERBOSE ) {
504513 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 }
514 }
515 if ($USESVN) {
516 my $SVNCMD = "$NICE svn co $SVNURL";
517 if ($VERBOSE) {
518 print "( time -p $SVNCMD/llvm/trunk llvm; cd llvm/projects ; " .
519 "$SVNCMD/llvm-test/trunk llvm-test ) > $COLog 2>&1\n";
520 system "( time -p $SVNCMD/llvm/trunk llvm; cd llvm/projects ; " .
521 "$SVNCMD/llvm-test/trunk llvm-test ) > $COLog 2>&1\n";
522 }
523 } else {
524 my $CVSOPT = "";
525 $CVSOPT = "-z3" # Use compression if going over ssh.
526 if $CVSRootDir =~ /^:ext:/;
527 my $CVSCMD = "$NICE cvs $CVSOPT -d $CVSRootDir co -P $CVSCOOPT";
528 print "( time -p $CVSCMD llvm; cd llvm/projects ; " .
529 "$CVSCMD llvm-test ) > $COLog 2>&1";
530 system "( time -p $CVSCMD llvm; cd llvm/projects ; " .
531 "$CVSCMD llvm-test ) > $COLog 2>&1";
532 }
533 }
534 ChangeDir( $BuildDir , "Checkout directory") ;
512535 ChangeDir( "llvm" , "llvm source directory") ;
513536
514537 ##############################################################
518541 # This can probably be put on the server side
519542 #
520543 ##############################################################
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;
544 my $CheckoutTime_Wall = GetRegex "([0-9.]+)", `grep '^real' $COLog`;
545 my $CheckoutTime_User = GetRegex "([0-9.]+)", `grep '^user' $COLog`;
546 my $CheckoutTime_Sys = GetRegex "([0-9.]+)", `grep '^sys' $COLog`;
547 my $CheckoutTime_CPU = $CVSCheckoutTime_User + $CVSCheckoutTime_Sys;
548
549 my $NumFilesInCVS = 0;
550 my $NumDirsInCVS = 0;
551 if ($USESVN) {
552 $NumFilesInCVS = `egrep '^A' $COLog | wc -l` + 0;
553 $NumDirsInCVS = `sed -e 's#/[^/]*$##' $COLog | sort | uniq | wc -l` + 0;
554 } else {
555 $NumFilesInCVS = `egrep '^U' $COLog | wc -l` + 0;
556 $NumDirsInCVS = `egrep '^cvs (checkout|server|update):' $COLog | wc -l` + 0;
557 }
529558
530559 ##############################################################
531560 #
537566
538567 my (%AddedFiles, %ModifiedFiles, %RemovedFiles, %UsersCommitted, %UsersUpdated);
539568
540 if(!$NOCVSSTATS){
541
569 if (!$NOCVSSTATS) {
542570 if ($VERBOSE) { print "CVS HISTORY ANALYSIS STAGE\n"; }
543 @CVSHistory = split "\n", `cvs history -D '1 day ago' -a -xAMROCGUW`;
571
572 if ($USESVN) {
573 my $delimiter = "----------------------------------------------------" .
574 "--------------------\n";
575 @SVNHistory = split $delimiter, `svn log --verbose -r{$DATE}:HEAD`;
576
577 # Skip very first entry.
578 shift @SVNHistory;
579 foreach $Record (@SVNHistory) {
580 my (@Lines, @Fields);
581 my ($Rev, $Author, $StrTime, $LogLines, $Time);
582 @Lines = split "\n", $Record;
583 # print join"\n", @Lines;
584
585 ($Rev, $Author, $StrTime, $LogLines) = split ' \| ', $Lines[0];
586 $Time = str2time($StrTime);
587 if (time() - $Time > 24*3600) {
588 next;
589 }
590
591 $UsersCommitted{$Author} = 1;
592
593 #print $Rev, $Author, $Time, $LogLines, "\n";
594
595 my $i = 2;
596 while ($Lines[$i] ne '') {
597 my ($Type, $Filename, $FromFile, $FromRev);
598 #print $Lines[$i], "\n";
599
600 if ($Lines[$i] =~ / ([MAD]) ([^ ]+) \(from ([^ ]+):([^ ]+)\)/) {
601 ($Type, $Filename, $FromFile, $FromRev) = ($1, $2, $3, $4);
602 } elsif ($Lines[$i] =~ / ([MAD]) ([^ ]+)/) {
603 ($Type, $Filename, $FromFile, $FromRev) = ($1, $2, "", "");
604 } else {
605 print "UNMATCHABLE: $Lines[$i]\n";
606 }
607
608 if ($Type eq 'M') { # Modified
609 $ModifiedFiles{$Filename} = 1;
610 } elsif ($Type eq 'A') { # Added
611 if ($FromFile eq "") { # File was added
612 $AddedFiles{$Filename} = 1;
613 } else { #File was added from another file - moved or copied.
614 $MovedFiles{$Filename} = 1;
615 }
616 } elsif ($Type eq 'D') { # Removed
617 $RemovedFiles{$Filename} = 1;
618 } else {
619 print "INVALID TYPE: $Type";
620 }
621
622 #print $Filename, "\n";
623 #print $Type, $File, $FromFile, $FromRev, "\n";
624 ++$i;
625 }
626 }
627 } else {
628 @CVSHistory = split "\n", `cvs history -D '1 day ago' -a -xAMROCGUW`;
544629 #print join "\n", @CVSHistory; print "\n";
545630
546 my $DateRE = '[-/:0-9 ]+\+[0-9]+';
631 my $DateRE = '[-/:0-9 ]+\+[0-9]+';
547632
548633 # 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
634 foreach $File (@CVSHistory) {
635 my ($Type, $Date, $UID, $Rev, $Filename);
636 if ($File =~ /([AMRUGC]) ($DateRE) ([^ ]+) +([^ ]+) +([^ ]+) +([^ ]+)/) {
637 ($Type, $Date, $UID, $Rev, $Filename) = ($1, $2, $3, $4, "$6/$5");
638 } elsif ($File =~ /([W]) ($DateRE) ([^ ]+)/) {
639 ($Type, $Date, $UID, $Rev, $Filename) = ($1, $2, $3, "", "");
640 } elsif ($File =~ /([O]) ($DateRE) ([^ ]+) +([^ ]+)/) {
641 ($Type, $Date, $UID, $Rev, $Filename) = ($1, $2, $3, "", "$4/");
642 } else {
643 print "UNMATCHABLE: $File\n";
644 next;
645 }
646 # print "$File\nTy = $Type Date = '$Date' UID=$UID Rev=$Rev File = '$Filename'\n";
647
648 if ($Filename =~ /^llvm/) {
649 if ($Type eq 'M') { # Modified
650 $ModifiedFiles{$Filename} = 1;
651 $UsersCommitted{$UID} = 1;
652 } elsif ($Type eq 'A') { # Added
653 $AddedFiles{$Filename} = 1;
654 $UsersCommitted{$UID} = 1;
655 } elsif ($Type eq 'R') { # Removed
656 $RemovedFiles{$Filename} = 1;
657 $UsersCommitted{$UID} = 1;
658 } else {
659 $UsersUpdated{$UID} = 1;
660 }
661 }
662 }
663
664 my $TestError = 1;
665 } #$USESVN
581666 }#!NOCVSSTATS
582667
583668 my $CVSAddedFiles = join "\n", sort keys %AddedFiles;
9431028
9441029 my @CVS_DATA;
9451030 my $cvs_data;
946 @CVS_DATA = ReadFile "$CVSLog";
1031 @CVS_DATA = ReadFile "$COLog";
9471032 $cvs_data = join("\n", @CVS_DATA);
9481033
9491034 my @BUILD_DATA;
9891074 'nickname' => $nickname,
9901075 'dejagnutime_wall' => $DejagnuWallTime,
9911076 'dejagnutime_cpu' => $DejagnuTime,
992 'cvscheckouttime_wall' => $CVSCheckoutTime_Wall,
993 'cvscheckouttime_cpu' => $CVSCheckoutTime_CPU,
1077 'cvscheckouttime_wall' => $CheckoutTime_Wall,
1078 'cvscheckouttime_cpu' => $CheckoutTime_CPU,
9941079 'configtime_wall' => $ConfigWallTime,
9951080 'configtime_cpu'=> $ConfigTime,
9961081 'buildtime_wall' => $BuildWallTime,