aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2008-10-10 22:10:17 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2008-10-10 22:12:06 +0100
commitca07bf6393b0db1cc3162da8ef0eac9c9ba484e8 (patch)
treea40b5441cd5d2587e4e7c959cddbf826df39e6f9
parentb72601a91b640a34c7aa2dc1ef92428ecf22b1cc (diff)
downloadpaludis-ca07bf6393b0db1cc3162da8ef0eac9c9ba484e8.tar.gz
paludis-ca07bf6393b0db1cc3162da8ef0eac9c9ba484e8.tar.xz
Change how NoConfigEnvironment does masters.
Now rather than specifying the master repository directory, we specify the master repository name (if there's no layout.conf) and a number of extra repository directories. Clients now use --extra-repository-dir (possibly multiple times) and --master-repository-name (if it can't be determined automatically) instead of --master-repository-dir. Fixes: ticket:635.
-rw-r--r--paludis/args/args_dumper.cc9
-rw-r--r--paludis/args/args_dumper.hh3
-rw-r--r--paludis/args/args_option.cc49
-rw-r--r--paludis/args/args_option.hh45
-rw-r--r--paludis/args/args_visitor.cc19
-rw-r--r--paludis/args/args_visitor.hh9
-rw-r--r--paludis/args/man.cc4
-rw-r--r--paludis/environments/no_config/no_config_environment.cc59
-rw-r--r--paludis/environments/no_config/no_config_environment.sr3
-rw-r--r--paludis/environments/no_config/no_config_environment_TEST.cc6
-rw-r--r--paludis/environments/no_config/registration.cc14
-rw-r--r--python/environment.cc14
-rwxr-xr-xpython/environment_TEST.py6
-rw-r--r--ruby/environment.cc33
-rw-r--r--ruby/environment_TEST.rb5
-rw-r--r--src/clients/accerso/accerso.cc12
-rw-r--r--src/clients/accerso/command_line.cc9
-rw-r--r--src/clients/accerso/command_line.hh5
-rw-r--r--src/clients/adjutrix/adjutrix.cc12
-rw-r--r--src/clients/adjutrix/command_line.cc9
-rw-r--r--src/clients/adjutrix/command_line.hh5
-rw-r--r--src/clients/instruo/command_line.cc9
-rw-r--r--src/clients/instruo/command_line.hh5
-rw-r--r--src/clients/instruo/instruo.cc12
-rw-r--r--src/clients/qualudis/qualudis.cc10
-rw-r--r--src/clients/qualudis/qualudis_command_line.cc9
-rw-r--r--src/clients/qualudis/qualudis_command_line.hh3
27 files changed, 288 insertions, 90 deletions
diff --git a/paludis/args/args_dumper.cc b/paludis/args/args_dumper.cc
index ce142a1..d2b6d01 100644
--- a/paludis/args/args_dumper.cc
+++ b/paludis/args/args_dumper.cc
@@ -63,6 +63,11 @@ void ArgsDumper::visit(const StringSetArg & a)
}
}
+void ArgsDumper::visit(const StringSequenceArg & a)
+{
+ generic_visit(a);
+}
+
void ArgsDumper::visit(const EnumArg & a)
{
generic_visit(a);
@@ -103,7 +108,7 @@ ArgsDumper::visit(const IntegerArg & a)
void
ArgsDumper::visit(const AliasArg & a)
{
- if(!a.hidden())
- generic_visit(a);
+ if(! a.hidden())
+ generic_visit(a);
}
diff --git a/paludis/args/args_dumper.hh b/paludis/args/args_dumper.hh
index 078f82f..23cd164 100644
--- a/paludis/args/args_dumper.hh
+++ b/paludis/args/args_dumper.hh
@@ -81,6 +81,9 @@ namespace paludis
/// Visit a StringSetArg.
void visit(const StringSetArg &);
+
+ /// Visit a StringSequenceArg.
+ void visit(const StringSequenceArg &);
};
}
}
diff --git a/paludis/args/args_option.cc b/paludis/args/args_option.cc
index e3718a9..f373b41 100644
--- a/paludis/args/args_option.cc
+++ b/paludis/args/args_option.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2005, 2006, 2007 Ciaran McCreesh
+ * Copyright (c) 2005, 2006, 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
@@ -25,6 +25,7 @@
#include <set>
#include <vector>
#include <algorithm>
+#include <list>
using namespace paludis;
using namespace paludis::args;
@@ -34,6 +35,7 @@ template class WrappedForwardIterator<StringSetArg::AllowedArgConstIteratorTag,
const std::pair<std::string, std::string> >;
template class WrappedForwardIterator<EnumArg::AllowedArgConstIteratorTag,
const std::pair<std::string, std::string> >;
+template class WrappedForwardIterator<StringSequenceArg::ConstIteratorTag, const std::string>;
namespace
{
@@ -185,6 +187,45 @@ StringSetArg::add_argument(const std::string & arg)
_imp->args.insert(arg);
}
+namespace paludis
+{
+ template<>
+ struct Implementation<StringSequenceArg>
+ {
+ std::list<std::string> args;
+ };
+}
+
+StringSequenceArg::StringSequenceArg(ArgsGroup * const g, const std::string & our_long_name,
+ const char our_short_name, const std::string & our_description) :
+ ArgsOption(g, our_long_name, our_short_name, our_description),
+ PrivateImplementationPattern<StringSequenceArg>(new Implementation<StringSequenceArg>)
+{
+}
+
+StringSequenceArg::~StringSequenceArg()
+{
+}
+
+StringSequenceArg::ConstIterator
+StringSequenceArg::begin_args() const
+{
+ return ConstIterator(_imp->args.begin());
+}
+
+StringSequenceArg::ConstIterator
+StringSequenceArg::end_args() const
+{
+ return ConstIterator(_imp->args.end());
+}
+
+void
+StringSequenceArg::add_argument(const std::string & arg)
+{
+ Context context("When handling argument '" + arg + "' for '--" + long_name() + "':");
+ _imp->args.push_back(arg);
+}
+
IntegerArg::IntegerArg(ArgsGroup * const our_group, const std::string & our_long_name,
char our_short_name, const std::string & our_description) :
ArgsOption(our_group, our_long_name, our_short_name, our_description)
@@ -355,6 +396,12 @@ StringSetArg::can_be_negated() const
}
bool
+StringSequenceArg::can_be_negated() const
+{
+ return false;
+}
+
+bool
SwitchArg::can_be_negated() const
{
return _can_be_negated;
diff --git a/paludis/args/args_option.hh b/paludis/args/args_option.hh
index 1d4a8aa..caab1c9 100644
--- a/paludis/args/args_option.hh
+++ b/paludis/args/args_option.hh
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2005, 2006, 2007 Ciaran McCreesh
+ * Copyright (c) 2005, 2006, 2007, 2008 Ciaran McCreesh
* Copyright (c) 2006 Stephen Bennett
*
* This file is part of the Paludis package manager. Paludis is free software;
@@ -315,6 +315,49 @@ namespace paludis
virtual bool can_be_negated() const;
};
+ /**
+ * An option that takes a set of strings.
+ *
+ * \since 0.32
+ * \ingroup g_args
+ * \nosubgrouping
+ */
+ class PALUDIS_VISIBLE StringSequenceArg :
+ public ArgsOption,
+ public AcceptInterfaceVisitsThis<ArgsVisitorTypes, StringSequenceArg>,
+ private PrivateImplementationPattern<StringSequenceArg>
+ {
+ public:
+ ///\name Basic operations
+ ///\{
+
+ StringSequenceArg(ArgsGroup * const, const std::string & long_name,
+ const char short_name, const std::string & description);
+
+ ~StringSequenceArg();
+
+ ///\}
+
+ ///\name Iterate over our args.
+ ///\{
+
+ struct ConstIteratorTag;
+ typedef WrappedForwardIterator<ConstIteratorTag, const std::string> ConstIterator;
+
+ ConstIterator begin_args() const;
+
+ ConstIterator end_args() const;
+
+ ///\}
+
+ /**
+ * Add an argument to the set.
+ */
+ void add_argument(const std::string & arg);
+
+ virtual bool can_be_negated() const;
+ };
+
/**
* An AliasArg is an alias for another argument.
diff --git a/paludis/args/args_visitor.cc b/paludis/args/args_visitor.cc
index b4af7ce..24e6097 100644
--- a/paludis/args/args_visitor.cc
+++ b/paludis/args/args_visitor.cc
@@ -1,6 +1,6 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2005, 2006, 2007 Ciaran McCreesh
+ * Copyright (c) 2005, 2006, 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
@@ -169,6 +169,23 @@ void ArgsVisitor::visit(StringSetArg & arg)
throw BadArgument("--no-" + arg.long_name());
}
+void ArgsVisitor::visit(StringSequenceArg & arg)
+{
+ if (! _no)
+ {
+ arg.set_specified(true);
+
+ std::string param = get_param(arg);
+ arg.add_argument(param);
+
+ if (! _env_prefix.empty())
+ setenv(env_name(arg.long_name()).c_str(), join(arg.begin_args(),
+ arg.end_args(), " ").c_str(), 1);
+ }
+ else
+ throw BadArgument("--no-" + arg.long_name());
+}
+
std::string
ArgsVisitor::env_name(const std::string & long_name) const
{
diff --git a/paludis/args/args_visitor.hh b/paludis/args/args_visitor.hh
index 1fcf70e..5d554d1 100644
--- a/paludis/args/args_visitor.hh
+++ b/paludis/args/args_visitor.hh
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2005, 2006, 2007 Ciaran McCreesh
+ * Copyright (c) 2005, 2006, 2007, 2008 Ciaran McCreesh
* Copyright (c) 2006 Stephen Bennett
*
* This file is part of the Paludis package manager. Paludis is free software;
@@ -47,6 +47,7 @@ namespace paludis
class IntegerArg;
class EnumArg;
class StringSetArg;
+ class StringSequenceArg;
/**
* Visitor types for visitors that can visit Args.
@@ -62,7 +63,8 @@ namespace paludis
SwitchArg,
IntegerArg,
EnumArg,
- StringSetArg>
+ StringSetArg,
+ StringSequenceArg>
{
};
@@ -113,6 +115,9 @@ namespace paludis
/// Visit a StringSetArg.
void visit(StringSetArg &);
+ /// Visit a StringSequenceArg.
+ void visit(StringSequenceArg &);
+
/// Change whether we're visiting a --no- option
void set_no(const bool);
};
diff --git a/paludis/args/man.cc b/paludis/args/man.cc
index b6c21d2..4e2b3c2 100644
--- a/paludis/args/man.cc
+++ b/paludis/args/man.cc
@@ -88,6 +88,10 @@ namespace
_dw.end_extra_arg();
}
+
+ void visit(const StringSequenceArg &)
+ {
+ }
};
}
diff --git a/paludis/environments/no_config/no_config_environment.cc b/paludis/environments/no_config/no_config_environment.cc
index b02b79a..6531582 100644
--- a/paludis/environments/no_config/no_config_environment.cc
+++ b/paludis/environments/no_config/no_config_environment.cc
@@ -61,6 +61,7 @@ namespace paludis
std::tr1::shared_ptr<Repository> main_repo;
std::tr1::shared_ptr<Repository> master_repo;
+ std::list<std::tr1::shared_ptr<Repository> > extra_repos;
std::string paludis_command;
@@ -166,35 +167,41 @@ Implementation<NoConfigEnvironment>::initialise(NoConfigEnvironment * const env)
if (! is_vdb)
{
- if (FSEntry("/var/empty") != params.master_repository_dir)
+ for (FSEntrySequence::ConstIterator d(params.extra_repository_dirs->begin()), d_end(params.extra_repository_dirs->end()) ;
+ d != d_end ; ++d)
{
- if (params.repository_dir.realpath() == params.master_repository_dir.realpath())
- Log::get_instance()->message("no_config_environment.master_repository.ignoring", ll_warning, lc_context)
- << "Ignoring master_repository_dir '" << params.master_repository_dir
- << "' because it is the same as repository_dir";
-
- else
+ if (params.repository_dir.realpath() == d->realpath())
{
- std::tr1::shared_ptr<Map<std::string, std::string> > keys(new Map<std::string, std::string>);
-
- if (params.extra_params)
- std::copy(params.extra_params->begin(), params.extra_params->end(), keys->inserter());
-
- keys->insert("format", "ebuild");
- keys->insert("location", stringify(params.master_repository_dir));
- keys->insert("profiles", "/var/empty");
- keys->insert("ignore_deprecated_profiles", "true");
- keys->insert("write_cache", stringify(params.write_cache));
- keys->insert("names_cache", "/var/empty");
- keys->insert("builddir", "/var/empty");
- if (params.disable_metadata_cache)
- keys->insert("cache", "/var/empty");
-
- package_database->add_repository(1, ((master_repo =
- RepositoryFactory::get_instance()->create(env, std::tr1::bind(from_keys, keys, std::tr1::placeholders::_1)))));
+ Log::get_instance()->message("no_config_environment.extra_repository.ignoring", ll_warning, lc_context)
+ << "Ignoring extra_repository_dir '" << *d << "' because it is the same as repository_dir";
+ continue;
}
+
+ std::tr1::shared_ptr<Map<std::string, std::string> > keys(new Map<std::string, std::string>);
+
+ if (params.extra_params)
+ std::copy(params.extra_params->begin(), params.extra_params->end(), keys->inserter());
+
+ keys->insert("format", "ebuild");
+ keys->insert("location", stringify(*d));
+ keys->insert("profiles", "/var/empty");
+ keys->insert("ignore_deprecated_profiles", "true");
+ keys->insert("write_cache", stringify(params.write_cache));
+ keys->insert("names_cache", "/var/empty");
+ keys->insert("builddir", "/var/empty");
+ if (params.disable_metadata_cache)
+ keys->insert("cache", "/var/empty");
+
+ std::tr1::shared_ptr<Repository> repo(RepositoryFactory::get_instance()->create(
+ env, std::tr1::bind(from_keys, keys, std::tr1::placeholders::_1)));
+ if (stringify(repo->name()) == params.master_repository_name)
+ master_repo = repo;
+ package_database->add_repository(1, repo);
}
+ if ((! params.master_repository_name.empty()) && (! master_repo))
+ throw ConfigurationError("Can't find repository '" + params.master_repository_name + "'");
+
std::tr1::shared_ptr<Map<std::string, std::string> > keys( new Map<std::string, std::string>);
if (params.extra_params)
@@ -211,8 +218,8 @@ Implementation<NoConfigEnvironment>::initialise(NoConfigEnvironment * const env)
if (params.disable_metadata_cache)
keys->insert("cache", "/var/empty");
- if (master_repo)
- keys->insert("master_repository", stringify(master_repo->name()));
+ if (! params.master_repository_name.empty())
+ keys->insert("master_repository", params.master_repository_name);
if ((params.repository_dir / "metadata" / "profiles_desc.conf").exists())
keys->insert("layout", "exheres");
diff --git a/paludis/environments/no_config/no_config_environment.sr b/paludis/environments/no_config/no_config_environment.sr
index e459802..703a68e 100644
--- a/paludis/environments/no_config/no_config_environment.sr
+++ b/paludis/environments/no_config/no_config_environment.sr
@@ -11,7 +11,8 @@ make_class_Params()
key accept_unstable bool
key extra_accept_keywords std::string
key repository_type no_config_environment::RepositoryType
- key master_repository_dir "FSEntry"
+ key master_repository_name std::string
+ key extra_repository_dirs "std::tr1::shared_ptr<const FSEntrySequence>"
key extra_params "std::tr1::shared_ptr<Map<std::string, std::string> >"
allow_named_args
diff --git a/paludis/environments/no_config/no_config_environment_TEST.cc b/paludis/environments/no_config/no_config_environment_TEST.cc
index 9c457a7..ff34331 100644
--- a/paludis/environments/no_config/no_config_environment_TEST.cc
+++ b/paludis/environments/no_config/no_config_environment_TEST.cc
@@ -20,6 +20,9 @@
#include "no_config_environment.hh"
#include <test/test_runner.hh>
#include <test/test_framework.hh>
+#include <paludis/util/sequence.hh>
+#include <paludis/util/fs_entry.hh>
+#include <paludis/util/make_shared_ptr.hh>
using namespace test;
using namespace paludis;
@@ -40,7 +43,8 @@ namespace test_cases
.disable_metadata_cache(false)
.extra_params(std::tr1::shared_ptr<Map<std::string, std::string> >())
.extra_accept_keywords("")
- .master_repository_dir(FSEntry("/var/empty")));
+ .master_repository_name("")
+ .extra_repository_dirs(make_shared_ptr(new FSEntrySequence)));
TEST_CHECK(e.package_database());
}
diff --git a/paludis/environments/no_config/registration.cc b/paludis/environments/no_config/registration.cc
index 091ba68..0ffa69e 100644
--- a/paludis/environments/no_config/registration.cc
+++ b/paludis/environments/no_config/registration.cc
@@ -24,6 +24,7 @@
#include <paludis/util/tokeniser.hh>
#include <paludis/util/destringify.hh>
#include <paludis/util/make_shared_ptr.hh>
+#include <paludis/util/sequence.hh>
#include <list>
using namespace paludis;
@@ -38,8 +39,9 @@ namespace
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());
+ std::tr1::shared_ptr<FSEntrySequence> extra_repository_dirs(new FSEntrySequence);
FSEntry write_cache("/var/empty");
- FSEntry master_repository_dir("/var/empty");
+ std::string master_repository_name;
bool disable_metadata_cache(false);
bool accept_unstable(false);
no_config_environment::RepositoryType repository_type(no_config_environment::ncer_auto);
@@ -59,8 +61,13 @@ namespace
if (key == "write-cache")
write_cache = value;
+ else if (key == "master-repository-name")
+ master_repository_name = value;
else if (key == "master-repository-dir")
- master_repository_dir = value;
+ throw ConfigurationError("NoConfigEnvironment key master-repository-dir is no longer "
+ "supported, use master-repository-name and extra-repository-dir");
+ else if (key == "extra-repository-dir")
+ extra_repository_dirs->push_back(value);
else if (key == "repository-dir")
repository_dir = value;
else if (key == "disable-metadata-cache")
@@ -80,7 +87,8 @@ namespace
no_config_environment::Params::create()
.repository_dir(repository_dir)
.write_cache(write_cache)
- .master_repository_dir(master_repository_dir)
+ .master_repository_name(master_repository_name)
+ .extra_repository_dirs(extra_repository_dirs)
.extra_params(extra_params)
.repository_type(repository_type)
.disable_metadata_cache(disable_metadata_cache)
diff --git a/python/environment.cc b/python/environment.cc
index 0354402..2ceefe4 100644
--- a/python/environment.cc
+++ b/python/environment.cc
@@ -32,6 +32,7 @@
#include <paludis/package_id.hh>
#include <paludis/selection.hh>
#include <paludis/util/wrapped_forward_iterator.hh>
+#include <paludis/util/make_shared_ptr.hh>
using namespace paludis;
using namespace paludis::python;
@@ -441,9 +442,11 @@ struct NoConfigEnvironmentWrapper :
NoConfigEnvironment
{
NoConfigEnvironmentWrapper(const FSEntry & env_dir, const FSEntry & cache_dir,
- const FSEntry & master_repo_dir) :
+ const std::string & master_repo_name, const std::tr1::shared_ptr<const FSEntrySequence> & extra_repository_dirs
+ ) :
NoConfigEnvironment(no_config_environment::Params(env_dir, cache_dir, false, false, "",
- no_config_environment::ncer_auto, master_repo_dir,
+ no_config_environment::ncer_auto, master_repo_name,
+ extra_repository_dirs,
std::tr1::shared_ptr<Map<std::string, std::string> >())
)
{
@@ -727,11 +730,12 @@ void expose_environment()
(
"NoConfigEnvironment",
"An environment that uses a single repository, with no user configuration.",
- bp::init<const FSEntry &, const FSEntry &, const FSEntry &>(
+ bp::init<const FSEntry &, const FSEntry &, const std::string &, const std::tr1::shared_ptr<const FSEntrySequence> &>(
(bp::arg("environment_dir"), bp::arg("write_cache_dir")="/var/empty",
- bp::arg("master_repository_dir")="/var/empty"),
+ bp::arg("master_repository_name")="",
+ bp::arg("extra_repository_dirs") = make_shared_ptr(new FSEntrySequence)),
"__init__(environment_dir, write_cache_dir=\"/var/empty\", "
- "master_repository_dir=\"/var/empty\")"
+ "master_repository_name=\"\", extra_repository_dirs=[])"
)
)
.add_property("main_repository", main_repository,
diff --git a/python/environment_TEST.py b/python/environment_TEST.py
index e710254..d2e1339 100755
--- a/python/environment_TEST.py
+++ b/python/environment_TEST.py
@@ -40,8 +40,8 @@ class TestCase_01_Environments(unittest.TestCase):
def test_01_create(self):
NoConfigEnvironment(repo)
NoConfigEnvironment(repo, "/var/empty")
- NoConfigEnvironment(repo, "/var/empty", "/var/empty")
- NoConfigEnvironment(repo, master_repository_dir="/var/empty")
+ NoConfigEnvironment(repo, "/var/empty", "")
+ NoConfigEnvironment(repo, master_repository_name="")
NoConfigEnvironment(repo, write_cache_dir="/var/empty")
def test_02_create_error(self):
@@ -73,7 +73,7 @@ class TestCase_01_Environments(unittest.TestCase):
self.assert_(isinstance(self.nce.set_names, SetNameIterable))
def test_08_repositories(self):
- nce2 = NoConfigEnvironment(repo, master_repository_dir=slaverepo)
+ nce2 = NoConfigEnvironment(repo, master_repository_name="slaverepo", extra_repository_dirs=[slaverepo])
self.assert_(isinstance(self.nce.main_repository, Repository))
self.assertEquals(self.nce.master_repository, None)
diff --git a/ruby/environment.cc b/ruby/environment.cc
index 255f660..f3ac2aa 100644
--- a/ruby/environment.cc
+++ b/ruby/environment.cc
@@ -339,34 +339,48 @@ namespace
* call-seq:
* NoConfigEnvironment.new(environment_dir) -> NoConfigEnvironment
* NoConfigEnvironment.new(environment_dir, write_cache_dir) -> NoConfigEnvironment
- * NoConfigEnvironment.new(environment_dir, write_cache_dir, master_repository_dir) -> NoConfigEnvironment
+ * NoConfigEnvironment.new(environment_dir, write_cache_dir, master_repository_name) -> NoConfigEnvironment
+ * NoConfigEnvironment.new(environment_dir, write_cache_dir, master_repository_name, [extra_repository_dirs]) -> NoConfigEnvironment
*
- * Create a new NoConfigEnvironment from the specified directory. A write cache and master repository
- * may also be specified.
+ * Create a new NoConfigEnvironment from the specified directory. A write cache, master repository name
+ * and extra repository dirs may also be specified.
*/
VALUE
no_config_environment_new(int argc, VALUE* argv, VALUE self)
{
try
{
- std::string write_cache, master_repository_dir;
+ std::string write_cache, master_repository_name;
+ std::tr1::shared_ptr<FSEntrySequence> extra_repository_dirs(new FSEntrySequence);
if (1 == argc)
{
write_cache = "/var/empty/";
- master_repository_dir = "/var/empty/";
+ master_repository_name = "";
}
else if (2 == argc)
{
write_cache = StringValuePtr(argv[1]);
- master_repository_dir = "/var/empty/";
+ master_repository_name = "";
}
else if (3 == argc)
{
write_cache = StringValuePtr(argv[1]);
- master_repository_dir = StringValuePtr(argv[2]);
+ master_repository_name = StringValuePtr(argv[2]);
+ }
+ else if (4 == argc)
+ {
+ write_cache = StringValuePtr(argv[1]);
+ master_repository_name = StringValuePtr(argv[2]);
+
+ Check_Type(argv[3], T_ARRAY);
+ for (int i(0) ; i < RARRAY(argv[3])->len ; ++i)
+ {
+ VALUE entry(rb_ary_entry(argv[3], i));
+ extra_repository_dirs->push_back(stringify(StringValuePtr(entry)));
+ }
}
else
- rb_raise(rb_eArgError, "NoConfigEnvironment.new expects one to three arguments, but got %d", argc);
+ rb_raise(rb_eArgError, "NoConfigEnvironment.new expects one to four arguments, but got %d", argc);
std::string path;
if (rb_obj_is_kind_of(argv[0], rb_cDir))
@@ -385,8 +399,9 @@ namespace
.disable_metadata_cache(false)
.repository_type(no_config_environment::ncer_auto)
.extra_params(std::tr1::shared_ptr<Map<std::string, std::string> >())
+ .extra_repository_dirs(extra_repository_dirs)
.extra_accept_keywords("")
- .master_repository_dir(FSEntry(master_repository_dir))));
+ .master_repository_name(master_repository_name)));
VALUE tdata(Data_Wrap_Struct(self, 0, &Common<std::tr1::shared_ptr<Environment> >::free, e));
rb_obj_call_init(tdata, argc, argv);
return tdata;
diff --git a/ruby/environment_TEST.rb b/ruby/environment_TEST.rb
index 262aa50..becac4f 100644
--- a/ruby/environment_TEST.rb
+++ b/ruby/environment_TEST.rb
@@ -68,7 +68,7 @@ module Paludis
end
assert_raise ArgumentError do
- e = NoConfigEnvironment.new(1,2,3,4)
+ e = NoConfigEnvironment.new(1,2,3,4,5)
end
end
end
@@ -322,7 +322,8 @@ module Paludis
def env_master
NoConfigEnvironment.new(Dir.getwd().to_s + "/environment_TEST_dir/testrepo",
"/var/empty",
- Dir.getwd().to_s + "/environment_TEST_dir/slaverepo")
+ "slaverepo",
+ [Dir.getwd().to_s + "/environment_TEST_dir/slaverepo"])
end
def test_master_repository
diff --git a/src/clients/accerso/accerso.cc b/src/clients/accerso/accerso.cc
index 4d142a8..a01858c 100644
--- a/src/clients/accerso/accerso.cc
+++ b/src/clients/accerso/accerso.cc
@@ -84,9 +84,6 @@ main(int argc, char *argv[])
if (! CommandLine::get_instance()->a_repository_directory.specified())
CommandLine::get_instance()->a_repository_directory.set_argument(stringify(FSEntry::cwd()));
- if (! CommandLine::get_instance()->a_master_repository_dir.specified())
- CommandLine::get_instance()->a_master_repository_dir.set_argument("/var/empty");
-
if (CommandLine::get_instance()->a_version.specified())
{
cout << "accerso, part of " << PALUDIS_PACKAGE << " " << PALUDIS_VERSION_MAJOR << "."
@@ -102,6 +99,12 @@ main(int argc, char *argv[])
}
else
{
+ std::tr1::shared_ptr<FSEntrySequence> extra_repository_dirs(new FSEntrySequence);
+ 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(*d);
+
std::tr1::shared_ptr<Map<std::string, std::string> > keys(new Map<std::string, std::string>);
keys->insert("distdir", CommandLine::get_instance()->a_download_directory.argument());
NoConfigEnvironment env(no_config_environment::Params::create()
@@ -112,7 +115,8 @@ main(int argc, char *argv[])
.disable_metadata_cache(false)
.extra_params(keys)
.extra_accept_keywords("")
- .master_repository_dir(FSEntry(CommandLine::get_instance()->a_master_repository_dir.argument())));
+ .extra_repository_dirs(extra_repository_dirs)
+ .master_repository_name(CommandLine::get_instance()->a_master_repository_name.argument()));
std::tr1::shared_ptr<const PackageIDSequence> ids(env[selection::AllVersionsSorted(
generator::InRepository(env.main_repository()->name()))]);
diff --git a/src/clients/accerso/command_line.cc b/src/clients/accerso/command_line.cc
index 2272ee7..ccd1826 100644
--- a/src/clients/accerso/command_line.cc
+++ b/src/clients/accerso/command_line.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
@@ -43,8 +43,11 @@ CommandLine::CommandLine() :
"Where to find the repository (default: current directory)"),
a_download_directory(&general_args, "download-dir", 'd',
"Where to place downloaded files"),
- a_master_repository_dir(&general_args, "master-repository-dir", '\0',
- "Use the specified location for the master repository"),
+ 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_write_cache_dir(&general_args, "write-cache-dir", '\0',
"Use a subdirectory named for the repository name under the specified directory for repository write cache"),
a_report_file(&general_args, "report-file", 'r',
diff --git a/src/clients/accerso/command_line.hh b/src/clients/accerso/command_line.hh
index 00af934..14052a2 100644
--- a/src/clients/accerso/command_line.hh
+++ b/src/clients/accerso/command_line.hh
@@ -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
@@ -55,7 +55,8 @@ class CommandLine :
paludis::args::AliasArg a_no_color;
paludis::args::StringArg a_repository_directory;
paludis::args::StringArg a_download_directory;
- paludis::args::StringArg a_master_repository_dir;
+ paludis::args::StringArg a_master_repository_name;
+ paludis::args::StringSequenceArg a_extra_repository_dir;
paludis::args::StringArg a_write_cache_dir;
paludis::args::StringArg a_report_file;
};
diff --git a/src/clients/adjutrix/adjutrix.cc b/src/clients/adjutrix/adjutrix.cc
index ae8369f..a00a945 100644
--- a/src/clients/adjutrix/adjutrix.cc
+++ b/src/clients/adjutrix/adjutrix.cc
@@ -33,6 +33,7 @@
#include <paludis/util/join.hh>
#include <paludis/util/log.hh>
#include <paludis/util/fs_entry.hh>
+#include <paludis/util/sequence.hh>
#include <paludis/environments/no_config/no_config_environment.hh>
#include <iostream>
#include <cstdlib>
@@ -126,8 +127,12 @@ main(int argc, char *argv[])
if (! CommandLine::get_instance()->a_write_cache_dir.specified())
CommandLine::get_instance()->a_write_cache_dir.set_argument("/var/empty");
- if (! CommandLine::get_instance()->a_master_repository_dir.specified())
- CommandLine::get_instance()->a_master_repository_dir.set_argument("/var/empty");
+
+ std::tr1::shared_ptr<FSEntrySequence> extra_repository_dirs(new FSEntrySequence);
+ 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(*d);
NoConfigEnvironment env(no_config_environment::Params::create()
.repository_dir(get_location_and_add_filters())
@@ -137,8 +142,9 @@ main(int argc, char *argv[])
(CommandLine::get_instance()->a_reverse_deps.specified()) ? no_config_environment::ncer_auto :
no_config_environment::ncer_ebuild)
.disable_metadata_cache(false)
- .master_repository_dir(CommandLine::get_instance()->a_master_repository_dir.argument())
+ .master_repository_name(CommandLine::get_instance()->a_master_repository_name.argument())
.extra_accept_keywords("")
+ .extra_repository_dirs(extra_repository_dirs)
.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/adjutrix/command_line.cc b/src/clients/adjutrix/command_line.cc
index c4131ef..04bec11 100644
--- a/src/clients/adjutrix/command_line.cc
+++ b/src/clients/adjutrix/command_line.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2006, 2007 Ciaran McCreesh
+ * Copyright (c) 2006, 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
@@ -102,8 +102,11 @@ CommandLine::CommandLine() :
"Options that control general configuration."),
a_write_cache_dir(&configuration_options, "write-cache-dir", '\0',
"Use a subdirectory named for the repository name under the specified directory for repository write cache"),
- a_master_repository_dir(&configuration_options, "master-repository-dir", '\0',
- "Use the specified location for the master repository")
+ 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.")
{
add_usage_line("--find-stable-candidates arch [ --repository-dir /path ] "
"[ --category app-misc --category sys-apps ... ] "
diff --git a/src/clients/adjutrix/command_line.hh b/src/clients/adjutrix/command_line.hh
index 83a0339..6de86fb 100644
--- a/src/clients/adjutrix/command_line.hh
+++ b/src/clients/adjutrix/command_line.hh
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2006, 2007 Ciaran McCreesh
+ * Copyright (c) 2006, 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
@@ -121,7 +121,8 @@ class CommandLine :
paludis::args::ArgsGroup configuration_options;
paludis::args::StringArg a_write_cache_dir;
- paludis::args::StringArg a_master_repository_dir;
+ paludis::args::StringArg a_master_repository_name;
+ paludis::args::StringSequenceArg a_extra_repository_dir;
///\}
};
diff --git a/src/clients/instruo/command_line.cc b/src/clients/instruo/command_line.cc
index 2771b40..b6d0cb4 100644
--- a/src/clients/instruo/command_line.cc
+++ b/src/clients/instruo/command_line.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
@@ -43,8 +43,11 @@ CommandLine::CommandLine() :
"Where to find the repository (default: current directory)"),
a_output_directory(&general_args, "output-dir", 'o',
"Where to place generated metadata (default: current directory)"),
- a_master_repository_dir(&general_args, "master-repository-dir", '\0',
- "Use the specified location for the master repository"),
+ 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_report_file(&general_args, "report-file", 'r',
"Write report to the specified file, rather than stdout")
{
diff --git a/src/clients/instruo/command_line.hh b/src/clients/instruo/command_line.hh
index b11b843..3cf46e1 100644
--- a/src/clients/instruo/command_line.hh
+++ b/src/clients/instruo/command_line.hh
@@ -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
@@ -55,7 +55,8 @@ class CommandLine :
paludis::args::AliasArg a_no_color;
paludis::args::StringArg a_repository_directory;
paludis::args::StringArg a_output_directory;
- paludis::args::StringArg a_master_repository_dir;
+ paludis::args::StringArg a_master_repository_name;
+ paludis::args::StringSequenceArg a_extra_repository_dir;
paludis::args::StringArg a_report_file;
};
diff --git a/src/clients/instruo/instruo.cc b/src/clients/instruo/instruo.cc
index 19cd3c9..759fbd6 100644
--- a/src/clients/instruo/instruo.cc
+++ b/src/clients/instruo/instruo.cc
@@ -222,12 +222,15 @@ main(int argc, char *argv[])
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_master_repository_dir.specified())
- CommandLine::get_instance()->a_master_repository_dir.set_argument("/var/empty");
-
if (! CommandLine::get_instance()->a_output_directory.specified())
CommandLine::get_instance()->a_output_directory.set_argument(stringify(FSEntry::cwd()));
+ std::tr1::shared_ptr<FSEntrySequence> extra_repository_dirs(new FSEntrySequence);
+ 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(*d);
+
std::tr1::shared_ptr<Map<std::string, std::string> > keys(new Map<std::string, std::string>);
keys->insert("append_repository_name_to_write_cache", "false");
NoConfigEnvironment env(no_config_environment::Params::create()
@@ -238,7 +241,8 @@ main(int argc, char *argv[])
.disable_metadata_cache(true)
.extra_params(keys)
.extra_accept_keywords("")
- .master_repository_dir(FSEntry(CommandLine::get_instance()->a_master_repository_dir.argument())));
+ .extra_repository_dirs(extra_repository_dirs)
+ .master_repository_name(CommandLine::get_instance()->a_master_repository_name.argument()));
std::tr1::shared_ptr<const PackageIDSequence> ids(env[selection::AllVersionsSorted(
generator::InRepository(env.main_repository()->name()))]);
diff --git a/src/clients/qualudis/qualudis.cc b/src/clients/qualudis/qualudis.cc
index bdf4722..b5fe133 100644
--- a/src/clients/qualudis/qualudis.cc
+++ b/src/clients/qualudis/qualudis.cc
@@ -335,15 +335,19 @@ int main(int argc, char *argv[])
if (! QualudisCommandLine::get_instance()->a_write_cache_dir.specified())
QualudisCommandLine::get_instance()->a_write_cache_dir.set_argument("/var/empty");
- if (! QualudisCommandLine::get_instance()->a_master_repository_dir.specified())
- QualudisCommandLine::get_instance()->a_master_repository_dir.set_argument("/var/empty");
+ std::tr1::shared_ptr<FSEntrySequence> extra_repository_dirs(new FSEntrySequence);
+ for (args::StringSequenceArg::ConstIterator d(QualudisCommandLine::get_instance()->a_extra_repository_dir.begin_args()),
+ d_end(QualudisCommandLine::get_instance()->a_extra_repository_dir.end_args()) ;
+ d != d_end ; ++d)
+ extra_repository_dirs->push_back(*d);
std::tr1::shared_ptr<NoConfigEnvironment> env(new NoConfigEnvironment(no_config_environment::Params::create()
.repository_dir(get_location())
.write_cache(QualudisCommandLine::get_instance()->a_write_cache_dir.argument())
.accept_unstable(false)
.repository_type(no_config_environment::ncer_ebuild)
- .master_repository_dir(QualudisCommandLine::get_instance()->a_master_repository_dir.argument())
+ .extra_repository_dirs(extra_repository_dirs)
+ .master_repository_name(QualudisCommandLine::get_instance()->a_master_repository_name.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("")
diff --git a/src/clients/qualudis/qualudis_command_line.cc b/src/clients/qualudis/qualudis_command_line.cc
index a9b4332..f59b5eb 100644
--- a/src/clients/qualudis/qualudis_command_line.cc
+++ b/src/clients/qualudis/qualudis_command_line.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2006, 2007 Ciaran McCreesh
+ * Copyright (c) 2006, 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
@@ -61,8 +61,11 @@ QualudisCommandLine::QualudisCommandLine() :
"Options that control general configuration."),
a_write_cache_dir(&configuration_options, "write-cache-dir", '\0',
"Use a subdirectory named for the repository name under the specified directory for repository write cache"),
- a_master_repository_dir(&configuration_options, "master-repository-dir", '\0',
- "Use the specified location for the master repository"),
+ a_master_repository_name(&configuration_options, "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(&configuration_options, "extra-repository-dir", '\0',
+ "Also include the repository at this location. May be specified multiple times, in creation order."),
a_use_repository_cache(&configuration_options, "use-repository-cache", '\0',
"Use the repository's metadata cache, if available (faster, but may miss certain errors)", true)
{
diff --git a/src/clients/qualudis/qualudis_command_line.hh b/src/clients/qualudis/qualudis_command_line.hh
index e8ca68e..5b02ce5 100644
--- a/src/clients/qualudis/qualudis_command_line.hh
+++ b/src/clients/qualudis/qualudis_command_line.hh
@@ -73,7 +73,8 @@ class QualudisCommandLine :
paludis::args::ArgsGroup configuration_options;
paludis::args::StringArg a_write_cache_dir;
- paludis::args::StringArg a_master_repository_dir;
+ paludis::args::StringArg a_master_repository_name;
+ paludis::args::StringSequenceArg a_extra_repository_dir;
paludis::args::SwitchArg a_use_repository_cache;
///\}