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

commit:     6f8073955015091f3e8a082d8bd16b3ee4dee832
Author:     Mu Qiao <qiaomuf <AT> gentoo <DOT> org>
AuthorDate: Tue May 31 07:52:50 2011 +0000
Commit:     Petteri Räty <betelgeuse <AT> gentoo <DOT> org>
CommitDate: Wed Jun  1 12:15:21 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/libbash.git;a=commit;h=6f807395

Utility: print total time for metadata generation

diff errors are redirected to $outputdir/error_output.

---
 utils/metadata_diff.sh |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/utils/metadata_diff.sh b/utils/metadata_diff.sh
index 1e9d60f..46fd323 100755
--- a/utils/metadata_diff.sh
+++ b/utils/metadata_diff.sh
@@ -11,7 +11,7 @@ fi
 
 echo "Generating metadata at $outputdir"
 
-./instruo -D ${PORTDIR:-/usr/portage/} -o $outputdir 2>$outputdir/error_output
+time ./instruo -D ${PORTDIR:-/usr/portage/} -o $outputdir 2>$outputdir/error_output
 
 echo "Running diff..."
 
@@ -26,7 +26,7 @@ do
         for path in $cache_dir/*
         do
             filename=${path##*\/}
-            diff -u $cache_dir/$file $outputdir/$category/$filename > $outputdir/$category/$filename.diff
+            diff -u $cache_dir/$file $outputdir/$category/$filename > $outputdir/$category/$filename.diff 2>>$outputdir/error_output
             error_count+=$?
             total_num+=1
         done



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

* [gentoo-commits] proj/libbash:master commit in: utils/
@ 2011-06-01 12:19 Petteri Räty
  0 siblings, 0 replies; 7+ messages in thread
From: Petteri Räty @ 2011-06-01 12:19 UTC (permalink / raw
  To: gentoo-commits

commit:     e6af93628b7715f05fdd3fe7e37918de48e2554d
Author:     Mu Qiao <qiaomuf <AT> gentoo <DOT> org>
AuthorDate: Tue May 31 07:32:31 2011 +0000
Commit:     Petteri Räty <betelgeuse <AT> gentoo <DOT> org>
CommitDate: Wed Jun  1 12:15:21 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/libbash.git;a=commit;h=e6af9362

Utility: fix the order of INHERITED

Portage requires INHERITED values to be sorted. Now this is fixed.

---
 utils/metadata.cpp |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/utils/metadata.cpp b/utils/metadata.cpp
index 600f9e4..899ef80 100644
--- a/utils/metadata.cpp
+++ b/utils/metadata.cpp
@@ -93,6 +93,11 @@ void write_metadata(std::ostream& output,
                  value,
                  boost::is_any_of(" \t\n"),
                  boost::token_compress_on);
+
+    // INHERITED eclasses should be sorted
+    if(*iter_name == "INHERITED")
+      sort(splitted_value.begin(), splitted_value.end());
+
     using namespace boost::spirit::karma;
     output << format(string % ' ', splitted_value) << std::endl;
   }



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

* [gentoo-commits] proj/libbash:master commit in: utils/
@ 2011-06-01 12:19 Petteri Räty
  0 siblings, 0 replies; 7+ messages in thread
From: Petteri Räty @ 2011-06-01 12:19 UTC (permalink / raw
  To: gentoo-commits

commit:     b9ae4dd215d2a4b1e0f253b10525e3659f5a7cb6
Author:     Mu Qiao <qiaomuf <AT> gentoo <DOT> org>
AuthorDate: Tue May 31 13:27:47 2011 +0000
Commit:     Petteri Räty <betelgeuse <AT> gentoo <DOT> org>
CommitDate: Wed Jun  1 12:15:21 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/libbash.git;a=commit;h=b9ae4dd2

Utility: add more portage functions

---
 utils/isolated-functions.sh |   32 ++++++++++++++++++++++++++++++++
 1 files changed, 32 insertions(+), 0 deletions(-)

diff --git a/utils/isolated-functions.sh b/utils/isolated-functions.sh
index efbf933..d4073dc 100755
--- a/utils/isolated-functions.sh
+++ b/utils/isolated-functions.sh
@@ -20,3 +20,35 @@ EXPORT_FUNCTIONS() {
     fi   
     $__export_funcs_var="$__export_funcs_var $*" 
 }
+
+use() {
+    echo "use should be called"
+    return 1
+}
+
+useq() {
+    echo "useq should be called"
+    return 1
+}
+
+use_with() {
+    echo "use_with should be called"
+    return 1
+}
+
+use_enable() {
+    echo "use_enable should be called"
+    return 1
+}
+
+eerror() {
+    echo "eerror: $*" >&2
+}
+
+debug-print() {
+    echo "debug-print: $*"
+}
+
+ewarn() {
+    echo "ewarn: $*" >&2
+}



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

* [gentoo-commits] proj/libbash:master commit in: utils/
@ 2011-06-09 11:46 Petteri Räty
  0 siblings, 0 replies; 7+ messages in thread
From: Petteri Räty @ 2011-06-09 11:46 UTC (permalink / raw
  To: gentoo-commits

commit:     a889b494b9dd8bf31336fe9dced8fe6e755e1e6b
Author:     Mu Qiao <qiaomuf <AT> gentoo <DOT> org>
AuthorDate: Tue Jun  7 11:09:22 2011 +0000
Commit:     Petteri Räty <betelgeuse <AT> gentoo <DOT> org>
CommitDate: Thu Jun  9 11:41:23 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/libbash.git;a=commit;h=a889b494

Utility: fix some Portage functions

---
 utils/isolated-functions.sh |   19 ++++++++++---------
 1 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/utils/isolated-functions.sh b/utils/isolated-functions.sh
index d4073dc..9d189ed 100755
--- a/utils/isolated-functions.sh
+++ b/utils/isolated-functions.sh
@@ -1,9 +1,9 @@
 die(){
-    echo "Die is called. Something went wrong while interpreting"
+    echo "Die is called: $*"
 }
 
 has() {
-    hasq "$@"
+    hasq $*
 }
 
 hasq() {
@@ -17,32 +17,33 @@ hasq() {
 EXPORT_FUNCTIONS() {
     if [ -z "$ECLASS" ]; then 
         die "EXPORT_FUNCTIONS without a defined ECLASS"
+        return 1
     fi   
-    $__export_funcs_var="$__export_funcs_var $*" 
+    __export_funcs_var="$__export_funcs_var $*" 
 }
 
 use() {
-    echo "use should be called"
+    echo "use shouldn't be called"
     return 1
 }
 
 useq() {
-    echo "useq should be called"
+    echo "useq shouldn't be called"
     return 1
 }
 
 use_with() {
-    echo "use_with should be called"
+    echo "use_with shouldn't be called"
     return 1
 }
 
 use_enable() {
-    echo "use_enable should be called"
+    echo "use_enable shouldn't be called"
     return 1
 }
 
 eerror() {
-    echo "eerror: $*" >&2
+    echo "eerror: $*"
 }
 
 debug-print() {
@@ -50,5 +51,5 @@ debug-print() {
 }
 
 ewarn() {
-    echo "ewarn: $*" >&2
+    echo "ewarn: $*"
 }



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

* [gentoo-commits] proj/libbash:master commit in: utils/
@ 2011-06-09 11:46 Petteri Räty
  0 siblings, 0 replies; 7+ messages in thread
From: Petteri Räty @ 2011-06-09 11:46 UTC (permalink / raw
  To: gentoo-commits

commit:     d7af7504cc91ab7cd5ca37abbe3fc3f5d7556acd
Author:     Mu Qiao <qiaomuf <AT> gentoo <DOT> org>
AuthorDate: Wed Jun  8 10:44:15 2011 +0000
Commit:     Petteri Räty <betelgeuse <AT> gentoo <DOT> org>
CommitDate: Thu Jun  9 11:41:23 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/libbash.git;a=commit;h=d7af7504

Utility: fix error counting

diff may return value that is greater than 1. Now this is fixed.

---
 utils/metadata_diff.sh |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/utils/metadata_diff.sh b/utils/metadata_diff.sh
index 46fd323..7a21855 100755
--- a/utils/metadata_diff.sh
+++ b/utils/metadata_diff.sh
@@ -27,7 +27,7 @@ do
         do
             filename=${path##*\/}
             diff -u $cache_dir/$file $outputdir/$category/$filename > $outputdir/$category/$filename.diff 2>>$outputdir/error_output
-            error_count+=$?
+            error_count+=$(($? != 0))
             total_num+=1
         done
     fi



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

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

commit:     af86bf52b566c9e5c83b53f5a4f1a9689c827a9f
Author:     Mu Qiao <qiaomuf <AT> gentoo <DOT> org>
AuthorDate: Mon Mar 26 14:44:55 2012 +0000
Commit:     Petteri Räty <betelgeuse <AT> gentoo <DOT> org>
CommitDate: Sat May 26 10:40:48 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/libbash.git;a=commit;h=af86bf52

Utils: handle RDEPEND for metadata generation

---
 utils/metadata.cpp |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/utils/metadata.cpp b/utils/metadata.cpp
index ed07092..e0232ae 100644
--- a/utils/metadata.cpp
+++ b/utils/metadata.cpp
@@ -28,6 +28,7 @@
 #include <boost/algorithm/string/classification.hpp>
 #include <boost/algorithm/string/split.hpp>
 #include <boost/algorithm/string/trim.hpp>
+#include <boost/lexical_cast.hpp>
 
 static const std::vector<std::string> metadata_names = {"DEPEND", "RDEPEND", "SLOT", "SRC_URI",
                                                         "RESTRICT",  "HOMEPAGE",  "LICENSE", "DESCRIPTION",
@@ -56,6 +57,11 @@ void write_metadata(std::ostream& output,
                     std::unordered_map<std::string, std::vector<std::string>>& variables,
                     std::vector<std::string>& functions)
 {
+  int EAPI = 0;
+  if(variables.find("EAPI") != variables.end())
+    EAPI = boost::lexical_cast<int>(variables["EAPI"][0]);
+  if(EAPI < 4 && variables.find("RDEPEND") == variables.end() && variables.find("DEPEND") != variables.end())
+    variables["RDEPEND"] = variables["DEPEND"];
   for(auto iter_name = metadata_names.begin(); iter_name != metadata_names.end(); ++iter_name)
   {
     auto iter_value = variables.find(*iter_name);



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

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

commit:     81641558199405b3001eb6ec5cc4d3ebe8ec5d99
Author:     André Aparício <aparicio99 <AT> gmail <DOT> com>
AuthorDate: Wed Jun 20 22:10:28 2012 +0000
Commit:     Petteri Räty <betelgeuse <AT> gentoo <DOT> org>
CommitDate: Sun Jul  8 09:22:30 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/libbash.git;a=commit;h=81641558

Utils: Upgrade instruo to work with paludis 0.74.1

---
 utils/command_line.cpp |   11 ++----
 utils/command_line.h   |    5 +--
 utils/instruo.cpp      |   91 +++++++++++++++++++++--------------------------
 utils/metadata_diff.sh |    2 +-
 4 files changed, 48 insertions(+), 61 deletions(-)

diff --git a/utils/command_line.cpp b/utils/command_line.cpp
index 8d238b4..8354785 100644
--- a/utils/command_line.cpp
+++ b/utils/command_line.cpp
@@ -41,15 +41,12 @@ CommandLine::CommandLine() :
     a_no_color(&a_no_colour, "no-color"),
     a_force_colour(&general_args, "force-colour", '\0', "Force the use of colour", false),
     a_force_color(&a_force_colour, "force-color"),
-    a_repository_directory(&general_args, "repository-dir", 'D',
-            "Where to find the repository (default: current directory)"),
+    a_package_manager(&general_args, "package-manager", 'p',
+            "What package manager to use (default: portage)"),
     a_output_directory(&general_args, "output-dir", 'o',
             "Where to place generated metadata (default: current directory)"),
-    a_master_repository_name(&general_args, "master-repository-name", '\0',
-            "Use the specified name for the master repository. Specify the location using --extra-repository-dir. "
-            "Only for repositories with no metadata/layout.conf."),
-    a_extra_repository_dir(&general_args, "extra-repository-dir", '\0',
-            "Also include the repository at this location. May be specified multiple times, in creation order."),
+    a_repository_name(&general_args, "repository-name", 'n',
+            "Use the specified name for the repository (default: gentoo)"),
     a_report_file(&general_args, "report-file", 'r',
             "Write report to the specified file, rather than stdout")
 {

diff --git a/utils/command_line.h b/utils/command_line.h
index 2fdb10b..9bdf790 100644
--- a/utils/command_line.h
+++ b/utils/command_line.h
@@ -52,10 +52,9 @@ class CommandLine :
         paludis::args::AliasArg a_no_color;
         paludis::args::SwitchArg a_force_colour;
         paludis::args::AliasArg a_force_color;
-        paludis::args::StringArg a_repository_directory;
+        paludis::args::StringArg a_package_manager;
         paludis::args::StringArg a_output_directory;
-        paludis::args::StringArg a_master_repository_name;
-        paludis::args::StringSequenceArg a_extra_repository_dir;
+        paludis::args::StringArg a_repository_name;
         paludis::args::StringArg a_report_file;
 };
 

diff --git a/utils/instruo.cpp b/utils/instruo.cpp
index 690e843..2bad8a2 100644
--- a/utils/instruo.cpp
+++ b/utils/instruo.cpp
@@ -25,33 +25,37 @@
 #include <iostream>
 #include <map>
 
-#include <paludis/args/do_help.hh>
 #include <paludis/about.hh>
 #include <paludis/action.hh>
-#include <paludis/package_id.hh>
-#include <paludis/generator.hh>
+#include <paludis/args/do_help.hh>
+#include <paludis/environment.hh>
+#include <paludis/environment_factory.hh>
 #include <paludis/filter.hh>
 #include <paludis/filtered_generator.hh>
+#include <paludis/generator.hh>
+#include <paludis/metadata_key.hh>
+#include <paludis/name.hh>
+#include <paludis/package_id.hh>
+#include <paludis/repository.hh>
 #include <paludis/selection.hh>
-#include <paludis/util/system.hh>
+#include <paludis/util/accept_visitor.hh>
+#include <paludis/util/destringify.hh>
+#include <paludis/util/fs_path.hh>
+#include <paludis/util/indirect_iterator-impl.hh>
 #include <paludis/util/join.hh>
 #include <paludis/util/log.hh>
-#include <paludis/util/sequence.hh>
-#include <paludis/util/map.hh>
-#include <paludis/util/visitor_cast.hh>
-#include <paludis/util/set.hh>
 #include <paludis/util/make_named_values.hh>
+#include <paludis/util/map.hh>
 #include <paludis/util/mutex.hh>
-#include <paludis/util/thread_pool.hh>
-#include <paludis/util/destringify.hh>
-#include <paludis/util/safe_ofstream.hh>
 #include <paludis/util/pretty_print.hh>
-#include <paludis/util/indirect_iterator-impl.hh>
+#include <paludis/util/safe_ofstream.hh>
+#include <paludis/util/sequence.hh>
+#include <paludis/util/set.hh>
+#include <paludis/util/system.hh>
+#include <paludis/util/thread_pool.hh>
 #include <paludis/util/timestamp.hh>
-#include <paludis/util/accept_visitor.hh>
-#include <paludis/environments/no_config/no_config_environment.hh>
-#include <paludis/package_database.hh>
-#include <paludis/metadata_key.hh>
+#include <paludis/util/visitor_cast.hh>
+#include <paludis/version_spec.hh>
 
 #include "command_line.h"
 #include "exceptions.h"
@@ -64,7 +68,7 @@ using std::cout;
 using std::cerr;
 using std::endl;
 
-void worker(const std::shared_ptr<PackageIDSequence> &ids)
+void worker(const std::shared_ptr<PackageIDSequence> &ids, const std::string &repository_path)
 {
   unsigned total(0);
   CategoryNamePart old_cat("OLDCAT");
@@ -99,7 +103,7 @@ void worker(const std::shared_ptr<PackageIDSequence> &ids)
         variables["CATEGORY"].push_back(stringify(id->name().category()));
         std::vector<std::string> functions;
 
-        std::string ebuild_path(CommandLine::get_instance()->a_repository_directory.argument() +
+        std::string ebuild_path(repository_path + "/" +
                                 variables["CATEGORY"][0] + "/" +
                                 variables["PN"][0] + "/" +
                                 variables["PN"][0] + "-" +
@@ -126,6 +130,7 @@ void worker(const std::shared_ptr<PackageIDSequence> &ids)
   }
 }
 
+
 int main(int argc, char** argv)
 {
   try
@@ -153,8 +158,11 @@ int main(int argc, char** argv)
             ))
         throw args::DoHelp("you should specify exactly one action");
 
-    if (! CommandLine::get_instance()->a_repository_directory.specified())
-        CommandLine::get_instance()->a_repository_directory.set_argument(stringify(FSPath::cwd()));
+    if (! CommandLine::get_instance()->a_package_manager.specified())
+        CommandLine::get_instance()->a_package_manager.set_argument("portage");
+
+    if (! CommandLine::get_instance()->a_repository_name.specified())
+        CommandLine::get_instance()->a_repository_name.set_argument("gentoo");
 
     if (CommandLine::get_instance()->a_version.specified())
     {
@@ -170,42 +178,25 @@ int main(int argc, char** argv)
         return EXIT_SUCCESS;
     }
 
-    if ((
-                CommandLine::get_instance()->a_repository_directory.specified() +
-                CommandLine::get_instance()->a_output_directory.specified()
-        ) < 1)
-        throw args::DoHelp("at least one of '--" + CommandLine::get_instance()->a_repository_directory.long_name() + "' or '--"
-                + CommandLine::get_instance()->a_output_directory.long_name() + "' must be specified");
-
     if (! CommandLine::get_instance()->a_output_directory.specified())
         CommandLine::get_instance()->a_output_directory.set_argument(stringify(FSPath::cwd()));
 
-    std::shared_ptr<FSPathSequence> extra_repository_dirs(std::make_shared<FSPathSequence>());
-    for (args::StringSequenceArg::ConstIterator d(CommandLine::get_instance()->a_extra_repository_dir.begin_args()),
-            d_end(CommandLine::get_instance()->a_extra_repository_dir.end_args()) ;
-            d != d_end ; ++d)
-        extra_repository_dirs->push_back(FSPath(*d));
+    FSPath(CommandLine::get_instance()->a_output_directory.argument()).mkdir(0755,  {fspmkdo_ok_if_exists});
 
-    std::shared_ptr<Map<std::string, std::string> > keys(std::make_shared<Map<std::string, std::string>>());
-    keys->insert("append_repository_name_to_write_cache", "false");
-    NoConfigEnvironment env(make_named_values<no_config_environment::Params>(
-                n::accept_unstable() = true,
-                n::disable_metadata_cache() = true,
-                n::extra_accept_keywords() = "",
-                n::extra_params() = keys,
-                n::extra_repository_dirs() = extra_repository_dirs,
-                n::master_repository_name() = CommandLine::get_instance()->a_master_repository_name.argument(),
-                n::profiles_if_not_auto() = "",
-                n::repository_dir() = CommandLine::get_instance()->a_repository_directory.argument(),
-                n::repository_type() = no_config_environment::ncer_ebuild,
-                n::write_cache() = CommandLine::get_instance()->a_output_directory.argument()
-            ));
+    std::shared_ptr<Environment> env(EnvironmentFactory::get_instance()->create(CommandLine::get_instance()->a_package_manager.argument()));
 
-    FSPath(CommandLine::get_instance()->a_output_directory.argument()).mkdir(0755,  {fspmkdo_ok_if_exists});
+    std::shared_ptr<Repository> repo = env->fetch_repository(RepositoryName(CommandLine::get_instance()->a_repository_name.argument()));
+
+    Repository::MetadataConstIterator distdir_metadata(repo->find_metadata("location"));
+    const MetadataValueKey<FSPath> *path_key;
+    if(distdir_metadata != repo->end_metadata())
+    {
+      path_key = visitor_cast<const MetadataValueKey<FSPath>>(**distdir_metadata);
 
-    std::shared_ptr<PackageIDSequence> ids(env[selection::AllVersionsSorted(
-                generator::InRepository(env.main_repository()->name()))]);
-    worker(ids);
+      std::shared_ptr<PackageIDSequence> ids((*env)[selection::AllVersionsSorted(
+                  generator::InRepository(RepositoryName(CommandLine::get_instance()->a_repository_name.argument())))]);
+      worker(ids, stringify(path_key->parse_value().realpath()));
+    }
   }
   catch (const paludis::args::ArgsError & e)
   {

diff --git a/utils/metadata_diff.sh b/utils/metadata_diff.sh
index 7a21855..c0a808a 100755
--- a/utils/metadata_diff.sh
+++ b/utils/metadata_diff.sh
@@ -11,7 +11,7 @@ fi
 
 echo "Generating metadata at $outputdir"
 
-time ./instruo -D ${PORTDIR:-/usr/portage/} -o $outputdir 2>$outputdir/error_output
+time ./instruo -p portage -n gentoo -o $outputdir 2>$outputdir/error_output
 
 echo "Running diff..."
 



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

end of thread, other threads:[~2012-07-08  9:31 UTC | newest]

Thread overview: 7+ 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: utils/ Petteri Räty
  -- strict thread matches above, loose matches on Subject: below --
2012-07-08  9:31 Petteri Räty
2011-06-09 11:46 Petteri Räty
2011-06-09 11:46 Petteri Räty
2011-06-01 12:19 Petteri Räty
2011-06-01 12:19 Petteri Räty
2011-06-01 12:19 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