diff options
author | 2011-03-29 13:23:41 +0100 | |
---|---|---|
committer | 2011-04-04 08:32:59 +0100 | |
commit | bc262ad74eb8d80eb979a5c5591b222d5fc1eb36 (patch) | |
tree | 6da646abbdea2c1948347abe2679fa1f79be1d15 /paludis | |
parent | 63ca918976505d042587bf7591dfce41b206b8cc (diff) | |
download | paludis-bc262ad74eb8d80eb979a5c5591b222d5fc1eb36.tar.gz paludis-bc262ad74eb8d80eb979a5c5591b222d5fc1eb36.tar.xz |
installed at path to requirements
Diffstat (limited to 'paludis')
-rw-r--r-- | paludis/dep_spec.cc | 6 | ||||
-rw-r--r-- | paludis/dep_spec.hh | 7 | ||||
-rw-r--r-- | paludis/dep_spec_data.hh | 7 | ||||
-rw-r--r-- | paludis/generator.cc | 8 | ||||
-rw-r--r-- | paludis/match_package.cc | 4 | ||||
-rw-r--r-- | paludis/package_dep_spec_constraint-fwd.hh | 3 | ||||
-rw-r--r-- | paludis/package_dep_spec_constraint.cc | 18 | ||||
-rw-r--r-- | paludis/package_dep_spec_constraint.hh | 24 | ||||
-rw-r--r-- | paludis/package_dep_spec_properties.cc | 2 | ||||
-rw-r--r-- | paludis/partially_made_package_dep_spec.cc | 12 | ||||
-rw-r--r-- | paludis/user_dep_spec_TEST.cc | 6 |
11 files changed, 71 insertions, 26 deletions
diff --git a/paludis/dep_spec.cc b/paludis/dep_spec.cc index da912dfe3..8d254ea80 100644 --- a/paludis/dep_spec.cc +++ b/paludis/dep_spec.cc @@ -596,10 +596,10 @@ PackageDepSpec::from_repository_constraint() const return _imp->data->from_repository_constraint(); } -std::shared_ptr<const FSPath> -PackageDepSpec::installed_at_path_ptr() const +const std::shared_ptr<const InstalledAtPathConstraint> +PackageDepSpec::installed_at_path_constraint() const { - return _imp->data->installed_at_path_ptr(); + return _imp->data->installed_at_path_constraint(); } std::shared_ptr<const InstallableToPath> diff --git a/paludis/dep_spec.hh b/paludis/dep_spec.hh index 5af03b39b..5058aa677 100644 --- a/paludis/dep_spec.hh +++ b/paludis/dep_spec.hh @@ -408,11 +408,12 @@ namespace paludis const std::shared_ptr<const FromRepositoryConstraint> from_repository_constraint() const; /** - * Fetch the installed-at-path requirement (may be a zero pointer). + * Fetch the single InstalledAtPathConstraint, if we have one, or + * a null pointer otherwise. * - * \since 0.32 + * \since 0.61 */ - std::shared_ptr<const FSPath> installed_at_path_ptr() const; + const std::shared_ptr<const InstalledAtPathConstraint> installed_at_path_constraint() const; /** * Fetch the installable-to-path requirement (may be a zero pointer). diff --git a/paludis/dep_spec_data.hh b/paludis/dep_spec_data.hh index 20af6bdf2..b94d5df91 100644 --- a/paludis/dep_spec_data.hh +++ b/paludis/dep_spec_data.hh @@ -177,11 +177,12 @@ namespace paludis virtual const std::shared_ptr<const FromRepositoryConstraint> from_repository_constraint() const = 0; /** - * Fetch the installed-at-path requirement (may be a zero pointer). + * Fetch the single InstalledAtPathConstraint, if we have one, or + * a null pointer otherwise. * - * \since 0.32 + * \since 0.61 */ - virtual std::shared_ptr<const FSPath> installed_at_path_ptr() const = 0; + virtual const std::shared_ptr<const InstalledAtPathConstraint> installed_at_path_constraint() const = 0; /** * Fetch the installable-to-path requirement (may be a zero pointer). diff --git a/paludis/generator.cc b/paludis/generator.cc index f8b7996f9..1484bbb29 100644 --- a/paludis/generator.cc +++ b/paludis/generator.cc @@ -326,12 +326,12 @@ namespace { if (env->has_repository_named(spec.in_repository_constraint()->name())) { - if (spec.installed_at_path_ptr()) + if (spec.installed_at_path_constraint()) { 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()) + if (repo->installed_root_key()->value() != spec.installed_at_path_constraint()->path()) return result; } @@ -340,7 +340,7 @@ namespace } else { - if (spec.installed_at_path_ptr()) + if (spec.installed_at_path_constraint()) { for (auto i(env->begin_repositories()), i_end(env->end_repositories()) ; i != i_end ; ++i) @@ -348,7 +348,7 @@ namespace if (! (*i)->installed_root_key()) continue; - if ((*i)->installed_root_key()->value() != *spec.installed_at_path_ptr()) + if ((*i)->installed_root_key()->value() != spec.installed_at_path_constraint()->path()) continue; result->insert((*i)->name()); diff --git a/paludis/match_package.cc b/paludis/match_package.cc index f5bd18396..5c77b1dca 100644 --- a/paludis/match_package.cc +++ b/paludis/match_package.cc @@ -140,12 +140,12 @@ paludis::match_package_with_maybe_changes( return false; } - if (spec.installed_at_path_ptr()) + if (spec.installed_at_path_constraint()) { auto repo(env.fetch_repository(id->repository_name())); if (! repo->installed_root_key()) return false; - if (repo->installed_root_key()->value() != *spec.installed_at_path_ptr()) + if (repo->installed_root_key()->value() != spec.installed_at_path_constraint()->path()) return false; } diff --git a/paludis/package_dep_spec_constraint-fwd.hh b/paludis/package_dep_spec_constraint-fwd.hh index 630976518..e395b31bd 100644 --- a/paludis/package_dep_spec_constraint-fwd.hh +++ b/paludis/package_dep_spec_constraint-fwd.hh @@ -40,6 +40,9 @@ namespace paludis class FromRepositoryConstraint; typedef Pool<FromRepositoryConstraint> FromRepositoryConstraintPool; + + class InstalledAtPathConstraint; + typedef Pool<InstalledAtPathConstraint> InstalledAtPathConstraintPool; } #endif diff --git a/paludis/package_dep_spec_constraint.cc b/paludis/package_dep_spec_constraint.cc index 39b4ee597..fe1d9cac3 100644 --- a/paludis/package_dep_spec_constraint.cc +++ b/paludis/package_dep_spec_constraint.cc @@ -116,3 +116,21 @@ template class Singleton<Pool<FromRepositoryConstraint> >; template const std::shared_ptr<const FromRepositoryConstraint> Pool<FromRepositoryConstraint>::create( const RepositoryName &) const; +InstalledAtPathConstraint::InstalledAtPathConstraint(const FSPath & n) : + _path(n) +{ +} + +InstalledAtPathConstraint::~InstalledAtPathConstraint() = default; + +const FSPath +InstalledAtPathConstraint::path() const +{ + return _path; +} + +template class Pool<InstalledAtPathConstraint>; +template class Singleton<Pool<InstalledAtPathConstraint> >; +template const std::shared_ptr<const InstalledAtPathConstraint> Pool<InstalledAtPathConstraint>::create( + const FSPath &) const; + diff --git a/paludis/package_dep_spec_constraint.hh b/paludis/package_dep_spec_constraint.hh index 261707319..88eae4559 100644 --- a/paludis/package_dep_spec_constraint.hh +++ b/paludis/package_dep_spec_constraint.hh @@ -27,6 +27,7 @@ #include <paludis/util/pool.hh> #include <paludis/util/visitor.hh> #include <paludis/util/type_list.hh> +#include <paludis/util/fs_path.hh> namespace paludis { @@ -36,7 +37,8 @@ namespace paludis PackageNamePartConstraint, CategoryNamePartConstraint, InRepositoryConstraint, - FromRepositoryConstraint + FromRepositoryConstraint, + InstalledAtPathConstraint >::Type> { public: @@ -138,11 +140,31 @@ namespace paludis const RepositoryName name() const PALUDIS_ATTRIBUTE((warn_unused_result)); }; + class PALUDIS_VISIBLE InstalledAtPathConstraint : + public PackageDepSpecConstraint, + public ImplementAcceptMethods<PackageDepSpecConstraint, InstalledAtPathConstraint> + { + friend class Pool<InstalledAtPathConstraint>; + + private: + FSPath _path; + + InstalledAtPathConstraint(const FSPath &); + + InstalledAtPathConstraint(const InstalledAtPathConstraint &) = delete; + + public: + ~InstalledAtPathConstraint(); + + const FSPath path() 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>; } #endif diff --git a/paludis/package_dep_spec_properties.cc b/paludis/package_dep_spec_properties.cc index 11e038b83..394395b48 100644 --- a/paludis/package_dep_spec_properties.cc +++ b/paludis/package_dep_spec_properties.cc @@ -47,7 +47,7 @@ paludis::package_dep_spec_has_properties(const PackageDepSpec & spec, const Pack 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()); + 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()); result = result && check(bool(spec.slot_requirement_ptr()), properties.has_slot_requirement()); diff --git a/paludis/partially_made_package_dep_spec.cc b/paludis/partially_made_package_dep_spec.cc index 9f4e7f764..5454f00c3 100644 --- a/paludis/partially_made_package_dep_spec.cc +++ b/paludis/partially_made_package_dep_spec.cc @@ -57,7 +57,7 @@ namespace 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 FSPath> installed_at_path; + std::shared_ptr<const InstalledAtPathConstraint> installed_at_path; std::shared_ptr<const InstallableToPath> installable_to_path; std::shared_ptr<AdditionalPackageDepSpecRequirements> additional_requirements; PartiallyMadePackageDepSpecOptions options_for_partially_made_package_dep_spec_v; @@ -80,7 +80,7 @@ namespace in_repository(other.in_repository_constraint()), from_repository(other.from_repository_constraint()), installable_to_repository(other.installable_to_repository_ptr()), - installed_at_path(other.installed_at_path_ptr()), + installed_at_path(other.installed_at_path_constraint()), installable_to_path(other.installable_to_path_ptr()), 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()) @@ -174,14 +174,14 @@ namespace if (in_repository_constraint()) right = stringify(in_repository_constraint()->name()); - if (installed_at_path_ptr()) + if (installed_at_path_constraint()) { if (! right.empty()) { need_arrow = true; right.append("->"); } - right.append(stringify(*installed_at_path_ptr())); + right.append(stringify(installed_at_path_constraint()->path())); } if (installable_to_repository_ptr()) @@ -323,7 +323,7 @@ namespace return from_repository; } - virtual std::shared_ptr<const FSPath> installed_at_path_ptr() const + virtual const std::shared_ptr<const InstalledAtPathConstraint> installed_at_path_constraint() const { return installed_at_path; } @@ -461,7 +461,7 @@ PartiallyMadePackageDepSpec::clear_installable_to_repository() PartiallyMadePackageDepSpec & PartiallyMadePackageDepSpec::installed_at_path(const FSPath & s) { - _imp->data->installed_at_path = std::make_shared<FSPath>(s); + _imp->data->installed_at_path = InstalledAtPathConstraintPool::get_instance()->create(s); return *this; } diff --git a/paludis/user_dep_spec_TEST.cc b/paludis/user_dep_spec_TEST.cc index d18b9f35a..73461f001 100644 --- a/paludis/user_dep_spec_TEST.cc +++ b/paludis/user_dep_spec_TEST.cc @@ -161,11 +161,11 @@ UserDepSpecTest::check_spec( } if (installed_at_path.empty()) - EXPECT_TRUE(! spec.installed_at_path_ptr()); + EXPECT_TRUE(! spec.installed_at_path_constraint()); else { - EXPECT_TRUE(bool(spec.installed_at_path_ptr())); - EXPECT_EQ(installed_at_path, stringify(*spec.installed_at_path_ptr())); + EXPECT_TRUE(bool(spec.installed_at_path_constraint())); + EXPECT_EQ(installed_at_path, stringify(spec.installed_at_path_constraint()->path())); } if (installable_to_path_f.empty()) |