aboutsummaryrefslogtreecommitdiff
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
parent52a4c781098800f3b2831134f5e94434729c46a5 (diff)
downloadpaludis-a004eeed5dda3432dcb1a4c0a865ae24daae4fd3.tar.gz
paludis-a004eeed5dda3432dcb1a4c0a865ae24daae4fd3.tar.xz
installable to repository to requirements
-rw-r--r--doc/api/cplusplus/examples/example_dep_spec.cc6
-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
-rw-r--r--python/package_dep_spec_constraint.cc19
-rw-r--r--ruby/dep_spec.cc40
-rw-r--r--ruby/dep_spec_TEST.rb13
-rw-r--r--ruby/package_dep_spec_constraint.cc48
-rw-r--r--src/clients/cave/cmd_print_spec.cc5
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 6a7fd69..71b6c93 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 69eb4e0..a5f8552 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 3428c81..4b5fe74 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 1b6bffd..d99e9f1 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 1f03c0d..4652caf 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 199d75c..9995bf3 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 3f55dcb..b949a2b 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 a597a88..dc1f4ad 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 0843a01..7e71bd6 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 11d5717..dbb057f 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 5d31cb4..5de8177 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 b982a1f..6eb9d5f 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 f18bfcb..f2590cd 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 2d42cb5..e89f463 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 aa377fc..da98fb9 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 80e32f3..7e3db1b 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 360caab..4d4ed38 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 6bba880..e861e49 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);
}
}