aboutsummaryrefslogtreecommitdiff
path: root/paludis
diff options
context:
space:
mode:
Diffstat (limited to 'paludis')
-rw-r--r--paludis/args/legacy/dep_list_args_group.cc6
-rw-r--r--paludis/legacy/override_functions.cc25
-rw-r--r--paludis/legacy/override_functions.hh4
-rw-r--r--paludis/mask.hh24
-rw-r--r--paludis/repositories/e/e_mask.cc28
-rw-r--r--paludis/repositories/e/e_mask.hh8
-rw-r--r--paludis/repositories/e/ebuild_id.cc14
-rw-r--r--paludis/repositories/fake/fake_package_id.cc18
-rw-r--r--paludis/repositories/fake/fake_package_id.hh4
-rw-r--r--paludis/repositories/virtuals/package_id.cc12
10 files changed, 82 insertions, 61 deletions
diff --git a/paludis/args/legacy/dep_list_args_group.cc b/paludis/args/legacy/dep_list_args_group.cc
index 45920d146..29fd0af93 100644
--- a/paludis/args/legacy/dep_list_args_group.cc
+++ b/paludis/args/legacy/dep_list_args_group.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2005, 2006, 2007, 2008, 2009, 2010 Ciaran McCreesh
+ * Copyright (c) 2005, 2006, 2007, 2008, 2009, 2010, 2011 Ciaran McCreesh
* Copyright (c) 2007 David Leverton
*
* This file is part of the Paludis package manager. Paludis is free software;
@@ -233,7 +233,7 @@ DepListArgsGroup::populate_dep_list_options(const Environment * env, DepListOpti
if (! options.override_masks())
options.override_masks() = std::make_shared<DepListOverrideMasksFunctions>();
options.override_masks()->push_back(std::bind(&override_tilde_keywords, env, _1, _2));
- options.override_masks()->push_back(std::bind(&override_license, _2));
+ options.override_masks()->push_back(std::bind(&override_license, _1, _2));
if (dl_override_masks.specified())
{
@@ -252,7 +252,7 @@ DepListArgsGroup::populate_dep_list_options(const Environment * env, DepListOpti
else if (*a == "repository")
options.override_masks()->push_back(std::bind(&override_repository_masks, _2));
else if (*a == "license")
- options.override_masks()->push_back(std::bind(&override_license, _2));
+ options.override_masks()->push_back(std::bind(&override_license, _1, _2));
else if (*a == "none")
{
}
diff --git a/paludis/legacy/override_functions.cc b/paludis/legacy/override_functions.cc
index 06461f90c..ace84d87c 100644
--- a/paludis/legacy/override_functions.cc
+++ b/paludis/legacy/override_functions.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2007, 2008, 2010 Ciaran McCreesh
+ * Copyright (c) 2007, 2008, 2010, 2011 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
@@ -40,7 +40,11 @@ paludis::override_tilde_keywords(const Environment * const e, const std::shared_
if (! mm)
return false;
- const MetadataCollectionKey<KeywordNameSet> * const k(simple_visitor_cast<const MetadataCollectionKey<KeywordNameSet> >(*mm->unaccepted_key()));
+ auto ki(id->find_metadata(mm->unaccepted_key_name()));
+ if (ki == id->end_metadata())
+ return false;
+
+ auto k(simple_visitor_cast<const MetadataCollectionKey<KeywordNameSet> >(**ki));
if (! k)
return false;
@@ -65,7 +69,11 @@ paludis::override_unkeyworded(const Environment * const e, const std::shared_ptr
if (! mm)
return false;
- const MetadataCollectionKey<KeywordNameSet> * const k(simple_visitor_cast<const MetadataCollectionKey<KeywordNameSet> >(*mm->unaccepted_key()));
+ auto ki(id->find_metadata(mm->unaccepted_key_name()));
+ if (ki == id->end_metadata())
+ return false;
+
+ auto k(simple_visitor_cast<const MetadataCollectionKey<KeywordNameSet> >(**ki));
if (! k)
return false;
@@ -86,11 +94,18 @@ paludis::override_repository_masks(const Mask & m)
}
bool
-paludis::override_license(const Mask & m)
+paludis::override_license(const std::shared_ptr<const PackageID> & id, const Mask & m)
{
Context c("When working out whether mask is a license mask for override:");
const UnacceptedMask * const mm(simple_visitor_cast<const UnacceptedMask>(m));
- return mm && simple_visitor_cast<const MetadataSpecTreeKey<LicenseSpecTree> >(*mm->unaccepted_key());
+ if (! mm)
+ return false;
+
+ auto m_i(id->find_metadata(mm->unaccepted_key_name()));
+ if (m_i == id->end_metadata())
+ return false;
+
+ return simple_visitor_cast<const MetadataSpecTreeKey<LicenseSpecTree> >(**m_i);
}
diff --git a/paludis/legacy/override_functions.hh b/paludis/legacy/override_functions.hh
index 1f9764f18..bd55a6736 100644
--- a/paludis/legacy/override_functions.hh
+++ b/paludis/legacy/override_functions.hh
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2007, 2010 Ciaran McCreesh
+ * Copyright (c) 2007, 2010, 2011 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
@@ -70,7 +70,7 @@ namespace paludis
* \ingroup g_dep_list
* \since 0.26
*/
- bool override_license(const Mask & m)
+ bool override_license(const std::shared_ptr<const PackageID> &, const Mask & m)
PALUDIS_ATTRIBUTE((warn_unused_result)) PALUDIS_VISIBLE;
}
diff --git a/paludis/mask.hh b/paludis/mask.hh
index 87bc8fa5b..2587060cb 100644
--- a/paludis/mask.hh
+++ b/paludis/mask.hh
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2007, 2008, 2009, 2010 Ciaran McCreesh
+ * Copyright (c) 2007, 2008, 2009, 2010, 2011 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
@@ -21,8 +21,8 @@
#define PALUDIS_GUARD_PALUDIS_MASK_HH 1
#include <paludis/mask-fwd.hh>
-#include <paludis/metadata_key-fwd.hh>
#include <paludis/package_id-fwd.hh>
+#include <paludis/dep_spec-fwd.hh>
#include <paludis/util/simple_visitor.hh>
#include <paludis/util/attributes.hh>
#include <paludis/util/fs_path.hh>
@@ -137,9 +137,11 @@ namespace paludis
{
public:
/**
- * Fetch the metadata key that is not accepted.
+ * Fetch the raw name of the metadata key that is not accepted.
+ *
+ * \since 0.59
*/
- virtual const std::shared_ptr<const MetadataKey> unaccepted_key() const = 0;
+ virtual const std::string unaccepted_key_name() const = 0;
};
/**
@@ -156,10 +158,12 @@ namespace paludis
{
public:
/**
- * Fetch a metadata key explaining the mask. May return a zero
- * pointer, if no more information is available.
+ * Fetch the raw name of a metadata key explaining the mask. May
+ * return a zero pointer, if no more information is available.
+ *
+ * \since 0.59
*/
- virtual const std::shared_ptr<const MetadataKey> mask_key() const = 0;
+ virtual const std::string mask_key_name() const = 0;
};
/**
@@ -199,9 +203,11 @@ namespace paludis
{
public:
/**
- * Fetch the associated package.
+ * Fetch a spec identifying the associated package.
+ *
+ * \since 0.59
*/
- virtual const std::shared_ptr<const PackageID> associated_package() const = 0;
+ virtual const PackageDepSpec associated_package_spec() const = 0;
};
/**
diff --git a/paludis/repositories/e/e_mask.cc b/paludis/repositories/e/e_mask.cc
index a2f987811..e2aba5b5d 100644
--- a/paludis/repositories/e/e_mask.cc
+++ b/paludis/repositories/e/e_mask.cc
@@ -30,18 +30,18 @@ namespace paludis
{
const char key;
const std::string description;
- const std::shared_ptr<const MetadataKey> unaccepted_key;
+ const std::string unaccepted_key_name;
- Imp(const char k, const std::string & d, const std::shared_ptr<const MetadataKey> & u) :
+ Imp(const char k, const std::string & d, const std::string & u) :
key(k),
description(d),
- unaccepted_key(u)
+ unaccepted_key_name(u)
{
}
};
}
-EUnacceptedMask::EUnacceptedMask(const char k, const std::string & d, const std::shared_ptr<const MetadataKey> & u) :
+EUnacceptedMask::EUnacceptedMask(const char k, const std::string & d, const std::string & u) :
_imp(k, d, u)
{
}
@@ -62,10 +62,10 @@ EUnacceptedMask::description() const
return _imp->description;
}
-const std::shared_ptr<const MetadataKey>
-EUnacceptedMask::unaccepted_key() const
+const std::string
+EUnacceptedMask::unaccepted_key_name() const
{
- return _imp->unaccepted_key;
+ return _imp->unaccepted_key_name;
}
namespace paludis
@@ -122,18 +122,18 @@ namespace paludis
{
const char key;
const std::string description;
- const std::shared_ptr<const MetadataKey> mask_key;
+ const std::string mask_key_name;
- Imp(const char k, const std::string & d, const std::shared_ptr<const MetadataKey> & m) :
+ Imp(const char k, const std::string & d, const std::string & m) :
key(k),
description(d),
- mask_key(m)
+ mask_key_name(m)
{
}
};
}
-ERepositoryMask::ERepositoryMask(const char k, const std::string & d, const std::shared_ptr<const MetadataKey> & m) :
+ERepositoryMask::ERepositoryMask(const char k, const std::string & d, const std::string & m) :
_imp(k, d, m)
{
}
@@ -154,9 +154,9 @@ ERepositoryMask::description() const
return _imp->description;
}
-const std::shared_ptr<const MetadataKey>
-ERepositoryMask::mask_key() const
+const std::string
+ERepositoryMask::mask_key_name() const
{
- return _imp->mask_key;
+ return _imp->mask_key_name;
}
diff --git a/paludis/repositories/e/e_mask.hh b/paludis/repositories/e/e_mask.hh
index 494755c6b..7ca68f89f 100644
--- a/paludis/repositories/e/e_mask.hh
+++ b/paludis/repositories/e/e_mask.hh
@@ -34,12 +34,12 @@ namespace paludis
Pimp<EUnacceptedMask> _imp;
public:
- EUnacceptedMask(const char, const std::string &, const std::shared_ptr<const MetadataKey> &);
+ EUnacceptedMask(const char, const std::string &, const std::string &);
~EUnacceptedMask();
char key() const;
const std::string description() const;
- const std::shared_ptr<const MetadataKey> unaccepted_key() const;
+ const std::string unaccepted_key_name() const;
};
class EUnsupportedMask :
@@ -64,12 +64,12 @@ namespace paludis
Pimp<ERepositoryMask> _imp;
public:
- ERepositoryMask(const char, const std::string &, const std::shared_ptr<const MetadataKey> &);
+ ERepositoryMask(const char, const std::string &, const std::string &);
~ERepositoryMask();
virtual char key() const;
const std::string description() const;
- const std::shared_ptr<const MetadataKey> mask_key() const;
+ const std::string mask_key_name() const;
};
}
}
diff --git a/paludis/repositories/e/ebuild_id.cc b/paludis/repositories/e/ebuild_id.cc
index b01ceb5a5..04c293012 100644
--- a/paludis/repositories/e/ebuild_id.cc
+++ b/paludis/repositories/e/ebuild_id.cc
@@ -532,7 +532,7 @@ EbuildID::need_masks_added() const
{
add_mask(std::make_shared<EUnacceptedMask>('K',
DistributionData::get_instance()->distribution_from_string(
- _imp->environment->distribution())->concept_keyword(), keywords_key()));
+ _imp->environment->distribution())->concept_keyword(), keywords_key()->raw_name()));
}
else if (keywords_key()->value()->end() == std::find_if(keywords_key()->value()->begin(),
keywords_key()->value()->end(), &is_stable_keyword))
@@ -541,7 +541,7 @@ EbuildID::need_masks_added() const
make_named_values<OverriddenMask>(
n::mask() = std::make_shared<EUnacceptedMask>('~',
DistributionData::get_instance()->distribution_from_string(
- _imp->environment->distribution())->concept_keyword() + " (unstable accepted)", keywords_key()),
+ _imp->environment->distribution())->concept_keyword() + " (unstable accepted)", keywords_key()->raw_name()),
n::override_reason() = mro_accepted_unstable
)));
}
@@ -554,18 +554,18 @@ EbuildID::need_masks_added() const
if (! c.ok)
add_mask(std::make_shared<EUnacceptedMask>('L',
DistributionData::get_instance()->distribution_from_string(
- _imp->environment->distribution())->concept_license(), license_key()));
+ _imp->environment->distribution())->concept_license(), license_key()->raw_name()));
}
if (! _imp->environment->unmasked_by_user(shared_from_this()))
{
/* repo unless user */
if (_imp->repository_mask->value())
- add_mask(std::make_shared<ERepositoryMask>('R', "repository", _imp->repository_mask));
+ add_mask(std::make_shared<ERepositoryMask>('R', "repository", _imp->repository_mask->raw_name()));
/* profile unless user */
if (_imp->profile_mask->value())
- add_mask(std::make_shared<ERepositoryMask>('P', "profile", _imp->profile_mask));
+ add_mask(std::make_shared<ERepositoryMask>('P', "profile", _imp->profile_mask->raw_name()));
/* user */
std::shared_ptr<const Mask> user_mask(_imp->environment->mask_for_user(shared_from_this(), false));
@@ -578,7 +578,7 @@ EbuildID::need_masks_added() const
if (_imp->repository_mask->value())
add_overridden_mask(std::make_shared<OverriddenMask>(
make_named_values<OverriddenMask>(
- n::mask() = std::make_shared<ERepositoryMask>('r', "repository (overridden)", _imp->repository_mask),
+ n::mask() = std::make_shared<ERepositoryMask>('r', "repository (overridden)", _imp->repository_mask->raw_name()),
n::override_reason() = mro_overridden_by_user
)));
@@ -586,7 +586,7 @@ EbuildID::need_masks_added() const
if (_imp->profile_mask->value())
add_overridden_mask(std::make_shared<OverriddenMask>(
make_named_values<OverriddenMask>(
- n::mask() = std::make_shared<ERepositoryMask>('p', "profile (overridden)", _imp->profile_mask),
+ n::mask() = std::make_shared<ERepositoryMask>('p', "profile (overridden)", _imp->profile_mask->raw_name()),
n::override_reason() = mro_overridden_by_user
)));
diff --git a/paludis/repositories/fake/fake_package_id.cc b/paludis/repositories/fake/fake_package_id.cc
index 48d0197d8..ea827b956 100644
--- a/paludis/repositories/fake/fake_package_id.cc
+++ b/paludis/repositories/fake/fake_package_id.cc
@@ -529,18 +529,18 @@ namespace paludis
{
const char key;
const std::string description;
- const std::shared_ptr<const MetadataKey> unaccepted_key;
+ const std::string unaccepted_key_name;
- Imp(const char k, const std::string & d, const std::shared_ptr<const MetadataKey> & u) :
+ Imp(const char k, const std::string & d, const std::string & u) :
key(k),
description(d),
- unaccepted_key(u)
+ unaccepted_key_name(u)
{
}
};
}
-FakeUnacceptedMask::FakeUnacceptedMask(const char c, const std::string & s, const std::shared_ptr<const MetadataKey> & k) :
+FakeUnacceptedMask::FakeUnacceptedMask(const char c, const std::string & s, const std::string & k) :
_imp(c, s, k)
{
}
@@ -561,10 +561,10 @@ FakeUnacceptedMask::description() const
return _imp->description;
}
-const std::shared_ptr<const MetadataKey>
-FakeUnacceptedMask::unaccepted_key() const
+const std::string
+FakeUnacceptedMask::unaccepted_key_name() const
{
- return _imp->unaccepted_key;
+ return _imp->unaccepted_key_name;
}
FakeUnsupportedMask::FakeUnsupportedMask()
@@ -1053,14 +1053,14 @@ FakePackageID::need_masks_added() const
if (keywords_key())
if (! _imp->env->accept_keywords(keywords_key()->value(), shared_from_this()))
- add_mask(std::make_shared<FakeUnacceptedMask>('K', "keywords", keywords_key()));
+ add_mask(std::make_shared<FakeUnacceptedMask>('K', "keywords", keywords_key()->raw_name()));
if (license_key())
{
LicenceChecker c(_imp->env, &Environment::accept_license, shared_from_this());
license_key()->value()->top()->accept(c);
if (! c.ok)
- add_mask(std::make_shared<FakeUnacceptedMask>('L', "license", license_key()));
+ add_mask(std::make_shared<FakeUnacceptedMask>('L', "license", license_key()->raw_name()));
}
if (! _imp->env->unmasked_by_user(shared_from_this()))
diff --git a/paludis/repositories/fake/fake_package_id.hh b/paludis/repositories/fake/fake_package_id.hh
index 80647d97c..02ef7a046 100644
--- a/paludis/repositories/fake/fake_package_id.hh
+++ b/paludis/repositories/fake/fake_package_id.hh
@@ -182,12 +182,12 @@ namespace paludis
Pimp<FakeUnacceptedMask> _imp;
public:
- FakeUnacceptedMask(const char, const std::string &, const std::shared_ptr<const MetadataKey> &);
+ FakeUnacceptedMask(const char, const std::string &, const std::string &);
~FakeUnacceptedMask();
char key() const;
const std::string description() const;
- const std::shared_ptr<const MetadataKey> unaccepted_key() const;
+ const std::string unaccepted_key_name() const;
};
class PALUDIS_VISIBLE FakeUnsupportedMask :
diff --git a/paludis/repositories/virtuals/package_id.cc b/paludis/repositories/virtuals/package_id.cc
index c6b20de1d..d96ec3d34 100644
--- a/paludis/repositories/virtuals/package_id.cc
+++ b/paludis/repositories/virtuals/package_id.cc
@@ -462,11 +462,11 @@ namespace
public AssociationMask
{
private:
- const std::shared_ptr<const PackageID> _id;
+ const PackageDepSpec _spec;
public:
- VirtualsAssociationMask(const std::shared_ptr<const PackageID> & i) :
- _id(i)
+ VirtualsAssociationMask(const PackageDepSpec & s) :
+ _spec(s)
{
}
@@ -480,9 +480,9 @@ namespace
return "by association";
}
- const std::shared_ptr<const PackageID> associated_package() const
+ const PackageDepSpec associated_package_spec() const
{
- return _id;
+ return _spec;
}
};
}
@@ -496,7 +496,7 @@ VirtualsPackageID::need_masks_added() const
return;
if (_imp->virtual_for->value()->masked())
- add_mask(std::make_shared<VirtualsAssociationMask>(_imp->virtual_for->value()));
+ add_mask(std::make_shared<VirtualsAssociationMask>(_imp->virtual_for->value()->uniquely_identifying_spec()));
_imp->has_masks = true;
}