public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/libbash:master commit in: scripts/, utils/
@ 2011-04-26 11:02 Petteri Räty
  0 siblings, 0 replies; 2+ messages in thread
From: Petteri Räty @ 2011-04-26 11:02 UTC (permalink / raw
  To: gentoo-commits

commit:     8a521c26265103005783a625ed097968f84ebc98
Author:     Mu Qiao <qiaomuf <AT> gentoo <DOT> org>
AuthorDate: Thu Apr 21 14:52:31 2011 +0000
Commit:     Petteri Räty <betelgeuse <AT> gentoo <DOT> org>
CommitDate: Tue Apr 26 10:50:39 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/libbash.git;a=commit;h=8a521c26

Utility: improve the output format of metadata_generator

The metadata_generator now generates the same format as what
Portage does.

---
 scripts/sunpinyin-2.0.3-r1.ebuild.result |    7 ++-----
 utils/metadata_generator.cpp             |   17 ++++++++++++++++-
 2 files changed, 18 insertions(+), 6 deletions(-)

diff --git a/scripts/sunpinyin-2.0.3-r1.ebuild.result b/scripts/sunpinyin-2.0.3-r1.ebuild.result
index d29858d..41f016e 100644
--- a/scripts/sunpinyin-2.0.3-r1.ebuild.result
+++ b/scripts/sunpinyin-2.0.3-r1.ebuild.result
@@ -1,10 +1,7 @@
-dev-db/sqlite:3
-		dev-util/pkgconfig
+dev-db/sqlite:3 dev-util/pkgconfig
 dev-db/sqlite:3
 0
-http://sunpinyin.googlecode.com/files/.tar.gz
-		http://open-gram.googlecode.com/files/dict.utf8.tar.bz2
-		http://open-gram.googlecode.com/files/lm_sc.t3g.arpa.tar.bz2
+http://sunpinyin.googlecode.com/files/.tar.gz http://open-gram.googlecode.com/files/dict.utf8.tar.bz2 http://open-gram.googlecode.com/files/lm_sc.t3g.arpa.tar.bz2
 
 http://sunpinyin.googlecode.com
 LGPL-2.1 CDDL

diff --git a/utils/metadata_generator.cpp b/utils/metadata_generator.cpp
index 57facb1..859839c 100644
--- a/utils/metadata_generator.cpp
+++ b/utils/metadata_generator.cpp
@@ -27,6 +27,9 @@
 #include <vector>
 
 #include <boost/spirit/include/karma.hpp>
+#include <boost/algorithm/string/classification.hpp>
+#include <boost/algorithm/string/split.hpp>
+#include <boost/algorithm/string/trim.hpp>
 
 #include "libbash.h"
 
@@ -55,6 +58,8 @@ static const std::unordered_map<std::string, std::string> phases = {
 
 int main(int argc, char** argv)
 {
+  using namespace boost::spirit::karma;
+
   if(argc != 2)
   {
     std::cerr<<"Please provide your script as an argument"<<std::endl;
@@ -69,9 +74,19 @@ int main(int argc, char** argv)
   {
     auto iter_value = variables.find(*iter_name);
     if(iter_value != variables.end())
-      std::cout << iter_value->second[0] << std::endl;
+    {
+      std::vector<std::string> formatted;
+      boost::trim_if(iter_value->second[0], boost::is_any_of(" \t\n"));
+      boost::split(formatted,
+                   iter_value->second[0],
+                   boost::is_any_of(" \t\n"),
+                   boost::token_compress_on);
+      std::cout << format(string % ' ', formatted) << std::endl;
+    }
     else
+    {
       std::cout << std::endl;
+    }
   }
 
   // Print defined phases



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [gentoo-commits] proj/libbash:master commit in: scripts/, utils/
@ 2012-06-03  9:08 Petteri Räty
  0 siblings, 0 replies; 2+ messages in thread
From: Petteri Räty @ 2012-06-03  9:08 UTC (permalink / raw
  To: gentoo-commits

commit:     d5775bf39c6ccb0ab61fa77b3582d812b07911a5
Author:     Mu Qiao <qiaomuf <AT> gentoo <DOT> org>
AuthorDate: Tue Mar 27 12:38:37 2012 +0000
Commit:     Petteri Räty <betelgeuse <AT> gentoo <DOT> org>
CommitDate: Sat May 26 10:40:50 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/libbash.git;a=commit;h=d5775bf3

Utils: add debug-print-function

---
 scripts/isolated_functions.bash |    1 +
 utils/isolated-functions.sh     |    4 ++++
 2 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/scripts/isolated_functions.bash b/scripts/isolated_functions.bash
index bf65f3e..e704c1a 100644
--- a/scripts/isolated_functions.bash
+++ b/scripts/isolated_functions.bash
@@ -12,3 +12,4 @@ use_enable
 eerror foo
 debug-print foo
 ewarn foo
+debug-print-function foo bar

diff --git a/utils/isolated-functions.sh b/utils/isolated-functions.sh
index 150fe4b..e40bee0 100755
--- a/utils/isolated-functions.sh
+++ b/utils/isolated-functions.sh
@@ -50,6 +50,10 @@ debug-print() {
     echo "debug-print: $*"
 }
 
+debug-print-function() {
+    debug-print "${1}: entering function, parameters: ${*:2}"
+}
+
 ewarn() {
     echo "ewarn: $*"
 }



^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-06-03  9:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-06-03  9:08 [gentoo-commits] proj/libbash:master commit in: scripts/, utils/ Petteri Räty
  -- strict thread matches above, loose matches on Subject: below --
2011-04-26 11:02 Petteri Räty

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox