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

commit:     53c8fd8af69c2b2120ba52205e3c658d1c5c1b68
Author:     Mu Qiao <qiaomuf <AT> gentoo <DOT> org>
AuthorDate: Fri Apr 22 02:52:34 2011 +0000
Commit:     Petteri Räty <betelgeuse <AT> gentoo <DOT> org>
CommitDate: Tue Apr 26 10:53:59 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/libbash.git;a=commit;h=53c8fd8a

Utility: write a script that generates ebuild metadata

---
 Makefile.am       |    4 ++++
 utils/meta_gen.sh |   24 ++++++++++++++++++++++++
 2 files changed, 28 insertions(+), 0 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index e161fcd..b4f6488 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -180,6 +180,7 @@ EXTRA_DIST = bashast/bashast.g \
 			 bashast/features_script/features.sh.tokens \
 			 test/ast_printer_test.sh \
 			 test/verify_bashs_test.sh \
+			 utils/meta_gen.sh \
 			 $(BASH_TESTS) \
 			 $(BASH_RESULT) \
 			 $(EBUILD_TESTS) \
@@ -240,3 +241,6 @@ callgrind.out: ast_printer
 
 benchmark_parser: callgrind.out
 	callgrind_annotate callgrind.out
+
+generate_metadata: metadata_generator
+	srcdir=$(srcdir) utils/meta_gen.sh

diff --git a/utils/meta_gen.sh b/utils/meta_gen.sh
new file mode 100755
index 0000000..2cddcb0
--- /dev/null
+++ b/utils/meta_gen.sh
@@ -0,0 +1,24 @@
+#!/bin/sh
+
+source /etc/make.conf
+
+outputdir=${1:-$(mktemp -d)}
+
+if [ -d $outputdir && -w $outputdir]
+then
+    echo "$outputdir is not writable"
+fi
+
+for category_dir in ${PORTDIR:-/usr/portage}/*
+do
+    category=${category_dir##*\/}
+    mkdir $outputdir/$category
+    for file in ${category_dir}/*/*.ebuild
+    do
+        filename=${file##*\/}
+        filename=${filename/.ebuild}
+        metadata_file="$outputdir/$category/$filename"
+        echo "Generating metadata of $category/$filename to $metadata_file"
+        LD_LIBRARY_PATH=${srcdir:-..}/.libs ${srcdir:-..}/.libs/metadata_generator $file > $metadata_file
+    done
+done



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

* [gentoo-commits] proj/libbash:master commit in: /, utils/
@ 2011-05-23 14:34 Petteri Räty
  0 siblings, 0 replies; 5+ messages in thread
From: Petteri Räty @ 2011-05-23 14:34 UTC (permalink / raw
  To: gentoo-commits

commit:     72ba19cb8d57c466b2799fe2eba4997aaba44d58
Author:     Mu Qiao <qiaomuf <AT> gentoo <DOT> org>
AuthorDate: Thu May 19 09:03:29 2011 +0000
Commit:     Petteri Räty <betelgeuse <AT> gentoo <DOT> org>
CommitDate: Mon May 23 15:04:44 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/libbash.git;a=commit;h=72ba19cb

Utility: removed unused meta_gen.sh

As we already have an implementation of instruo so meta_gen.sh is
not needed any more. The target is not useful as we can simply run
instruo rather than make metadata_generation.

---
 Makefile.am       |    4 ----
 utils/meta_gen.sh |   24 ------------------------
 2 files changed, 0 insertions(+), 28 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 33dbe51..171af0b 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -223,7 +223,6 @@ EXTRA_DIST = bashast/bashast.g \
 			 scripts/source_true.sh \
 			 scripts/source_return.sh \
 			 scripts/illegal_script.sh \
-			 utils/meta_gen.sh \
 			 scripts/foo.eclass \
 			 test_coverage.sh \
 			 autogen.sh \
@@ -289,9 +288,6 @@ callgrind.out: ast_printer
 benchmark_parser: callgrind.out
 	callgrind_annotate callgrind.out
 
-generate_metadata: metadata_generator
-	srcdir=$(srcdir) utils/meta_gen.sh
-
 test_coverage: dist
 	MAKE=$(MAKE) DIST_ARCHIVES=$(DIST_ARCHIVES) ./test_coverage.sh
 	rm $(DIST_ARCHIVES)

diff --git a/utils/meta_gen.sh b/utils/meta_gen.sh
deleted file mode 100755
index 2cddcb0..0000000
--- a/utils/meta_gen.sh
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/bin/sh
-
-source /etc/make.conf
-
-outputdir=${1:-$(mktemp -d)}
-
-if [ -d $outputdir && -w $outputdir]
-then
-    echo "$outputdir is not writable"
-fi
-
-for category_dir in ${PORTDIR:-/usr/portage}/*
-do
-    category=${category_dir##*\/}
-    mkdir $outputdir/$category
-    for file in ${category_dir}/*/*.ebuild
-    do
-        filename=${file##*\/}
-        filename=${filename/.ebuild}
-        metadata_file="$outputdir/$category/$filename"
-        echo "Generating metadata of $category/$filename to $metadata_file"
-        LD_LIBRARY_PATH=${srcdir:-..}/.libs ${srcdir:-..}/.libs/metadata_generator $file > $metadata_file
-    done
-done



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

* [gentoo-commits] proj/libbash:master commit in: /, utils/
@ 2011-05-23 14:34 Petteri Räty
  0 siblings, 0 replies; 5+ messages in thread
From: Petteri Räty @ 2011-05-23 14:34 UTC (permalink / raw
  To: gentoo-commits

commit:     fa45a6a4d9cd33f79d3837a6e7759a8f843bf72f
Author:     Mu Qiao <qiaomuf <AT> gentoo <DOT> org>
AuthorDate: Thu May 19 11:24:56 2011 +0000
Commit:     Petteri Räty <betelgeuse <AT> gentoo <DOT> org>
CommitDate: Mon May 23 15:04:44 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/libbash.git;a=commit;h=fa45a6a4

Utility: add a script for metadata correctness statistic

---
 Makefile.am            |    1 +
 utils/metadata_diff.sh |   36 ++++++++++++++++++++++++++++++++++++
 2 files changed, 37 insertions(+), 0 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 171af0b..011f011 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -224,6 +224,7 @@ EXTRA_DIST = bashast/bashast.g \
 			 scripts/source_return.sh \
 			 scripts/illegal_script.sh \
 			 scripts/foo.eclass \
+			 utils/metadata_diff.sh \
 			 test_coverage.sh \
 			 autogen.sh \
 			 $(BASH_TESTS) \

diff --git a/utils/metadata_diff.sh b/utils/metadata_diff.sh
new file mode 100755
index 0000000..1e9d60f
--- /dev/null
+++ b/utils/metadata_diff.sh
@@ -0,0 +1,36 @@
+#!/bin/bash
+
+source /etc/make.conf
+
+outputdir=${1:-$(mktemp -d)}
+
+if [[ ! (-d $outputdir && -w $outputdir) ]]
+then
+    echo "$outputdir is not writable"
+fi
+
+echo "Generating metadata at $outputdir"
+
+./instruo -D ${PORTDIR:-/usr/portage/} -o $outputdir 2>$outputdir/error_output
+
+echo "Running diff..."
+
+declare -i error_count=0 total_num=0
+
+for category_dir in ${PORTDIR:-/usr/portage}/*
+do
+    category=${category_dir##*\/}
+    cache_dir=${PORTDIR:-/usr/portage}/metadata/cache/${category}
+    if [[ -d $cache_dir ]]
+    then
+        for path in $cache_dir/*
+        do
+            filename=${path##*\/}
+            diff -u $cache_dir/$file $outputdir/$category/$filename > $outputdir/$category/$filename.diff
+            error_count+=$?
+            total_num+=1
+        done
+    fi
+done
+
+echo "$((total_num - error_count)) out of $total_num metadata files are correct. See file.diff for more details."



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

* [gentoo-commits] proj/libbash:master commit in: /, utils/
@ 2011-05-23 14:34 Petteri Räty
  0 siblings, 0 replies; 5+ messages in thread
From: Petteri Räty @ 2011-05-23 14:34 UTC (permalink / raw
  To: gentoo-commits

commit:     0b81725ba19e24f5fbbe7e0026058aa93f6a9965
Author:     Mu Qiao <qiaomuf <AT> gentoo <DOT> org>
AuthorDate: Sun May 22 09:41:22 2011 +0000
Commit:     Petteri Räty <betelgeuse <AT> gentoo <DOT> org>
CommitDate: Mon May 23 15:04:45 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/libbash.git;a=commit;h=0b81725b

Utility: support misc functions for instruo

"has", "hasq" and "die" are supported for instruo.

---
 Makefile.am                 |    1 +
 utils/instruo.cpp           |    2 +-
 utils/isolated-functions.sh |   22 ++++++++++++++++++++++
 3 files changed, 24 insertions(+), 1 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 011f011..267240e 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -225,6 +225,7 @@ EXTRA_DIST = bashast/bashast.g \
 			 scripts/illegal_script.sh \
 			 scripts/foo.eclass \
 			 utils/metadata_diff.sh \
+			 utils/isolated-functions.sh \
 			 test_coverage.sh \
 			 autogen.sh \
 			 $(BASH_TESTS) \

diff --git a/utils/instruo.cpp b/utils/instruo.cpp
index da020c3..8206b95 100644
--- a/utils/instruo.cpp
+++ b/utils/instruo.cpp
@@ -103,7 +103,7 @@ void worker(const std::shared_ptr<PackageIDSequence> &ids)
                             variables["PVR"][0] + ".ebuild");
     try
     {
-      libbash::interpret(ebuild_path, variables, functions);
+      libbash::interpret(ebuild_path, "utils/isolated-functions.sh", variables, functions);
     }
     catch(const interpreter_exception& e)
     {

diff --git a/utils/isolated-functions.sh b/utils/isolated-functions.sh
new file mode 100755
index 0000000..efbf933
--- /dev/null
+++ b/utils/isolated-functions.sh
@@ -0,0 +1,22 @@
+die(){
+    echo "Die is called. Something went wrong while interpreting"
+}
+
+has() {
+    hasq "$@"
+}
+
+hasq() {
+    for item in ${*:2}
+    do
+        [[ $item == $1 ]] && return 0
+    done
+    return 1
+}
+
+EXPORT_FUNCTIONS() {
+    if [ -z "$ECLASS" ]; then 
+        die "EXPORT_FUNCTIONS without a defined ECLASS"
+    fi   
+    $__export_funcs_var="$__export_funcs_var $*" 
+}



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

* [gentoo-commits] proj/libbash:master commit in: /, utils/
@ 2011-08-04 13:53 Petteri Räty
  0 siblings, 0 replies; 5+ messages in thread
From: Petteri Räty @ 2011-08-04 13:53 UTC (permalink / raw
  To: gentoo-commits

commit:     e61a9f55a0e70e590874235542d7c9b1252f2552
Author:     Mu Qiao <qiaomuf <AT> gentoo <DOT> org>
AuthorDate: Wed Jul 27 02:42:59 2011 +0000
Commit:     Petteri Räty <betelgeuse <AT> gentoo <DOT> org>
CommitDate: Tue Aug  2 07:52:18 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/libbash.git;a=commit;h=e61a9f55

Utility: add isolated functions for instruo

---
 Makefile.am       |    8 ++++++--
 utils/instruo.cpp |    3 ++-
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 76f77cb..ba77230 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -138,9 +138,13 @@ metadata_generator_SOURCES = utils/metadata_generator.cpp
 metadata_generator_LDADD = libcppbash.la libmetadata.a
 metadata_generator_CPPFLAGS = $(AM_CPPFLAGS) -Iutils
 
-instruo_SOURCES = utils/instruo.cpp utils/command_line.cpp utils/command_line.h
+instruo_SOURCES = utils/instruo.cpp \
+				  utils/command_line.cpp \
+				  utils/command_line.h \
+				  test/test.h \
+				  test/test.cpp
 instruo_LDADD = libcppbash.la @PALUDIS_LIBS@ libmetadata.a
-instruo_CPPFLAGS = $(AM_CPPFLAGS) @PALUDIS_CFLAGS@ -Iutils
+instruo_CPPFLAGS = $(AM_CPPFLAGS) @PALUDIS_CFLAGS@ -Iutils -I$(top_srcdir)/test/
 instruo_CXXFLAGS = $(AM_CXXFLAGS) -Wno-extra -fopenmp
 
 ast_printer_SOURCES = utils/ast_printer.cpp

diff --git a/utils/instruo.cpp b/utils/instruo.cpp
index 704c98c..98116cf 100644
--- a/utils/instruo.cpp
+++ b/utils/instruo.cpp
@@ -56,6 +56,7 @@
 #include "core/exceptions.h"
 #include "command_line.h"
 #include "libbash.h"
+#include "test.h"
 #include "utils/metadata.h"
 
 using namespace paludis;
@@ -105,7 +106,7 @@ void worker(const std::shared_ptr<PackageIDSequence> &ids)
                                 variables["PVR"][0] + ".ebuild");
         try
         {
-          libbash::interpret(ebuild_path, variables, functions);
+          libbash::interpret(ebuild_path, get_src_dir() + "/utils/isolated-functions.sh", variables, functions);
 
           std::string output_path(CommandLine::get_instance()->a_output_directory.argument() + "/" +
                                   variables["CATEGORY"][0] + "/" +



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

end of thread, other threads:[~2011-08-04 13:55 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-04 13:53 [gentoo-commits] proj/libbash:master commit in: /, utils/ Petteri Räty
  -- strict thread matches above, loose matches on Subject: below --
2011-05-23 14:34 Petteri Räty
2011-05-23 14:34 Petteri Räty
2011-05-23 14:34 Petteri Räty
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