Update of /cvsroot/boost/boost/tools/inspect
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv6073/tools/inspect
Modified Files:
Tag: RC_1_34_0
inspect.cpp inspector.hpp
Added Files:
Tag: RC_1_34_0
run_inspect.sh
Log Message:
Merge from HEAD.
--- NEW FILE: run_inspect.sh ---
#!/bin/sh
#~ Copyright Rene Rivera 2006.
#~ Distributed under the Boost Software License, Version 1.0.
#~ (See accompanying file LICENSE_1_0.txt or copy at
#~ http://www.boost.org/LICENSE_1_0.txt)
set -e
#~ Configuration options.
mail_to="Rene Rivera <[EMAIL PROTECTED]>"
#~ mail_to="Boost <[email protected]>"
cvs_branch="$1"
cvs_user=":ext:${USER}"
cvs_co="cvs -q -z9 [EMAIL PROTECTED]:/cvsroot/boost co -P -r ${cvs_branch}"
cvs_dir="${HOME}/devroots"
#~ Build bjam.
cd ${cvs_dir}
${cvs_co} -d boost_jam_src boost/tools/jam/src
cd boost_jam_src
LOCATE_TARGET=bin sh ./build.sh
#~ Build inspect.
cd ${cvs_dir}
${cvs_co} -d boost_${cvs_branch} boost
cd boost_${cvs_branch}/tools/inspect/build
${cvs_dir}/boost_jam_src/bin/bjam --v2
#~ Run the inspection.
cd ${cvs_dir}
cd boost_${cvs_branch}
./dist/bin/inspect -text -license -copyright -crlf -link -long_name -tab
-minmax > inspect-out.txt
#~ Send email with results.
mail_date=`date --iso-8601 --utc`
/usr/sbin/sendmail "${mail_to}" <<EMAIL
From: Rene Rivera <[EMAIL PROTECTED]>
To: ${mail_to}
Reply-To: Boost <[email protected]>
Subject: Boost inspection notification (${mail_date}/${cvs_branch})
`cat inspect-out.txt`
EMAIL
Index: inspect.cpp
===================================================================
RCS file: /cvsroot/boost/boost/tools/inspect/inspect.cpp,v
retrieving revision 1.15
retrieving revision 1.15.4.1
diff -u -d -r1.15 -r1.15.4.1
--- inspect.cpp 8 Feb 2005 18:52:35 -0000 1.15
+++ inspect.cpp 15 Jul 2006 23:32:05 -0000 1.15.4.1
@@ -1,7 +1,7 @@
// inspect program
---------------------------------------------------------//
// Copyright Beman Dawes 2002.
-// Copyright Rene Rivera 2004.
+// Copyright Rene Rivera 2004-2006.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
@@ -17,6 +17,7 @@
#include <boost/filesystem/exception.hpp>
#include <boost/filesystem/operations.hpp>
#include <boost/filesystem/fstream.hpp>
+#include <boost/format.hpp>
#include <iostream>
#include <cassert>
@@ -84,12 +85,23 @@
bool visit_predicate( const path & pth )
{
+ string local( boost::inspect::relative_to( pth, fs::initial_path() ) );
string leaf( pth.leaf() );
return
+ // so we can inspect a checkout
leaf != "CVS"
+ // don't look at binaries
&& leaf != "bin"
- && leaf != "jam_src" // this really out of our hands
- && leaf != "status" // too many issues with generated HTML files
+ && leaf != "bin.v2"
+ // this really out of our hands
+ && leaf != "jam_src"
+ && local.find("tools/jam/src") != 0
+ // too many issues with generated HTML files
+ && leaf != "status"
+ // no point in checking doxygen xml output
+ && local.find("doc/xml") != 0
+ // ignore some web files
+ && leaf != ".htaccess"
;
}
@@ -190,29 +202,54 @@
}
}
+// display
-----------------------------------------------------------------//
+
+ enum display_format_type
+ {
+ display_html, display_text
+ }
+ display_format = display_html;
+
// display_summary_helper
--------------------------------------------------//
void display_summary_helper( const string & current_library, int err_count )
{
- std::cout << " <tr><td><a href=\"#"
- << current_library
- << "\">" << current_library
- << "</a></td><td align=\"center\">"
- << err_count << "</td></tr>\n";
+ if (display_text == display_format)
+ {
+ std::cout << boost::format(" %1% (%2%)\n") % current_library %
err_count;
+ }
+ else
+ {
+ std::cout
+ << " <tr><td><a href=\"#"
+ << current_library
+ << "\">" << current_library
+ << "</a></td><td align=\"center\">"
+ << err_count << "</td></tr>\n";
+ }
}
// display_summary
---------------------------------------------------------//
void display_summary()
{
- std::cout << "</pre>\n"
- "<h2>Summary</h2>\n"
- "<table border=\"1\" cellpadding=\"5\" cellspacing=\"0\">\n"
- " <tr>\n"
- " <td><b>Library</b></td>\n"
- " <td><b>Problems</b></td>\n"
- " </tr>\n"
- ;
+ if (display_text == display_format)
+ {
+ std::cout << "Summary:\n";
+ }
+ else
+ {
+ std::cout
+ << "</pre>\n"
+ "<h2>Summary</h2>\n"
+ "<table border=\"1\" cellpadding=\"5\" cellspacing=\"0\">\n"
+ " <tr>\n"
+ " <td><b>Library</b></td>\n"
+ " <td><b>Problems</b></td>\n"
+ " </tr>\n"
+ ;
+ }
+
string current_library( msgs.begin()->library );
int err_count = 0;
for ( error_msg_vector::iterator itr ( msgs.begin() );
@@ -228,7 +265,14 @@
}
display_summary_helper( current_library, err_count );
- std::cout << "</table>\n";
+ if (display_text == display_format)
+ {
+ std::cout << "\n";
+ }
+ else
+ {
+ std::cout << "</table>\n";
+ }
}
@@ -236,41 +280,81 @@
void display_details()
{
- std::cout << "<h2>Details</h2>\n";
-
- // display error messages with group indication
- error_msg current;
- string sep;
- bool first = true;
- for ( error_msg_vector::iterator itr ( msgs.begin() );
- itr != msgs.end(); ++itr )
+ if (display_text == display_format)
{
- if ( current.library != itr->library )
- {
- if ( !first ) std::cout << "</pre>\n";
- std::cout << "\n<h3><a name=\"" << itr->library
- << "\">" << itr->library << "</a></h3>\n<pre>";
- }
- if ( current.library != itr->library
- || current.rel_path != itr->rel_path )
+ std::cout << "Details:\n";
+
+ // display error messages with group indication
+ error_msg current;
+ string sep;
+ for ( error_msg_vector::iterator itr ( msgs.begin() );
+ itr != msgs.end(); ++itr )
{
- std::cout << "\n";
- std::cout << itr->rel_path;
- sep = ": ";
+ if ( current.library != itr->library )
+ {
+ std::cout << boost::format("\n|%1%|\n") % itr->library;
+ }
+ if ( current.library != itr->library
+ || current.rel_path != itr->rel_path )
+ {
+ std::cout << boost::format(" %1%:\n") % itr->rel_path;
+ }
+ if ( current.library != itr->library
+ || current.rel_path != itr->rel_path
+ || current.msg != itr->msg )
+ {
+ string m = itr->msg;
+ for (string::size_type i = m.find(">"); i != string::npos;
+ i = m.find(">",i) )
+ {
+ m.replace(i,4,">");
+ }
+ std::cout << boost::format(" %1%\n") % m;
+ }
+ current.library = itr->library;
+ current.rel_path = itr->rel_path;
+ current.msg = itr->msg;
}
- if ( current.library != itr->library
- || current.rel_path != itr->rel_path
- || current.msg != itr->msg )
+ std::cout << "\n";
+ }
+ else
+ {
+ std::cout << "<h2>Details</h2>\n";
+
+ // display error messages with group indication
+ error_msg current;
+ string sep;
+ bool first = true;
+ for ( error_msg_vector::iterator itr ( msgs.begin() );
+ itr != msgs.end(); ++itr )
{
- std::cout << sep << itr->msg;
- sep = ", ";
+ if ( current.library != itr->library )
+ {
+ if ( !first ) std::cout << "</pre>\n";
+ std::cout << "\n<h3><a name=\"" << itr->library
+ << "\">" << itr->library << "</a></h3>\n<pre>";
+ }
+ if ( current.library != itr->library
+ || current.rel_path != itr->rel_path )
+ {
+ std::cout << "\n";
+ std::cout << itr->rel_path;
+ sep = ": ";
+ }
+ if ( current.library != itr->library
+ || current.rel_path != itr->rel_path
+ || current.msg != itr->msg )
+ {
+ std::cout << sep << itr->msg;
+ sep = ", ";
+ }
+ current.library = itr->library;
+ current.rel_path = itr->rel_path;
+ current.msg = itr->msg;
+ first = false;
}
- current.library = itr->library;
- current.rel_path = itr->rel_path;
- current.msg = itr->msg;
- first = false;
- }
- std::cout << "</pre>\n";
+ std::cout << "</pre>\n";
+ }
}
const char * options()
@@ -406,7 +490,7 @@
if ( argc > 1 && (std::strcmp( argv[1], "-help" ) == 0
|| std::strcmp( argv[1], "--help" ) == 0 ) )
{
- std::clog << "Usage: inspect [-cvs] [options...]\n"
+ std::clog << "Usage: inspect [-cvs] [-text] [options...]\n"
"options:\n"
<< options();
return 1;
@@ -427,6 +511,12 @@
--argc; ++argv;
}
+ if ( argc > 1 && std::strcmp( argv[1], "-text" ) == 0 )
+ {
+ display_format = display_text;
+ --argc; ++argv;
+ }
+
if ( argc > 1 && *argv[1] == '-' )
{
license_ck = false;
@@ -501,32 +591,62 @@
std::strftime( run_date, sizeof(run_date),
"%X UTC, %A %d %B %Y", std::gmtime( &tod ) );
- std::cout << "<html>\n"
- "<head>\n"
- "<title>Boost Inspection Report</title>\n"
- "</head>\n"
- "<body bgcolor=\"#ffffff\" text=\"#000000\">\n"
- "<table border=\"0\">\n"
- "<tr>\n"
- "<td><img border=\"0\" src=\"../boost.png\" width=\"277\" "
- "height=\"86\"></td>\n"
- "<td align=\"center\">\n"
- "<h1>Boost Inspection Report</h1>\n"
- "<b>Run Date:</b> " << run_date << "\n"
- "</td>\n"
- "</table>\n"
- "<p>An <a
href=\"http://www.boost.org/tools/inspect/index.html\">inspection\n"
- "program</a> checks each file in the current Boost CVS for various
problems,\n"
- "generating this web page as output. Problems detected include tabs
in files,\n"
- "missing copyrights, broken URL's, and similar misdemeanors.</p>\n"
- ;
+ if (display_text == display_format)
+ {
+ std::cout
+ <<
+ "Boost Inspection Report\n"
+ "Run Date: " << run_date << "\n"
+ "\n"
+ "An inspection program
<http://www.boost.org/tools/inspect/index.html>\n"
+ "checks each file in the current Boost CVS for various problems,\n"
+ "generating this as output. Problems detected include tabs in files,\n"
+ "missing copyrights, broken URL's, and similar misdemeanors.\n"
+ "\n"
+ ;
- std::cout << "<h2>Totals</h2>\n<pre>"
- << file_count << " files scanned\n"
- << directory_count << " directories scanned\n"
- << error_count << " problems reported\n";
+ std::cout
+ << "Totals:\n"
+ << boost::format(" %1% files scanned\n") % file_count
+ << boost::format(" %1% directories scanned\n") % directory_count
+ << boost::format(" %1% problems reported\n") % error_count
+ << "\n"
+ ;
- std::cout << "\nproblem counts:\n";
+ std::cout
+ << "Problem counts:\n";
+ }
+ else
+ {
+ std::cout
+ << "<html>\n"
+ "<head>\n"
+ "<title>Boost Inspection Report</title>\n"
+ "</head>\n"
+ "<body bgcolor=\"#ffffff\" text=\"#000000\">\n"
+ "<table border=\"0\">\n"
+ "<tr>\n"
+ "<td><img border=\"0\" src=\"../boost.png\" width=\"277\" "
+ "height=\"86\"></td>\n"
+ "<td align=\"center\">\n"
+ "<h1>Boost Inspection Report</h1>\n"
+ "<b>Run Date:</b> " << run_date << "\n"
+ "</td>\n"
+ "</table>\n"
+ "<p>An <a
href=\"http://www.boost.org/tools/inspect/index.html\">inspection\n"
+ "program</a> checks each file in the current Boost CVS for various
problems,\n"
+ "generating this web page as output. Problems detected include tabs in
files,\n"
+ "missing copyrights, broken URL's, and similar misdemeanors.</p>\n"
+ ;
+
+ std::cout
+ << "<h2>Totals</h2>\n<pre>"
+ << file_count << " files scanned\n"
+ << directory_count << " directories scanned\n"
+ << error_count << " problems reported\n";
+
+ std::cout << "\nproblem counts:\n";
+ }
for ( inspector_list::iterator itr = inspectors.begin();
itr != inspectors.end(); ++itr )
@@ -534,6 +654,11 @@
itr->inspector.reset();
}
+ if (display_text == display_format)
+ {
+ std::cout << "\n" ;
+ }
+
std::sort( msgs.begin(), msgs.end() );
if ( !msgs.empty() )
@@ -542,7 +667,15 @@
display_details();
}
- std::cout << "</body>\n"
- "</html>\n";
+ if (display_text == display_format)
+ {
+ std::cout << "\n\n" ;
+ }
+ else
+ {
+ std::cout
+ << "</body>\n"
+ "</html>\n";
+ }
return 0;
}
Index: inspector.hpp
===================================================================
RCS file: /cvsroot/boost/boost/tools/inspect/inspector.hpp,v
retrieving revision 1.5
retrieving revision 1.5.8.1
diff -u -d -r1.5 -r1.5.8.1
--- inspector.hpp 20 Jul 2004 04:31:53 -0000 1.5
+++ inspector.hpp 15 Jul 2006 23:32:06 -0000 1.5.8.1
@@ -78,13 +78,12 @@
inline string relative_to( const path & src_arg, const path & base_arg )
{
- path src( src_arg );
- src.normalize();
path base( base_arg );
base.normalize();
string::size_type pos( base.string().size() );
- return src.string().substr(
- pos + ( pos < src.string().size() ? 1 : 0 ) );
+ path src( src_arg.string().substr(pos) );
+ src.normalize();
+ return src.string().substr(1);
}
string impute_library( const path & full_dir_path );
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Boost-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/boost-cvs