aboutsummaryrefslogtreecommitdiff
path: root/paludis
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2011-03-29 12:01:02 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2011-04-04 08:32:59 +0100
commit7d346bba37dfe95c858fa727bbc63bbc42074f30 (patch)
treec1cfaffcbe3f9bfd1b41ddef24d26372a8a2fb4b /paludis
parent5574c81a3c60266d023d18dfc115803da8b12e6b (diff)
downloadpaludis-7d346bba37dfe95c858fa727bbc63bbc42074f30.tar.gz
paludis-7d346bba37dfe95c858fa727bbc63bbc42074f30.tar.xz
in repository to requirements
Diffstat (limited to 'paludis')
-rw-r--r--paludis/dep_spec.cc6
-rw-r--r--paludis/dep_spec.hh7
-rw-r--r--paludis/dep_spec_data.hh6
-rw-r--r--paludis/fuzzy_finder.cc4
-rw-r--r--paludis/generator.cc9
-rw-r--r--paludis/match_package.cc4
-rw-r--r--paludis/package_dep_spec_constraint-fwd.hh3
-rw-r--r--paludis/package_dep_spec_constraint.cc18
-rw-r--r--paludis/package_dep_spec_constraint.hh23
-rw-r--r--paludis/package_dep_spec_properties.cc2
-rw-r--r--paludis/partially_made_package_dep_spec.cc12
-rw-r--r--paludis/user_dep_spec_TEST.cc6
12 files changed, 73 insertions, 27 deletions
diff --git a/paludis/dep_spec.cc b/paludis/dep_spec.cc
index dac1df32e..793a43cfe 100644
--- a/paludis/dep_spec.cc
+++ b/paludis/dep_spec.cc
@@ -578,10 +578,10 @@ PackageDepSpec::slot_requirement_ptr() const
return _imp->data->slot_requirement_ptr();
}
-std::shared_ptr<const RepositoryName>
-PackageDepSpec::in_repository_ptr() const
+const std::shared_ptr<const InRepositoryConstraint>
+PackageDepSpec::in_repository_constraint() const
{
- return _imp->data->in_repository_ptr();
+ return _imp->data->in_repository_constraint();
}
std::shared_ptr<const InstallableToRepository>
diff --git a/paludis/dep_spec.hh b/paludis/dep_spec.hh
index 881b82607..e2c4c1662 100644
--- a/paludis/dep_spec.hh
+++ b/paludis/dep_spec.hh
@@ -387,9 +387,12 @@ namespace paludis
std::shared_ptr<const SlotRequirement> slot_requirement_ptr() const;
/**
- * Fetch the in-repository requirement (may be a zero pointer).
+ * Fetch the single InRepositoryConstraint, if we have one, or
+ * a null pointer otherwise.
+ *
+ * \since 0.61
*/
- std::shared_ptr<const RepositoryName> in_repository_ptr() const;
+ const std::shared_ptr<const InRepositoryConstraint> in_repository_constraint() const;
/**
* Fetch the installable-to-repository requirement (may be a zero pointer).
diff --git a/paludis/dep_spec_data.hh b/paludis/dep_spec_data.hh
index 53c1c62d4..70fbd860e 100644
--- a/paludis/dep_spec_data.hh
+++ b/paludis/dep_spec_data.hh
@@ -153,9 +153,11 @@ namespace paludis
virtual std::shared_ptr<const SlotRequirement> slot_requirement_ptr() const = 0;
/**
- * Fetch the from-repository requirement (may be a zero pointer).
+ * Fetch the single InRepositoryConstraint, if we have one, or
+ * a null pointer otherwise.
*/
- virtual std::shared_ptr<const RepositoryName> in_repository_ptr() const = 0;
+ virtual const std::shared_ptr<const InRepositoryConstraint> in_repository_constraint() const
+ PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
/**
* Fetch the installable-to-repository requirement (may be a zero pointer).
diff --git a/paludis/fuzzy_finder.cc b/paludis/fuzzy_finder.cc
index a96316530..097de08ae 100644
--- a/paludis/fuzzy_finder.cc
+++ b/paludis/fuzzy_finder.cc
@@ -150,8 +150,8 @@ FuzzyCandidatesFinder::FuzzyCandidatesFinder(const Environment & e, const std::s
package = stringify(pds.package_name_constraint()->name().package());
}
- if (pds.in_repository_ptr())
- g = g & generator::InRepository(*pds.in_repository_ptr());
+ if (pds.in_repository_constraint())
+ g = g & generator::InRepository(pds.in_repository_constraint()->name());
if (pds.from_repository_ptr())
g = g & generator::FromRepository(*pds.from_repository_ptr());
diff --git a/paludis/generator.cc b/paludis/generator.cc
index 5602195e8..f8b7996f9 100644
--- a/paludis/generator.cc
+++ b/paludis/generator.cc
@@ -322,21 +322,20 @@ namespace
std::shared_ptr<RepositoryNameSet> result(std::make_shared<RepositoryNameSet>());
- if (spec.in_repository_ptr())
+ if (spec.in_repository_constraint())
{
- if (env->has_repository_named(*spec.in_repository_ptr()))
+ if (env->has_repository_named(spec.in_repository_constraint()->name()))
{
if (spec.installed_at_path_ptr())
{
- std::shared_ptr<const Repository> repo(env->fetch_repository(
- *spec.in_repository_ptr()));
+ std::shared_ptr<const Repository> repo(env->fetch_repository(spec.in_repository_constraint()->name()));
if (! repo->installed_root_key())
return result;
if (repo->installed_root_key()->value() != *spec.installed_at_path_ptr())
return result;
}
- result->insert(*spec.in_repository_ptr());
+ result->insert(spec.in_repository_constraint()->name());
}
}
else
diff --git a/paludis/match_package.cc b/paludis/match_package.cc
index f9eb55eca..436514d62 100644
--- a/paludis/match_package.cc
+++ b/paludis/match_package.cc
@@ -126,8 +126,8 @@ paludis::match_package_with_maybe_changes(
;
}
- if (spec.in_repository_ptr())
- if (*spec.in_repository_ptr() != id->repository_name())
+ if (spec.in_repository_constraint())
+ if (spec.in_repository_constraint()->name() != id->repository_name())
return false;
if (spec.from_repository_ptr())
diff --git a/paludis/package_dep_spec_constraint-fwd.hh b/paludis/package_dep_spec_constraint-fwd.hh
index 24284f300..b64c0316f 100644
--- a/paludis/package_dep_spec_constraint-fwd.hh
+++ b/paludis/package_dep_spec_constraint-fwd.hh
@@ -34,6 +34,9 @@ namespace paludis
class CategoryNamePartConstraint;
typedef Pool<CategoryNamePartConstraint> CategoryNamePartConstraintPool;
+
+ class InRepositoryConstraint;
+ typedef Pool<InRepositoryConstraint> InRepositoryConstraintPool;
}
#endif
diff --git a/paludis/package_dep_spec_constraint.cc b/paludis/package_dep_spec_constraint.cc
index 7ffa90406..2d5c6dfb0 100644
--- a/paludis/package_dep_spec_constraint.cc
+++ b/paludis/package_dep_spec_constraint.cc
@@ -80,3 +80,21 @@ template class Singleton<Pool<PackageNamePartConstraint> >;
template const std::shared_ptr<const PackageNamePartConstraint> Pool<PackageNamePartConstraint>::create(
const PackageNamePart &) const;
+InRepositoryConstraint::InRepositoryConstraint(const RepositoryName & n) :
+ _name(n)
+{
+}
+
+InRepositoryConstraint::~InRepositoryConstraint() = default;
+
+const RepositoryName
+InRepositoryConstraint::name() const
+{
+ return _name;
+}
+
+template class Pool<InRepositoryConstraint>;
+template class Singleton<Pool<InRepositoryConstraint> >;
+template const std::shared_ptr<const InRepositoryConstraint> Pool<InRepositoryConstraint>::create(
+ const RepositoryName &) const;
+
diff --git a/paludis/package_dep_spec_constraint.hh b/paludis/package_dep_spec_constraint.hh
index 34bf6440a..689c9ed7e 100644
--- a/paludis/package_dep_spec_constraint.hh
+++ b/paludis/package_dep_spec_constraint.hh
@@ -34,7 +34,8 @@ namespace paludis
public virtual DeclareAbstractAcceptMethods<PackageDepSpecConstraint, MakeTypeList<
NameConstraint,
PackageNamePartConstraint,
- CategoryNamePartConstraint
+ CategoryNamePartConstraint,
+ InRepositoryConstraint
>::Type>
{
public:
@@ -98,9 +99,29 @@ namespace paludis
const PackageNamePart name_part() const PALUDIS_ATTRIBUTE((warn_unused_result));
};
+ class PALUDIS_VISIBLE InRepositoryConstraint :
+ public PackageDepSpecConstraint,
+ public ImplementAcceptMethods<PackageDepSpecConstraint, InRepositoryConstraint>
+ {
+ friend class Pool<InRepositoryConstraint>;
+
+ private:
+ RepositoryName _name;
+
+ InRepositoryConstraint(const RepositoryName &);
+
+ InRepositoryConstraint(const InRepositoryConstraint &) = delete;
+
+ public:
+ ~InRepositoryConstraint();
+
+ const RepositoryName name() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ };
+
extern template class Pool<NameConstraint>;
extern template class Pool<PackageNamePartConstraint>;
extern template class Pool<CategoryNamePartConstraint>;
+ extern template class Pool<InRepositoryConstraint>;
}
#endif
diff --git a/paludis/package_dep_spec_properties.cc b/paludis/package_dep_spec_properties.cc
index d964df855..7ee076ad4 100644
--- a/paludis/package_dep_spec_properties.cc
+++ b/paludis/package_dep_spec_properties.cc
@@ -44,7 +44,7 @@ paludis::package_dep_spec_has_properties(const PackageDepSpec & spec, const Pack
result = result && check(bool(spec.additional_requirements_ptr()) && ! spec.additional_requirements_ptr()->empty(), properties.has_additional_requirements());
result = result && check(bool(spec.category_name_part_constraint()), properties.has_category_name_part());
result = result && check(bool(spec.from_repository_ptr()), properties.has_from_repository());
- result = result && check(bool(spec.in_repository_ptr()), properties.has_in_repository());
+ result = result && check(bool(spec.in_repository_constraint()), properties.has_in_repository());
result = result && check(bool(spec.installable_to_path_ptr()), properties.has_installable_to_path());
result = result && check(bool(spec.installable_to_repository_ptr()), properties.has_installable_to_repository());
result = result && check(bool(spec.installed_at_path_ptr()), properties.has_installed_at_path());
diff --git a/paludis/partially_made_package_dep_spec.cc b/paludis/partially_made_package_dep_spec.cc
index 98eca7ca9..018308811 100644
--- a/paludis/partially_made_package_dep_spec.cc
+++ b/paludis/partially_made_package_dep_spec.cc
@@ -54,7 +54,7 @@ namespace
std::shared_ptr<VersionRequirements> version_requirements;
VersionRequirementsMode version_requirements_mode_v;
std::shared_ptr<const SlotRequirement> slot;
- std::shared_ptr<const RepositoryName> in_repository;
+ std::shared_ptr<const InRepositoryConstraint> in_repository;
std::shared_ptr<const RepositoryName> from_repository;
std::shared_ptr<const InstallableToRepository> installable_to_repository;
std::shared_ptr<const FSPath> installed_at_path;
@@ -77,7 +77,7 @@ namespace
version_requirements(other.version_requirements_ptr() ? new VersionRequirements : 0),
version_requirements_mode_v(other.version_requirements_mode()),
slot(other.slot_requirement_ptr()),
- in_repository(other.in_repository_ptr()),
+ in_repository(other.in_repository_constraint()),
from_repository(other.from_repository_ptr()),
installable_to_repository(other.installable_to_repository_ptr()),
installed_at_path(other.installed_at_path_ptr()),
@@ -171,8 +171,8 @@ namespace
if (from_repository_ptr())
left = stringify(*from_repository_ptr());
- if (in_repository_ptr())
- right = stringify(*in_repository_ptr());
+ if (in_repository_constraint())
+ right = stringify(in_repository_constraint()->name());
if (installed_at_path_ptr())
{
@@ -308,7 +308,7 @@ namespace
return slot;
}
- virtual std::shared_ptr<const RepositoryName> in_repository_ptr() const
+ virtual const std::shared_ptr<const InRepositoryConstraint> in_repository_constraint() const
{
return in_repository;
}
@@ -419,7 +419,7 @@ PartiallyMadePackageDepSpec::clear_slot_requirement()
PartiallyMadePackageDepSpec &
PartiallyMadePackageDepSpec::in_repository(const RepositoryName & s)
{
- _imp->data->in_repository = std::make_shared<RepositoryName>(s);
+ _imp->data->in_repository = InRepositoryConstraintPool::get_instance()->create(s);
return *this;
}
diff --git a/paludis/user_dep_spec_TEST.cc b/paludis/user_dep_spec_TEST.cc
index 7e325da8a..a38d3b276 100644
--- a/paludis/user_dep_spec_TEST.cc
+++ b/paludis/user_dep_spec_TEST.cc
@@ -143,11 +143,11 @@ UserDepSpecTest::check_spec(
}
if (in_repository.empty())
- EXPECT_TRUE(! spec.in_repository_ptr());
+ EXPECT_TRUE(! spec.in_repository_constraint());
else
{
- EXPECT_TRUE(bool(spec.in_repository_ptr()));
- EXPECT_EQ(in_repository, stringify(*spec.in_repository_ptr()));
+ EXPECT_TRUE(bool(spec.in_repository_constraint()));
+ EXPECT_EQ(in_repository, stringify(spec.in_repository_constraint()->name()));
}
if (additional_requirement.empty())