aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2011-03-19 12:46:08 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2011-03-19 12:46:08 +0000
commit2fbd0b1d5be90017142303cbdef842d807184812 (patch)
tree7a18242e721423e514d7ee19096ce2c24ca2bc42
parent8b17c798dc5a2a8e253ac8827450117a532a47eb (diff)
downloadpaludis-2fbd0b1d5be90017142303cbdef842d807184812.tar.gz
paludis-2fbd0b1d5be90017142303cbdef842d807184812.tar.xz
Allow IDs to have multiple masks
-rw-r--r--paludis/repositories/e/e_repository.cc4
-rw-r--r--paludis/repositories/e/e_repository.hh2
-rw-r--r--paludis/repositories/e/ebuild_id.cc34
-rw-r--r--paludis/repositories/e/exheres_profile.cc14
-rw-r--r--paludis/repositories/e/exheres_profile.hh2
-rw-r--r--paludis/repositories/e/mask_info.cc5
-rw-r--r--paludis/repositories/e/mask_info.hh7
-rw-r--r--paludis/repositories/e/profile.hh2
-rw-r--r--paludis/repositories/e/repository_mask_store.cc11
-rw-r--r--paludis/repositories/e/repository_mask_store.hh2
-rw-r--r--paludis/repositories/e/traditional_profile.cc13
-rw-r--r--paludis/repositories/e/traditional_profile.hh2
12 files changed, 55 insertions, 43 deletions
diff --git a/paludis/repositories/e/e_repository.cc b/paludis/repositories/e/e_repository.cc
index b10ef51..1b107b1 100644
--- a/paludis/repositories/e/e_repository.cc
+++ b/paludis/repositories/e/e_repository.cc
@@ -636,8 +636,8 @@ ERepository::package_ids(const QualifiedPackageName & n, const RepositoryContent
return _imp->layout->package_ids(n);
}
-std::shared_ptr<const MaskInfo>
-ERepository::repository_masked(const std::shared_ptr<const PackageID> & id) const
+std::shared_ptr<const MasksInfo>
+ERepository::repository_masks(const std::shared_ptr<const PackageID> & id) const
{
return _imp->repository_mask_store->query(id);
}
diff --git a/paludis/repositories/e/e_repository.hh b/paludis/repositories/e/e_repository.hh
index ff07862..22e4561 100644
--- a/paludis/repositories/e/e_repository.hh
+++ b/paludis/repositories/e/e_repository.hh
@@ -159,7 +159,7 @@ namespace paludis
const std::shared_ptr<const erepository::Layout> layout() const;
const std::shared_ptr<const erepository::Profile> profile() const;
- std::shared_ptr<const erepository::MaskInfo> repository_masked(const std::shared_ptr<const PackageID> &) const;
+ std::shared_ptr<const erepository::MasksInfo> repository_masks(const std::shared_ptr<const PackageID> &) const;
void regenerate_cache() const;
diff --git a/paludis/repositories/e/ebuild_id.cc b/paludis/repositories/e/ebuild_id.cc
index d2d884e..cd276e2 100644
--- a/paludis/repositories/e/ebuild_id.cc
+++ b/paludis/repositories/e/ebuild_id.cc
@@ -560,19 +560,19 @@ EbuildID::need_masks_added() const
_imp->environment->distribution())->concept_license(), license_key()->raw_name()));
}
- auto repo_mask(e_repo->repository_masked(shared_from_this()));
- auto profile_mask(e_repo->profile()->profile_masked(shared_from_this()));
+ auto repo_masks(e_repo->repository_masks(shared_from_this()));
+ auto profile_masks(e_repo->profile()->profile_masks(shared_from_this()));
if (! _imp->environment->unmasked_by_user(shared_from_this(), ""))
{
/* repo unless user */
- if (repo_mask)
- add_mask(std::make_shared<ERepositoryMask>('R', "repository",
- repo_mask->comment(), "", repo_mask->mask_file()));
+ for (auto r(repo_masks->begin()), r_end(repo_masks->end()) ;
+ r != r_end ; ++r)
+ add_mask(std::make_shared<ERepositoryMask>('R', "repository", r->comment(), "", r->mask_file()));
/* profile unless user */
- if (profile_mask)
- add_mask(std::make_shared<ERepositoryMask>('P', "profile",
- profile_mask->comment(), "", profile_mask->mask_file()));
+ for (auto r(profile_masks->begin()), r_end(profile_masks->end()) ;
+ r != r_end ; ++r)
+ add_mask(std::make_shared<ERepositoryMask>('P', "profile", r->comment(), "", r->mask_file()));
/* user */
std::shared_ptr<const Mask> user_mask(_imp->environment->mask_for_user(shared_from_this(), false));
@@ -582,20 +582,22 @@ EbuildID::need_masks_added() const
else
{
/* repo overridden by user */
- if (repo_mask)
+ for (auto r(repo_masks->begin()), r_end(repo_masks->end()) ;
+ r != r_end ; ++r)
add_overridden_mask(std::make_shared<OverriddenMask>(
- make_named_values<OverriddenMask>(
- n::mask() = std::make_shared<ERepositoryMask>('r', "repository (overridden)",
- repo_mask->comment(), "", repo_mask->mask_file()),
- n::override_reason() = mro_overridden_by_user
- )));
+ make_named_values<OverriddenMask>(
+ n::mask() = std::make_shared<ERepositoryMask>('r', "repository (overridden)",
+ r->comment(), "", r->mask_file()),
+ n::override_reason() = mro_overridden_by_user
+ )));
/* profile unless user */
- if (profile_mask)
+ for (auto r(profile_masks->begin()), r_end(profile_masks->end()) ;
+ r != r_end ; ++r)
add_overridden_mask(std::make_shared<OverriddenMask>(
make_named_values<OverriddenMask>(
n::mask() = std::make_shared<ERepositoryMask>('p', "profile (overridden)",
- profile_mask->comment(), "", profile_mask->mask_file()),
+ r->comment(), "", r->mask_file()),
n::override_reason() = mro_overridden_by_user
)));
diff --git a/paludis/repositories/e/exheres_profile.cc b/paludis/repositories/e/exheres_profile.cc
index 3d85c5d..dfcd24a 100644
--- a/paludis/repositories/e/exheres_profile.cc
+++ b/paludis/repositories/e/exheres_profile.cc
@@ -359,21 +359,21 @@ ExheresProfile::environment_variable(const std::string & s) const
return i->second;
}
-const std::shared_ptr<const MaskInfo>
-ExheresProfile::profile_masked(const std::shared_ptr<const PackageID> & id) const
+const std::shared_ptr<const MasksInfo>
+ExheresProfile::profile_masks(const std::shared_ptr<const PackageID> & id) const
{
+ auto result(std::make_shared<MasksInfo>());
+
PackageMaskMap::const_iterator rr(_imp->package_mask.find(id->name()));
- if (_imp->package_mask.end() == rr)
- return std::shared_ptr<const MaskInfo>();
- else
+ if (_imp->package_mask.end() != rr)
{
for (std::list<std::pair<std::shared_ptr<const PackageDepSpec>, std::shared_ptr<const MaskInfo> > >::const_iterator k(rr->second.begin()),
k_end(rr->second.end()) ; k != k_end ; ++k)
if (match_package(*_imp->env, *k->first, id, make_null_shared_ptr(), { }))
- return k->second;
+ result->push_back(*k->second);
}
- return std::shared_ptr<const MaskInfo>();
+ return result;
}
const std::shared_ptr<const SetSpecTree>
diff --git a/paludis/repositories/e/exheres_profile.hh b/paludis/repositories/e/exheres_profile.hh
index 0609840..c896315 100644
--- a/paludis/repositories/e/exheres_profile.hh
+++ b/paludis/repositories/e/exheres_profile.hh
@@ -95,7 +95,7 @@ namespace paludis
virtual const std::string environment_variable(const std::string &) const;
- virtual const std::shared_ptr<const MaskInfo> profile_masked(const std::shared_ptr<const PackageID> &) const;
+ virtual const std::shared_ptr<const MasksInfo> profile_masks(const std::shared_ptr<const PackageID> &) const;
virtual const std::shared_ptr<const SetSpecTree> system_packages() const;
diff --git a/paludis/repositories/e/mask_info.cc b/paludis/repositories/e/mask_info.cc
index 25f8eb2..39b03a1 100644
--- a/paludis/repositories/e/mask_info.cc
+++ b/paludis/repositories/e/mask_info.cc
@@ -18,7 +18,12 @@
*/
#include <paludis/repositories/e/mask_info.hh>
+#include <paludis/util/sequence-impl.hh>
+#include <paludis/util/wrapped_forward_iterator-impl.hh>
using namespace paludis;
using namespace paludis::erepository;
+template class Sequence<MaskInfo>;
+template class WrappedForwardIterator<Sequence<MaskInfo>::ConstIteratorTag, const MaskInfo>;
+
diff --git a/paludis/repositories/e/mask_info.hh b/paludis/repositories/e/mask_info.hh
index 08cc8e5..b7df9f9 100644
--- a/paludis/repositories/e/mask_info.hh
+++ b/paludis/repositories/e/mask_info.hh
@@ -22,6 +22,8 @@
#include <paludis/util/named_value.hh>
#include <paludis/util/fs_path.hh>
+#include <paludis/util/sequence.hh>
+#include <paludis/util/wrapped_forward_iterator.hh>
namespace paludis
{
@@ -40,7 +42,12 @@ namespace paludis
NamedValue<n::mask_file, FSPath> mask_file;
NamedValue<n::token, std::string> token;
};
+
+ typedef Sequence<MaskInfo> MasksInfo;
}
+
+ extern template class Sequence<erepository::MaskInfo>;
+ extern template class WrappedForwardIterator<Sequence<erepository::MaskInfo>::ConstIterator, const erepository::MaskInfo>;
}
#endif
diff --git a/paludis/repositories/e/profile.hh b/paludis/repositories/e/profile.hh
index 4c900a9..0fdbefb 100644
--- a/paludis/repositories/e/profile.hh
+++ b/paludis/repositories/e/profile.hh
@@ -95,7 +95,7 @@ namespace paludis
virtual const std::string environment_variable(const std::string &) const = 0;
- virtual const std::shared_ptr<const MaskInfo> profile_masked(const std::shared_ptr<const PackageID> &) const = 0;
+ virtual const std::shared_ptr<const MasksInfo> profile_masks(const std::shared_ptr<const PackageID> &) const = 0;
virtual const std::shared_ptr<const SetSpecTree> system_packages() const = 0;
diff --git a/paludis/repositories/e/repository_mask_store.cc b/paludis/repositories/e/repository_mask_store.cc
index c5225e6..8260365 100644
--- a/paludis/repositories/e/repository_mask_store.cc
+++ b/paludis/repositories/e/repository_mask_store.cc
@@ -119,17 +119,16 @@ RepositoryMaskStore::_populate()
}
}
-const std::shared_ptr<const MaskInfo>
+const std::shared_ptr<const MasksInfo>
RepositoryMaskStore::query(const std::shared_ptr<const PackageID> & id) const
{
+ auto result(std::make_shared<MasksInfo>());
auto r(_imp->repo_mask.find(id->name()));
- if (_imp->repo_mask.end() == r)
- return std::shared_ptr<const MaskInfo>();
- else
+ if (_imp->repo_mask.end() != r)
for (auto k(r->second.begin()), k_end(r->second.end()) ; k != k_end ; ++k)
if (match_package(*_imp->env, k->first, id, make_null_shared_ptr(), { }))
- return k->second;
+ result->push_back(*k->second);
- return std::shared_ptr<const MaskInfo>();
+ return result;
}
diff --git a/paludis/repositories/e/repository_mask_store.hh b/paludis/repositories/e/repository_mask_store.hh
index 424723c..4c8eb71 100644
--- a/paludis/repositories/e/repository_mask_store.hh
+++ b/paludis/repositories/e/repository_mask_store.hh
@@ -56,7 +56,7 @@ namespace paludis
~RepositoryMaskStore();
- const std::shared_ptr<const MaskInfo> query(const std::shared_ptr<const PackageID> & id) const;
+ const std::shared_ptr<const MasksInfo> query(const std::shared_ptr<const PackageID> & id) const;
};
}
diff --git a/paludis/repositories/e/traditional_profile.cc b/paludis/repositories/e/traditional_profile.cc
index 3daf56c..63ede75 100644
--- a/paludis/repositories/e/traditional_profile.cc
+++ b/paludis/repositories/e/traditional_profile.cc
@@ -1020,21 +1020,20 @@ TraditionalProfile::virtuals() const
return _imp->virtuals;
}
-const std::shared_ptr<const MaskInfo>
-TraditionalProfile::profile_masked(const std::shared_ptr<const PackageID> & id) const
+const std::shared_ptr<const MasksInfo>
+TraditionalProfile::profile_masks(const std::shared_ptr<const PackageID> & id) const
{
+ auto result(std::make_shared<MasksInfo>());
PackageMaskMap::const_iterator rr(_imp->package_mask.find(id->name()));
- if (_imp->package_mask.end() == rr)
- return std::shared_ptr<const MaskInfo>();
- else
+ if (_imp->package_mask.end() != rr)
{
for (std::list<std::pair<std::shared_ptr<const PackageDepSpec>, std::shared_ptr<const MaskInfo> > >::const_iterator k(rr->second.begin()),
k_end(rr->second.end()) ; k != k_end ; ++k)
if (match_package(*_imp->env, *k->first, id, make_null_shared_ptr(), { }))
- return k->second;
+ result->push_back(*k->second);
}
- return std::shared_ptr<const MaskInfo>();
+ return result;
}
const std::shared_ptr<const Set<std::string> >
diff --git a/paludis/repositories/e/traditional_profile.hh b/paludis/repositories/e/traditional_profile.hh
index 2fd3083..14a637b 100644
--- a/paludis/repositories/e/traditional_profile.hh
+++ b/paludis/repositories/e/traditional_profile.hh
@@ -94,7 +94,7 @@ namespace paludis
virtual const std::string environment_variable(const std::string &) const;
- virtual const std::shared_ptr<const MaskInfo> profile_masked(const std::shared_ptr<const PackageID> &) const;
+ virtual const std::shared_ptr<const MasksInfo> profile_masks(const std::shared_ptr<const PackageID> &) const;
virtual const std::shared_ptr<const SetSpecTree> system_packages() const;