aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2011-03-29 12:01:02 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2011-04-04 08:32:59 +0100
commit7d346bba37dfe95c858fa727bbc63bbc42074f30 (patch)
treec1cfaffcbe3f9bfd1b41ddef24d26372a8a2fb4b
parent5574c81a3c60266d023d18dfc115803da8b12e6b (diff)
downloadpaludis-7d346bba37dfe95c858fa727bbc63bbc42074f30.tar.gz
paludis-7d346bba37dfe95c858fa727bbc63bbc42074f30.tar.xz
in repository to requirements
-rw-r--r--doc/api/cplusplus/examples/example_dep_spec.cc4
-rw-r--r--paludis/dep_spec.cc6
-rw-r--r--paludis/dep_spec.hh7
-rw-r--r--paludis/dep_spec_data.hh6
-rw-r--r--paludis/fuzzy_finder.cc4
-rw-r--r--paludis/generator.cc9
-rw-r--r--paludis/match_package.cc4
-rw-r--r--paludis/package_dep_spec_constraint-fwd.hh3
-rw-r--r--paludis/package_dep_spec_constraint.cc18
-rw-r--r--paludis/package_dep_spec_constraint.hh23
-rw-r--r--paludis/package_dep_spec_properties.cc2
-rw-r--r--paludis/partially_made_package_dep_spec.cc12
-rw-r--r--paludis/user_dep_spec_TEST.cc6
-rw-r--r--python/dep_spec.cc22
-rw-r--r--python/dep_spec.hh2
-rwxr-xr-xpython/dep_spec_TEST.py2
-rw-r--r--python/package_dep_spec_constraint.cc15
-rw-r--r--ruby/dep_spec.cc10
-rw-r--r--ruby/dep_spec_TEST.rb10
-rw-r--r--ruby/package_dep_spec_constraint.cc31
-rw-r--r--src/clients/cave/cmd_graph_jobs.cc4
21 files changed, 146 insertions, 54 deletions
diff --git a/doc/api/cplusplus/examples/example_dep_spec.cc b/doc/api/cplusplus/examples/example_dep_spec.cc
index ba65dae..90d45bf 100644
--- a/doc/api/cplusplus/examples/example_dep_spec.cc
+++ b/doc/api/cplusplus/examples/example_dep_spec.cc
@@ -101,9 +101,9 @@ int main(int argc, char * argv[])
if (spec.slot_requirement_ptr())
cout << " " << left << setw(24) << "Slot:" << " " << *spec.slot_requirement_ptr() << endl;
- if (spec.in_repository_ptr())
+ if (spec.in_repository_constraint())
cout << " " << left << setw(24) << "In repository:" << " " <<
- *spec.in_repository_ptr() << endl;
+ spec.in_repository_constraint()->name() << endl;
if (spec.from_repository_ptr())
cout << " " << left << setw(24) << "From repository:" << " " <<
diff --git a/paludis/dep_spec.cc b/paludis/dep_spec.cc
index dac1df3..793a43c 100644
--- a/paludis/dep_spec.cc
+++ b/paludis/dep_spec.cc
@@ -578,10 +578,10 @@ PackageDepSpec::slot_requirement_ptr() const
return _imp->data->slot_requirement_ptr();
}
-std::shared_ptr<const RepositoryName>
-PackageDepSpec::in_repository_ptr() const
+const std::shared_ptr<const InRepositoryConstraint>
+PackageDepSpec::in_repository_constraint() const
{
- return _imp->data->in_repository_ptr();
+ return _imp->data->in_repository_constraint();
}
std::shared_ptr<const InstallableToRepository>
diff --git a/paludis/dep_spec.hh b/paludis/dep_spec.hh
index 881b826..e2c4c16 100644
--- a/paludis/dep_spec.hh
+++ b/paludis/dep_spec.hh
@@ -387,9 +387,12 @@ namespace paludis
std::shared_ptr<const SlotRequirement> slot_requirement_ptr() const;
/**
- * Fetch the in-repository requirement (may be a zero pointer).
+ * Fetch the single InRepositoryConstraint, if we have one, or
+ * a null pointer otherwise.
+ *
+ * \since 0.61
*/
- std::shared_ptr<const RepositoryName> in_repository_ptr() const;
+ const std::shared_ptr<const InRepositoryConstraint> in_repository_constraint() const;
/**
* Fetch the installable-to-repository requirement (may be a zero pointer).
diff --git a/paludis/dep_spec_data.hh b/paludis/dep_spec_data.hh
index 53c1c62..70fbd86 100644
--- a/paludis/dep_spec_data.hh
+++ b/paludis/dep_spec_data.hh
@@ -153,9 +153,11 @@ namespace paludis
virtual std::shared_ptr<const SlotRequirement> slot_requirement_ptr() const = 0;
/**
- * Fetch the from-repository requirement (may be a zero pointer).
+ * Fetch the single InRepositoryConstraint, if we have one, or
+ * a null pointer otherwise.
*/
- virtual std::shared_ptr<const RepositoryName> in_repository_ptr() const = 0;
+ virtual const std::shared_ptr<const InRepositoryConstraint> in_repository_constraint() const
+ PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
/**
* Fetch the installable-to-repository requirement (may be a zero pointer).
diff --git a/paludis/fuzzy_finder.cc b/paludis/fuzzy_finder.cc
index a963165..097de08 100644
--- a/paludis/fuzzy_finder.cc
+++ b/paludis/fuzzy_finder.cc
@@ -150,8 +150,8 @@ FuzzyCandidatesFinder::FuzzyCandidatesFinder(const Environment & e, const std::s
package = stringify(pds.package_name_constraint()->name().package());
}
- if (pds.in_repository_ptr())
- g = g & generator::InRepository(*pds.in_repository_ptr());
+ if (pds.in_repository_constraint())
+ g = g & generator::InRepository(pds.in_repository_constraint()->name());
if (pds.from_repository_ptr())
g = g & generator::FromRepository(*pds.from_repository_ptr());
diff --git a/paludis/generator.cc b/paludis/generator.cc
index 5602195..f8b7996 100644
--- a/paludis/generator.cc
+++ b/paludis/generator.cc
@@ -322,21 +322,20 @@ namespace
std::shared_ptr<RepositoryNameSet> result(std::make_shared<RepositoryNameSet>());
- if (spec.in_repository_ptr())
+ if (spec.in_repository_constraint())
{
- if (env->has_repository_named(*spec.in_repository_ptr()))
+ if (env->has_repository_named(spec.in_repository_constraint()->name()))
{
if (spec.installed_at_path_ptr())
{
- std::shared_ptr<const Repository> repo(env->fetch_repository(
- *spec.in_repository_ptr()));
+ 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())
return result;
}
- result->insert(*spec.in_repository_ptr());
+ result->insert(spec.in_repository_constraint()->name());
}
}
else
diff --git a/paludis/match_package.cc b/paludis/match_package.cc
index f9eb55e..436514d 100644
--- a/paludis/match_package.cc
+++ b/paludis/match_package.cc
@@ -126,8 +126,8 @@ paludis::match_package_with_maybe_changes(
;
}
- if (spec.in_repository_ptr())
- if (*spec.in_repository_ptr() != id->repository_name())
+ if (spec.in_repository_constraint())
+ if (spec.in_repository_constraint()->name() != id->repository_name())
return false;
if (spec.from_repository_ptr())
diff --git a/paludis/package_dep_spec_constraint-fwd.hh b/paludis/package_dep_spec_constraint-fwd.hh
index 24284f3..b64c031 100644
--- a/paludis/package_dep_spec_constraint-fwd.hh
+++ b/paludis/package_dep_spec_constraint-fwd.hh
@@ -34,6 +34,9 @@ namespace paludis
class CategoryNamePartConstraint;
typedef Pool<CategoryNamePartConstraint> CategoryNamePartConstraintPool;
+
+ class InRepositoryConstraint;
+ typedef Pool<InRepositoryConstraint> InRepositoryConstraintPool;
}
#endif
diff --git a/paludis/package_dep_spec_constraint.cc b/paludis/package_dep_spec_constraint.cc
index 7ffa904..2d5c6df 100644
--- a/paludis/package_dep_spec_constraint.cc
+++ b/paludis/package_dep_spec_constraint.cc
@@ -80,3 +80,21 @@ template class Singleton<Pool<PackageNamePartConstraint> >;
template const std::shared_ptr<const PackageNamePartConstraint> Pool<PackageNamePartConstraint>::create(
const PackageNamePart &) const;
+InRepositoryConstraint::InRepositoryConstraint(const RepositoryName & n) :
+ _name(n)
+{
+}
+
+InRepositoryConstraint::~InRepositoryConstraint() = default;
+
+const RepositoryName
+InRepositoryConstraint::name() const
+{
+ return _name;
+}
+
+template class Pool<InRepositoryConstraint>;
+template class Singleton<Pool<InRepositoryConstraint> >;
+template const std::shared_ptr<const InRepositoryConstraint> Pool<InRepositoryConstraint>::create(
+ const RepositoryName &) const;
+
diff --git a/paludis/package_dep_spec_constraint.hh b/paludis/package_dep_spec_constraint.hh
index 34bf644..689c9ed 100644
--- a/paludis/package_dep_spec_constraint.hh
+++ b/paludis/package_dep_spec_constraint.hh
@@ -34,7 +34,8 @@ namespace paludis
public virtual DeclareAbstractAcceptMethods<PackageDepSpecConstraint, MakeTypeList<
NameConstraint,
PackageNamePartConstraint,
- CategoryNamePartConstraint
+ CategoryNamePartConstraint,
+ InRepositoryConstraint
>::Type>
{
public:
@@ -98,9 +99,29 @@ namespace paludis
const PackageNamePart name_part() const PALUDIS_ATTRIBUTE((warn_unused_result));
};
+ class PALUDIS_VISIBLE InRepositoryConstraint :
+ public PackageDepSpecConstraint,
+ public ImplementAcceptMethods<PackageDepSpecConstraint, InRepositoryConstraint>
+ {
+ friend class Pool<InRepositoryConstraint>;
+
+ private:
+ RepositoryName _name;
+
+ InRepositoryConstraint(const RepositoryName &);
+
+ InRepositoryConstraint(const InRepositoryConstraint &) = delete;
+
+ public:
+ ~InRepositoryConstraint();
+
+ const RepositoryName name() 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>;
}
#endif
diff --git a/paludis/package_dep_spec_properties.cc b/paludis/package_dep_spec_properties.cc
index d964df8..7ee076a 100644
--- a/paludis/package_dep_spec_properties.cc
+++ b/paludis/package_dep_spec_properties.cc
@@ -44,7 +44,7 @@ paludis::package_dep_spec_has_properties(const PackageDepSpec & spec, const Pack
result = result && check(bool(spec.additional_requirements_ptr()) && ! spec.additional_requirements_ptr()->empty(), properties.has_additional_requirements());
result = result && check(bool(spec.category_name_part_constraint()), properties.has_category_name_part());
result = result && check(bool(spec.from_repository_ptr()), properties.has_from_repository());
- result = result && check(bool(spec.in_repository_ptr()), properties.has_in_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_repository_ptr()), properties.has_installable_to_repository());
result = result && check(bool(spec.installed_at_path_ptr()), properties.has_installed_at_path());
diff --git a/paludis/partially_made_package_dep_spec.cc b/paludis/partially_made_package_dep_spec.cc
index 98eca7c..0183088 100644
--- a/paludis/partially_made_package_dep_spec.cc
+++ b/paludis/partially_made_package_dep_spec.cc
@@ -54,7 +54,7 @@ namespace
std::shared_ptr<VersionRequirements> version_requirements;
VersionRequirementsMode version_requirements_mode_v;
std::shared_ptr<const SlotRequirement> slot;
- std::shared_ptr<const RepositoryName> in_repository;
+ std::shared_ptr<const InRepositoryConstraint> in_repository;
std::shared_ptr<const RepositoryName> from_repository;
std::shared_ptr<const InstallableToRepository> installable_to_repository;
std::shared_ptr<const FSPath> installed_at_path;
@@ -77,7 +77,7 @@ namespace
version_requirements(other.version_requirements_ptr() ? new VersionRequirements : 0),
version_requirements_mode_v(other.version_requirements_mode()),
slot(other.slot_requirement_ptr()),
- in_repository(other.in_repository_ptr()),
+ in_repository(other.in_repository_constraint()),
from_repository(other.from_repository_ptr()),
installable_to_repository(other.installable_to_repository_ptr()),
installed_at_path(other.installed_at_path_ptr()),
@@ -171,8 +171,8 @@ namespace
if (from_repository_ptr())
left = stringify(*from_repository_ptr());
- if (in_repository_ptr())
- right = stringify(*in_repository_ptr());
+ if (in_repository_constraint())
+ right = stringify(in_repository_constraint()->name());
if (installed_at_path_ptr())
{
@@ -308,7 +308,7 @@ namespace
return slot;
}
- virtual std::shared_ptr<const RepositoryName> in_repository_ptr() const
+ virtual const std::shared_ptr<const InRepositoryConstraint> in_repository_constraint() const
{
return in_repository;
}
@@ -419,7 +419,7 @@ PartiallyMadePackageDepSpec::clear_slot_requirement()
PartiallyMadePackageDepSpec &
PartiallyMadePackageDepSpec::in_repository(const RepositoryName & s)
{
- _imp->data->in_repository = std::make_shared<RepositoryName>(s);
+ _imp->data->in_repository = InRepositoryConstraintPool::get_instance()->create(s);
return *this;
}
diff --git a/paludis/user_dep_spec_TEST.cc b/paludis/user_dep_spec_TEST.cc
index 7e325da..a38d3b2 100644
--- a/paludis/user_dep_spec_TEST.cc
+++ b/paludis/user_dep_spec_TEST.cc
@@ -143,11 +143,11 @@ UserDepSpecTest::check_spec(
}
if (in_repository.empty())
- EXPECT_TRUE(! spec.in_repository_ptr());
+ EXPECT_TRUE(! spec.in_repository_constraint());
else
{
- EXPECT_TRUE(bool(spec.in_repository_ptr()));
- EXPECT_EQ(in_repository, stringify(*spec.in_repository_ptr()));
+ EXPECT_TRUE(bool(spec.in_repository_constraint()));
+ EXPECT_EQ(in_repository, stringify(spec.in_repository_constraint()->name()));
}
if (additional_requirement.empty())
diff --git a/python/dep_spec.cc b/python/dep_spec.cc
index a602f25..c3c75e0 100644
--- a/python/dep_spec.cc
+++ b/python/dep_spec.cc
@@ -79,7 +79,7 @@ namespace paludis
std::shared_ptr<VersionRequirements> version_requirements;
VersionRequirementsMode version_requirements_mode;
std::shared_ptr<const SlotRequirement> slot;
- std::shared_ptr<const RepositoryName> in_repository;
+ std::shared_ptr<const InRepositoryConstraint> in_repository;
std::shared_ptr<const RepositoryName> from_repository;
std::shared_ptr<const AdditionalPackageDepSpecRequirements> additional_requirements;
const std::string str;
@@ -91,7 +91,7 @@ namespace paludis
const std::shared_ptr<VersionRequirements> & v,
const VersionRequirementsMode m,
const std::shared_ptr<const SlotRequirement> & s,
- const std::shared_ptr<const RepositoryName> & ri,
+ const std::shared_ptr<const InRepositoryConstraint> & ri,
const std::shared_ptr<const RepositoryName> & rf,
const std::shared_ptr<const AdditionalPackageDepSpecRequirements> & u,
const std::string & st) :
@@ -229,7 +229,7 @@ PythonPackageDepSpec::PythonPackageDepSpec(const PackageDepSpec & p) :
std::make_shared<VersionRequirements>(),
p.version_requirements_mode(),
p.slot_requirement_ptr(),
- deep_copy(p.in_repository_ptr()),
+ p.in_repository_constraint(),
deep_copy(p.from_repository_ptr()),
p.additional_requirements_ptr(),
stringify(p))
@@ -250,7 +250,7 @@ PythonPackageDepSpec::PythonPackageDepSpec(const PythonPackageDepSpec & p) :
std::make_shared<VersionRequirements>(),
p.version_requirements_mode(),
p.slot_requirement_ptr(),
- deep_copy(p.in_repository_ptr()),
+ p.in_repository_constraint(),
deep_copy(p.from_repository_ptr()),
p.additional_requirements_ptr(),
p.py_str())
@@ -281,8 +281,8 @@ PythonPackageDepSpec::operator PackageDepSpec() const
if (slot_requirement_ptr())
p.slot_requirement(slot_requirement_ptr());
- if (in_repository_ptr())
- p.in_repository(*in_repository_ptr());
+ if (in_repository_constraint())
+ p.in_repository(in_repository_constraint()->name());
if (from_repository_ptr())
p.from_repository(*from_repository_ptr());
@@ -352,8 +352,8 @@ PythonPackageDepSpec::slot_requirement_ptr() const
return _imp->slot;
}
-std::shared_ptr<const RepositoryName>
-PythonPackageDepSpec::in_repository_ptr() const
+const std::shared_ptr<const InRepositoryConstraint>
+PythonPackageDepSpec::in_repository_constraint() const
{
return _imp->in_repository;
}
@@ -1233,9 +1233,9 @@ void expose_dep_spec()
)
#endif
- .add_property("in_repository", &PythonPackageDepSpec::in_repository_ptr,
- "[ro] RepositoryName\n"
- "In repository name (may be None)."
+ .add_property("in_repository_constraint", &PythonPackageDepSpec::in_repository_constraint,
+ "[ro] InRepositoryConstraint\n"
+ "In repository constraint (may be None)."
)
diff --git a/python/dep_spec.hh b/python/dep_spec.hh
index e36d85a..6993062 100644
--- a/python/dep_spec.hh
+++ b/python/dep_spec.hh
@@ -175,12 +175,12 @@ namespace paludis
const std::shared_ptr<const NameConstraint> package_name_constraint() const;
const std::shared_ptr<const PackageNamePartConstraint> package_name_part_constraint() const;
const std::shared_ptr<const CategoryNamePartConstraint> category_name_part_constraint() const;
+ const std::shared_ptr<const InRepositoryConstraint> in_repository_constraint() const;
std::shared_ptr<const VersionRequirements> version_requirements_ptr() const;
VersionRequirementsMode version_requirements_mode() const;
void set_version_requirements_mode(const VersionRequirementsMode m);
std::shared_ptr<const SlotRequirement> slot_requirement_ptr() const;
- std::shared_ptr<const RepositoryName> in_repository_ptr() const;
std::shared_ptr<const RepositoryName> from_repository_ptr() const;
std::shared_ptr<const AdditionalPackageDepSpecRequirements> additional_requirements_ptr() const;
diff --git a/python/dep_spec_TEST.py b/python/dep_spec_TEST.py
index d762401..b81aabf 100755
--- a/python/dep_spec_TEST.py
+++ b/python/dep_spec_TEST.py
@@ -68,7 +68,7 @@ class TestCase_1_DepSpecs(unittest.TestCase):
def test_06_in_from_repository(self):
self.get_depspecs()
- self.assertEqual(str(self.pds.in_repository), "testrepo")
+ self.assertEqual(str(self.pds.in_repository_constraint.name), "testrepo")
self.assertEqual(self.pds.from_repository, None)
def test_07_version_requirements(self):
diff --git a/python/package_dep_spec_constraint.cc b/python/package_dep_spec_constraint.cc
index 686bdf3..6b4a9d3 100644
--- a/python/package_dep_spec_constraint.cc
+++ b/python/package_dep_spec_constraint.cc
@@ -103,5 +103,20 @@ void expose_package_dep_spec_constraint()
"[RO] The cat/ in question"
)
;
+
+ /**
+ * InRepositoryConstraint
+ */
+ class_package_dep_spec_constraint<InRepositoryConstraint>
+ (
+ "InRepositoryConstraint",
+ "A ::repo constraint for a PackageDepSpec.",
+ bp::no_init
+ )
+
+ .add_property("name", &InRepositoryConstraint::name,
+ "[RO] The ::repo name in question"
+ )
+ ;
}
diff --git a/ruby/dep_spec.cc b/ruby/dep_spec.cc
index 4584a2e..8da8626 100644
--- a/ruby/dep_spec.cc
+++ b/ruby/dep_spec.cc
@@ -672,18 +672,18 @@ namespace
/*
* call-seq:
- * in_repository -> String or Nil
+ * in_repository_constraint -> InRepositoryConstraint or Nil
*
* Fetch the in-repository name.
*/
VALUE
- package_dep_spec_in_repository_ptr(VALUE self)
+ package_dep_spec_in_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()->in_repository_ptr()))
+ if (! bool(std::static_pointer_cast<const WrappedSpec<PackageDepSpec> >(*ptr)->spec()->in_repository_constraint()))
return Qnil;
- return rb_str_new2(stringify((*std::static_pointer_cast<const WrappedSpec<PackageDepSpec> >(*ptr)->spec()->in_repository_ptr())).c_str());
+ return package_dep_spec_constraint_to_value(std::static_pointer_cast<const WrappedSpec<PackageDepSpec> >(*ptr)->spec()->in_repository_constraint());
}
/*
@@ -1113,7 +1113,7 @@ namespace
rb_define_method(c_package_dep_spec, "package_name_part_constraint", RUBY_FUNC_CAST(&package_dep_spec_package_name_part_constraint), 0);
rb_define_method(c_package_dep_spec, "category_name_part_constraint", RUBY_FUNC_CAST(&package_dep_spec_category_name_part_constraint), 0);
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", RUBY_FUNC_CAST(&package_dep_spec_in_repository_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", RUBY_FUNC_CAST(&package_dep_spec_from_repository_ptr), 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, "installed_at_path", RUBY_FUNC_CAST(&package_dep_spec_installed_at_path), 0);
diff --git a/ruby/dep_spec_TEST.rb b/ruby/dep_spec_TEST.rb
index 7c58554..1a1e2b1 100644
--- a/ruby/dep_spec_TEST.rb
+++ b/ruby/dep_spec_TEST.rb
@@ -156,11 +156,11 @@ module Paludis
end
def test_in_repository
- assert_equal "testrepo", pda.in_repository
- assert_nil pdb.in_repository
- assert_nil pdc.in_repository
- assert_nil pdd.in_repository
- assert_nil pde.in_repository
+ assert_equal "testrepo", pda.in_repository_constraint.name
+ assert_nil pdb.in_repository_constraint
+ assert_nil pdc.in_repository_constraint
+ assert_nil pdd.in_repository_constraint
+ assert_nil pde.in_repository_constraint
end
def test_installable_to_repository
diff --git a/ruby/package_dep_spec_constraint.cc b/ruby/package_dep_spec_constraint.cc
index 925b70e..1ae743d 100644
--- a/ruby/package_dep_spec_constraint.cc
+++ b/ruby/package_dep_spec_constraint.cc
@@ -34,6 +34,7 @@ namespace
static VALUE c_name_constraint;
static VALUE c_package_name_part_constraint;
static VALUE c_category_name_part_constraint;
+ static VALUE c_in_repository_constraint;
struct V
{
@@ -62,6 +63,12 @@ namespace
value = Data_Wrap_Struct(c_package_name_part_constraint, 0, &Common<std::shared_ptr<const PackageDepSpecConstraint> >::free,
new std::shared_ptr<const PackageDepSpecConstraint>(mm));
}
+
+ void visit(const InRepositoryConstraint &)
+ {
+ value = Data_Wrap_Struct(c_in_repository_constraint, 0, &Common<std::shared_ptr<const PackageDepSpecConstraint> >::free,
+ new std::shared_ptr<const PackageDepSpecConstraint>(mm));
+ }
};
/*
@@ -103,6 +110,19 @@ namespace
return rb_str_new2(stringify((std::static_pointer_cast<const CategoryNamePartConstraint>(*ptr))->name_part()).c_str());
}
+ /*
+ * Document-method: name
+ *
+ * The name constraint.
+ */
+ static VALUE
+ in_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 InRepositoryConstraint>(*ptr))->name()).c_str());
+ }
+
void do_register_package_dep_spec_constraint()
{
/*
@@ -144,6 +164,17 @@ namespace
rb_funcall(c_category_name_part_constraint, rb_intern("private_class_method"), 1, rb_str_new2("new"));
rb_define_method(c_category_name_part_constraint, "name_part", RUBY_FUNC_CAST(
&category_name_part_constraint_name_part), 0);
+
+ /*
+ * Document-class: Paludis::InRepositoryConstraint
+ *
+ * Represents a /pkg name constraint in a PackageDepSpec.
+ */
+ c_in_repository_constraint = rb_define_class_under(
+ paludis_module(), "InRepositoryConstraint", c_package_dep_spec_constraint);
+ rb_funcall(c_in_repository_constraint, rb_intern("private_class_method"), 1, rb_str_new2("new"));
+ rb_define_method(c_in_repository_constraint, "name", RUBY_FUNC_CAST(
+ &in_repository_constraint_name), 0);
}
}
diff --git a/src/clients/cave/cmd_graph_jobs.cc b/src/clients/cave/cmd_graph_jobs.cc
index 2d1019b..b573f28 100644
--- a/src/clients/cave/cmd_graph_jobs.cc
+++ b/src/clients/cave/cmd_graph_jobs.cc
@@ -98,8 +98,8 @@ namespace
std::string result(stringify(p.package_name_constraint()->name().package()));
if (p.slot_requirement_ptr())
result = result + stringify(*p.slot_requirement_ptr());
- if (p.in_repository_ptr())
- result = result + "::" + stringify(*p.in_repository_ptr());
+ if (p.in_repository_constraint())
+ result = result + "::" + stringify(p.in_repository_constraint()->name());
return result;
}
}