aboutsummaryrefslogtreecommitdiff
path: root/paludis
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2011-03-29 15:26:48 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2011-04-04 08:32:59 +0100
commita004eeed5dda3432dcb1a4c0a865ae24daae4fd3 (patch)
tree69188ac33eeb2acd1860315e7f794a42f19e6358 /paludis
parent52a4c781098800f3b2831134f5e94434729c46a5 (diff)
downloadpaludis-a004eeed5dda3432dcb1a4c0a865ae24daae4fd3.tar.gz
paludis-a004eeed5dda3432dcb1a4c0a865ae24daae4fd3.tar.xz
installable to repository to requirements
Diffstat (limited to 'paludis')
-rw-r--r--paludis/dep_spec-fwd.hh2
-rw-r--r--paludis/dep_spec.cc6
-rw-r--r--paludis/dep_spec.hh25
-rw-r--r--paludis/dep_spec_data.hh6
-rw-r--r--paludis/match_package.cc6
-rw-r--r--paludis/package_dep_spec_constraint-fwd.hh3
-rw-r--r--paludis/package_dep_spec_constraint.cc25
-rw-r--r--paludis/package_dep_spec_constraint.hh25
-rw-r--r--paludis/package_dep_spec_properties.cc2
-rw-r--r--paludis/partially_made_package_dep_spec.cc18
-rw-r--r--paludis/partially_made_package_dep_spec.hh4
-rw-r--r--paludis/user_dep_spec.cc8
12 files changed, 78 insertions, 52 deletions
diff --git a/paludis/dep_spec-fwd.hh b/paludis/dep_spec-fwd.hh
index 69eb4e01b..a5f855222 100644
--- a/paludis/dep_spec-fwd.hh
+++ b/paludis/dep_spec-fwd.hh
@@ -64,8 +64,6 @@ namespace paludis
*/
typedef LabelsDepSpec<DependenciesLabel> DependenciesLabelsDepSpec;
- struct InstallableToRepository;
-
/**
* A PlainTextDepSpec can be written to an ostream.
*
diff --git a/paludis/dep_spec.cc b/paludis/dep_spec.cc
index 3428c81c0..4b5fe744b 100644
--- a/paludis/dep_spec.cc
+++ b/paludis/dep_spec.cc
@@ -584,10 +584,10 @@ PackageDepSpec::in_repository_constraint() const
return _imp->data->in_repository_constraint();
}
-std::shared_ptr<const InstallableToRepository>
-PackageDepSpec::installable_to_repository_ptr() const
+const std::shared_ptr<const InstallableToRepositoryConstraint>
+PackageDepSpec::installable_to_repository_constraint() const
{
- return _imp->data->installable_to_repository_ptr();
+ return _imp->data->installable_to_repository_constraint();
}
const std::shared_ptr<const FromRepositoryConstraint>
diff --git a/paludis/dep_spec.hh b/paludis/dep_spec.hh
index 1b6bffd52..d99e9f154 100644
--- a/paludis/dep_spec.hh
+++ b/paludis/dep_spec.hh
@@ -265,25 +265,6 @@ namespace paludis
std::string text() const;
};
- namespace n
- {
- typedef Name<struct name_include_masked> include_masked;
- typedef Name<struct name_path> path;
- typedef Name<struct name_repository> repository;
- }
-
- /**
- * Data for PackageDepSpec.installable_to_repository_ptr() etc.
- *
- * \ingroup g_dep_spec
- * \since 0.32
- */
- struct InstallableToRepository
- {
- NamedValue<n::include_masked, bool> include_masked;
- NamedValue<n::repository, RepositoryName> repository;
- };
-
/**
* A PackageDepSpec represents a package name (for example,
* 'app-editors/vim'), possibly with associated version and SLOT
@@ -383,11 +364,11 @@ namespace paludis
const std::shared_ptr<const InRepositoryConstraint> in_repository_constraint() const;
/**
- * Fetch the installable-to-repository requirement (may be a zero pointer).
+ * Fetch the single InstallableToRepositoryConstraint, if we have one, or
*
- * \since 0.32
+ * \since 0.61
*/
- std::shared_ptr<const InstallableToRepository> installable_to_repository_ptr() const;
+ const std::shared_ptr<const InstallableToRepositoryConstraint> installable_to_repository_constraint() const;
/**
* Fetch the single FromRepositoryConstraint, if we have one, or
diff --git a/paludis/dep_spec_data.hh b/paludis/dep_spec_data.hh
index 1f03c0d5b..4652caf2f 100644
--- a/paludis/dep_spec_data.hh
+++ b/paludis/dep_spec_data.hh
@@ -162,11 +162,11 @@ namespace paludis
PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
/**
- * Fetch the installable-to-repository requirement (may be a zero pointer).
+ * Fetch the single InstallableToRepositoryConstraint, if we have one, or
*
- * \since 0.32
+ * \since 0.61
*/
- virtual std::shared_ptr<const InstallableToRepository> installable_to_repository_ptr() const = 0;
+ virtual const std::shared_ptr<const InstallableToRepositoryConstraint> installable_to_repository_constraint() const = 0;
/**
* Fetch the single FromRepositoryConstraint, if we have one, or
diff --git a/paludis/match_package.cc b/paludis/match_package.cc
index 199d75c1b..9995bf35f 100644
--- a/paludis/match_package.cc
+++ b/paludis/match_package.cc
@@ -149,16 +149,16 @@ paludis::match_package_with_maybe_changes(
return false;
}
- if (spec.installable_to_repository_ptr())
+ if (spec.installable_to_repository_constraint())
{
if (! id->supports_action(SupportsActionTest<InstallAction>()))
return false;
- if (! spec.installable_to_repository_ptr()->include_masked())
+ if (! spec.installable_to_repository_constraint()->include_masked())
if (id->masked())
return false;
const std::shared_ptr<const Repository> dest(env.fetch_repository(
- spec.installable_to_repository_ptr()->repository()));
+ spec.installable_to_repository_constraint()->name()));
if (! dest->destination_interface())
return false;
if (! dest->destination_interface()->is_suitable_destination_for(id))
diff --git a/paludis/package_dep_spec_constraint-fwd.hh b/paludis/package_dep_spec_constraint-fwd.hh
index 3f55dcbbc..b949a2b7f 100644
--- a/paludis/package_dep_spec_constraint-fwd.hh
+++ b/paludis/package_dep_spec_constraint-fwd.hh
@@ -46,6 +46,9 @@ namespace paludis
class InstallableToPathConstraint;
typedef Pool<InstallableToPathConstraint> InstallableToPathConstraintPool;
+
+ class InstallableToRepositoryConstraint;
+ typedef Pool<InstallableToRepositoryConstraint> InstallableToRepositoryConstraintPool;
}
#endif
diff --git a/paludis/package_dep_spec_constraint.cc b/paludis/package_dep_spec_constraint.cc
index a597a88ee..dc1f4ad65 100644
--- a/paludis/package_dep_spec_constraint.cc
+++ b/paludis/package_dep_spec_constraint.cc
@@ -159,3 +159,28 @@ template class Singleton<Pool<InstallableToPathConstraint> >;
template const std::shared_ptr<const InstallableToPathConstraint> Pool<InstallableToPathConstraint>::create(
const FSPath &, const bool & ...) const;
+InstallableToRepositoryConstraint::InstallableToRepositoryConstraint(const RepositoryName & n, const bool i) :
+ _name(n),
+ _include_masked(i)
+{
+}
+
+InstallableToRepositoryConstraint::~InstallableToRepositoryConstraint() = default;
+
+const RepositoryName
+InstallableToRepositoryConstraint::name() const
+{
+ return _name;
+}
+
+bool
+InstallableToRepositoryConstraint::include_masked() const
+{
+ return _include_masked;
+}
+
+template class Pool<InstallableToRepositoryConstraint>;
+template class Singleton<Pool<InstallableToRepositoryConstraint> >;
+template const std::shared_ptr<const InstallableToRepositoryConstraint> Pool<InstallableToRepositoryConstraint>::create(
+ const RepositoryName &, const bool & ...) const;
+
diff --git a/paludis/package_dep_spec_constraint.hh b/paludis/package_dep_spec_constraint.hh
index 0843a0130..7e71bd646 100644
--- a/paludis/package_dep_spec_constraint.hh
+++ b/paludis/package_dep_spec_constraint.hh
@@ -39,7 +39,8 @@ namespace paludis
InRepositoryConstraint,
FromRepositoryConstraint,
InstalledAtPathConstraint,
- InstallableToPathConstraint
+ InstallableToPathConstraint,
+ InstallableToRepositoryConstraint
>::Type>
{
public:
@@ -181,6 +182,27 @@ namespace paludis
bool include_masked() const PALUDIS_ATTRIBUTE((warn_unused_result));
};
+ class PALUDIS_VISIBLE InstallableToRepositoryConstraint :
+ public PackageDepSpecConstraint,
+ public ImplementAcceptMethods<PackageDepSpecConstraint, InstallableToRepositoryConstraint>
+ {
+ friend class Pool<InstallableToRepositoryConstraint>;
+
+ private:
+ RepositoryName _name;
+ bool _include_masked;
+
+ InstallableToRepositoryConstraint(const RepositoryName &, const bool);
+
+ InstallableToRepositoryConstraint(const InstallableToRepositoryConstraint &) = delete;
+
+ public:
+ ~InstallableToRepositoryConstraint();
+
+ const RepositoryName name() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ bool include_masked() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ };
+
extern template class Pool<NameConstraint>;
extern template class Pool<PackageNamePartConstraint>;
extern template class Pool<CategoryNamePartConstraint>;
@@ -188,6 +210,7 @@ namespace paludis
extern template class Pool<FromRepositoryConstraint>;
extern template class Pool<InstalledAtPathConstraint>;
extern template class Pool<InstallableToPathConstraint>;
+ extern template class Pool<InstallableToRepositoryConstraint>;
}
#endif
diff --git a/paludis/package_dep_spec_properties.cc b/paludis/package_dep_spec_properties.cc
index 11d5717b4..dbb057fad 100644
--- a/paludis/package_dep_spec_properties.cc
+++ b/paludis/package_dep_spec_properties.cc
@@ -46,7 +46,7 @@ paludis::package_dep_spec_has_properties(const PackageDepSpec & spec, const Pack
result = result && check(bool(spec.from_repository_constraint()), properties.has_from_repository());
result = result && check(bool(spec.in_repository_constraint()), properties.has_in_repository());
result = result && check(bool(spec.installable_to_path_constraint()), properties.has_installable_to_path());
- result = result && check(bool(spec.installable_to_repository_ptr()), properties.has_installable_to_repository());
+ result = result && check(bool(spec.installable_to_repository_constraint()), properties.has_installable_to_repository());
result = result && check(bool(spec.installed_at_path_constraint()), properties.has_installed_at_path());
result = result && check(bool(spec.package_name_constraint()), properties.has_package());
result = result && check(bool(spec.package_name_part_constraint()), properties.has_package_name_part());
diff --git a/paludis/partially_made_package_dep_spec.cc b/paludis/partially_made_package_dep_spec.cc
index 5d31cb426..5de8177f4 100644
--- a/paludis/partially_made_package_dep_spec.cc
+++ b/paludis/partially_made_package_dep_spec.cc
@@ -56,7 +56,7 @@ namespace
std::shared_ptr<const SlotRequirement> slot;
std::shared_ptr<const InRepositoryConstraint> in_repository;
std::shared_ptr<const FromRepositoryConstraint> from_repository;
- std::shared_ptr<const InstallableToRepository> installable_to_repository;
+ std::shared_ptr<const InstallableToRepositoryConstraint> installable_to_repository;
std::shared_ptr<const InstalledAtPathConstraint> installed_at_path;
std::shared_ptr<const InstallableToPathConstraint> installable_to_path;
std::shared_ptr<AdditionalPackageDepSpecRequirements> additional_requirements;
@@ -79,7 +79,7 @@ namespace
slot(other.slot_requirement_ptr()),
in_repository(other.in_repository_constraint()),
from_repository(other.from_repository_constraint()),
- installable_to_repository(other.installable_to_repository_ptr()),
+ installable_to_repository(other.installable_to_repository_constraint()),
installed_at_path(other.installed_at_path_constraint()),
installable_to_path(other.installable_to_path_constraint()),
additional_requirements(other.additional_requirements_ptr() ? new AdditionalPackageDepSpecRequirements : 0),
@@ -184,17 +184,17 @@ namespace
right.append(stringify(installed_at_path_constraint()->path()));
}
- if (installable_to_repository_ptr())
+ if (installable_to_repository_constraint())
{
if (! right.empty())
{
need_arrow = true;
right.append("->");
}
- if (installable_to_repository_ptr()->include_masked())
- right.append(stringify(installable_to_repository_ptr()->repository()) + "??");
+ if (installable_to_repository_constraint()->include_masked())
+ right.append(stringify(installable_to_repository_constraint()->name()) + "??");
else
- right.append(stringify(installable_to_repository_ptr()->repository()) + "?");
+ right.append(stringify(installable_to_repository_constraint()->name()) + "?");
}
if (installable_to_path_constraint())
@@ -313,7 +313,7 @@ namespace
return in_repository;
}
- virtual std::shared_ptr<const InstallableToRepository> installable_to_repository_ptr() const
+ virtual const std::shared_ptr<const InstallableToRepositoryConstraint> installable_to_repository_constraint() const
{
return installable_to_repository;
}
@@ -445,9 +445,9 @@ PartiallyMadePackageDepSpec::clear_from_repository()
}
PartiallyMadePackageDepSpec &
-PartiallyMadePackageDepSpec::installable_to_repository(const InstallableToRepository & s)
+PartiallyMadePackageDepSpec::installable_to_repository(const RepositoryName & n, const bool i)
{
- _imp->data->installable_to_repository = std::make_shared<InstallableToRepository>(s);
+ _imp->data->installable_to_repository = InstallableToRepositoryConstraintPool::get_instance()->create(n, i);
return *this;
}
diff --git a/paludis/partially_made_package_dep_spec.hh b/paludis/partially_made_package_dep_spec.hh
index b982a1fe2..6eb9d5ff7 100644
--- a/paludis/partially_made_package_dep_spec.hh
+++ b/paludis/partially_made_package_dep_spec.hh
@@ -101,9 +101,9 @@ namespace paludis
/**
* Set our installable-to-repository requirement, return ourself.
*
- * \since 0.32
+ * \since 0.61
*/
- PartiallyMadePackageDepSpec & installable_to_repository(const InstallableToRepository &);
+ PartiallyMadePackageDepSpec & installable_to_repository(const RepositoryName &, const bool);
/**
* Clear our installable-to-repository requirement, return ourself.
diff --git a/paludis/user_dep_spec.cc b/paludis/user_dep_spec.cc
index f18bfcb6f..f2590cd8a 100644
--- a/paludis/user_dep_spec.cc
+++ b/paludis/user_dep_spec.cc
@@ -273,13 +273,9 @@ namespace
if ('?' == req.at(req.length() - 1))
{
if (req.length() >= 3 && '?' == req.at(req.length() - 2))
- reqs.installable_to_repository(make_named_values<InstallableToRepository>(
- n::include_masked() = true,
- n::repository() = RepositoryName(req.substr(0, req.length() - 2))));
+ reqs.installable_to_repository(RepositoryName(req.substr(0, req.length() - 2)), true);
else
- reqs.installable_to_repository(make_named_values<InstallableToRepository>(
- n::include_masked() = false,
- n::repository() = RepositoryName(req.substr(0, req.length() - 1))));
+ reqs.installable_to_repository(RepositoryName(req.substr(0, req.length() - 1)), false);
}
else
reqs.in_repository(RepositoryName(req));