diff options
author | 2011-03-29 15:26:48 +0100 | |
---|---|---|
committer | 2011-04-04 08:32:59 +0100 | |
commit | a004eeed5dda3432dcb1a4c0a865ae24daae4fd3 (patch) | |
tree | 69188ac33eeb2acd1860315e7f794a42f19e6358 | |
parent | 52a4c781098800f3b2831134f5e94434729c46a5 (diff) | |
download | paludis-a004eeed5dda3432dcb1a4c0a865ae24daae4fd3.tar.gz paludis-a004eeed5dda3432dcb1a4c0a865ae24daae4fd3.tar.xz |
installable to repository to requirements
-rw-r--r-- | doc/api/cplusplus/examples/example_dep_spec.cc | 6 | ||||
-rw-r--r-- | paludis/dep_spec-fwd.hh | 2 | ||||
-rw-r--r-- | paludis/dep_spec.cc | 6 | ||||
-rw-r--r-- | paludis/dep_spec.hh | 25 | ||||
-rw-r--r-- | paludis/dep_spec_data.hh | 6 | ||||
-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-- | python/package_dep_spec_constraint.cc | 19 | ||||
-rw-r--r-- | ruby/dep_spec.cc | 40 | ||||
-rw-r--r-- | ruby/dep_spec_TEST.rb | 13 | ||||
-rw-r--r-- | ruby/package_dep_spec_constraint.cc | 48 | ||||
-rw-r--r-- | src/clients/cave/cmd_print_spec.cc | 5 |
18 files changed, 171 insertions, 90 deletions
diff --git a/doc/api/cplusplus/examples/example_dep_spec.cc b/doc/api/cplusplus/examples/example_dep_spec.cc index 6a7fd690d..71b6c936b 100644 --- a/doc/api/cplusplus/examples/example_dep_spec.cc +++ b/doc/api/cplusplus/examples/example_dep_spec.cc @@ -118,10 +118,10 @@ int main(int argc, char * argv[]) spec.installable_to_path_constraint()->path() << ", " << spec.installable_to_path_constraint()->include_masked() << endl; - if (spec.installable_to_repository_ptr()) + if (spec.installable_to_repository_constraint()) cout << " " << left << setw(24) << "Installable to repository:" << " " << - spec.installable_to_repository_ptr()->repository() << ", " << - spec.installable_to_repository_ptr()->include_masked() << endl; + spec.installable_to_repository_constraint()->name() << ", " << + spec.installable_to_repository_constraint()->include_masked() << endl; if (spec.additional_requirements_ptr() && ! spec.additional_requirements_ptr()->empty()) { 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)); diff --git a/python/package_dep_spec_constraint.cc b/python/package_dep_spec_constraint.cc index 2d42cb5f1..e89f463d9 100644 --- a/python/package_dep_spec_constraint.cc +++ b/python/package_dep_spec_constraint.cc @@ -167,5 +167,24 @@ void expose_package_dep_spec_constraint() "[RO] Whether to include masked, as per ::/??" ) ; + + /** + * InstallableToRepositoryConstraint + */ + class_package_dep_spec_constraint<InstallableToRepositoryConstraint> + ( + "InstalledableToPathConstraint", + "A ::/? constraint for a PackageDepSpec.", + bp::no_init + ) + + .add_property("name", &InstallableToRepositoryConstraint::name, + "[RO] The ::repo? in question" + ) + + .add_property("include_masked", &InstallableToRepositoryConstraint::include_masked, + "[RO] Whether to include masked, as per ::repo??" + ) + ; } diff --git a/ruby/dep_spec.cc b/ruby/dep_spec.cc index aa377fc52..da98fb9f8 100644 --- a/ruby/dep_spec.cc +++ b/ruby/dep_spec.cc @@ -704,59 +704,53 @@ namespace /* * call-seq: - * installable_to_repository -> Hash or Nil + * installed_at_path_constraint -> + * InstalledAtPathConstraint or Nil * - * Fetch the installable-to-repository requirement. + * Fetch the installed-at-path requirement. */ VALUE - package_dep_spec_installable_to_repository(VALUE self) + package_dep_spec_installed_at_path_constraint(VALUE self) { std::shared_ptr<WrappedSpecBase> * ptr; Data_Get_Struct(self, std::shared_ptr<WrappedSpecBase>, ptr); - std::shared_ptr<const InstallableToRepository> i2r(std::static_pointer_cast<const WrappedSpec<PackageDepSpec> >(*ptr)->spec()->installable_to_repository_ptr()); - if (! i2r) + if (! bool(std::static_pointer_cast<const WrappedSpec<PackageDepSpec> >(*ptr)->spec()->installed_at_path_constraint())) return Qnil; - VALUE result(rb_hash_new()); - rb_hash_aset(result, ID2SYM(rb_intern("repository")), - rb_str_new2(stringify(i2r->repository()).c_str())); - rb_hash_aset(result, ID2SYM(rb_intern("include_masked?")), - i2r->include_masked() ? Qtrue : Qfalse); - return result; + return package_dep_spec_constraint_to_value(std::static_pointer_cast<const WrappedSpec<PackageDepSpec> >(*ptr)->spec()->installed_at_path_constraint()); } /* * call-seq: - * installed_at_path_constraint -> - * InstalledAtPathConstraint or Nil + * installable_to_path_constraint -> InstallableToPathConstraint or Nil * - * Fetch the installed-at-path requirement. + * Fetch the installable-to-path constraint. */ VALUE - package_dep_spec_installed_at_path_constraint(VALUE self) + package_dep_spec_installable_to_path_constraint(VALUE self) { std::shared_ptr<WrappedSpecBase> * ptr; Data_Get_Struct(self, std::shared_ptr<WrappedSpecBase>, ptr); - if (! bool(std::static_pointer_cast<const WrappedSpec<PackageDepSpec> >(*ptr)->spec()->installed_at_path_constraint())) + if (! bool(std::static_pointer_cast<const WrappedSpec<PackageDepSpec> >(*ptr)->spec()->installable_to_path_constraint())) return Qnil; - return package_dep_spec_constraint_to_value(std::static_pointer_cast<const WrappedSpec<PackageDepSpec> >(*ptr)->spec()->installed_at_path_constraint()); + return package_dep_spec_constraint_to_value( + std::static_pointer_cast<const WrappedSpec<PackageDepSpec> >(*ptr)->spec()->installable_to_path_constraint()); } /* * call-seq: - * installable_to_path_constraint -> - * InstallableToPathConstraintPool or Nil + * installable_to_path_constraint -> InstallableToRepositoryConstraint or Nil * * Fetch the installable-to-path constraint. */ VALUE - package_dep_spec_installable_to_path_constraint(VALUE self) + package_dep_spec_installable_to_repository_constraint(VALUE self) { std::shared_ptr<WrappedSpecBase> * ptr; Data_Get_Struct(self, std::shared_ptr<WrappedSpecBase>, ptr); - if (! bool(std::static_pointer_cast<const WrappedSpec<PackageDepSpec> >(*ptr)->spec()->installable_to_path_constraint())) + if (! bool(std::static_pointer_cast<const WrappedSpec<PackageDepSpec> >(*ptr)->spec()->installable_to_repository_constraint())) return Qnil; return package_dep_spec_constraint_to_value( - std::static_pointer_cast<const WrappedSpec<PackageDepSpec> >(*ptr)->spec()->installable_to_path_constraint()); + std::static_pointer_cast<const WrappedSpec<PackageDepSpec> >(*ptr)->spec()->installable_to_repository_constraint()); } /* @@ -1112,7 +1106,7 @@ namespace rb_define_method(c_package_dep_spec, "slot_requirement", RUBY_FUNC_CAST(&package_dep_spec_slot_requirement_ptr), 0); rb_define_method(c_package_dep_spec, "in_repository_constraint", RUBY_FUNC_CAST(&package_dep_spec_in_repository_constraint), 0); rb_define_method(c_package_dep_spec, "from_repository_constraint", RUBY_FUNC_CAST(&package_dep_spec_from_repository_constraint), 0); - rb_define_method(c_package_dep_spec, "installable_to_repository", RUBY_FUNC_CAST(&package_dep_spec_installable_to_repository), 0); + rb_define_method(c_package_dep_spec, "installable_to_repository_constraint", RUBY_FUNC_CAST(&package_dep_spec_installable_to_repository_constraint), 0); rb_define_method(c_package_dep_spec, "installed_at_path_constraint", RUBY_FUNC_CAST(&package_dep_spec_installed_at_path_constraint), 0); rb_define_method(c_package_dep_spec, "installable_to_path_constraint", RUBY_FUNC_CAST(&package_dep_spec_installable_to_path_constraint), 0); rb_define_method(c_package_dep_spec, "version_requirements", RUBY_FUNC_CAST(&package_dep_spec_version_requirements_ptr), 0); diff --git a/ruby/dep_spec_TEST.rb b/ruby/dep_spec_TEST.rb index 80e32f351..7e3db1b9c 100644 --- a/ruby/dep_spec_TEST.rb +++ b/ruby/dep_spec_TEST.rb @@ -164,13 +164,12 @@ module Paludis end def test_installable_to_repository - assert_nil pda.installable_to_repository - assert_nil pdb.installable_to_repository - assert_kind_of Hash, pdc.installable_to_repository - assert_equal "installed", pdc.installable_to_repository[:repository] - assert ! pdc.installable_to_repository[:include_masked?] - assert_nil pdd.installable_to_repository - assert_nil pde.installable_to_repository + assert_nil pda.installable_to_repository_constraint + assert_nil pdb.installable_to_repository_constraint + assert_equal "installed", pdc.installable_to_repository_constraint.name + assert ! pdc.installable_to_repository_constraint.include_masked? + assert_nil pdd.installable_to_repository_constraint + assert_nil pde.installable_to_repository_constraint end def test_installed_at_path diff --git a/ruby/package_dep_spec_constraint.cc b/ruby/package_dep_spec_constraint.cc index 360caab8e..4d4ed3852 100644 --- a/ruby/package_dep_spec_constraint.cc +++ b/ruby/package_dep_spec_constraint.cc @@ -38,6 +38,7 @@ namespace static VALUE c_from_repository_constraint; static VALUE c_installed_at_path_constraint; static VALUE c_installable_to_path_constraint; + static VALUE c_installable_to_repository_constraint; struct V { @@ -90,6 +91,12 @@ namespace value = Data_Wrap_Struct(c_installable_to_path_constraint, 0, &Common<std::shared_ptr<const PackageDepSpecConstraint> >::free, new std::shared_ptr<const PackageDepSpecConstraint>(mm)); } + + void visit(const InstallableToRepositoryConstraint &) + { + value = Data_Wrap_Struct(c_installable_to_repository_constraint, 0, &Common<std::shared_ptr<const PackageDepSpecConstraint> >::free, + new std::shared_ptr<const PackageDepSpecConstraint>(mm)); + } }; /* @@ -196,6 +203,32 @@ namespace return (std::static_pointer_cast<const InstallableToPathConstraint>(*ptr))->include_masked() ? Qtrue : Qfalse; } + /* + * Document-method: name + * + * The name constraint. + */ + static VALUE + installable_to_repository_constraint_name(VALUE self) + { + std::shared_ptr<const PackageDepSpecConstraint> * ptr; + Data_Get_Struct(self, std::shared_ptr<const PackageDepSpecConstraint>, ptr); + return rb_str_new2(stringify((std::static_pointer_cast<const InstallableToRepositoryConstraint>(*ptr))->name()).c_str()); + } + + /* + * Document-method: include_masked? + * + * The include-masked constraint. + */ + static VALUE + installable_to_repository_constraint_include_masked(VALUE self) + { + std::shared_ptr<const PackageDepSpecConstraint> * ptr; + Data_Get_Struct(self, std::shared_ptr<const PackageDepSpecConstraint>, ptr); + return (std::static_pointer_cast<const InstallableToRepositoryConstraint>(*ptr))->include_masked() ? Qtrue : Qfalse; + } + void do_register_package_dep_spec_constraint() { /* @@ -274,7 +307,7 @@ namespace /* * Document-class: Paludis::InstallableToPathConstraint * - * Represents a ::/ path constraint in a PackageDepSpec. + * Represents a ::/? path constraint in a PackageDepSpec. */ c_installable_to_path_constraint = rb_define_class_under( paludis_module(), "InRepositoryConstraint", c_package_dep_spec_constraint); @@ -283,6 +316,19 @@ namespace &installable_to_path_constraint_path), 0); rb_define_method(c_installable_to_path_constraint, "include_masked?", RUBY_FUNC_CAST( &installable_to_path_constraint_include_masked), 0); + + /* + * Document-class: Paludis::InstallableToRepositoryConstraint + * + * Represents a ::repo? repository constraint in a PackageDepSpec. + */ + c_installable_to_repository_constraint = rb_define_class_under( + paludis_module(), "InstallableToRepositoryConstraint", c_package_dep_spec_constraint); + rb_funcall(c_installable_to_repository_constraint, rb_intern("private_class_method"), 1, rb_str_new2("new")); + rb_define_method(c_installable_to_repository_constraint, "name", RUBY_FUNC_CAST( + &installable_to_repository_constraint_name), 0); + rb_define_method(c_installable_to_repository_constraint, "include_masked?", RUBY_FUNC_CAST( + &installable_to_repository_constraint_include_masked), 0); } } diff --git a/src/clients/cave/cmd_print_spec.cc b/src/clients/cave/cmd_print_spec.cc index 6bba880c0..e861e4934 100644 --- a/src/clients/cave/cmd_print_spec.cc +++ b/src/clients/cave/cmd_print_spec.cc @@ -166,10 +166,7 @@ namespace include_masked = true; } - s.installable_to_repository(make_named_values<InstallableToRepository>( - n::include_masked() = include_masked, - n::repository() = RepositoryName(repo) - )); + s.installable_to_repository(RepositoryName(repo), include_masked); } } |