aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar David Leverton <levertond@googlemail.com> 2008-02-23 02:04:01 +0000
committerAvatar David Leverton <levertond@googlemail.com> 2008-02-23 02:04:01 +0000
commit2ebb819deae85af0ce88566986e7e8403d092113 (patch)
tree5672a4756eec94e922e4425dd0f9d90976fe0d51
parent4ee4ed76c1a0d9f34f5e649497a3732667371c83 (diff)
downloadpaludis-2ebb819deae85af0ce88566986e7e8403d092113.tar.gz
paludis-2ebb819deae85af0ce88566986e7e8403d092113.tar.xz
Allow set names in package_mask.conf and package_unmask.conf.
-rw-r--r--NEWS2
-rw-r--r--paludis/environments/paludis/package_mask_conf.cc44
2 files changed, 42 insertions, 4 deletions
diff --git a/NEWS b/NEWS
index 7bd245b..3fafad3 100644
--- a/NEWS
+++ b/NEWS
@@ -8,6 +8,8 @@ TRUNK:
* rsync based syncers (rsync://, file://, tar+http:// and tar+ftp://) now
support --exclude in sync_options, as well as --exclude-from.
+ * Set names are now supported in package_mask.conf and package_unmask.conf.
+
0.26.0_alpha9:
* Recent Portage unpacks lzma files, in violation of PMS and without any way
of ebuilds being able to check for this behaviour. We now emulate this
diff --git a/paludis/environments/paludis/package_mask_conf.cc b/paludis/environments/paludis/package_mask_conf.cc
index 90bb412..8a3533f 100644
--- a/paludis/environments/paludis/package_mask_conf.cc
+++ b/paludis/environments/paludis/package_mask_conf.cc
@@ -33,6 +33,7 @@
#include <paludis/util/tokeniser.hh>
#include <paludis/util/private_implementation_pattern-impl.hh>
#include <paludis/util/indirect_iterator-impl.hh>
+#include <paludis/util/mutex.hh>
#include <list>
#include <algorithm>
#include <paludis/util/tr1_functional.hh>
@@ -40,6 +41,8 @@
using namespace paludis;
using namespace paludis::paludis_environment;
+typedef std::list<std::pair<SetName, tr1::shared_ptr<const SetSpecTree::ConstItem> > > Sets;
+
namespace paludis
{
template<>
@@ -47,6 +50,8 @@ namespace paludis
{
const PaludisEnvironment * const env;
std::list<tr1::shared_ptr<const PackageDepSpec> > masks;
+ mutable Sets sets;
+ mutable Mutex set_mutex;
Implementation(const PaludisEnvironment * const e) :
env(e)
@@ -75,17 +80,48 @@ PackageMaskConf::add(const FSEntry & filename)
for (LineConfigFile::ConstIterator line(f->begin()), line_end(f->end()) ;
line != line_end ; ++line)
- _imp->masks.push_back(tr1::shared_ptr<PackageDepSpec>(new PackageDepSpec(parse_user_package_dep_spec(
- *line, UserPackageDepSpecOptions() + updso_allow_wildcards))));
+ {
+ if (std::string::npos == line->find("/"))
+ _imp->sets.push_back(std::make_pair(SetName(*line), tr1::shared_ptr<const SetSpecTree::ConstItem>()));
+ else
+ _imp->masks.push_back(tr1::shared_ptr<PackageDepSpec>(new PackageDepSpec(parse_user_package_dep_spec(
+ *line, UserPackageDepSpecOptions() + updso_allow_wildcards))));
+ }
}
bool
PackageMaskConf::query(const PackageID & e) const
{
using namespace tr1::placeholders;
- return indirect_iterator(_imp->masks.end()) != std::find_if(
+ if (indirect_iterator(_imp->masks.end()) != std::find_if(
indirect_iterator(_imp->masks.begin()),
indirect_iterator(_imp->masks.end()),
- tr1::bind(&match_package, tr1::ref(*_imp->env), _1, tr1::cref(e)));
+ tr1::bind(&match_package, tr1::ref(*_imp->env), _1, tr1::cref(e))))
+ return true;
+
+ {
+ Lock lock(_imp->set_mutex);
+
+ for (Sets::iterator it(_imp->sets.begin()),
+ it_end(_imp->sets.end()); it_end != it; ++it)
+ {
+ if (! it->second)
+ {
+ it->second = _imp->env->set(it->first);
+ if (! it->second)
+ {
+ Log::get_instance()->message(ll_warning, lc_no_context) << "Set name '"
+ << it->first << "' does not exist";
+ it->second.reset(new ConstTreeSequence<SetSpecTree, AllDepSpec>(
+ tr1::shared_ptr<AllDepSpec>(new AllDepSpec)));
+ }
+ }
+
+ if (match_package_in_set(*_imp->env, *it->second, e))
+ return true;
+ }
+ }
+
+ return false;
}