aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar David Leverton <levertond@googlemail.com> 2007-07-26 20:04:35 +0000
committerAvatar David Leverton <levertond@googlemail.com> 2007-07-26 20:04:35 +0000
commit028beef56698063b848c2f02419227b8be6f4a03 (patch)
tree675a7a49105aee7d52c2189929a59b99f796fef5
parent8013d621d51886e7bd51896d37bc022edc898369 (diff)
downloadpaludis-028beef56698063b848c2f02419227b8be6f4a03.tar.gz
paludis-028beef56698063b848c2f02419227b8be6f4a03.tar.xz
Expose repository and profile masks as a metadata key, currently containing the filename that the mask comes from.
-rw-r--r--paludis/dep_list/override_functions.cc12
-rw-r--r--paludis/files.m42
-rw-r--r--paludis/mask-fwd.hh2
-rw-r--r--paludis/mask.cc2
-rw-r--r--paludis/mask.hh6
-rw-r--r--paludis/metadata_key-fwd.hh1
-rw-r--r--paludis/metadata_key.cc5
-rw-r--r--paludis/metadata_key.hh16
-rw-r--r--paludis/repositories/e/e_key.cc23
-rw-r--r--paludis/repositories/e/e_key.hh17
-rw-r--r--paludis/repositories/e/e_mask.cc16
-rw-r--r--paludis/repositories/e/e_mask.hh3
-rw-r--r--paludis/repositories/e/e_repository.cc17
-rw-r--r--paludis/repositories/e/e_repository.hh3
-rw-r--r--paludis/repositories/e/e_repository_profile.cc32
-rw-r--r--paludis/repositories/e/e_repository_profile.hh3
-rw-r--r--paludis/repositories/e/e_repository_profile_file.cc17
-rw-r--r--paludis/repositories/e/e_repository_profile_file.hh3
-rw-r--r--paludis/repositories/e/ebuild_id.cc19
-rw-r--r--paludis/repositories/gems/gem_specification_TEST.cc4
-rw-r--r--python/metadata_key.cc5
-rw-r--r--ruby/package_id.cc5
-rw-r--r--src/output/console_query_task.cc24
-rw-r--r--src/output/console_query_task.hh1
24 files changed, 189 insertions, 49 deletions
diff --git a/paludis/dep_list/override_functions.cc b/paludis/dep_list/override_functions.cc
index 739602e..e48d1f7 100644
--- a/paludis/dep_list/override_functions.cc
+++ b/paludis/dep_list/override_functions.cc
@@ -61,6 +61,10 @@ namespace
{
}
+ void visit(const MetadataRepositoryMaskInfoKey &)
+ {
+ }
+
void visit(const MetadataSpecTreeKey<RestrictSpecTree> &)
{
}
@@ -176,6 +180,10 @@ namespace
{
}
+ void visit(const MetadataRepositoryMaskInfoKey &)
+ {
+ }
+
void visit(const MetadataSpecTreeKey<RestrictSpecTree> &)
{
}
@@ -316,6 +324,10 @@ namespace
{
}
+ void visit(const MetadataRepositoryMaskInfoKey &)
+ {
+ }
+
void visit(const MetadataSpecTreeKey<RestrictSpecTree> &)
{
}
diff --git a/paludis/files.m4 b/paludis/files.m4
index 28a34fc..de9f20a 100644
--- a/paludis/files.m4
+++ b/paludis/files.m4
@@ -23,7 +23,7 @@ add(`hashed_containers', `hh', `cc', `test')
add(`hook', `hh', `cc', `fwd',`se', `sr')
add(`hooker', `hh', `cc', `test', `testscript')
add(`host_tuple_name', `hh', `cc', `sr', `test')
-add(`mask', `hh', `cc', `fwd')
+add(`mask', `hh', `cc', `fwd', `sr')
add(`match_package', `hh', `cc')
add(`metadata_key', `hh', `cc', `se', `fwd')
add(`name', `hh', `cc', `fwd', `test', `sr', `se')
diff --git a/paludis/mask-fwd.hh b/paludis/mask-fwd.hh
index d3ba1e5..63c5a17 100644
--- a/paludis/mask-fwd.hh
+++ b/paludis/mask-fwd.hh
@@ -31,6 +31,8 @@ namespace paludis
class UnsupportedMask;
class AssociationMask;
+ class RepositoryMaskInfo;
+
class MaskVisitorTypes;
}
diff --git a/paludis/mask.cc b/paludis/mask.cc
index 679f280..cb214cc 100644
--- a/paludis/mask.cc
+++ b/paludis/mask.cc
@@ -22,6 +22,8 @@
using namespace paludis;
+#include <paludis/mask-sr.cc>
+
template class ConstAcceptInterface<MaskVisitorTypes>;
template class ConstAcceptInterfaceVisitsThis<MaskVisitorTypes, UserMask>;
template class ConstAcceptInterfaceVisitsThis<MaskVisitorTypes, UnacceptedMask>;
diff --git a/paludis/mask.hh b/paludis/mask.hh
index 89f9ac9..96c15b8 100644
--- a/paludis/mask.hh
+++ b/paludis/mask.hh
@@ -25,10 +25,14 @@
#include <paludis/package_id-fwd.hh>
#include <paludis/util/visitor.hh>
#include <paludis/util/attributes.hh>
+#include <paludis/util/fs_entry.hh>
#include <string>
namespace paludis
{
+
+#include <paludis/mask-sr.hh>
+
struct MaskVisitorTypes :
VisitorTypes<
MaskVisitorTypes,
@@ -70,6 +74,8 @@ namespace paludis
public Mask,
public ConstAcceptInterfaceVisitsThis<MaskVisitorTypes, RepositoryMask>
{
+ public:
+ virtual const tr1::shared_ptr<const MetadataKey> mask_key() const = 0;
};
class PALUDIS_VISIBLE UnsupportedMask :
diff --git a/paludis/metadata_key-fwd.hh b/paludis/metadata_key-fwd.hh
index 73b1ff0..04f0cf7 100644
--- a/paludis/metadata_key-fwd.hh
+++ b/paludis/metadata_key-fwd.hh
@@ -32,6 +32,7 @@ namespace paludis
class MetadataStringKey;
class MetadataContentsKey;
class MetadataTimeKey;
+ class MetadataRepositoryMaskInfoKey;
template <typename C_> class MetadataSetKey;
template <typename C_> class MetadataSpecTreeKey;
diff --git a/paludis/metadata_key.cc b/paludis/metadata_key.cc
index 4356c3b..869dc99 100644
--- a/paludis/metadata_key.cc
+++ b/paludis/metadata_key.cc
@@ -92,6 +92,11 @@ MetadataPackageIDKey::MetadataPackageIDKey(const std::string & r, const std::str
{
}
+MetadataRepositoryMaskInfoKey::MetadataRepositoryMaskInfoKey(const std::string & r, const std::string & h, const MetadataKeyType t) :
+ MetadataKey(r, h, t)
+{
+}
+
template <typename C_>
MetadataSetKey<C_>::MetadataSetKey(const std::string & r, const std::string & h, const MetadataKeyType t) :
MetadataKey(r, h, t)
diff --git a/paludis/metadata_key.hh b/paludis/metadata_key.hh
index 7ae6489..8ace96d 100644
--- a/paludis/metadata_key.hh
+++ b/paludis/metadata_key.hh
@@ -21,6 +21,7 @@
#define PALUDIS_GUARD_PALUDIS_METADATA_KEY_HH 1
#include <paludis/metadata_key-fwd.hh>
+#include <paludis/mask-fwd.hh>
#include <paludis/package_id-fwd.hh>
#include <paludis/name-fwd.hh>
#include <paludis/dep_spec-fwd.hh>
@@ -50,7 +51,8 @@ namespace paludis
MetadataSpecTreeKey<RestrictSpecTree>,
MetadataStringKey,
MetadataContentsKey,
- MetadataTimeKey
+ MetadataTimeKey,
+ MetadataRepositoryMaskInfoKey
>
{
};
@@ -119,6 +121,18 @@ namespace paludis
PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
};
+ class PALUDIS_VISIBLE MetadataRepositoryMaskInfoKey :
+ public MetadataKey,
+ public ConstAcceptInterfaceVisitsThis<MetadataKeyVisitorTypes, MetadataRepositoryMaskInfoKey>
+ {
+ protected:
+ MetadataRepositoryMaskInfoKey(const std::string &, const std::string &, const MetadataKeyType);
+
+ public:
+ virtual const tr1::shared_ptr<const RepositoryMaskInfo> value() const
+ PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
+ };
+
template <typename C_>
class PALUDIS_VISIBLE MetadataSetKey :
public MetadataKey,
diff --git a/paludis/repositories/e/e_key.cc b/paludis/repositories/e/e_key.cc
index 0e7d4bf..2adb62e 100644
--- a/paludis/repositories/e/e_key.cc
+++ b/paludis/repositories/e/e_key.cc
@@ -63,6 +63,29 @@ EStringKey::value() const
return _value;
}
+EMutableRepositoryMaskInfoKey::EMutableRepositoryMaskInfoKey(const tr1::shared_ptr<const ERepositoryID> &,
+ const std::string & r, const std::string & h, tr1::shared_ptr<const RepositoryMaskInfo> v, const MetadataKeyType t) :
+ MetadataRepositoryMaskInfoKey(r, h, t),
+ _value(v)
+{
+}
+
+EMutableRepositoryMaskInfoKey::~EMutableRepositoryMaskInfoKey()
+{
+}
+
+const tr1::shared_ptr<const RepositoryMaskInfo>
+EMutableRepositoryMaskInfoKey::value() const
+{
+ return _value;
+}
+
+void
+EMutableRepositoryMaskInfoKey::set_value(tr1::shared_ptr<const RepositoryMaskInfo> v)
+{
+ _value = v;
+}
+
namespace paludis
{
template <>
diff --git a/paludis/repositories/e/e_key.hh b/paludis/repositories/e/e_key.hh
index 5f2cf26..5ff7c1a 100644
--- a/paludis/repositories/e/e_key.hh
+++ b/paludis/repositories/e/e_key.hh
@@ -45,6 +45,23 @@ namespace paludis
PALUDIS_ATTRIBUTE((warn_unused_result));
};
+ class EMutableRepositoryMaskInfoKey :
+ public MetadataRepositoryMaskInfoKey
+ {
+ private:
+ tr1::shared_ptr<const RepositoryMaskInfo> _value;
+
+ public:
+ EMutableRepositoryMaskInfoKey(const tr1::shared_ptr<const ERepositoryID> &,
+ const std::string &, const std::string &, tr1::shared_ptr<const RepositoryMaskInfo>, const MetadataKeyType);
+ ~EMutableRepositoryMaskInfoKey();
+
+ virtual const tr1::shared_ptr<const RepositoryMaskInfo> value() const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ void set_value(tr1::shared_ptr<const RepositoryMaskInfo>);
+ };
+
class EDependenciesKey :
public MetadataSpecTreeKey<DependencySpecTree>,
private PrivateImplementationPattern<EDependenciesKey>
diff --git a/paludis/repositories/e/e_mask.cc b/paludis/repositories/e/e_mask.cc
index 16fcd14..6ade0ce 100644
--- a/paludis/repositories/e/e_mask.cc
+++ b/paludis/repositories/e/e_mask.cc
@@ -122,17 +122,19 @@ namespace paludis
{
const char key;
const std::string description;
+ const tr1::shared_ptr<const MetadataKey> mask_key;
- Implementation(const char k, const std::string & d) :
+ Implementation(const char k, const std::string & d, const tr1::shared_ptr<const MetadataKey> & m) :
key(k),
- description(d)
+ description(d),
+ mask_key(m)
{
}
};
}
-ERepositoryMask::ERepositoryMask(const char k, const std::string & d) :
- PrivateImplementationPattern<ERepositoryMask>(new Implementation<ERepositoryMask>(k, d))
+ERepositoryMask::ERepositoryMask(const char k, const std::string & d, const tr1::shared_ptr<const MetadataKey> & m) :
+ PrivateImplementationPattern<ERepositoryMask>(new Implementation<ERepositoryMask>(k, d, m))
{
}
@@ -152,3 +154,9 @@ ERepositoryMask::description() const
return _imp->description;
}
+const tr1::shared_ptr<const MetadataKey>
+ERepositoryMask::mask_key() const
+{
+ return _imp->mask_key;
+}
+
diff --git a/paludis/repositories/e/e_mask.hh b/paludis/repositories/e/e_mask.hh
index 23bad5e..2c99188 100644
--- a/paludis/repositories/e/e_mask.hh
+++ b/paludis/repositories/e/e_mask.hh
@@ -58,11 +58,12 @@ namespace paludis
private PrivateImplementationPattern<ERepositoryMask>
{
public:
- ERepositoryMask(const char, const std::string &);
+ ERepositoryMask(const char, const std::string &, const tr1::shared_ptr<const MetadataKey> &);
~ERepositoryMask();
const char key() const;
const std::string description() const;
+ const tr1::shared_ptr<const MetadataKey> mask_key() const;
};
}
}
diff --git a/paludis/repositories/e/e_repository.cc b/paludis/repositories/e/e_repository.cc
index 0825aa2..5b039a7 100644
--- a/paludis/repositories/e/e_repository.cc
+++ b/paludis/repositories/e/e_repository.cc
@@ -48,6 +48,7 @@
#include <paludis/repository_name_cache.hh>
#include <paludis/syncer.hh>
#include <paludis/action.hh>
+#include <paludis/mask.hh>
#include <paludis/util/fs_entry.hh>
#include <paludis/util/iterator.hh>
@@ -92,7 +93,7 @@
using namespace paludis;
-typedef MakeHashedMap<QualifiedPackageName, std::list<tr1::shared_ptr<const PackageDepSpec> > >::Type RepositoryMaskMap;
+typedef MakeHashedMap<QualifiedPackageName, std::list<std::pair<tr1::shared_ptr<const PackageDepSpec>, tr1::shared_ptr<const RepositoryMaskInfo> > > >::Type RepositoryMaskMap;
typedef MakeHashedMultiMap<std::string, std::string>::Type MirrorMap;
typedef MakeHashedMap<QualifiedPackageName, tr1::shared_ptr<const PackageDepSpec> >::Type VirtualsMap;
typedef std::list<RepositoryEInterface::ProfilesDescLine> ProfilesDesc;
@@ -372,7 +373,7 @@ ERepository::do_package_ids(const QualifiedPackageName & n) const
return _imp->layout->package_ids(n);
}
-bool
+tr1::shared_ptr<const RepositoryMaskInfo>
ERepository::repository_masked(const PackageID & id) const
{
Lock l(_imp->mutexes->repo_mask_mutex);
@@ -397,7 +398,7 @@ ERepository::repository_masked(const PackageID & id) const
{
tr1::shared_ptr<const PackageDepSpec> a(new PackageDepSpec(*line, pds_pm_eapi_0));
if (a->package_ptr())
- _imp->repo_mask[*a->package_ptr()].push_back(a);
+ _imp->repo_mask[*a->package_ptr()].push_back(std::make_pair(a, tr1::shared_ptr<const RepositoryMaskInfo>(new RepositoryMaskInfo(*p))));
else
Log::get_instance()->message(ll_warning, lc_context, "Loading package mask spec '"
+ stringify(*line) + "' failed because specification does not restrict to a "
@@ -418,14 +419,14 @@ ERepository::repository_masked(const PackageID & id) const
RepositoryMaskMap::iterator r(_imp->repo_mask.find(id.name()));
if (_imp->repo_mask.end() == r)
- return false;
+ return tr1::shared_ptr<const RepositoryMaskInfo>();
else
- for (IndirectIterator<std::list<tr1::shared_ptr<const PackageDepSpec> >::const_iterator, const PackageDepSpec>
+ for (std::list<std::pair<tr1::shared_ptr<const PackageDepSpec>, tr1::shared_ptr<const RepositoryMaskInfo> > >::const_iterator
k(r->second.begin()), k_end(r->second.end()) ; k != k_end ; ++k)
- if (match_package(*_imp->params.environment, *k, id))
- return true;
+ if (match_package(*_imp->params.environment, *k->first, id))
+ return k->second;
- return false;
+ return tr1::shared_ptr<const RepositoryMaskInfo>();
}
UseFlagState
diff --git a/paludis/repositories/e/e_repository.hh b/paludis/repositories/e/e_repository.hh
index 629a299..89eb767 100644
--- a/paludis/repositories/e/e_repository.hh
+++ b/paludis/repositories/e/e_repository.hh
@@ -22,6 +22,7 @@
#include <paludis/repository.hh>
#include <paludis/package_database.hh>
+#include <paludis/mask-fwd.hh>
#include <paludis/util/fs_entry.hh>
#include <paludis/util/private_implementation_pattern.hh>
#include <paludis/util/tr1_memory.hh>
@@ -231,7 +232,7 @@ namespace paludis
const tr1::shared_ptr<const erepository::ERepositoryEntries> entries() const;
const tr1::shared_ptr<const ERepositoryProfile> profile() const;
- bool repository_masked(const PackageID &) const;
+ tr1::shared_ptr<const RepositoryMaskInfo> repository_masked(const PackageID &) const;
void regenerate_cache() const;
};
diff --git a/paludis/repositories/e/e_repository_profile.cc b/paludis/repositories/e/e_repository_profile.cc
index 2f64f06..c318d23 100644
--- a/paludis/repositories/e/e_repository_profile.cc
+++ b/paludis/repositories/e/e_repository_profile.cc
@@ -59,7 +59,7 @@ namespace
typedef MakeHashedSet<UseFlagName>::Type UseFlagSet;
typedef MakeHashedMap<std::string, std::string>::Type EnvironmentVariablesMap;
typedef MakeHashedMap<QualifiedPackageName, tr1::shared_ptr<const PackageDepSpec> >::Type VirtualsMap;
- typedef MakeHashedMap<QualifiedPackageName, std::list<tr1::shared_ptr<const PackageDepSpec> > >::Type PackageMaskMap;
+ typedef MakeHashedMap<QualifiedPackageName, std::list<std::pair<tr1::shared_ptr<const PackageDepSpec>, tr1::shared_ptr<const RepositoryMaskInfo> > > >::Type PackageMaskMap;
typedef MakeHashedMap<UseFlagName, bool>::Type FlagStatusMap;
typedef std::list<std::pair<tr1::shared_ptr<const PackageDepSpec>, FlagStatusMap> > PackageFlagStatusMapList;
@@ -427,11 +427,11 @@ Implementation<ERepositoryProfile>::make_vars_from_file_vars()
{
for (ProfileFile::Iterator i(packages_file.begin()), i_end(packages_file.end()) ; i != i_end ; ++i)
{
- if (0 != i->compare(0, 1, "*", 0, 1))
+ if (0 != i->first.compare(0, 1, "*", 0, 1))
continue;
- Context context_spec("When parsing '" + *i + "':");
- tr1::shared_ptr<PackageDepSpec> spec(new PackageDepSpec(i->substr(1), pds_pm_eapi_0));
+ Context context_spec("When parsing '" + i->first + "':");
+ tr1::shared_ptr<PackageDepSpec> spec(new PackageDepSpec(i->first.substr(1), pds_pm_eapi_0));
spec->set_tag(system_tag);
system_packages->add(tr1::shared_ptr<SetSpecTree::ConstItem>(new TreeLeaf<SetSpecTree, PackageDepSpec>(spec)));
}
@@ -450,7 +450,7 @@ Implementation<ERepositoryProfile>::make_vars_from_file_vars()
line != line_end ; ++line)
{
std::vector<std::string> tokens;
- WhitespaceTokeniser::get_instance()->tokenise(*line, std::back_inserter(tokens));
+ WhitespaceTokeniser::get_instance()->tokenise(line->first, std::back_inserter(tokens));
if (tokens.size() < 2)
continue;
@@ -469,23 +469,23 @@ Implementation<ERepositoryProfile>::make_vars_from_file_vars()
for (ProfileFile::Iterator line(package_mask_file.begin()), line_end(package_mask_file.end()) ;
line != line_end ; ++line)
{
- if (line->empty())
+ if (line->first.empty())
continue;
try
{
- tr1::shared_ptr<const PackageDepSpec> a(new PackageDepSpec(*line, pds_pm_eapi_0));
+ tr1::shared_ptr<const PackageDepSpec> a(new PackageDepSpec(line->first, pds_pm_eapi_0));
if (a->package_ptr())
- package_mask[*a->package_ptr()].push_back(a);
+ package_mask[*a->package_ptr()].push_back(std::make_pair(a, line->second));
else
Log::get_instance()->message(ll_warning, lc_context, "Loading package.mask spec '"
- + stringify(*line) + "' failed because specification does not restrict to a "
+ + stringify(line->first) + "' failed because specification does not restrict to a "
"unique package");
}
catch (const Exception & e)
{
Log::get_instance()->message(ll_warning, lc_context, "Loading package.mask spec '"
- + stringify(*line) + "' failed due to exception '" + e.message() + "' ("
+ + stringify(line->first) + "' failed due to exception '" + e.message() + "' ("
+ e.what() + ")");
}
}
@@ -778,20 +778,20 @@ ERepositoryProfile::end_virtuals() const
return VirtualsIterator(_imp->virtuals.end());
}
-bool
+tr1::shared_ptr<const RepositoryMaskInfo>
ERepositoryProfile::profile_masked(const PackageID & id) const
{
PackageMaskMap::const_iterator rr(_imp->package_mask.find(id.name()));
if (_imp->package_mask.end() == rr)
- return false;
+ return tr1::shared_ptr<const RepositoryMaskInfo>();
else
{
- for (std::list<tr1::shared_ptr<const PackageDepSpec> >::const_iterator k(rr->second.begin()),
+ for (std::list<std::pair<tr1::shared_ptr<const PackageDepSpec>, tr1::shared_ptr<const RepositoryMaskInfo> > >::const_iterator k(rr->second.begin()),
k_end(rr->second.end()) ; k != k_end ; ++k)
- if (match_package(*_imp->env, **k, id))
- return true;
+ if (match_package(*_imp->env, *k->first, id))
+ return k->second;
}
- return false;
+ return tr1::shared_ptr<const RepositoryMaskInfo>();
}
diff --git a/paludis/repositories/e/e_repository_profile.hh b/paludis/repositories/e/e_repository_profile.hh
index a27bdd5..eca2951 100644
--- a/paludis/repositories/e/e_repository_profile.hh
+++ b/paludis/repositories/e/e_repository_profile.hh
@@ -24,6 +24,7 @@
#include <paludis/package_id-fwd.hh>
#include <paludis/name-fwd.hh>
#include <paludis/version_spec-fwd.hh>
+#include <paludis/mask-fwd.hh>
#include <paludis/util/fs_entry-fwd.hh>
#include <paludis/util/private_implementation_pattern.hh>
#include <paludis/util/instantiation_policy.hh>
@@ -103,7 +104,7 @@ namespace paludis
///\name Masks
///\{
- bool profile_masked(const PackageID &) const;
+ tr1::shared_ptr<const RepositoryMaskInfo> profile_masked(const PackageID &) const;
///\}
diff --git a/paludis/repositories/e/e_repository_profile_file.cc b/paludis/repositories/e/e_repository_profile_file.cc
index 16de693..fac86ed 100644
--- a/paludis/repositories/e/e_repository_profile_file.cc
+++ b/paludis/repositories/e/e_repository_profile_file.cc
@@ -23,9 +23,10 @@
#include <paludis/config_file.hh>
#include <paludis/util/private_implementation_pattern-impl.hh>
#include <paludis/util/options.hh>
+#include <paludis/mask.hh>
#include <libwrapiter/libwrapiter_forward_iterator.hh>
#include <libwrapiter/libwrapiter_output_iterator.hh>
-#include <list>
+#include <map>
#include <algorithm>
using namespace paludis;
@@ -35,7 +36,7 @@ namespace paludis
template <>
struct Implementation<ProfileFile>
{
- std::list<std::string> lines;
+ std::multimap<std::string, tr1::shared_ptr<const RepositoryMaskInfo> > lines;
};
}
@@ -52,18 +53,12 @@ ProfileFile::add_file(const FSEntry & f)
{
if (0 == line->compare(0, 1, "-", 0, 1))
{
- std::list<std::string>::iterator i(std::find(_imp->lines.begin(), _imp->lines.end(), line->substr(1)));
- if (_imp->lines.end() == i)
+ int erased(_imp->lines.erase(line->substr(1)));
+ if (0 == erased)
Log::get_instance()->message(ll_qa, lc_context, "No match for '" + *line + "'");
- else
- while (_imp->lines.end() != i)
- {
- _imp->lines.erase(i++);
- i = std::find(i, _imp->lines.end(), line->substr(1));
- }
}
else
- _imp->lines.push_back(*line);
+ _imp->lines.insert(std::make_pair(*line, tr1::shared_ptr<const RepositoryMaskInfo>(new RepositoryMaskInfo(f))));
}
}
diff --git a/paludis/repositories/e/e_repository_profile_file.hh b/paludis/repositories/e/e_repository_profile_file.hh
index 5e9e7a3..f0f127a 100644
--- a/paludis/repositories/e/e_repository_profile_file.hh
+++ b/paludis/repositories/e/e_repository_profile_file.hh
@@ -23,6 +23,7 @@
#include <paludis/util/private_implementation_pattern.hh>
#include <paludis/util/attributes.hh>
#include <paludis/util/fs_entry.hh>
+#include <paludis/mask-fwd.hh>
#include <libwrapiter/libwrapiter_forward_iterator-fwd.hh>
namespace paludis
@@ -54,7 +55,7 @@ namespace paludis
///\name Iterate over our profile lines.
///\{
- typedef libwrapiter::ForwardIterator<ProfileFile, const std::string> Iterator;
+ typedef libwrapiter::ForwardIterator<ProfileFile, const std::pair<const std::string, tr1::shared_ptr<const RepositoryMaskInfo> > > Iterator;
Iterator begin() const;
Iterator end() const;
diff --git a/paludis/repositories/e/ebuild_id.cc b/paludis/repositories/e/ebuild_id.cc
index 59934a0..d7c2663 100644
--- a/paludis/repositories/e/ebuild_id.cc
+++ b/paludis/repositories/e/ebuild_id.cc
@@ -97,6 +97,8 @@ namespace paludis
mutable tr1::shared_ptr<const EKeywordsKey> keywords;
mutable tr1::shared_ptr<const EIUseKey> iuse;
mutable tr1::shared_ptr<const EInheritedKey> inherited;
+ mutable tr1::shared_ptr<EMutableRepositoryMaskInfoKey> repository_mask;
+ mutable tr1::shared_ptr<EMutableRepositoryMaskInfoKey> profile_mask;
Implementation(const QualifiedPackageName & q, const VersionSpec & v,
const Environment * const e,
@@ -259,6 +261,13 @@ EbuildID::need_keys_added() const
if (_imp->license)
IdleActionPool::get_instance()->optional_idle_action(tr1::bind(tr1::mem_fn(&ELicenseKey::idle_load), _imp->license));
}
+
+ _imp->repository_mask = make_shared_ptr(new EMutableRepositoryMaskInfoKey(shared_from_this(), "repository_mask", "Repository masked",
+ tr1::static_pointer_cast<const ERepository>(repository())->repository_masked(*this), mkt_internal));
+ add_metadata_key(_imp->repository_mask);
+ _imp->profile_mask = make_shared_ptr(new EMutableRepositoryMaskInfoKey(shared_from_this(), "profile_mask", "Profile masked",
+ tr1::static_pointer_cast<const ERepository>(repository())->profile()->profile_masked(*this), mkt_internal));
+ add_metadata_key(_imp->profile_mask);
}
namespace
@@ -354,12 +363,12 @@ EbuildID::need_masks_added() const
if (! _imp->environment->unmasked_by_user(*this))
{
/* repo unless user */
- if (tr1::static_pointer_cast<const ERepository>(repository())->repository_masked(*this))
- add_mask(make_shared_ptr(new ERepositoryMask('R', "repository")));
+ if (_imp->repository_mask->value())
+ add_mask(make_shared_ptr(new ERepositoryMask('R', "repository", _imp->repository_mask)));
/* profile unless user */
- if (tr1::static_pointer_cast<const ERepository>(repository())->profile()->profile_masked(*this))
- add_mask(make_shared_ptr(new ERepositoryMask('P', "profile")));
+ if (_imp->profile_mask->value())
+ add_mask(make_shared_ptr(new ERepositoryMask('P', "profile", _imp->profile_mask)));
/* user */
tr1::shared_ptr<const Mask> user_mask(_imp->environment->mask_for_user(*this));
@@ -383,6 +392,8 @@ EbuildID::invalidate_masks() const
_imp->has_masks = false;
PackageID::invalidate_masks();
+ _imp->repository_mask->set_value(tr1::static_pointer_cast<const ERepository>(repository())->repository_masked(*this));
+ _imp->profile_mask->set_value(tr1::static_pointer_cast<const ERepository>(repository())->profile()->profile_masked(*this));
}
const std::string
diff --git a/paludis/repositories/gems/gem_specification_TEST.cc b/paludis/repositories/gems/gem_specification_TEST.cc
index 2752e6e..7ac3349 100644
--- a/paludis/repositories/gems/gem_specification_TEST.cc
+++ b/paludis/repositories/gems/gem_specification_TEST.cc
@@ -91,6 +91,10 @@ namespace
void visit(const MetadataTimeKey &)
{
}
+
+ void visit(const MetadataRepositoryMaskInfoKey &)
+ {
+ }
};
}
diff --git a/python/metadata_key.cc b/python/metadata_key.cc
index 28d62a4..7ca6dd5 100644
--- a/python/metadata_key.cc
+++ b/python/metadata_key.cc
@@ -91,6 +91,11 @@ struct MetadataKeyToPython :
value = bp::object(bp::ptr(&k));
}
+ void visit(const MetadataRepositoryMaskInfoKey & k)
+ {
+ value = bp::object();
+ }
+
void visit(const MetadataSetKey<KeywordNameSet> & k)
{
value = bp::object(bp::ptr(&k));
diff --git a/ruby/package_id.cc b/ruby/package_id.cc
index 4f98841..a4543c5 100644
--- a/ruby/package_id.cc
+++ b/ruby/package_id.cc
@@ -80,6 +80,11 @@ namespace
new tr1::shared_ptr<const MetadataContentsKey>(tr1::static_pointer_cast<const MetadataContentsKey>(mm)));
}
+ void visit(const MetadataRepositoryMaskInfoKey &)
+ {
+ value = Qnil;
+ }
+
void visit(const MetadataSetKey<KeywordNameSet> &)
{
value = Data_Wrap_Struct(c_metadata_keyword_name_set_key, 0, &Common<tr1::shared_ptr<const MetadataSetKey<KeywordNameSet> > >::free,
diff --git a/src/output/console_query_task.cc b/src/output/console_query_task.cc
index fb26bfc..cf36a82 100644
--- a/src/output/console_query_task.cc
+++ b/src/output/console_query_task.cc
@@ -323,6 +323,12 @@ namespace
task->display_metadata_time(k.human_name(), k.raw_name(), k.value());
}
+ void visit(const MetadataRepositoryMaskInfoKey & k)
+ {
+ if (k.type() == type)
+ task->display_metadata_repository_mask_info(k.human_name(), k.raw_name(), k.value());
+ }
+
void visit(const MetadataContentsKey &)
{
}
@@ -456,6 +462,24 @@ ConsoleQueryTask::display_metadata_time(const std::string & k, const std::string
}
void
+ConsoleQueryTask::display_metadata_repository_mask_info(const std::string & k, const std::string & kk,
+ tr1::shared_ptr<const RepositoryMaskInfo> i) const
+{
+ if (! i)
+ return;
+
+ if (want_raw())
+ {
+ output_left_column(kk + ":");
+ }
+ else
+ {
+ output_left_column(k + ":");
+ }
+ output_right_column(stringify(i->mask_file));
+}
+
+void
ConsoleQueryTask::display_metadata_iuse(const std::string & k, const std::string & kk,
const std::string & v, const tr1::shared_ptr<const PackageID> & id,
const tr1::shared_ptr<const IUseFlagSet> & e) const
diff --git a/src/output/console_query_task.hh b/src/output/console_query_task.hh
index 8c40dcb..fcea10c 100644
--- a/src/output/console_query_task.hh
+++ b/src/output/console_query_task.hh
@@ -54,6 +54,7 @@ namespace paludis
const std::string &) const;
virtual void display_metadata_pde(const std::string &, const std::string &, const PackageID &) const;
virtual void display_metadata_time(const std::string &, const std::string &, time_t) const;
+ virtual void display_metadata_repository_mask_info(const std::string &, const std::string &, tr1::shared_ptr<const RepositoryMaskInfo>) const;
virtual void display_metadata_iuse(const std::string &, const std::string &, const std::string &,
const tr1::shared_ptr<const PackageID> & id,
const tr1::shared_ptr<const IUseFlagSet> &) const;