Ticket #1995: pjl_cs080606.patch
File pjl_cs080606.patch, 13.3 KB (added by , 14 years ago) |
---|
-
compiler_status.cpp
21 21 22 22 #include "boost/config.hpp" 23 23 #include "boost/filesystem/operations.hpp" 24 #include "boost/filesystem/convenience.hpp" 24 25 #include "boost/filesystem/fstream.hpp" 25 26 #include "detail/tiny_xml.hpp" 26 27 namespace fs = boost::filesystem; … … 90 91 std::vector<int> error_count; 91 92 92 93 // prefix for library and test hyperlink prefix 93 string cvs_root ( "http://boost.cvs.sourceforge.net/" );94 string url_prefix_dir_view( cvs_root + "boost/boost");95 string url_prefix_checkout_view( cvs_root + "*checkout*/boost/boost");96 string url_suffix_text_view( " ?view=markup&rev=HEAD" );94 string svn_root ( "http://svn.boost.org/trac/boost/browser/trunk/" ); 95 string url_prefix_dir_view( svn_root ); 96 string url_prefix_checkout_view( svn_root ); 97 string url_suffix_text_view( "" ); 97 98 98 99 // get revision number (as a string) if boost_root is svn working copy -----// 99 100 … … 349 350 fs::path bin_path; 350 351 if (boost_build_v2) 351 352 { 352 bin_path = locate_root / "bin.v2" / relative; 353 if ( relative == "status" ) 354 bin_path = locate_root / "bin.v2" / "libs"; 355 else 356 { 357 bin_path = locate_root / "bin.v2" / relative; 358 if (!fs::exists(bin_path)) 359 bin_path = locate_root / "bin" / relative; 360 } 353 361 if (!fs::exists(bin_path)) 354 362 { 355 363 std::cerr << "warning: could not find build results for '" … … 732 740 } 733 741 } 734 742 743 // find_compilers ------------------------------------------------------------// 744 745 void find_compilers(const fs::path & bin_dir) 746 { 747 fs::directory_iterator compiler_itr( bin_dir ); 748 if ( specific_compiler.empty() ) 749 std::clog << "Using " << bin_dir.string() << " to determine compilers\n"; 750 for (; compiler_itr != end_itr; ++compiler_itr ) 751 { 752 if ( fs::is_directory( *compiler_itr ) // check just to be sure 753 && compiler_itr->leaf() != "test" ) // avoid strange directory (Jamfile bug?) 754 { 755 if ( specific_compiler.size() != 0 756 && specific_compiler != compiler_itr->leaf() ) continue; 757 toolsets.push_back( compiler_itr->leaf() ); 758 string desc( compiler_desc( compiler_itr->leaf() ) ); 759 string vers( version_desc( compiler_itr->leaf() ) ); 760 report << "<td>" 761 << (desc.size() ? desc : compiler_itr->leaf()) 762 << (vers.size() ? (string( "<br>" ) + vers ) : string( "" )) 763 << "</td>\n"; 764 error_count.push_back( 0 ); 765 } 766 } 767 } 768 735 769 // do_table_body -----------------------------------------------------------// 736 770 737 771 void do_table_body( const fs::path & bin_dir ) … … 746 780 jamfile.clear(); 747 781 jamfile.seekg(0); 748 782 string line; 783 bool run_tests = false; 784 749 785 while( std::getline( jamfile, line ) ) 750 786 { 751 787 bool v2(false); 752 string::size_type pos( line.find( "subinclude" ) );753 if ( pos == string::npos ) {754 pos = line.find( "build-project" );788 string::size_type sub_pos( line.find( "subinclude" ) ); 789 if ( sub_pos == string::npos ) { 790 sub_pos = line.find( "build-project" ); 755 791 v2 = true; 756 792 } 757 if ( pos != string::npos758 && line.find( '#' ) > pos )793 if ( sub_pos != string::npos 794 && line.find( '#' ) > sub_pos ) 759 795 { 760 796 if (v2) 761 pos = line.find_first_not_of( " \t./",pos+13 );797 sub_pos = line.find_first_not_of( " \t./", sub_pos+13 ); 762 798 else 763 pos = line.find_first_not_of( " \t./",pos+10 );799 sub_pos = line.find_first_not_of( " \t./", sub_pos+10 ); 764 800 765 if ( pos == string::npos ) continue;801 if ( sub_pos == string::npos ) continue; 766 802 string subinclude_bin_dir( 767 line.substr( pos, line.find_first_of( " \t", pos )-pos ) );803 line.substr( sub_pos, line.find_first_of( " \t", sub_pos )-sub_pos ) ); 768 804 769 805 fs::path bin_path = find_bin_path(subinclude_bin_dir); 770 806 if (!bin_path.empty()) 771 807 do_rows_for_sub_tree( bin_path, results ); 772 808 } 809 if ( ! run_tests ) 810 { 811 string::size_type run_pos = line.find("run-tests"); 812 if ( run_pos != string::npos && line.find_first_not_of(" \t") == run_pos ) 813 run_tests = true; 814 } 815 else 816 { 817 if ( line.find(";") != string::npos ) 818 run_tests = false; 819 else 820 { 821 string::size_type pos = line.find_first_not_of( " \t" ); 822 if ( pos != string::npos && line[pos] != '#' ) 823 { 824 string::size_type end_pos = line.find_first_of(" \t#", pos); 825 string::iterator end = end_pos != string::npos ? line.begin() + end_pos : line.end(); 826 string run_tests_bin_dir(line.begin() + pos, end); 827 fs::path bin_path = find_bin_path("libs/" + run_tests_bin_dir); 828 if (!bin_path.empty()) 829 do_rows_for_sub_tree( bin_path, results ); 830 } 831 } 832 } 773 833 } 774 834 775 835 … … 789 849 // - Boost.Build V2 location with top-lelve "build-dir" 790 850 // - Boost.Build V1 location without ALL_LOCATE_TARGET 791 851 string relative( fs::initial_path().string() ); 792 relative.erase( 0, boost_root.string().size()+1 ); 852 if ( relative.find(boost_root.string()) != string::npos ) 853 relative.erase( 0, boost_root.string().size()+1 ); 854 else if ( relative.find(locate_root.string()) != string::npos ) 855 relative.erase( 0, locate_root.string().size()+1 ); 793 856 fs::path bin_path = find_bin_path(relative); 794 857 795 858 report << "<table border=\"1\" cellspacing=\"0\" cellpadding=\"5\">\n"; … … 799 862 report << "<tr><td>Library</td><td>Test Name</td>\n" 800 863 "<td><a href=\"compiler_status.html#test-type\">Test Type</a></td>\n"; 801 864 802 fs::directory_iterator itr( bin_path ); 803 while ( itr != end_itr 804 && ((itr->string().find( ".test" ) != (itr->string().size()-5)) 805 || !fs::is_directory( *itr ))) 806 ++itr; // bypass chaff 807 if ( itr != end_itr ) 865 if ( relative == "status" ) 808 866 { 809 fs::directory_iterator compiler_itr( *itr ); 810 if ( specific_compiler.empty() ) 811 std::clog << "Using " << itr->string() << " to determine compilers\n"; 812 for (; compiler_itr != end_itr; ++compiler_itr ) 867 fs::recursive_directory_iterator ritr( bin_path ); 868 fs::recursive_directory_iterator end_ritr; 869 while ( ritr != end_ritr 870 && ((ritr->string().find( ".test" ) != (ritr->string().size()-5)) 871 || !fs::is_directory( *ritr ))) 872 ++ritr; // bypass chaff 873 if ( ritr != end_ritr ) 813 874 { 814 if ( fs::is_directory( *compiler_itr ) // check just to be sure 815 && compiler_itr->leaf() != "test" ) // avoid strange directory (Jamfile bug?) 816 { 817 if ( specific_compiler.size() != 0 818 && specific_compiler != compiler_itr->leaf() ) continue; 819 toolsets.push_back( compiler_itr->leaf() ); 820 string desc( compiler_desc( compiler_itr->leaf() ) ); 821 string vers( version_desc( compiler_itr->leaf() ) ); 822 report << "<td>" 823 << (desc.size() ? desc : compiler_itr->leaf()) 824 << (vers.size() ? (string( "<br>" ) + vers ) : string( "" )) 825 << "</td>\n"; 826 error_count.push_back( 0 ); 827 } 875 find_compilers( *ritr ); 828 876 } 829 877 } 878 else 879 { 880 fs::directory_iterator itr( bin_path ); 881 while ( itr != end_itr 882 && ((itr->string().find( ".test" ) != (itr->string().size()-5)) 883 || !fs::is_directory( *itr ))) 884 ++itr; // bypass chaff 885 if ( itr != end_itr ) 886 { 887 find_compilers( *itr ); 888 } 889 } 830 890 831 891 report << "</tr>\n"; 832 892 -
process_jam_log.cpp
155 155 temp.erase( temp.find_last_of( "/" ) ); // remove leaf 156 156 temp = split( trim_left( temp ) ).back(); 157 157 if ( temp[0] == '.' ) temp.erase( 0, temp.find_first_not_of( "./" ) ); 158 else temp.erase( 0, locate_root.string().size()+1 );158 else if ( temp[0] == '/' ) temp.erase( 0, locate_root.string().size()+1 ); 159 159 if ( echo ) 160 160 std::cout << "\ttarget_directory( \"" << s << "\") -> \"" << temp << "\"" << std::endl; 161 161 return temp; … … 555 555 std::ios::sync_with_stdio(false); 556 556 557 557 fs::initial_path(); 558 std::istream* input = 0; 558 559 559 560 if ( argc <= 1 ) 560 std::cout << "Usage: bjam [bjam-args] | process_jam_log [--echo] [--create-directories] [--v1|v2] [locate-root]\n" 561 "locate-root - the same as the bjam ALL_LOCATE_TARGET\n" 562 " parameter, if any. Default is boost-root.\n" 563 "create-directories - if the directory for xml file doesn't exists - creates it.\n" 564 " usually used for processing logfile on different machine\n" 565 "v2 - bjam version 2 used (default).\n" 566 "v1 - bjam version 1 used.\n" 567 ; 561 std::cout << "process_jam_log [--echo] [--create-directories] [--v1|--v2]\n" 562 " [--boost-root boost_root] [--locate-root locate_root]\n" 563 " [--input-file input_file]\n" 564 "--echo - verbose diagnostic output.\n" 565 "--create-directories - if the directory for xml file doesn't exists - creates it.\n" 566 " usually used for processing logfile on different machine\n" 567 "--v2 - bjam version 2 used (default).\n" 568 "--v1 - bjam version 1 used.\n" 569 "--boost-root - the root of the boost installation being used. If not defined\n" 570 " assume to run from within it and discover it euristically.\n" 571 "--locate-root - the same as the bjam ALL_LOCATE_TARGET\n" 572 " parameter, if any. Default is boost-root.\n" 573 "--input-file - the output of a bjam --dump-tests run. Default is std input.\n" 574 ; 568 575 569 set_boost_root(); 570 571 boost_root.normalize(); 572 573 if ( argc > 1 && std::strcmp( argv[1], "--echo" ) == 0 ) 576 while ( argc > 1 ) 574 577 { 575 echo = true; 576 --argc; ++argv; 577 } 578 579 580 if (argc > 1 && std::strcmp( argv[1], "--create-directories" ) == 0 ) 581 { 582 create_dirs = true; 578 if ( std::strcmp( argv[1], "--echo" ) == 0 ) 579 { 580 echo = true; 583 581 --argc; ++argv; 584 } 585 586 if ( argc > 1 && std::strcmp( argv[1], "--v2" ) == 0 ) 587 { 588 boost_build_v2 = true; 589 --argc; ++argv; 590 } 591 592 if ( argc > 1 && std::strcmp( argv[1], "--v1" ) == 0 ) 593 { 594 boost_build_v2 = false; 595 --argc; ++argv; 596 } 597 598 if (argc > 1) 599 { 582 } 583 else if ( std::strcmp( argv[1], "--create-directories" ) == 0 ) 584 { 585 create_dirs = true; 586 --argc; ++argv; 587 } 588 else if ( std::strcmp( argv[1], "--v2" ) == 0 ) 589 { 590 boost_build_v2 = true; 591 --argc; ++argv; 592 } 593 else if ( std::strcmp( argv[1], "--v1" ) == 0 ) 594 { 595 boost_build_v2 = false; 596 --argc; ++argv; 597 } 598 else if ( std::strcmp( argv[1], "--boost-root" ) == 0 ) 599 { 600 --argc; ++argv; 601 if ( argc == 1 ) 602 { 603 std::cout << "Abort: option --boost-root requires a directory argument\n"; 604 std::exit(1); 605 } 606 boost_root = fs::path( argv[1], fs::native ); 607 if ( !boost_root.is_complete() ) 608 boost_root = ( fs::initial_path() / boost_root ).normalize(); 609 610 --argc; ++argv; 611 } 612 else if ( std::strcmp( argv[1], "--locate-root" ) == 0 ) 613 { 614 --argc; ++argv; 615 if ( argc == 1 ) 616 { 617 std::cout << "Abort: option --locate-root requires a directory argument\n"; 618 std::exit(1); 619 } 600 620 locate_root = fs::path( argv[1], fs::native ); 601 621 if ( !locate_root.is_complete() ) 602 622 locate_root = ( fs::initial_path() / locate_root ).normalize(); 603 623 604 624 --argc; ++argv; 605 } 606 else 625 } 626 else if ( std::strcmp( argv[1], "--input-file" ) == 0 ) 627 { 628 --argc; ++argv; 629 if ( argc == 1 ) 630 { 631 std::cout << "Abort: option --input-file requires a filename argument\n"; 632 std::exit(1); 633 } 634 input = new std::ifstream(argv[1]); 635 --argc; ++argv; 636 } 637 } 638 639 if ( boost_root.empty() ) 607 640 { 608 locate_root = boost_root; 641 set_boost_root(); 642 boost_root.normalize(); 609 643 } 644 if ( locate_root.empty() ) 645 { 646 locate_root = boost_root; 647 } 648 if ( input == 0 ) 649 { 650 input = &std::cin; 651 } 610 652 611 653 std::cout << "boost_root: " << boost_root.string() << '\n' 612 654 << "locate_root: " << locate_root.string() << '\n'; … … 617 659 string content; 618 660 bool capture_lines = false; 619 661 620 std::istream* input;621 if (argc > 1)622 {623 input = new std::ifstream(argv[1]);624 }625 else626 {627 input = &std::cin;628 }629 630 662 // This loop looks at lines for certain signatures, and accordingly: 631 663 // * Calls start_message() to start capturing lines. (start_message() will 632 664 // automatically call stop_message() if needed.)