Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r78624 - in trunk/tools/inspect: . build/msvc
From: bdawes_at_[hidden]
Date: 2012-05-25 14:52:10


Author: bemandawes
Date: 2012-05-25 14:52:09 EDT (Fri, 25 May 2012)
New Revision: 78624
URL: http://svn.boost.org/trac/boost/changeset/78624

Log:
inspect: make URL and revision discovery less dependent on version of svn info. Upgrade to MSVC 2010.
Text files modified:
   trunk/tools/inspect/build/msvc/boost_inspect.sln | 6 ++--
   trunk/tools/inspect/build/msvc/readme.txt | 6 ++--
   trunk/tools/inspect/inspect.cpp | 48 ++++++++++++++++++++++-----------------
   3 files changed, 33 insertions(+), 27 deletions(-)

Modified: trunk/tools/inspect/build/msvc/boost_inspect.sln
==============================================================================
--- trunk/tools/inspect/build/msvc/boost_inspect.sln (original)
+++ trunk/tools/inspect/build/msvc/boost_inspect.sln 2012-05-25 14:52:09 EDT (Fri, 25 May 2012)
@@ -1,7 +1,7 @@
 ï»¿
-Microsoft Visual Studio Solution File, Format Version 10.00
-# Visual C++ Express 2008
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "boost_inspect", "boost_inspect.vcproj", "{0EC8AC1C-6D1F-47FC-A06A-9CC3F924BD82}"
+Microsoft Visual Studio Solution File, Format Version 11.00
+# Visual C++ Express 2010
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "inspect", "boost_inspect.vcxproj", "{0EC8AC1C-6D1F-47FC-A06A-9CC3F924BD82}"
 EndProject
 Global
         GlobalSection(SolutionConfigurationPlatforms) = preSolution

Modified: trunk/tools/inspect/build/msvc/readme.txt
==============================================================================
--- trunk/tools/inspect/build/msvc/readme.txt (original)
+++ trunk/tools/inspect/build/msvc/readme.txt 2012-05-25 14:52:09 EDT (Fri, 25 May 2012)
@@ -1,4 +1,4 @@
-The provided Microsoft VC++ solution assumes the following commands have been run in the root directory:
+The provided Microsoft VC++ 10 solution assumes the following commands have been run in the root directory:
 
- bjam --toolset=msvc-9.0express --build-type=complete --with-filesystem stage
- bjam --toolset=msvc-9.0express --build-type=complete --with-regex stage
+ bjam --toolset=msvc-10.0express --build-type=complete --with-filesystem stage
+ bjam --toolset=msvc-10.0express --build-type=complete --with-regex stage

Modified: trunk/tools/inspect/inspect.cpp
==============================================================================
--- trunk/tools/inspect/inspect.cpp (original)
+++ trunk/tools/inspect/inspect.cpp 2012-05-25 14:52:09 EDT (Fri, 25 May 2012)
@@ -26,6 +26,15 @@
 #include "boost/filesystem/operations.hpp"
 #include "boost/filesystem/fstream.hpp"
 
+#include <stdio.h> // for popen, pclose
+#if defined(_MSC_VER)
+# define POPEN _popen
+# define PCLOSE _pclose
+#else
+# define POPEN popen
+# define PCLOSE pclose
+#endif
+
 #include "time_string.hpp"
 
 #include "inspector.hpp"
@@ -111,29 +120,26 @@
 
 // get info (as a string) if inspect_root is svn working copy --------------//
 
- void extract_info( fs::ifstream & entries_file, string & rev, string & repos )
- {
- std::getline( entries_file, rev );
- std::getline( entries_file, rev );
- std::getline( entries_file, rev );
- std::getline( entries_file, rev ); // revision number as a string
- std::getline( entries_file, repos ); // repository as a string
- }
-
   string info( const fs::path & inspect_root )
   {
- string rev( "?" );
- string repos( "unknown" );
- fs::path entries( inspect_root / ".svn" / "entries" );
- fs::ifstream entries_file( entries );
- if ( entries_file )
- extract_info( entries_file, rev, repos );
- else
- {
- entries = inspect_root / ".." / "svn_info" / ".svn" / "entries";
- fs::ifstream entries_file( entries );
- if ( entries_file )
- extract_info( entries_file, rev, repos );
+ string rev("unknown");
+ string repos("unknown");
+ string command("cd ");
+ command += inspect_root.string() + " & svn info";
+ FILE* fp = POPEN(command.c_str(), "r");
+ if (fp)
+ {
+ static const int line_max = 128;
+ char line[line_max];
+ while (fgets(line, line_max, fp) != NULL)
+ {
+ string ln(line);
+ string::size_type pos;
+ if ((pos = ln.find("Revision: ")) != string::npos)
+ rev = ln.substr(pos + 10);
+ else if ((pos = ln.find("URL: ")) != string::npos)
+ repos = ln.substr(pos + 5);
+ }
     }
     return repos + " at revision " + rev;
   }


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk