aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2008-06-12 14:18:46 +0000
committerAvatar Fernando J. Pereda <ferdy@ferdyx.org> 2008-06-14 12:37:56 +0000
commit3981782f15baa105c0f97eafe68033879f4aa61c (patch)
tree8293c84208186bb0f52d6311b85f3a4652bfc741
parent5c8ef002cd1268509d23c1597a06e3f5bb7eb5d9 (diff)
downloadpaludis-3981782f15baa105c0f97eafe68033879f4aa61c.tar.gz
paludis-3981782f15baa105c0f97eafe68033879f4aa61c.tar.xz
Make NoConfigEnvironment -Eable. Fixes: ticket:596
-rw-r--r--paludis/environments/no_config/Makefile.am34
-rw-r--r--paludis/environments/no_config/no_config_environment.cc38
-rw-r--r--paludis/environments/no_config/no_config_environment.hh14
-rw-r--r--paludis/environments/no_config/no_config_environment.se23
-rw-r--r--paludis/environments/no_config/no_config_environment.sr1
-rw-r--r--paludis/environments/no_config/no_config_environment_TEST.cc1
-rw-r--r--paludis/environments/no_config/registration.cc71
-rw-r--r--ruby/environment.cc1
-rw-r--r--src/clients/accerso/accerso.cc1
-rw-r--r--src/clients/adjutrix/adjutrix.cc1
-rw-r--r--src/clients/instruo/instruo.cc1
-rw-r--r--src/clients/qualudis/qualudis.cc1
12 files changed, 149 insertions, 38 deletions
diff --git a/paludis/environments/no_config/Makefile.am b/paludis/environments/no_config/Makefile.am
index fca33ea..226ea11 100644
--- a/paludis/environments/no_config/Makefile.am
+++ b/paludis/environments/no_config/Makefile.am
@@ -1,5 +1,6 @@
CLEANFILES = *~ gmon.out *.gcov *.gcno *.gcda *.loT ihateautomake.cc ihateautomake.o
-DISTCLEANFILES = no_config_environment-sr.hh no_config_environment-sr.cc
+DISTCLEANFILES = no_config_environment-sr.hh no_config_environment-sr.cc no_config_environment-se.hh \
+ no_config_environment-se.cc
MAINTAINERCLEANFILES = Makefile.in
AM_CXXFLAGS = -I$(top_srcdir) @PALUDIS_CXXFLAGS@ @PALUDIS_CXXFLAGS_VISIBILITY@
DEFS= \
@@ -14,33 +15,26 @@ libpaludisnoconfigenvironment_la_SOURCES = \
libpaludisnoconfigenvironment_la_LDFLAGS = -version-info @VERSION_LIB_CURRENT@:@VERSION_LIB_REVISION@:0
-if ! MONOLITHIC
-
libpaludisnoconfigenvironment_la_LIBADD = \
$(top_builddir)/paludis/util/libpaludisutil.la \
$(top_builddir)/paludis/libpaludis.la
-endif
-
-if MONOLITHIC
-
-noinst_LTLIBRARIES = libpaludisnoconfigenvironment.la
-
-else
-
-lib_LTLIBRARIES = libpaludisnoconfigenvironment.la
-
-endif
+libenvdir = $(libdir)/paludis/environments/
+libenv_LTLIBRARIES = libpaludisnoconfigenvironment.la
paludis_environment_no_config_includedir = $(includedir)/paludis-$(PALUDIS_PC_SLOT)/paludis/environments/no_config
paludis_environment_no_config_include_HEADERS = \
no_config_environment.hh \
- no_config_environment-sr.hh
+ no_config_environment-sr.hh \
+ no_config_environment-se.hh
EXTRA_DIST = \
no_config_environment-sr.hh \
no_config_environment-sr.cc \
no_config_environment.sr \
+ no_config_environment-se.hh \
+ no_config_environment-se.cc \
+ no_config_environment.se \
no_config_environment_TEST.cc \
no_config_environment_TEST_setup.sh \
no_config_environment_TEST_cleanup.sh
@@ -72,7 +66,9 @@ no_config_environment_TEST_LDADD = \
BUILT_SOURCES = \
no_config_environment-sr.hh \
- no_config_environment-sr.cc
+ no_config_environment-sr.cc \
+ no_config_environment-se.hh \
+ no_config_environment-se.cc
no_config_environment-sr.hh : no_config_environment.sr $(top_srcdir)/misc/make_sr.bash
$(top_srcdir)/misc/make_sr.bash --header $(srcdir)/no_config_environment.sr > $@
@@ -80,6 +76,12 @@ no_config_environment-sr.hh : no_config_environment.sr $(top_srcdir)/misc/make_s
no_config_environment-sr.cc : no_config_environment.sr $(top_srcdir)/misc/make_sr.bash
$(top_srcdir)/misc/make_sr.bash --source $(srcdir)/no_config_environment.sr > $@
+no_config_environment-se.hh : no_config_environment.se $(top_srcdir)/misc/make_se.bash
+ $(top_srcdir)/misc/make_se.bash --header $(srcdir)/no_config_environment.se > $@
+
+no_config_environment-se.cc : no_config_environment.se $(top_srcdir)/misc/make_se.bash
+ $(top_srcdir)/misc/make_se.bash --source $(srcdir)/no_config_environment.se > $@
+
built-sources : $(BUILT_SOURCES)
for s in $(SUBDIRS) ; do $(MAKE) -C $$s built-sources || exit 1 ; done
diff --git a/paludis/environments/no_config/no_config_environment.cc b/paludis/environments/no_config/no_config_environment.cc
index f1e055b..e86401c 100644
--- a/paludis/environments/no_config/no_config_environment.cc
+++ b/paludis/environments/no_config/no_config_environment.cc
@@ -45,6 +45,7 @@ using namespace paludis;
using namespace paludis::no_config_environment;
#include <paludis/environments/no_config/no_config_environment-sr.cc>
+#include <paludis/environments/no_config/no_config_environment-se.cc>
namespace paludis
{
@@ -86,6 +87,7 @@ namespace
case ncer_vdb:
return true;
case ncer_auto:
+ case last_ncer:
;
}
@@ -341,15 +343,20 @@ NoConfigEnvironment::accept_keywords(std::tr1::shared_ptr<const KeywordNameSet>
std::string arch_var((*_imp->main_repo)[k::e_interface()]->arch_variable());
if (arch_var.empty())
- throw ConfigurationError("Don't know how to work out whether keywords are acceptable");
-
- std::string arch((*_imp->main_repo)[k::e_interface()]->profile_variable(arch_var));
+ {
+ if (_imp->params.extra_accept_keywords.empty())
+ throw ConfigurationError("Don't know how to work out whether keywords are acceptable");
+ }
+ else
+ {
+ std::string arch((*_imp->main_repo)[k::e_interface()]->profile_variable(arch_var));
- if (keywords->end() != keywords->find(KeywordName(arch)))
- return true;
+ if (keywords->end() != keywords->find(KeywordName(arch)))
+ return true;
- if (_imp->accept_unstable && keywords->end() != keywords->find(KeywordName("~" + arch)))
- return true;
+ if (_imp->accept_unstable && keywords->end() != keywords->find(KeywordName("~" + arch)))
+ return true;
+ }
}
else
{
@@ -368,6 +375,23 @@ NoConfigEnvironment::accept_keywords(std::tr1::shared_ptr<const KeywordNameSet>
}
}
+ {
+ std::list<KeywordName> accepted;
+ tokenise_whitespace(_imp->params.extra_accept_keywords,
+ create_inserter<KeywordName>(std::back_inserter(accepted)));
+
+ for (KeywordNameSet::ConstIterator k(keywords->begin()), k_end(keywords->end()) ;
+ k != k_end ; ++k)
+ {
+ if (accepted.end() != std::find(accepted.begin(), accepted.end(), *k))
+ return true;
+
+ if (_imp->accept_unstable && stringify(*k).at(0) == '~')
+ if (accepted.end() != std::find(accepted.begin(), accepted.end(), KeywordName(stringify(*k).substr(1))))
+ return true;
+ }
+ }
+
return false;
}
diff --git a/paludis/environments/no_config/no_config_environment.hh b/paludis/environments/no_config/no_config_environment.hh
index 0e61e65..0c75765 100644
--- a/paludis/environments/no_config/no_config_environment.hh
+++ b/paludis/environments/no_config/no_config_environment.hh
@@ -30,19 +30,7 @@ namespace paludis
{
namespace no_config_environment
{
- /**
- * The type of repository to use for a NoConfigEnvironment.
- *
- * \see NoConfigEnvironment
- * \ingroup grpnoconfigenvironment
- */
- enum RepositoryType
- {
- ncer_ebuild,
- ncer_vdb,
- ncer_auto
- };
-
+#include <paludis/environments/no_config/no_config_environment-se.hh>
#include <paludis/environments/no_config/no_config_environment-sr.hh>
}
diff --git a/paludis/environments/no_config/no_config_environment.se b/paludis/environments/no_config/no_config_environment.se
new file mode 100644
index 0000000..85cd57c
--- /dev/null
+++ b/paludis/environments/no_config/no_config_environment.se
@@ -0,0 +1,23 @@
+#!/bin/bash
+# vim: set sw=4 sts=4 et ft=sh :
+
+make_enum_RepositoryType()
+{
+ namespace no_config_environment
+ want_destringify
+ prefix ncer
+
+ key ncer_ebuild "Ebuilds"
+ key ncer_vdb "VDB"
+ key ncer_auto "Automatic"
+
+ doxygen_comment << "END"
+ /**
+ * Type of repository for NoConfigEnvironment.
+ *
+ * \see NoConfigEnvironment
+ * \since 0.28
+ */
+END
+}
+
diff --git a/paludis/environments/no_config/no_config_environment.sr b/paludis/environments/no_config/no_config_environment.sr
index 003b12d..c6c76f3 100644
--- a/paludis/environments/no_config/no_config_environment.sr
+++ b/paludis/environments/no_config/no_config_environment.sr
@@ -9,6 +9,7 @@ make_class_Params()
key write_cache "FSEntry"
key disable_metadata_cache bool
key accept_unstable bool
+ key extra_accept_keywords std::string
key repository_type no_config_environment::RepositoryType
key master_repository_dir "FSEntry"
key extra_params "std::tr1::shared_ptr<Map<std::string, std::string> >"
diff --git a/paludis/environments/no_config/no_config_environment_TEST.cc b/paludis/environments/no_config/no_config_environment_TEST.cc
index aff988f..9c457a7 100644
--- a/paludis/environments/no_config/no_config_environment_TEST.cc
+++ b/paludis/environments/no_config/no_config_environment_TEST.cc
@@ -39,6 +39,7 @@ namespace test_cases
.repository_type(no_config_environment::ncer_auto)
.disable_metadata_cache(false)
.extra_params(std::tr1::shared_ptr<Map<std::string, std::string> >())
+ .extra_accept_keywords("")
.master_repository_dir(FSEntry("/var/empty")));
TEST_CHECK(e.package_database());
diff --git a/paludis/environments/no_config/registration.cc b/paludis/environments/no_config/registration.cc
index a11623b..0601d22 100644
--- a/paludis/environments/no_config/registration.cc
+++ b/paludis/environments/no_config/registration.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2007 Ciaran McCreesh
+ * Copyright (c) 2007, 2008 Ciaran McCreesh
*
* This file is part of the Paludis package manager. Paludis is free software;
* you can redistribute it and/or modify it under the terms of the GNU General
@@ -19,6 +19,11 @@
#include <paludis/environment_maker.hh>
#include <paludis/environments/no_config/no_config_environment.hh>
+#include <paludis/util/map.hh>
+#include <paludis/util/tokeniser.hh>
+#include <paludis/util/destringify.hh>
+#include <paludis/util/make_shared_ptr.hh>
+#include <list>
using namespace paludis;
@@ -27,8 +32,70 @@ extern "C"
void PALUDIS_VISIBLE register_environments(EnvironmentMaker * maker);
}
-void register_environments(EnvironmentMaker *)
+namespace
{
+ std::tr1::shared_ptr<Environment>
+ make_no_config_environment(const std::string & s)
+ {
+ Context context("When making NoConfigEnvironment using spec '" + s + "':");
+
+ std::tr1::shared_ptr<Map<std::string, std::string> > extra_params(
+ make_shared_ptr(new Map<std::string, std::string>));
+ FSEntry repository_dir(FSEntry::cwd());
+ FSEntry write_cache("/var/empty");
+ FSEntry master_repository_dir("/var/empty");
+ bool disable_metadata_cache(false);
+ bool accept_unstable(false);
+ no_config_environment::RepositoryType repository_type(no_config_environment::ncer_auto);
+ std::string extra_accept_keywords;
+
+ std::list<std::string> tokens;
+ tokenise<delim_kind::AnyOfTag, delim_mode::DelimiterTag>(s, ":", "", std::back_inserter(tokens));
+ for (std::list<std::string>::const_iterator t(tokens.begin()), t_end(tokens.end()) ;
+ t != t_end ; ++t)
+ {
+ std::string::size_type p(t->find('='));
+ if (std::string::npos == p)
+ repository_dir = *t;
+ else
+ {
+ std::string key(t->substr(0, p)), value(t->substr(p + 1));
+
+ if (key == "write-cache")
+ write_cache = value;
+ else if (key == "master-repository-dir")
+ master_repository_dir = value;
+ else if (key == "repository-dir")
+ repository_dir = value;
+ else if (key == "disable-metadata-cache")
+ disable_metadata_cache = destringify<bool>(value);
+ else if (key == "accept-unstable")
+ accept_unstable = destringify<bool>(value);
+ else if (key == "repository-type")
+ repository_type = destringify<no_config_environment::RepositoryType>(value);
+ else if (key == "extra-accept-keywords")
+ extra_accept_keywords = value;
+ else
+ extra_params->insert(key, value);
+ }
+ }
+
+ return std::tr1::shared_ptr<Environment>(new NoConfigEnvironment(
+ no_config_environment::Params::create()
+ .repository_dir(repository_dir)
+ .write_cache(write_cache)
+ .master_repository_dir(master_repository_dir)
+ .extra_params(extra_params)
+ .repository_type(repository_type)
+ .disable_metadata_cache(disable_metadata_cache)
+ .accept_unstable(accept_unstable)
+ .extra_accept_keywords(extra_accept_keywords)
+ ));
+ }
}
+void register_environments(EnvironmentMaker * maker)
+{
+ maker->register_maker("no-config", &make_no_config_environment);
+}
diff --git a/ruby/environment.cc b/ruby/environment.cc
index b2a0300..e13e332 100644
--- a/ruby/environment.cc
+++ b/ruby/environment.cc
@@ -373,6 +373,7 @@ namespace
.disable_metadata_cache(false)
.repository_type(no_config_environment::ncer_auto)
.extra_params(std::tr1::shared_ptr<Map<std::string, std::string> >())
+ .extra_accept_keywords("")
.master_repository_dir(FSEntry(master_repository_dir))));
VALUE tdata(Data_Wrap_Struct(self, 0, &Common<std::tr1::shared_ptr<Environment> >::free, e));
rb_obj_call_init(tdata, argc, argv);
diff --git a/src/clients/accerso/accerso.cc b/src/clients/accerso/accerso.cc
index 1869612..c50dd9f 100644
--- a/src/clients/accerso/accerso.cc
+++ b/src/clients/accerso/accerso.cc
@@ -111,6 +111,7 @@ main(int argc, char *argv[])
.repository_type(no_config_environment::ncer_ebuild)
.disable_metadata_cache(false)
.extra_params(keys)
+ .extra_accept_keywords("")
.master_repository_dir(FSEntry(CommandLine::get_instance()->a_master_repository_dir.argument())));
std::tr1::shared_ptr<const PackageIDSequence> ids(env[selection::AllVersionsSorted(
diff --git a/src/clients/adjutrix/adjutrix.cc b/src/clients/adjutrix/adjutrix.cc
index 2503837..9ae5832 100644
--- a/src/clients/adjutrix/adjutrix.cc
+++ b/src/clients/adjutrix/adjutrix.cc
@@ -138,6 +138,7 @@ main(int argc, char *argv[])
no_config_environment::ncer_ebuild)
.disable_metadata_cache(false)
.master_repository_dir(CommandLine::get_instance()->a_master_repository_dir.argument())
+ .extra_accept_keywords("")
.extra_params(std::tr1::shared_ptr<Map<std::string, std::string> >()));
if (CommandLine::get_instance()->a_find_stable_candidates.specified())
diff --git a/src/clients/instruo/instruo.cc b/src/clients/instruo/instruo.cc
index 0258a9f..b55ec69 100644
--- a/src/clients/instruo/instruo.cc
+++ b/src/clients/instruo/instruo.cc
@@ -232,6 +232,7 @@ main(int argc, char *argv[])
.repository_type(no_config_environment::ncer_ebuild)
.disable_metadata_cache(true)
.extra_params(keys)
+ .extra_accept_keywords("")
.master_repository_dir(FSEntry(CommandLine::get_instance()->a_master_repository_dir.argument())));
std::tr1::shared_ptr<const PackageIDSequence> ids(env[selection::AllVersionsSorted(
diff --git a/src/clients/qualudis/qualudis.cc b/src/clients/qualudis/qualudis.cc
index 11eaa2c..1e3d6e6 100644
--- a/src/clients/qualudis/qualudis.cc
+++ b/src/clients/qualudis/qualudis.cc
@@ -343,6 +343,7 @@ int main(int argc, char *argv[])
.master_repository_dir(QualudisCommandLine::get_instance()->a_master_repository_dir.argument())
.disable_metadata_cache(! QualudisCommandLine::get_instance()->a_use_repository_cache.specified())
.extra_params(std::tr1::shared_ptr<Map<std::string, std::string> >())
+ .extra_accept_keywords("")
));
if (! (*env->main_repository())[k::qa_interface()])