aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2008-01-18 23:27:08 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2008-01-18 23:27:08 +0000
commit6bb6418a5c51cbdf7a12e06204a864acbac03dbf (patch)
tree994b6a1c0add557e5ad469ec6e9ac4a130e4e79b
parentd8a52603c1b7cadcd41eacc759b877ace8a4e574 (diff)
downloadpaludis-6bb6418a5c51cbdf7a12e06204a864acbac03dbf.tar.gz
paludis-6bb6418a5c51cbdf7a12e06204a864acbac03dbf.tar.xz
If an E repository entry has a use_key, use flags are forced / masked to the values in that key.
-rw-r--r--paludis/repositories/e/e_repository.cc60
-rw-r--r--paludis/repositories/e/e_repository_id.hh3
-rw-r--r--paludis/repositories/e/eapi.cc2
-rw-r--r--paludis/repositories/e/eapi.sr2
-rw-r--r--paludis/repositories/e/eapis/0.conf1
-rw-r--r--paludis/repositories/e/ebuild.cc3
-rw-r--r--paludis/repositories/e/ebuild_id.cc18
-rw-r--r--paludis/repositories/e/ebuild_id.hh4
-rw-r--r--paludis/repositories/e/vdb_id.hh4
9 files changed, 79 insertions, 18 deletions
diff --git a/paludis/repositories/e/e_repository.cc b/paludis/repositories/e/e_repository.cc
index 2ec28f2..ab14546 100644
--- a/paludis/repositories/e/e_repository.cc
+++ b/paludis/repositories/e/e_repository.cc
@@ -595,29 +595,65 @@ ERepository::repository_masked(const PackageID & id) const
UseFlagState
ERepository::query_use(const UseFlagName & f, const PackageID & e) const
{
- _imp->need_profiles();
- if (query_use_mask(f, e))
- return use_disabled;
- else if (query_use_force(f, e))
- return use_enabled;
+ if (this != e.repository().get())
+ return use_unspecified;
+
+ const erepository::ERepositoryID & id(static_cast<const erepository::ERepositoryID &>(e));
+ if (id.use_key())
+ {
+ if (id.use_key()->value()->end() != id.use_key()->value()->find(f))
+ return use_enabled;
+ else
+ return use_disabled;
+ }
else
- return _imp->profile_ptr->use_state_ignoring_masks(f, e);
+ {
+ _imp->need_profiles();
+ if (query_use_mask(f, e))
+ return use_disabled;
+ else if (query_use_force(f, e))
+ return use_enabled;
+ else
+ return _imp->profile_ptr->use_state_ignoring_masks(f, e);
+ }
}
bool
ERepository::query_use_mask(const UseFlagName & u, const PackageID & e) const
{
- _imp->need_profiles();
- return _imp->profile_ptr->use_masked(u, e) ||
- (arch_flags()->end() != arch_flags()->find(u) &&
- use_enabled != _imp->profile_ptr->use_state_ignoring_masks(u, e));
+ if (this != e.repository().get())
+ return use_unspecified;
+
+ const erepository::ERepositoryID & id(static_cast<const erepository::ERepositoryID &>(e));
+ if (id.use_key())
+ {
+ return (id.use_key()->value()->end() == id.use_key()->value()->find(u));
+ }
+ else
+ {
+ _imp->need_profiles();
+ return _imp->profile_ptr->use_masked(u, e) ||
+ (arch_flags()->end() != arch_flags()->find(u) &&
+ use_enabled != _imp->profile_ptr->use_state_ignoring_masks(u, e));
+ }
}
bool
ERepository::query_use_force(const UseFlagName & u, const PackageID & e) const
{
- _imp->need_profiles();
- return _imp->profile_ptr->use_forced(u, e);
+ if (this != e.repository().get())
+ return use_unspecified;
+
+ const erepository::ERepositoryID & id(static_cast<const erepository::ERepositoryID &>(e));
+ if (id.use_key())
+ {
+ return (id.use_key()->value()->end() != id.use_key()->value()->find(u));
+ }
+ else
+ {
+ _imp->need_profiles();
+ return _imp->profile_ptr->use_forced(u, e);
+ }
}
tr1::shared_ptr<const UseFlagNameSet>
diff --git a/paludis/repositories/e/e_repository_id.hh b/paludis/repositories/e/e_repository_id.hh
index 55f3f92..556d166 100644
--- a/paludis/repositories/e/e_repository_id.hh
+++ b/paludis/repositories/e/e_repository_id.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
@@ -33,6 +33,7 @@ namespace paludis
public:
virtual const tr1::shared_ptr<const EAPI> eapi() const PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
virtual const tr1::shared_ptr<const MetadataSpecTreeKey<RestrictSpecTree> > restrict_key() const = 0;
+ virtual const tr1::shared_ptr<const MetadataCollectionKey<UseFlagNameSet> > use_key() const = 0;
virtual bool breaks_portage() const PALUDIS_ATTRIBUTE((warn_unused_result));
};
diff --git a/paludis/repositories/e/eapi.cc b/paludis/repositories/e/eapi.cc
index 55c0760..86bf77b 100644
--- a/paludis/repositories/e/eapi.cc
+++ b/paludis/repositories/e/eapi.cc
@@ -170,6 +170,7 @@ namespace paludis
.metadata_provide(k.get("metadata_provide"))
.metadata_eapi(k.get("metadata_eapi"))
.metadata_dependencies(k.get("metadata_dependencies"))
+ .metadata_use(k.get("metadata_use"))
.description_build_depend(k.get("description_build_depend"))
.description_run_depend(k.get("description_run_depend"))
.description_slot(k.get("description_slot"))
@@ -186,6 +187,7 @@ namespace paludis
.description_provide(k.get("description_provide"))
.description_eapi(k.get("description_eapi"))
.description_dependencies(k.get("description_dependencies"))
+ .description_use(k.get("description_use"))
)))
.ebuild_environment_variables(make_shared_ptr(new EAPIEbuildEnvironmentVariables(
diff --git a/paludis/repositories/e/eapi.sr b/paludis/repositories/e/eapi.sr
index 5891013..f225d13 100644
--- a/paludis/repositories/e/eapi.sr
+++ b/paludis/repositories/e/eapi.sr
@@ -47,6 +47,7 @@ make_class_EAPIEbuildMetadataVariables()
key metadata_provide std::string
key metadata_eapi std::string
key metadata_dependencies std::string
+ key metadata_use std::string
key description_build_depend std::string
key description_run_depend std::string
@@ -64,6 +65,7 @@ make_class_EAPIEbuildMetadataVariables()
key description_provide std::string
key description_eapi std::string
key description_dependencies std::string
+ key description_use std::string
doxygen_comment << "END"
/**
diff --git a/paludis/repositories/e/eapis/0.conf b/paludis/repositories/e/eapis/0.conf
index d71850c..14d8f92 100644
--- a/paludis/repositories/e/eapis/0.conf
+++ b/paludis/repositories/e/eapis/0.conf
@@ -118,7 +118,6 @@ description_restrict = Restrictions
description_run_depend = Run dependencies
description_slot = Slot
description_src_uri = Source URI
-description_use = Selected USE flags
metadata_build_depend = DEPEND
metadata_description = DESCRIPTION
diff --git a/paludis/repositories/e/ebuild.cc b/paludis/repositories/e/ebuild.cc
index 1412d23..07a925b 100644
--- a/paludis/repositories/e/ebuild.cc
+++ b/paludis/repositories/e/ebuild.cc
@@ -431,6 +431,9 @@ EbuildMetadataCommand::load(const tr1::shared_ptr<const EbuildID> & id)
if (! m.metadata_restrict.empty())
id->load_restrict(m.metadata_restrict, m.description_restrict, get(keys, m.metadata_restrict));
+
+ if (! m.metadata_use.empty())
+ id->load_use(m.metadata_use, m.description_use, get(keys, m.metadata_use));
}
EbuildVariableCommand::EbuildVariableCommand(const EbuildCommandParams & p,
diff --git a/paludis/repositories/e/ebuild_id.cc b/paludis/repositories/e/ebuild_id.cc
index 6b77f1b..b37a820 100644
--- a/paludis/repositories/e/ebuild_id.cc
+++ b/paludis/repositories/e/ebuild_id.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
@@ -100,6 +100,7 @@ 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<const EUseKey> use;
mutable tr1::shared_ptr<EMutableRepositoryMaskInfoKey> repository_mask;
mutable tr1::shared_ptr<EMutableRepositoryMaskInfoKey> profile_mask;
@@ -524,6 +525,13 @@ EbuildID::iuse_key() const
return _imp->iuse;
}
+const tr1::shared_ptr<const MetadataCollectionKey<UseFlagNameSet> >
+EbuildID::use_key() const
+{
+ need_keys_added();
+ return _imp->use;
+}
+
const tr1::shared_ptr<const MetadataSpecTreeKey<LicenseSpecTree> >
EbuildID::license_key() const
{
@@ -774,6 +782,14 @@ EbuildID::load_iuse(const std::string & r, const std::string & h, const std::str
}
void
+EbuildID::load_use(const std::string & r, const std::string & h, const std::string & v) const
+{
+ Lock l(_imp->mutex);
+ _imp->use.reset(new EUseKey(_imp->environment, shared_from_this(), r, h, v, mkt_internal));
+ add_metadata_key(_imp->use);
+}
+
+void
EbuildID::load_keywords(const std::string & r, const std::string & h, const std::string & v) const
{
Lock l(_imp->mutex);
diff --git a/paludis/repositories/e/ebuild_id.hh b/paludis/repositories/e/ebuild_id.hh
index 08755d5..f86e2c4 100644
--- a/paludis/repositories/e/ebuild_id.hh
+++ b/paludis/repositories/e/ebuild_id.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
@@ -88,6 +88,7 @@ namespace paludis
const tr1::shared_ptr<const MetadataCollectionKey<Set<std::string> > > inherited_key() const;
const tr1::shared_ptr<const MetadataSpecTreeKey<LicenseSpecTree> > license_key() const;
virtual const tr1::shared_ptr<const MetadataSpecTreeKey<RestrictSpecTree> > restrict_key() const;
+ virtual const tr1::shared_ptr<const MetadataCollectionKey<UseFlagNameSet> > use_key() const;
virtual bool arbitrary_less_than_comparison(const PackageID &) const
PALUDIS_ATTRIBUTE((warn_unused_result));
@@ -109,6 +110,7 @@ namespace paludis
void load_license(const std::string &, const std::string &, const std::string &) const;
void load_provide(const std::string &, const std::string &, const std::string &) const;
void load_iuse(const std::string &, const std::string &, const std::string &) const;
+ void load_use(const std::string &, const std::string &, const std::string &) const;
void load_inherited(const std::string &, const std::string &, const std::string &) const;
void load_keywords(const std::string &, const std::string &, const std::string &) const;
void load_restrict(const std::string &, const std::string &, const std::string &) const;
diff --git a/paludis/repositories/e/vdb_id.hh b/paludis/repositories/e/vdb_id.hh
index 044f044..b39cdda 100644
--- a/paludis/repositories/e/vdb_id.hh
+++ b/paludis/repositories/e/vdb_id.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
@@ -81,7 +81,7 @@ namespace paludis
virtual const tr1::shared_ptr<const MetadataSizeKey> size_of_download_required_key() const;
virtual const tr1::shared_ptr<const MetadataSizeKey> size_of_all_distfiles_key() const;
- const tr1::shared_ptr<const MetadataCollectionKey<UseFlagNameSet> > use_key() const;
+ virtual const tr1::shared_ptr<const MetadataCollectionKey<UseFlagNameSet> > use_key() const;
const tr1::shared_ptr<const MetadataCollectionKey<Set<std::string> > > inherited_key() const;
virtual bool supports_action(const SupportsActionTestBase &) const PALUDIS_ATTRIBUTE((warn_unused_result));