Changeset 795 for trunk/bin


Ignore:
Timestamp:
Jun 30, 2009, 5:57:27 AM (14 years ago)
Author:
Peter Johansson
Message:

refs #388

Create a sub-directory 'lib/yat' in which files from yat are
placed. The files may be updated via 'make fetch', see file README for
more details on how to change which files are updated/copied through
this mechanism.

The reason we do not use subversion's external mechanism is that we
don't want the files to be synchronised with yat automatically. We
want the update to be moderated by some developer.

I chose to fetch files using the svn client rather than wget because
the svn allows us to get an Id string with information from the yat
repository. 'wget' would just download the file as it appears on the
server that is the string is not expanded.

The file 'config_public.h' is created by configure just as in
yat. This implies that automake adds $(top_builddir)/lib/yat to the
include path so unless in a VPATH build $(top_srcdir)/lib/yat is in
the include path. As we have already added $(top_srcdir)/lib to the
include path, and there are both a lib/utility.h and a
lib/yat/utility.h it is not obvious which file is included when having
'include "utility.h"'. For this reason, when being in bin/ and test/
it is needed to include "../lib/utility.h" rather than "utility.h"
when we want to include 'lib/utility.h'.

Location:
trunk/bin
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/bin/Makefile.am

    r768 r795  
    2929noinst_HEADERS = Parameter.h
    3030
    31 LDADD = $(top_builddir)/lib/libsvndigest.a $(SVNDIGEST_LIBS)
     31LDADD = $(top_builddir)/lib/libsvndigest.a \
     32  $(top_builddir)/lib/yat/libyat.a $(SVNDIGEST_LIBS)
    3233AM_LDFLAGS = $(SVNDIGEST_LDFLAGS)
    3334
  • trunk/bin/Parameter.cc

    r752 r795  
    2222#include "Parameter.h"
    2323
    24 #include "ColumnStream.h"
    25 #include "OptionArg.h"
    26 #include "OptionHelp.h"
    27 #include "OptionSwitch.h"
    2824#include "OptionVersion.h"
    29 #include "utility.h"
     25#include "../lib/utility.h" // to avoid inclusion of yat file
     26
     27#include "yat/ColumnStream.h"
     28#include "yat/Exception.h"
     29#include "yat/OptionArg.h"
     30#include "yat/OptionHelp.h"
     31#include "yat/OptionSwitch.h"
     32
    3033#include <config.h> // this header file is created by configure
    3134
     
    5255      cmd_.parse(argc, argv);
    5356    }
    54     catch (cmd_error& e) {
     57    catch (yat::utility::cmd_error& e) {
    5558      std::cerr << e.what() << std::endl;
    5659      exit (-1);
     
    101104        ss << "svndigest: cannot read `" << root_->value() << "': "
    102105           << strerror(errno);
    103         throw cmd_error(ss.str());
     106        throw yat::utility::cmd_error(ss.str());
    104107      }
    105108      root_->value(pwd());
     
    116119          ss << "svndigest: cannot create directory `" << path
    117120             << "': " << strerror(errno);
    118           throw cmd_error(ss.str());
     121          throw yat::utility::cmd_error(ss.str());
    119122        }
    120123        if (node_exist(path) && !force()) {
     
    122125          ss << "svndigest: cannot create directory `" << path << "' "
    123126             << strerror(EEXIST);
    124           throw cmd_error(ss.str());
     127          throw yat::utility::cmd_error(ss.str());
    125128        }
    126129        if (chdir(target_->value().c_str())) {
     
    128131          ss << "svndigest: cannot read `" << target_->value() << "': "
    129132             << strerror(errno);
    130           throw cmd_error(ss.str());
     133          throw yat::utility::cmd_error(ss.str());
    131134        }
    132135        target_->value(pwd());
     
    151154        ss << "svndigest: `" << config_file_->value()
    152155           << "' is not a regular file";
    153         throw cmd_error(ss.str());
     156        throw yat::utility::cmd_error(ss.str());
    154157      }
    155158    }
     
    163166    std::stringstream ss;
    164167    ss << "svndigest: cannot stat `" << path << "': " << strerror(errno);
    165     throw cmd_error(ss.str());
     168    throw yat::utility::cmd_error(ss.str());
    166169  }
    167170
     
    173176    std::stringstream ss;
    174177    ss << "svndigest: cannot open `" << path << "': " << strerror(errno);
    175     throw cmd_error(ss.str());
     178    throw yat::utility::cmd_error(ss.str());
    176179  }
    177180 
     
    211214    // don't use argv[0] because user may rename the binary
    212215    cmd_.program_name() = PACKAGE_NAME;
    213     config_file_=new OptionArg<std::string>(cmd_, "config-file",
     216    config_file_=new yat::utility::OptionArg<std::string>(cmd_, "config-file",
    214217                                "configuration file [<ROOT>/.svndigest/config]");
    215218    config_file_->print_arg("=FILE");
    216219    std::stringstream ss;
    217     copyright_ = new OptionSwitch(cmd_, "copyright",
     220    copyright_ = new yat::utility::OptionSwitch(cmd_, "copyright",
    218221                                  "update copyright statement");
    219222
    220223    ss << "if sub-directory named <ROOT> exists in target directory, remove "
    221224       << "sub-directory before writing results";
    222     force_ = new OptionSwitch(cmd_, "f,force", ss.str());
    223     ss.str("");
    224 
    225     help_ = new OptionHelp(cmd_);
     225    force_ = new yat::utility::OptionSwitch(cmd_, "f,force", ss.str());
     226    ss.str("");
     227
     228    help_ = new yat::utility::OptionHelp(cmd_);
    226229    generate_config_ =
    227       new OptionSwitch(cmd_, "g,generate-config",
     230      new yat::utility::OptionSwitch(cmd_, "g,generate-config",
    228231                       "write configuration file to standard output");
    229232
    230233    ss.str("");
    231234    ss << "ignore cache files and analyze everything from repository";
    232     ignore_cache_ = new OptionSwitch(cmd_, "ignore-cache", ss.str());
     235    ignore_cache_ = new yat::utility::OptionSwitch(cmd_, "ignore-cache", ss.str());
    233236         
    234     report_ = new OptionSwitch(cmd_, "report", "create no HTML report", true);
     237    report_ = new yat::utility::OptionSwitch(cmd_, "report", "create no HTML report", true);
    235238
    236239    ss.str("");
    237240    ss << "use revision numbers as time scale instead of dates [dates]";
    238     revisions_ = new OptionSwitch(cmd_, "revisions", ss.str());
     241    revisions_ = new yat::utility::OptionSwitch(cmd_, "revisions", ss.str());
    239242
    240243    root_=
    241       new OptionArg<std::string>(cmd_, "r,root",
     244      new yat::utility::OptionArg<std::string>(cmd_, "r,root",
    242245                     "svn controlled directory to perform statistics on [.]");
    243246    root_->print_arg("=ROOT");
    244     target_ = new OptionArg<std::string>(cmd_, "t,target",
     247    target_ = new yat::utility::OptionArg<std::string>(cmd_, "t,target",
    245248                                         "output directory [.]");
    246249    target_->print_arg("=TARGET");
    247250   
    248     verbose_ = new OptionSwitch(cmd_, "v,verbose", "explain what is being done");
     251    verbose_ = new yat::utility::OptionSwitch(cmd_, "v,verbose", "explain what is being done");
    249252    version_ = new OptionVersion(cmd_, "version",
    250253                                 "print version information and exit", verbose_);
  • trunk/bin/Parameter.h

    r768 r795  
    2424*/
    2525
    26 #include "CommandLine.h"
    27 #include "OptionArg.h"
     26#include "yat/CommandLine.h"
     27#include "yat/OptionArg.h"
    2828
    2929#include <string>
    3030
    3131namespace theplu {
     32namespace yat {
     33namespace utility {
     34  class OptionHelp;
     35  class OptionSwitch;
     36}}
    3237namespace svndigest {
    3338
    34   class OptionHelp;
    35   class OptionSwitch;
    3639  class OptionVersion;
    3740
     
    6669    void init(void);
    6770
    68     CommandLine cmd_;
    69     OptionArg<std::string>* config_file_;
    70     OptionSwitch* copyright_;
    71     OptionSwitch* force_;
    72     OptionSwitch* generate_config_;
    73     OptionHelp* help_;
    74     OptionSwitch* ignore_cache_;
    75     OptionSwitch* report_;
    76     OptionSwitch* revisions_;
    77     OptionArg<std::string>* root_;
    78     OptionArg<std::string>* target_;
    79     OptionSwitch* verbose_;
     71    yat::utility::CommandLine cmd_;
     72    yat::utility::OptionArg<std::string>* config_file_;
     73    yat::utility::OptionSwitch* copyright_;
     74    yat::utility::OptionSwitch* force_;
     75    yat::utility::OptionSwitch* generate_config_;
     76    yat::utility::OptionHelp* help_;
     77    yat::utility::OptionSwitch* ignore_cache_;
     78    yat::utility::OptionSwitch* report_;
     79    yat::utility::OptionSwitch* revisions_;
     80    yat::utility::OptionArg<std::string>* root_;
     81    yat::utility::OptionArg<std::string>* target_;
     82    yat::utility::OptionSwitch* verbose_;
    8083    OptionVersion* version_;
    8184
  • trunk/bin/svndigest.cc

    r763 r795  
    2626#include "css.h"
    2727#include "Directory.h"
    28 #include "Exception.h"
    2928#include "first_page.h"
    3029#include "GnuplotFE.h"
     
    3635#include "SVNinfo.h"
    3736#include "SVNlog.h"
    38 #include "utility.h"
     37#include "../lib/utility.h"
     38
     39#include "yat/Exception.h"
    3940
    4041#include <cassert>
     
    5152int main( int argc, char* argv[])
    5253{
    53   using namespace theplu::svndigest;
     54  using namespace theplu;
     55  using namespace svndigest;
    5456
    5557  // Reading commandline options
     
    6062      std::cout << "Done parsing parameters" << std::endl;
    6163  }
    62   catch (cmd_error& e) {
     64  catch (yat::utility::cmd_error& e) {
    6365    std::cerr << e.what() << std::endl;
    6466    exit(-1);
Note: See TracChangeset for help on using the changeset viewer.