Boost logo

Boost :

Subject: [boost] BCP module list from file
From: Matthew Chambers (matthew.chambers_at_[hidden])
Date: 2009-08-26 14:35:18


Hi,

I'm automating the creation of a boost subset tarball with bcp and I had
to add passing the module list in from a file because the list got so
long (and of course piecemeal invocation results in a lot of redundant
copying). Is this a feature that someone wants to patch into an official
release? I'll attach the diffs; it was a very simple change but it makes
the program scalable for larger projects.

Thanks,
Matt


--- C:/bumbershoot/src/pwiz-src/libraries/boost_1_39_0/tools/bcp/trunk bcp_imp.hpp Wed Aug 26 13:29:19 2009
+++ C:/bumbershoot/src/pwiz-src/libraries/boost_1_39_0/tools/bcp/bcp_imp.hpp Wed Aug 19 15:17:17 2009
@@ -59,6 +59,7 @@
    void enable_bsl_summary_mode();
    void set_boost_path(const char* p);
    void set_destination(const char* p);
+ void set_module_list_file(const char* p);
    void add_module(const char* p);
 
    virtual int run();

--- C:/bumbershoot/src/pwiz-src/libraries/boost_1_39_0/tools/bcp/trunk main.cpp Wed Aug 26 13:29:26 2009
+++ C:/bumbershoot/src/pwiz-src/libraries/boost_1_39_0/tools/bcp/main.cpp Wed Aug 19 15:28:38 2009
@@ -34,11 +34,13 @@
       " bcp [options] module-list output-path\n"
       "\n"
       "Options:\n"
- " --boost=path sets the location of the boost tree to path\n"
- " --scan treat the module list as a list of (possibly non-boost)\n"
- " files to scan for boost dependencies\n"
- " --cvs only copy files under cvs version control\n"
- " --unix-lines make sure that all copied files use Unix style line endings\n"
+ " --boost=path sets the location of the boost tree to path\n"
+ " --scan treat the module list as a list of (possibly\n"
+ " non-boost) files to scan for boost dependencies\n"
+ " --cvs only copy files under cvs version control\n"
+ " --unix-lines convert all copied files to use Unix style end-lines\n"
+ " --module-list-file=path reads the module-list from a file, or from standard\n"
+ " input if the filename is '-'\n"
       "\n"
       "module-list: a list of boost files or library names to copy\n"
       "html-file: the name of a html file to which the report will be written\n"
@@ -134,6 +136,10 @@
       {
          papp->set_boost_path(argv[i] + 8);
       }
+ else if(0 == std::strncmp("--module-list-file=", argv[i], 19))
+ {
+ papp->set_module_list_file(argv[i] + 19);
+ }
       else if(argv[i][0] == '-')
       {
          show_usage();

--- C:/bumbershoot/src/pwiz-src/libraries/boost_1_39_0/tools/bcp/trunk bcp_imp.cpp Wed Aug 26 13:29:17 2009
+++ C:/bumbershoot/src/pwiz-src/libraries/boost_1_39_0/tools/bcp/bcp_imp.cpp Wed Aug 19 15:16:59 2009
@@ -95,6 +95,33 @@
    m_dest_path = fs::path(p, fs::native);
 }
 
+void bcp_implementation::set_module_list_file(const char* p)
+{
+ if(0 == std::strncmp("-", p, 1))
+ {
+ // read lines from standard input
+ std::string s;
+ while(std::getline(std::cin, s))
+ m_module_list.push_back(s);
+ }
+ else
+ {
+ fs::path module_list_file_path = fs::path(p, fs::native);
+ if(!fs::exists(module_list_file_path))
+ {
+ std::runtime_error e("The module list file does not exist.");
+ throw e;
+ }
+
+ std::ifstream module_list_file(p, std::ios::in);
+
+ // read lines from file
+ std::string s;
+ while(std::getline(module_list_file, s))
+ m_module_list.push_back(s);
+ }
+}
+
 void bcp_implementation::add_module(const char* p)
 {
    m_module_list.push_back(p);

--- C:/bumbershoot/src/pwiz-src/libraries/boost_1_39_0/tools/bcp/trunk bcp.hpp Wed Aug 26 13:29:08 2009
+++ C:/bumbershoot/src/pwiz-src/libraries/boost_1_39_0/tools/bcp/bcp.hpp Wed Aug 19 15:00:27 2009
@@ -28,6 +28,7 @@
    virtual void enable_bsl_summary_mode() = 0;
    virtual void set_boost_path(const char* p) = 0;
    virtual void set_destination(const char* p) = 0;
+ virtual void set_module_list_file(const char* p) = 0;
    virtual void add_module(const char* p) = 0;
 
    virtual int run() = 0;


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk