diff options
author | 2011-03-29 14:43:22 +0100 | |
---|---|---|
committer | 2011-04-04 08:32:59 +0100 | |
commit | 52a4c781098800f3b2831134f5e94434729c46a5 (patch) | |
tree | 55499ba5305132e315d51633332ee18289df5adb /paludis | |
parent | bc262ad74eb8d80eb979a5c5591b222d5fc1eb36 (diff) | |
download | paludis-52a4c781098800f3b2831134f5e94434729c46a5.tar.gz paludis-52a4c781098800f3b2831134f5e94434729c46a5.tar.xz |
installable to path to requirements
Diffstat (limited to 'paludis')
-rw-r--r-- | paludis/dep_spec-fwd.hh | 1 | ||||
-rw-r--r-- | paludis/dep_spec.cc | 6 | ||||
-rw-r--r-- | paludis/dep_spec.hh | 19 | ||||
-rw-r--r-- | paludis/dep_spec_data.hh | 7 | ||||
-rw-r--r-- | paludis/match_package.cc | 6 | ||||
-rw-r--r-- | paludis/package_dep_spec_constraint-fwd.hh | 3 | ||||
-rw-r--r-- | paludis/package_dep_spec_constraint.cc | 25 | ||||
-rw-r--r-- | paludis/package_dep_spec_constraint.hh | 25 | ||||
-rw-r--r-- | paludis/package_dep_spec_properties.cc | 2 | ||||
-rw-r--r-- | paludis/partially_made_package_dep_spec.cc | 18 | ||||
-rw-r--r-- | paludis/partially_made_package_dep_spec.hh | 4 | ||||
-rw-r--r-- | paludis/user_dep_spec.cc | 8 | ||||
-rw-r--r-- | paludis/user_dep_spec_TEST.cc | 8 |
13 files changed, 84 insertions, 48 deletions
diff --git a/paludis/dep_spec-fwd.hh b/paludis/dep_spec-fwd.hh index 51128b675..69eb4e01b 100644 --- a/paludis/dep_spec-fwd.hh +++ b/paludis/dep_spec-fwd.hh @@ -65,7 +65,6 @@ namespace paludis typedef LabelsDepSpec<DependenciesLabel> DependenciesLabelsDepSpec; struct InstallableToRepository; - struct InstallableToPath; /** * A PlainTextDepSpec can be written to an ostream. diff --git a/paludis/dep_spec.cc b/paludis/dep_spec.cc index 8d254ea80..3428c81c0 100644 --- a/paludis/dep_spec.cc +++ b/paludis/dep_spec.cc @@ -602,10 +602,10 @@ PackageDepSpec::installed_at_path_constraint() const return _imp->data->installed_at_path_constraint(); } -std::shared_ptr<const InstallableToPath> -PackageDepSpec::installable_to_path_ptr() const +const std::shared_ptr<const InstallableToPathConstraint> +PackageDepSpec::installable_to_path_constraint() const { - return _imp->data->installable_to_path_ptr(); + return _imp->data->installable_to_path_constraint(); } std::shared_ptr<const AdditionalPackageDepSpecRequirements> diff --git a/paludis/dep_spec.hh b/paludis/dep_spec.hh index 5058aa677..1b6bffd52 100644 --- a/paludis/dep_spec.hh +++ b/paludis/dep_spec.hh @@ -285,18 +285,6 @@ namespace paludis }; /** - * Data for PackageDepSpec.installable_to_path_ptr() etc. - * - * \ingroup g_dep_spec - * \since 0.32 - */ - struct InstallableToPath - { - NamedValue<n::include_masked, bool> include_masked; - NamedValue<n::path, FSPath> path; - }; - - /** * A PackageDepSpec represents a package name (for example, * 'app-editors/vim'), possibly with associated version and SLOT * restrictions. @@ -416,11 +404,12 @@ namespace paludis const std::shared_ptr<const InstalledAtPathConstraint> installed_at_path_constraint() const; /** - * Fetch the installable-to-path requirement (may be a zero pointer). + * Fetch the single InstallableToPathConstraint, if we have one, or + * a null pointer otherwise. * - * \since 0.32 + * \since 0.61 */ - std::shared_ptr<const InstallableToPath> installable_to_path_ptr() const; + const std::shared_ptr<const InstallableToPathConstraint> installable_to_path_constraint() const; /** * Fetch any additional requirements (may be a zero pointer). diff --git a/paludis/dep_spec_data.hh b/paludis/dep_spec_data.hh index b94d5df91..1f03c0d5b 100644 --- a/paludis/dep_spec_data.hh +++ b/paludis/dep_spec_data.hh @@ -185,11 +185,12 @@ namespace paludis virtual const std::shared_ptr<const InstalledAtPathConstraint> installed_at_path_constraint() const = 0; /** - * Fetch the installable-to-path requirement (may be a zero pointer). + * Fetch the single InstallableToPathConstraint, if we have one, or + * a null pointer otherwise. * - * \since 0.32 + * \since 0.61 */ - virtual std::shared_ptr<const InstallableToPath> installable_to_path_ptr() const = 0; + virtual const std::shared_ptr<const InstallableToPathConstraint> installable_to_path_constraint() const = 0; /** * Fetch the additional requirements (may be a zero pointer). diff --git a/paludis/match_package.cc b/paludis/match_package.cc index 5c77b1dca..199d75c1b 100644 --- a/paludis/match_package.cc +++ b/paludis/match_package.cc @@ -165,11 +165,11 @@ paludis::match_package_with_maybe_changes( return false; } - if (spec.installable_to_path_ptr()) + if (spec.installable_to_path_constraint()) { if (! id->supports_action(SupportsActionTest<InstallAction>())) return false; - if (! spec.installable_to_path_ptr()->include_masked()) + if (! spec.installable_to_path_constraint()->include_masked()) if (id->masked()) return false; @@ -181,7 +181,7 @@ paludis::match_package_with_maybe_changes( continue; if (! (*d)->installed_root_key()) continue; - if ((*d)->installed_root_key()->value() != spec.installable_to_path_ptr()->path()) + if ((*d)->installed_root_key()->value() != spec.installable_to_path_constraint()->path()) continue; if (! (*d)->destination_interface()->is_suitable_destination_for(id)) continue; diff --git a/paludis/package_dep_spec_constraint-fwd.hh b/paludis/package_dep_spec_constraint-fwd.hh index e395b31bd..3f55dcbbc 100644 --- a/paludis/package_dep_spec_constraint-fwd.hh +++ b/paludis/package_dep_spec_constraint-fwd.hh @@ -43,6 +43,9 @@ namespace paludis class InstalledAtPathConstraint; typedef Pool<InstalledAtPathConstraint> InstalledAtPathConstraintPool; + + class InstallableToPathConstraint; + typedef Pool<InstallableToPathConstraint> InstallableToPathConstraintPool; } #endif diff --git a/paludis/package_dep_spec_constraint.cc b/paludis/package_dep_spec_constraint.cc index fe1d9cac3..a597a88ee 100644 --- a/paludis/package_dep_spec_constraint.cc +++ b/paludis/package_dep_spec_constraint.cc @@ -134,3 +134,28 @@ template class Singleton<Pool<InstalledAtPathConstraint> >; template const std::shared_ptr<const InstalledAtPathConstraint> Pool<InstalledAtPathConstraint>::create( const FSPath &) const; +InstallableToPathConstraint::InstallableToPathConstraint(const FSPath & n, const bool i) : + _path(n), + _include_masked(i) +{ +} + +InstallableToPathConstraint::~InstallableToPathConstraint() = default; + +const FSPath +InstallableToPathConstraint::path() const +{ + return _path; +} + +bool +InstallableToPathConstraint::include_masked() const +{ + return _include_masked; +} + +template class Pool<InstallableToPathConstraint>; +template class Singleton<Pool<InstallableToPathConstraint> >; +template const std::shared_ptr<const InstallableToPathConstraint> Pool<InstallableToPathConstraint>::create( + const FSPath &, const bool & ...) const; + diff --git a/paludis/package_dep_spec_constraint.hh b/paludis/package_dep_spec_constraint.hh index 88eae4559..0843a0130 100644 --- a/paludis/package_dep_spec_constraint.hh +++ b/paludis/package_dep_spec_constraint.hh @@ -38,7 +38,8 @@ namespace paludis CategoryNamePartConstraint, InRepositoryConstraint, FromRepositoryConstraint, - InstalledAtPathConstraint + InstalledAtPathConstraint, + InstallableToPathConstraint >::Type> { public: @@ -159,12 +160,34 @@ namespace paludis const FSPath path() const PALUDIS_ATTRIBUTE((warn_unused_result)); }; + class PALUDIS_VISIBLE InstallableToPathConstraint : + public PackageDepSpecConstraint, + public ImplementAcceptMethods<PackageDepSpecConstraint, InstallableToPathConstraint> + { + friend class Pool<InstallableToPathConstraint>; + + private: + FSPath _path; + bool _include_masked; + + InstallableToPathConstraint(const FSPath &, const bool); + + InstallableToPathConstraint(const InstallableToPathConstraint &) = delete; + + public: + ~InstallableToPathConstraint(); + + const FSPath path() 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>; extern template class Pool<InRepositoryConstraint>; extern template class Pool<FromRepositoryConstraint>; extern template class Pool<InstalledAtPathConstraint>; + extern template class Pool<InstallableToPathConstraint>; } #endif diff --git a/paludis/package_dep_spec_properties.cc b/paludis/package_dep_spec_properties.cc index 394395b48..11d5717b4 100644 --- a/paludis/package_dep_spec_properties.cc +++ b/paludis/package_dep_spec_properties.cc @@ -45,7 +45,7 @@ paludis::package_dep_spec_has_properties(const PackageDepSpec & spec, const Pack result = result && check(bool(spec.category_name_part_constraint()), properties.has_category_name_part()); 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_ptr()), properties.has_installable_to_path()); + 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.installed_at_path_constraint()), properties.has_installed_at_path()); result = result && check(bool(spec.package_name_constraint()), properties.has_package()); diff --git a/paludis/partially_made_package_dep_spec.cc b/paludis/partially_made_package_dep_spec.cc index 5454f00c3..5d31cb426 100644 --- a/paludis/partially_made_package_dep_spec.cc +++ b/paludis/partially_made_package_dep_spec.cc @@ -58,7 +58,7 @@ namespace std::shared_ptr<const FromRepositoryConstraint> from_repository; std::shared_ptr<const InstallableToRepository> installable_to_repository; std::shared_ptr<const InstalledAtPathConstraint> installed_at_path; - std::shared_ptr<const InstallableToPath> installable_to_path; + std::shared_ptr<const InstallableToPathConstraint> installable_to_path; std::shared_ptr<AdditionalPackageDepSpecRequirements> additional_requirements; PartiallyMadePackageDepSpecOptions options_for_partially_made_package_dep_spec_v; @@ -81,7 +81,7 @@ namespace from_repository(other.from_repository_constraint()), installable_to_repository(other.installable_to_repository_ptr()), installed_at_path(other.installed_at_path_constraint()), - installable_to_path(other.installable_to_path_ptr()), + installable_to_path(other.installable_to_path_constraint()), additional_requirements(other.additional_requirements_ptr() ? new AdditionalPackageDepSpecRequirements : 0), options_for_partially_made_package_dep_spec_v(other.options_for_partially_made_package_dep_spec()) { @@ -197,17 +197,17 @@ namespace right.append(stringify(installable_to_repository_ptr()->repository()) + "?"); } - if (installable_to_path_ptr()) + if (installable_to_path_constraint()) { if (! right.empty()) { need_arrow = true; right.append("->"); } - if (installable_to_path_ptr()->include_masked()) - right.append(stringify(installable_to_path_ptr()->path()) + "??"); + if (installable_to_path_constraint()->include_masked()) + right.append(stringify(installable_to_path_constraint()->path()) + "??"); else - right.append(stringify(installable_to_path_ptr()->path()) + "?"); + right.append(stringify(installable_to_path_constraint()->path()) + "?"); } if (need_arrow || ((! left.empty()) && (! right.empty()))) @@ -328,7 +328,7 @@ namespace return installed_at_path; } - virtual std::shared_ptr<const InstallableToPath> installable_to_path_ptr() const + virtual const std::shared_ptr<const InstallableToPathConstraint> installable_to_path_constraint() const { return installable_to_path; } @@ -473,9 +473,9 @@ PartiallyMadePackageDepSpec::clear_installed_at_path() } PartiallyMadePackageDepSpec & -PartiallyMadePackageDepSpec::installable_to_path(const InstallableToPath & s) +PartiallyMadePackageDepSpec::installable_to_path(const FSPath & s, const bool i) { - _imp->data->installable_to_path = std::make_shared<InstallableToPath>(s); + _imp->data->installable_to_path = InstallableToPathConstraintPool::get_instance()->create(s, i); return *this; } diff --git a/paludis/partially_made_package_dep_spec.hh b/paludis/partially_made_package_dep_spec.hh index 4f08730f6..b982a1fe2 100644 --- a/paludis/partially_made_package_dep_spec.hh +++ b/paludis/partially_made_package_dep_spec.hh @@ -129,9 +129,9 @@ namespace paludis /** * Set our installable-to-path requirement, return ourself. * - * \since 0.32 + * \since 0.61 */ - PartiallyMadePackageDepSpec & installable_to_path(const InstallableToPath &); + PartiallyMadePackageDepSpec & installable_to_path(const FSPath &, const bool include_masked); /** * Clear our installable-to-path requirement, return ourself. diff --git a/paludis/user_dep_spec.cc b/paludis/user_dep_spec.cc index 0e10a2fa2..f18bfcb6f 100644 --- a/paludis/user_dep_spec.cc +++ b/paludis/user_dep_spec.cc @@ -261,13 +261,9 @@ namespace if ('?' == req.at(req.length() - 1)) { if (req.length() >= 2 && '?' == req.at(req.length() - 2)) - reqs.installable_to_path(make_named_values<InstallableToPath>( - n::include_masked() = true, - n::path() = FSPath(req.substr(0, req.length() - 2)))); + reqs.installable_to_path(FSPath(req.substr(0, req.length() - 2)), true); else - reqs.installable_to_path(make_named_values<InstallableToPath>( - n::include_masked() = false, - n::path() = FSPath(req.substr(0, req.length() - 1)))); + reqs.installable_to_path(FSPath(req.substr(0, req.length() - 1)), false); } else reqs.installed_at_path(FSPath(req)); diff --git a/paludis/user_dep_spec_TEST.cc b/paludis/user_dep_spec_TEST.cc index 73461f001..b8a69c35f 100644 --- a/paludis/user_dep_spec_TEST.cc +++ b/paludis/user_dep_spec_TEST.cc @@ -169,12 +169,12 @@ UserDepSpecTest::check_spec( } if (installable_to_path_f.empty()) - EXPECT_TRUE(! spec.installable_to_path_ptr()); + EXPECT_TRUE(! spec.installable_to_path_constraint()); else { - EXPECT_TRUE(bool(spec.installable_to_path_ptr())); - EXPECT_EQ(installable_to_path_f, stringify(spec.installable_to_path_ptr()->path())); - EXPECT_EQ(installable_to_path_s, spec.installable_to_path_ptr()->include_masked()); + EXPECT_TRUE(bool(spec.installable_to_path_constraint())); + EXPECT_EQ(installable_to_path_f, stringify(spec.installable_to_path_constraint()->path())); + EXPECT_EQ(installable_to_path_s, spec.installable_to_path_constraint()->include_masked()); } } |