public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Petteri Räty" <betelgeuse@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/libbash:master commit in: /
Date: Fri,  8 Jul 2011 14:03:01 +0000 (UTC)	[thread overview]
Message-ID: <d3296b24ca1fa7cafc5bf25e129a3c1ce0811ac7.betelgeuse@gentoo> (raw)

commit:     d3296b24ca1fa7cafc5bf25e129a3c1ce0811ac7
Author:     Mu Qiao <qiaomuf <AT> gentoo <DOT> org>
AuthorDate: Fri Jul  1 09:51:38 2011 +0000
Commit:     Petteri Räty <betelgeuse <AT> gentoo <DOT> org>
CommitDate: Tue Jul  5 01:49:27 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/libbash.git;a=commit;h=d3296b24

Merge remote branch 'betelgeuse/multithread' into multithreading

Conflicts:
	src/builtins/source_builtin.cpp
	src/core/bash_ast.cpp
	src/core/bash_ast.h
	utils/instruo.cpp


 Makefile.am                     |    4 +-
 bashast/libbashWalker.g         |    2 +-
 src/builtins/source_builtin.cpp |   51 +++++++++++--------
 src/core/bash_ast.cpp           |   39 +++++++++++++-
 src/core/bash_ast.h             |    8 ++-
 utils/instruo.cpp               |  108 ++++++++++++++++++---------------------
 6 files changed, 125 insertions(+), 87 deletions(-)

diff --cc src/builtins/source_builtin.cpp
index bec83ad,ee95e29..d7924ab
--- a/src/builtins/source_builtin.cpp
+++ b/src/builtins/source_builtin.cpp
@@@ -30,39 -32,45 +31,47 @@@
  
  #include "builtins/builtin_exceptions.h"
  #include "cppbash_builtin.h"
 +#include "core/exceptions.h"
  #include "core/interpreter.h"
 -#include "core/interpreter_exception.h"
  #include "core/bash_ast.h"
  
- int source_builtin::exec(const std::vector<std::string>& bash_args)
- {
-   static std::unordered_map<std::string, std::shared_ptr<bash_ast>> ast_cache;
+ namespace {
+   std::mutex parse_mutex;
  
-   if(bash_args.size() == 0)
-     throw libbash::illegal_argument_exception("should provide one argument for source builtin");
+   std::shared_ptr<bash_ast>& parse(const std::string& path)
+   {
+     static std::unordered_map<std::string, std::shared_ptr<bash_ast>> ast_cache;
  
-   // we need fix this to pass extra arguments as positional parameters
-   const std::string& path = bash_args[0];
+     std::lock_guard<std::mutex> parse_lock(parse_mutex);
  
-   auto stored_ast = ast_cache.find(path);
-   if(stored_ast == ast_cache.end())
-   {
-     // ensure the path is cached
-     auto iter = ast_cache.insert(make_pair(path, std::shared_ptr<bash_ast>()));
-     // this may throw exception
-     iter.first->second.reset(new bash_ast(path));
-     stored_ast = iter.first;
-   }
-   else if(!(stored_ast->second))
-   {
-     throw libbash::parse_exception(path + " cannot be fully parsed");
 -    auto& stored_ast = ast_cache[path];
 -    if(!stored_ast)
++    auto stored_ast = ast_cache.find(path);
++    if(stored_ast == ast_cache.end())
+     {
 -      std::ifstream input(path);
 -      if(!input)
 -        throw interpreter_exception(path + " can't be read");
 -
 -      stored_ast.reset(new bash_ast(input));
 -      if(stored_ast->get_error_count())
 -        std::cerr << path << " could not be parsed properly" << std::endl;
++      // ensure the path is cached
++      auto iter = ast_cache.insert(make_pair(path, std::shared_ptr<bash_ast>()));
++      // this may throw exception
++      iter.first->second.reset(new bash_ast(path));
++      stored_ast = iter.first;
++    }
++    else if(!(stored_ast->second))
++    {
++      throw libbash::parse_exception(path + " cannot be fully parsed");
+     }
+ 
 -    return stored_ast;
++    return stored_ast->second;
    }
+ }
+ 
+ int source_builtin::exec(const std::vector<std::string>& bash_args)
+ {
 -  static std::unordered_map<std::string, std::shared_ptr<bash_ast>> ast_cache;
 -
+   if(bash_args.size() == 0)
 -    throw interpreter_exception("should provide one argument for source builtin");
++    throw libbash::illegal_argument_exception("should provide one argument for source builtin");
  
 +  const std::string& original_path = _walker.resolve<std::string>("0");
++  _walker.define("0", bash_args.front(), true);
    try
    {
-     _walker.define("0", path, true);
-     stored_ast->second->interpret_with(_walker);
+     parse(bash_args.front())->interpret_with(_walker);
    }
    catch(return_exception& e) {}
  
diff --cc src/core/bash_ast.cpp
index c7b9180,22c7f22..3787f84
--- a/src/core/bash_ast.cpp
+++ b/src/core/bash_ast.cpp
@@@ -18,15 -18,16 +18,17 @@@
  */
  ///
  /// \file bash_ast.cpp
 -/// \author Mu Qiao
 -/// \brief implementation that helps interpret from istream
 +/// \brief a wrapper class that helps interpret from istream and string
  ///
 -
  #include "core/bash_ast.h"
  
 +#include <fstream>
+ #include <sstream>
+ #include <thread>
  
 -#include "core/interpreter_exception.h"
 +#include <boost/numeric/conversion/cast.hpp>
 +
 +#include "core/exceptions.h"
  #include "core/interpreter.h"
  #include "libbashLexer.h"
  #include "libbashParser.h"
@@@ -38,60 -38,107 +40,85 @@@ bash_ast::bash_ast(const std::istream& 
    std::stringstream stream;
    stream << source.rdbuf();
    script = stream.str();
 +  init_parser(script, "unknown source");
 +}
  
 -  input = antlr3NewAsciiStringInPlaceStream(
 -      reinterpret_cast<pANTLR3_UINT8>(const_cast<char*>(script.c_str())),
 -      script.size(),
 -      NULL);
 -
 -  if(input == NULL)
 -    throw interpreter_exception("Unable to open file " + script + " due to malloc() failure");
 +bash_ast::bash_ast(const std::string& script_path,
 +                   std::function<pANTLR3_BASE_TREE(plibbashParser)> p): parse(p)
 +{
 +  std::stringstream stream;
 +  std::ifstream file_stream(script_path);
 +  if(!file_stream)
 +    throw libbash::parse_exception(script_path + " can't be read");
  
 -  init_parser();
 +  stream << file_stream.rdbuf();
 +  script = stream.str();
 +  init_parser(script, script_path);
  }
  
+ namespace
+ {
+   std::mutex string_mutex;
+ 
+   pANTLR3_STRING locked_newRaw8(pANTLR3_STRING_FACTORY factory)
+   {
+     std::lock_guard<std::mutex> l(string_mutex);
+     pANTLR3_STRING_FACTORY pristine = antlr3StringFactoryNew();
+     pANTLR3_STRING result = pristine->newRaw(factory);
+     pristine->close(pristine);
+     return result;
+   }
+ 
+   void locked_destroy(pANTLR3_STRING_FACTORY factory, pANTLR3_STRING string)
+   {
+     std::lock_guard<std::mutex> l(string_mutex);
+     pANTLR3_STRING_FACTORY pristine = antlr3StringFactoryNew();
+     pristine->destroy(factory, string);
+     pristine->close(pristine);
+   }
+ }
+ 
 -bash_ast::~bash_ast()
 +void bash_ast::init_parser(const std::string& script, const std::string& script_path)
  {
 -  psr->free(psr);
 -  tstream->free(tstream);
 -  lxr->free(lxr);
 -  input->close(input);
 -}
 -
 -void bash_ast::init_parser()
 -{
 -  lxr = libbashLexerNew(input);
 -  if ( lxr == NULL )
 -  {
 -    std::cerr << "Unable to create the lexer due to malloc() failure" << std::endl;
 -    error_count = 1;
 -    return;
 -  }
 -
 -  tstream = antlr3CommonTokenStreamSourceNew(
 -      ANTLR3_SIZE_HINT, lxr->pLexer->rec->state->tokSource);
 -  if (tstream == NULL)
 -  {
 -    std::cerr << "Out of memory trying to allocate token stream" << std::endl;
 -    error_count = 1;
 -    return;
 -  }
 -
 -  psr = libbashParserNew(tstream);
 -  if (psr == NULL)
 -  {
 -    std::cerr << "Out of memory trying to allocate parser" << std::endl;
 -    error_count = 1;
 -    return;
 -  }
 -
 -  langAST.reset(new libbashParser_start_return(psr->start(psr)));
 -  langAST->tree->strFactory->newRaw = &locked_newRaw8;
 -  langAST->tree->strFactory->destroy = &locked_destroy;
 -  error_count = psr->pParser->rec->getNumberOfSyntaxErrors(psr->pParser->rec);
 -}
 -
 -void bash_ast::interpret_with(interpreter& walker)
 -{
 -  set_interpreter(&walker);
 -
 -  auto nodes = antlr3CommonTreeNodeStreamNewTree(langAST->tree, ANTLR3_SIZE_HINT);
 -  plibbashWalker treePsr = libbashWalkerNew(nodes);
 -  try
 -  {
 -    treePsr->start(treePsr);
 -  }
 -  catch(...)
 -  {
 -    treePsr->free(treePsr);
 -    throw;
 -  }
 -  treePsr->free(treePsr);
 -  nodes->free(nodes);
 +  input.reset(antlr3NewAsciiStringInPlaceStream(
 +    reinterpret_cast<pANTLR3_UINT8>(const_cast<char*>(script.c_str())),
 +    // We do not support strings longer than the max value of ANTLR3_UNIT32
 +    boost::numeric_cast<ANTLR3_UINT32>(script.size()),
 +    NULL));
 +
 +  if(!input)
 +    throw libbash::parse_exception("Unable to open file " + script + " due to malloc() failure");
 +
 +  input->fileName = input->strFactory->newStr(
 +      input->strFactory,
 +      reinterpret_cast<pANTLR3_UINT8>(const_cast<char*>(script_path.c_str())));
 +
 +  lexer.reset(libbashLexerNew(input.get()));
 +  if(!lexer)
 +    throw libbash::parse_exception("Unable to create the lexer due to malloc() failure");
 +
 +  token_stream.reset(antlr3CommonTokenStreamSourceNew(
 +      ANTLR3_SIZE_HINT, lexer->pLexer->rec->state->tokSource));
 +  if(!token_stream)
 +    throw libbash::parse_exception("Out of memory trying to allocate token stream");
 +
 +  parser.reset(libbashParserNew(token_stream.get()));
 +  if(!parser)
 +    throw libbash::parse_exception("Out of memory trying to allocate parser");
 +
 +  ast = parse(parser.get());
++  ast->strFactory->newRaw = &locked_newRaw8;
++  ast->strFactory->destroy = &locked_destroy;
 +  if(parser->pParser->rec->getNumberOfSyntaxErrors(parser->pParser->rec))
 +    throw libbash::parse_exception("Something wrong happened while parsing");
-   nodes.reset(antlr3CommonTreeNodeStreamNewTree(ast, ANTLR3_SIZE_HINT));
  }
  
  std::string bash_ast::get_dot_graph()
  {
 -  auto nodes = antlr3CommonTreeNodeStreamNewTree(langAST->tree, ANTLR3_SIZE_HINT);
 -  pANTLR3_STRING graph = nodes->adaptor->makeDot(nodes->adaptor, langAST->tree);
 -  std::string result(reinterpret_cast<char*>(graph->chars));
 -  nodes->free(nodes);
 -  return result;
++  antlr_pointer<ANTLR3_COMMON_TREE_NODE_STREAM_struct> nodes(
++    antlr3CommonTreeNodeStreamNewTree(ast, ANTLR3_SIZE_HINT));
 +  pANTLR3_STRING graph = nodes->adaptor->makeDot(nodes->adaptor, ast);
 +  return std::string(reinterpret_cast<char*>(graph->chars));
  }
  
  std::string bash_ast::get_string_tree()
@@@ -148,71 -195,6 +175,79 @@@ std::string bash_ast::get_parser_tokens
        print_line_counter(result, token, line_counter, tokenName == "CONTINUE_LINE"? 1 : 0);
      }
    }
 +  return result.str();
 +}
 +
 +std::string bash_ast::get_walker_tokens(std::function<std::string(ANTLR3_UINT32)> token_map)
 +{
 +  std::stringstream result;
++  antlr_pointer<ANTLR3_COMMON_TREE_NODE_STREAM_struct> nodes(
++    antlr3CommonTreeNodeStreamNewTree(ast, ANTLR3_SIZE_HINT));
 +  pANTLR3_INT_STREAM istream = nodes->tnstream->istream;
 +  auto istream_size = istream->size(istream);
 +
 +  for(ANTLR3_UINT32 i = 1; i <= istream_size; ++i)
 +  {
 +    ANTLR3_UINT32 token = istream->_LA(istream, boost::numeric_cast<ANTLR3_INT32>(i));
 +    if(token == 2)
 +      result << "DOWN ";
 +    else if(token == 3)
 +      result << "UP ";
 +    else
 +      result << token_map(istream->_LA(istream, boost::numeric_cast<ANTLR3_INT32>(i))) << " ";
 +  }
 +  result << std::endl;
  
    return result.str();
  }
 +
 +void bash_ast::walker_start(plibbashWalker tree_parser)
 +{
 +  tree_parser->start(tree_parser);
 +}
 +
 +long bash_ast::walker_arithmetics(plibbashWalker tree_parser)
 +{
 +  return tree_parser->arithmetics(tree_parser);
 +}
 +
 +pANTLR3_BASE_TREE bash_ast::parser_start(plibbashParser parser)
 +{
 +  return parser->start(parser).tree;
 +}
 +
 +pANTLR3_BASE_TREE bash_ast::parser_arithmetics(plibbashParser parser)
 +{
 +  return parser->arithmetics(parser).tree;
 +}
 +
 +void bash_ast::call_function(plibbashWalker ctx,
 +                             ANTLR3_MARKER index)
 +{
 +  auto INPUT = ctx->pTreeParser->ctnstream;
++
++  // Initialize the input stream
++  auto ISTREAM = ctx->pTreeParser->ctnstream->tnstream->istream;
++  ISTREAM->size(ISTREAM);
++
 +  // Push function index into INPUT
 +  // The actual type of ANTLR3_MARKER is ANTLR3_INT32
 +  INPUT->push(INPUT, boost::numeric_cast<ANTLR3_INT32>(index));
 +  // Execute function body
 +  ctx->compound_command(ctx);
 +}
 +
- bash_ast::walker_pointer bash_ast::create_walker(interpreter& walker)
++bash_ast::walker_pointer bash_ast::create_walker(interpreter& walker,
++                                                 antlr_pointer<ANTLR3_COMMON_TREE_NODE_STREAM_struct>& nodes)
 +{
 +    set_interpreter(&walker);
 +    walker.push_current_ast(this);
 +
 +    auto deleter = [&](plibbashWalker tree_parser)
 +    {
 +      tree_parser->free(tree_parser);
 +      walker.pop_current_ast();
 +    };
 +
 +    return walker_pointer(libbashWalkerNew(nodes.get()), deleter);
 +}
diff --cc src/core/bash_ast.h
index 22635a1,852899c..190b020
--- a/src/core/bash_ast.h
+++ b/src/core/bash_ast.h
@@@ -36,79 -34,37 +36,81 @@@
  
  struct libbashLexer_Ctx_struct;
  struct libbashParser_Ctx_struct;
 -struct libbashParser_start_return_struct;
 +struct libbashWalker_Ctx_struct;
 +typedef libbashWalker_Ctx_struct* plibbashWalker;
  class interpreter;
  
 +template<typename T>
 +class antlr_pointer: public std::unique_ptr<T, std::function<void(T*)>>
 +{
 +  typedef std::unique_ptr<T, std::function<void(T*)>> parent;
 +public:
 +  antlr_pointer(T* p = 0) : parent(p, [](T* to_delete) { to_delete->free(to_delete); }) {};
 +};
 +
  /// \class bash_ast
 -/// \brief a wrapper class that helps interpret from istream
 -class bash_ast
 +/// \brief a wrapper class that helps interpret from istream and string
 +class bash_ast: public boost::noncopyable
  {
 -  pANTLR3_INPUT_STREAM input;
 +  antlr_pointer<ANTLR3_INPUT_STREAM_struct> input;
    std::string script;
 -  libbashLexer_Ctx_struct* lxr;
 -  pANTLR3_COMMON_TOKEN_STREAM tstream;
 -  libbashParser_Ctx_struct* psr;
 -  std::unique_ptr<libbashParser_start_return_struct> langAST;
 -  int error_count;
 +  antlr_pointer<libbashLexer_Ctx_struct> lexer;
 +  antlr_pointer<ANTLR3_COMMON_TOKEN_STREAM_struct> token_stream;
 +  antlr_pointer<libbashParser_Ctx_struct> parser;
 +  pANTLR3_BASE_TREE ast;
-   antlr_pointer<ANTLR3_COMMON_TREE_NODE_STREAM_struct> nodes;
 +  std::function<pANTLR3_BASE_TREE(libbashParser_Ctx_struct*)> parse;
 +
 +  typedef std::unique_ptr<libbashWalker_Ctx_struct, std::function<void(plibbashWalker)>> walker_pointer;
 +
 +  void init_parser(const std::string& script, const std::string& script_path);
-   walker_pointer create_walker(interpreter& walker);
++  walker_pointer create_walker(interpreter& walker,
++                               antlr_pointer<ANTLR3_COMMON_TREE_NODE_STREAM_struct>& nodes);
  
 -  void init_parser();
  public:
 -  explicit bash_ast(std::istream& source);
 -  ~bash_ast();
 +  bash_ast(const std::istream& source,
 +           std::function<pANTLR3_BASE_TREE(libbashParser_Ctx_struct*)> p=parser_start);
 +
 +  bash_ast(const std::string& script_path,
 +           std::function<pANTLR3_BASE_TREE(libbashParser_Ctx_struct*)> p=parser_start);
 +
 +  static void walker_start(plibbashWalker tree_parser);
 +
 +  static long walker_arithmetics(plibbashWalker tree_parser);
 +
 +  static void call_function(plibbashWalker tree_parser,
 +                            ANTLR3_MARKER index);
 +
 +  static pANTLR3_BASE_TREE parser_start(libbashParser_Ctx_struct* parser);
 +
 +  static pANTLR3_BASE_TREE parser_arithmetics(libbashParser_Ctx_struct* parser);
  
    ///
    /// \brief interpret the script with a given interpreter
    /// \param the interpreter object
 -  void interpret_with(interpreter& walker);
 +  /// \return the interpreted result
 +  template<typename Functor>
 +  typename std::result_of<Functor(plibbashWalker)>::type
 +  interpret_with(interpreter& walker, Functor walk)
 +  {
-     walker_pointer p_tree_parser = create_walker(walker);
++    antlr_pointer<ANTLR3_COMMON_TREE_NODE_STREAM_struct> nodes(
++      antlr3CommonTreeNodeStreamNewTree(ast, ANTLR3_SIZE_HINT));
++    walker_pointer p_tree_parser = create_walker(walker, nodes);
 +    return walk(p_tree_parser.get());
 +  }
 +
 +  void interpret_with(interpreter& walker)
 +  {
 +    interpret_with(walker, walker_start);
 +  }
 +
    std::string get_dot_graph();
 +
    std::string get_string_tree();
 -  std::string get_tokens(std::function<std::string(ANTLR3_INT32)> token_map);
 +
 +  static std::string get_parser_tokens(antlr_pointer<ANTLR3_COMMON_TOKEN_STREAM_struct>& token_stream,
 +                                       std::function<std::string(ANTLR3_UINT32)>);
 +
 +  std::string get_walker_tokens(std::function<std::string(ANTLR3_UINT32)>);
  };
  
  #endif
diff --cc utils/instruo.cpp
index dcd3924,f91bbf1..704c98c
--- a/utils/instruo.cpp
+++ b/utils/instruo.cpp
@@@ -53,7 -53,6 +53,7 @@@
  #include <paludis/package_database.hh>
  #include <paludis/metadata_key.hh>
  
- #include "builtins/builtin_exceptions.h"
++#include "core/exceptions.h"
  #include "command_line.h"
  #include "libbash.h"
  #include "utils/metadata.h"
@@@ -65,71 -64,63 +65,63 @@@ using std::endl
  
  void worker(const std::shared_ptr<PackageIDSequence> &ids)
  {
-   std::unordered_map<std::string, std::vector<std::string>> variables;
- 
-   std::shared_ptr<const PackageID> id;
    unsigned total(0);
    CategoryNamePart old_cat("OLDCAT");
-   while(!ids->empty())
+   #pragma omp parallel
    {
-     id = *ids->begin();
-     ids->pop_front();
-     if (id->name().category() != old_cat)
+     #pragma omp single nowait
+     while(!ids->empty())
      {
-       std::cout << "Processing " << stringify(id->name().category()) << "..." << std::endl;
-       old_cat = id->name().category();
-       FSPath(CommandLine::get_instance()->a_output_directory.argument() + "/" +
-           stringify(id->name().category())).mkdir(0755,  {fspmkdo_ok_if_exists});
-       ++total;
-     }
+       std::shared_ptr<const PackageID> id = *ids->begin();
+       ids->pop_front();
+       if (id->name().category() != old_cat)
+       {
+         std::cout << "Processing " << stringify(id->name().category()) << "..." << std::endl;
+         old_cat = id->name().category();
+         FSPath(CommandLine::get_instance()->a_output_directory.argument() + "/" +
+             stringify(id->name().category())).mkdir(0755,  {fspmkdo_ok_if_exists});
+         ++total;
+       }
  
-     Context i_context("When generating metadata for ID '" + stringify(*id) + "':");
+       #pragma omp task
+       {
+         Context i_context("When generating metadata for ID '" + stringify(*id) + "':");
  
-     variables.clear();
-     variables["PN"].push_back(stringify(id->name().package()));
-     variables["PV"].push_back(stringify(id->version().remove_revision()));
-     variables["P"].push_back(stringify(id->name().package()) + "-" +
-                              stringify(id->version().remove_revision()));
-     variables["PR"].push_back(id->version().revision_only());
-     variables["PVR"].push_back(stringify(id->version()));
-     variables["PF"].push_back(stringify(id->name().package()) + "-" + stringify(id->version()));
-     variables["CATEGORY"].push_back(stringify(id->name().category()));
-     std::vector<std::string> functions;
+         std::unordered_map<std::string, std::vector<std::string>> variables;
+         variables["PN"].push_back(stringify(id->name().package()));
+         variables["PV"].push_back(stringify(id->version().remove_revision()));
+         variables["P"].push_back(stringify(id->name().package()) + "-" +
+                                  stringify(id->version().remove_revision()));
+         variables["PR"].push_back(id->version().revision_only());
+         variables["PVR"].push_back(stringify(id->version()));
+         variables["PF"].push_back(stringify(id->name().package()) + "-" + stringify(id->version()));
+         variables["CATEGORY"].push_back(stringify(id->name().category()));
+         std::vector<std::string> functions;
  
-     std::string ebuild_path(CommandLine::get_instance()->a_repository_directory.argument() +
-                             variables["CATEGORY"][0] + "/" +
-                             variables["PN"][0] + "/" +
-                             variables["PN"][0] + "-" +
-                             variables["PVR"][0] + ".ebuild");
-     try
-     {
-       libbash::interpret(ebuild_path, "utils/isolated-functions.sh", variables, functions);
-     }
-     catch(const libbash::interpreter_exception& e)
-     {
-       cerr << "Exception occurred while interpreting " << ebuild_path << ". The error message is:\n"
-         << e.what() << endl;
-       continue;
-     }
-     catch(const return_exception& e)
-     {
-       cerr << "Unhandled return exception in " << ebuild_path << ". The error message is:\n"
-         << e.what() << endl;
-       continue;
-     }
-     catch (...)
-     {
-       cerr << "Unhandled exception in " << ebuild_path << endl;
-       continue;
-     }
+         std::string ebuild_path(CommandLine::get_instance()->a_repository_directory.argument() +
+                                 variables["CATEGORY"][0] + "/" +
+                                 variables["PN"][0] + "/" +
+                                 variables["PN"][0] + "-" +
+                                 variables["PVR"][0] + ".ebuild");
+         try
+         {
+           libbash::interpret(ebuild_path, variables, functions);
  
-     std::string output_path(CommandLine::get_instance()->a_output_directory.argument() + "/" +
-                             variables["CATEGORY"][0] + "/" +
-                             variables["PN"][0] + "-" +
-                             variables["PVR"][0]);
-     FSPath(output_path).dirname().mkdir(0755, {fspmkdo_ok_if_exists});
-     std::ofstream output(output_path, std::ofstream::out | std::ofstream::trunc);
-     write_metadata(output, variables, functions);
+           std::string output_path(CommandLine::get_instance()->a_output_directory.argument() + "/" +
+                                   variables["CATEGORY"][0] + "/" +
+                                   variables["PN"][0] + "-" +
+                                   variables["PVR"][0]);
+           FSPath(output_path).dirname().mkdir(0755, {fspmkdo_ok_if_exists});
+           std::ofstream output(output_path, std::ofstream::out | std::ofstream::trunc);
+           write_metadata(output, variables, functions);
+         }
 -        catch(const interpreter_exception& e)
++        catch(const libbash::interpreter_exception& e)
+         {
+           cerr << "Exception occurred while interpreting " << ebuild_path << ". The error message is:\n"
+             << e.what() << endl;
+         }
+       }
+     }
    }
  }
  



             reply	other threads:[~2011-07-08 14:03 UTC|newest]

Thread overview: 60+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-08 14:03 Petteri Räty [this message]
  -- strict thread matches above, loose matches on Subject: below --
2012-08-19 14:54 [gentoo-commits] proj/libbash:master commit in: / Petteri Räty
2012-06-03  9:08 Petteri Räty
2011-08-04 14:24 Petteri Räty
2011-08-04 14:24 Petteri Räty
2011-08-04 14:24 Petteri Räty
2011-08-04 14:24 Petteri Räty
2011-08-04 14:24 Petteri Räty
2011-08-04 14:24 Petteri Räty
2011-08-04 13:53 Petteri Räty
2011-07-20 14:01 Petteri Räty
2011-07-08 14:03 Petteri Räty
2011-07-03 20:21 Petteri Räty
2011-06-26 13:38 Petteri Räty
2011-06-26 13:38 Petteri Räty
2011-06-25 10:30 Petteri Räty
2011-06-25 10:05 Petteri Räty
2011-06-16 16:53 Petteri Räty
2011-06-11  8:52 Petteri Räty
2011-06-11  8:52 Petteri Räty
2011-06-11  8:24 Petteri Räty
2011-06-03 14:48 Petteri Räty
2011-06-03 12:43 Petteri Räty
2011-05-27 23:03 Petteri Räty
2011-05-24 14:50 Petteri Räty
2011-05-14 14:58 Petteri Räty
2011-05-14 14:58 Petteri Räty
2011-05-12 14:06 Petteri Räty
2011-05-11  7:19 Petteri Räty
2011-05-08 13:07 Petteri Räty
2011-05-07 12:25 Petteri Räty
2011-04-27 15:11 Petteri Räty
2011-04-20 11:26 Petteri Räty
2011-04-17 10:58 Petteri Räty
2011-04-14  4:50 Petteri Räty
2011-04-14  4:50 Petteri Räty
2011-04-12 18:29 Petteri Räty
2011-04-11  6:50 Petteri Räty
2011-04-09 13:08 Petteri Räty
2011-04-08 11:12 Petteri Räty
2011-04-07 16:44 Petteri Räty
2011-04-03 13:46 Petteri Räty
2011-04-03 13:46 Petteri Räty
2011-04-02 15:50 Petteri Räty
2011-03-30 12:48 Petteri Räty
2011-03-27  8:56 Petteri Räty
2011-03-26 19:08 Petteri Räty
2011-03-26 19:08 Petteri Räty
2011-03-26 12:24 Petteri Räty
2011-03-26 12:24 Petteri Räty
2011-03-26 12:24 Petteri Räty
2011-03-26 12:24 Petteri Räty
2011-03-26 12:24 Petteri Räty
2011-03-26 12:24 Petteri Räty
2011-03-26 12:24 Petteri Räty
2011-03-26 12:24 Petteri Räty
2011-03-25 12:11 Petteri Räty
2011-03-17  9:44 Petteri Räty
2011-03-12 11:53 Petteri Räty
2011-03-06 12:05 Petteri Räty

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d3296b24ca1fa7cafc5bf25e129a3c1ce0811ac7.betelgeuse@gentoo \
    --to=betelgeuse@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox