aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2011-03-29 12:40:53 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2011-04-04 08:32:59 +0100
commit63ca918976505d042587bf7591dfce41b206b8cc (patch)
treef54fcf53236ecd673dffe431b3df5cbca3ffe9f0
parent7d346bba37dfe95c858fa727bbc63bbc42074f30 (diff)
downloadpaludis-63ca918976505d042587bf7591dfce41b206b8cc.tar.gz
paludis-63ca918976505d042587bf7591dfce41b206b8cc.tar.xz
from 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.hh5
-rw-r--r--paludis/dep_spec_data.hh9
-rw-r--r--paludis/fuzzy_finder.cc4
-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.cc12
-rw-r--r--ruby/dep_spec_TEST.rb10
-rw-r--r--ruby/package_dep_spec_constraint.cc31
19 files changed, 142 insertions, 48 deletions
diff --git a/doc/api/cplusplus/examples/example_dep_spec.cc b/doc/api/cplusplus/examples/example_dep_spec.cc
index 90d45bf..6ef4e86 100644
--- a/doc/api/cplusplus/examples/example_dep_spec.cc
+++ b/doc/api/cplusplus/examples/example_dep_spec.cc
@@ -105,9 +105,9 @@ int main(int argc, char * argv[])
cout << " " << left << setw(24) << "In repository:" << " " <<
spec.in_repository_constraint()->name() << endl;
- if (spec.from_repository_ptr())
+ if (spec.from_repository_constraint())
cout << " " << left << setw(24) << "From repository:" << " " <<
- *spec.from_repository_ptr() << endl;
+ spec.from_repository_constraint()->name() << endl;
if (spec.installed_at_path_ptr())
cout << " " << left << setw(24) << "Installed at path:" << " " <<
diff --git a/paludis/dep_spec.cc b/paludis/dep_spec.cc
index 793a43c..da912df 100644
--- a/paludis/dep_spec.cc
+++ b/paludis/dep_spec.cc
@@ -590,10 +590,10 @@ PackageDepSpec::installable_to_repository_ptr() const
return _imp->data->installable_to_repository_ptr();
}
-std::shared_ptr<const RepositoryName>
-PackageDepSpec::from_repository_ptr() const
+const std::shared_ptr<const FromRepositoryConstraint>
+PackageDepSpec::from_repository_constraint() const
{
- return _imp->data->from_repository_ptr();
+ return _imp->data->from_repository_constraint();
}
std::shared_ptr<const FSPath>
diff --git a/paludis/dep_spec.hh b/paludis/dep_spec.hh
index e2c4c16..5af03b3 100644
--- a/paludis/dep_spec.hh
+++ b/paludis/dep_spec.hh
@@ -402,9 +402,10 @@ namespace paludis
std::shared_ptr<const InstallableToRepository> installable_to_repository_ptr() const;
/**
- * Fetch the from-repository requirement (may be a zero pointer).
+ * Fetch the single FromRepositoryConstraint, if we have one, or
+ * a null pointer otherwise.
*/
- std::shared_ptr<const RepositoryName> from_repository_ptr() const;
+ const std::shared_ptr<const FromRepositoryConstraint> from_repository_constraint() const;
/**
* Fetch the installed-at-path requirement (may be a zero pointer).
diff --git a/paludis/dep_spec_data.hh b/paludis/dep_spec_data.hh
index 70fbd86..20af6bd 100644
--- a/paludis/dep_spec_data.hh
+++ b/paludis/dep_spec_data.hh
@@ -155,6 +155,8 @@ namespace paludis
/**
* Fetch the single InRepositoryConstraint, if we have one, or
* a null pointer otherwise.
+ *
+ * \since 0.61
*/
virtual const std::shared_ptr<const InRepositoryConstraint> in_repository_constraint() const
PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
@@ -167,9 +169,12 @@ namespace paludis
virtual std::shared_ptr<const InstallableToRepository> installable_to_repository_ptr() const = 0;
/**
- * Fetch the from-repository requirement (may be a zero pointer).
+ * Fetch the single FromRepositoryConstraint, if we have one, or
+ * a null pointer otherwise.
+ *
+ * \since 0.61
*/
- virtual std::shared_ptr<const RepositoryName> from_repository_ptr() const = 0;
+ virtual const std::shared_ptr<const FromRepositoryConstraint> from_repository_constraint() const = 0;
/**
* Fetch the installed-at-path requirement (may be a zero pointer).
diff --git a/paludis/fuzzy_finder.cc b/paludis/fuzzy_finder.cc
index 097de08..ce0a193 100644
--- a/paludis/fuzzy_finder.cc
+++ b/paludis/fuzzy_finder.cc
@@ -153,8 +153,8 @@ FuzzyCandidatesFinder::FuzzyCandidatesFinder(const Environment & e, const std::s
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());
+ if (pds.from_repository_constraint())
+ g = g & generator::FromRepository(pds.from_repository_constraint()->name());
}
std::shared_ptr<const PackageIDSequence> ids(e[selection::BestVersionOnly(g | FuzzyPackageName(package) | filter)]);
diff --git a/paludis/match_package.cc b/paludis/match_package.cc
index 436514d..f5bd183 100644
--- a/paludis/match_package.cc
+++ b/paludis/match_package.cc
@@ -130,13 +130,13 @@ paludis::match_package_with_maybe_changes(
if (spec.in_repository_constraint()->name() != id->repository_name())
return false;
- if (spec.from_repository_ptr())
+ if (spec.from_repository_constraint())
{
if (! id->from_repositories_key())
return false;
if (id->from_repositories_key()->value()->end() == id->from_repositories_key()->value()->find(
- stringify(*spec.from_repository_ptr())))
+ stringify(spec.from_repository_constraint()->name())))
return false;
}
diff --git a/paludis/package_dep_spec_constraint-fwd.hh b/paludis/package_dep_spec_constraint-fwd.hh
index b64c031..6309765 100644
--- a/paludis/package_dep_spec_constraint-fwd.hh
+++ b/paludis/package_dep_spec_constraint-fwd.hh
@@ -37,6 +37,9 @@ namespace paludis
class InRepositoryConstraint;
typedef Pool<InRepositoryConstraint> InRepositoryConstraintPool;
+
+ class FromRepositoryConstraint;
+ typedef Pool<FromRepositoryConstraint> FromRepositoryConstraintPool;
}
#endif
diff --git a/paludis/package_dep_spec_constraint.cc b/paludis/package_dep_spec_constraint.cc
index 2d5c6df..39b4ee5 100644
--- a/paludis/package_dep_spec_constraint.cc
+++ b/paludis/package_dep_spec_constraint.cc
@@ -98,3 +98,21 @@ template class Singleton<Pool<InRepositoryConstraint> >;
template const std::shared_ptr<const InRepositoryConstraint> Pool<InRepositoryConstraint>::create(
const RepositoryName &) const;
+FromRepositoryConstraint::FromRepositoryConstraint(const RepositoryName & n) :
+ _name(n)
+{
+}
+
+FromRepositoryConstraint::~FromRepositoryConstraint() = default;
+
+const RepositoryName
+FromRepositoryConstraint::name() const
+{
+ return _name;
+}
+
+template class Pool<FromRepositoryConstraint>;
+template class Singleton<Pool<FromRepositoryConstraint> >;
+template const std::shared_ptr<const FromRepositoryConstraint> Pool<FromRepositoryConstraint>::create(
+ const RepositoryName &) const;
+
diff --git a/paludis/package_dep_spec_constraint.hh b/paludis/package_dep_spec_constraint.hh
index 689c9ed..2617073 100644
--- a/paludis/package_dep_spec_constraint.hh
+++ b/paludis/package_dep_spec_constraint.hh
@@ -35,7 +35,8 @@ namespace paludis
NameConstraint,
PackageNamePartConstraint,
CategoryNamePartConstraint,
- InRepositoryConstraint
+ InRepositoryConstraint,
+ FromRepositoryConstraint
>::Type>
{
public:
@@ -118,10 +119,30 @@ namespace paludis
const RepositoryName name() const PALUDIS_ATTRIBUTE((warn_unused_result));
};
+ class PALUDIS_VISIBLE FromRepositoryConstraint :
+ public PackageDepSpecConstraint,
+ public ImplementAcceptMethods<PackageDepSpecConstraint, FromRepositoryConstraint>
+ {
+ friend class Pool<FromRepositoryConstraint>;
+
+ private:
+ RepositoryName _name;
+
+ FromRepositoryConstraint(const RepositoryName &);
+
+ FromRepositoryConstraint(const FromRepositoryConstraint &) = delete;
+
+ public:
+ ~FromRepositoryConstraint();
+
+ 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>;
+ extern template class Pool<FromRepositoryConstraint>;
}
#endif
diff --git a/paludis/package_dep_spec_properties.cc b/paludis/package_dep_spec_properties.cc
index 7ee076a..11e038b 100644
--- a/paludis/package_dep_spec_properties.cc
+++ b/paludis/package_dep_spec_properties.cc
@@ -43,7 +43,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.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_repository_ptr()), properties.has_installable_to_repository());
diff --git a/paludis/partially_made_package_dep_spec.cc b/paludis/partially_made_package_dep_spec.cc
index 0183088..9f4e7f7 100644
--- a/paludis/partially_made_package_dep_spec.cc
+++ b/paludis/partially_made_package_dep_spec.cc
@@ -55,7 +55,7 @@ namespace
VersionRequirementsMode version_requirements_mode_v;
std::shared_ptr<const SlotRequirement> slot;
std::shared_ptr<const InRepositoryConstraint> in_repository;
- std::shared_ptr<const RepositoryName> from_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 InstallableToPath> installable_to_path;
@@ -78,7 +78,7 @@ namespace
version_requirements_mode_v(other.version_requirements_mode()),
slot(other.slot_requirement_ptr()),
in_repository(other.in_repository_constraint()),
- from_repository(other.from_repository_ptr()),
+ from_repository(other.from_repository_constraint()),
installable_to_repository(other.installable_to_repository_ptr()),
installed_at_path(other.installed_at_path_ptr()),
installable_to_path(other.installable_to_path_ptr()),
@@ -168,8 +168,8 @@ namespace
std::string left, right;
bool need_arrow(false);
- if (from_repository_ptr())
- left = stringify(*from_repository_ptr());
+ if (from_repository_constraint())
+ left = stringify(from_repository_constraint()->name());
if (in_repository_constraint())
right = stringify(in_repository_constraint()->name());
@@ -318,7 +318,7 @@ namespace
return installable_to_repository;
}
- virtual std::shared_ptr<const RepositoryName> from_repository_ptr() const
+ virtual const std::shared_ptr<const FromRepositoryConstraint> from_repository_constraint() const
{
return from_repository;
}
@@ -433,7 +433,7 @@ PartiallyMadePackageDepSpec::clear_in_repository()
PartiallyMadePackageDepSpec &
PartiallyMadePackageDepSpec::from_repository(const RepositoryName & s)
{
- _imp->data->from_repository = std::make_shared<RepositoryName>(s);
+ _imp->data->from_repository = FromRepositoryConstraintPool::get_instance()->create(s);
return *this;
}
diff --git a/paludis/user_dep_spec_TEST.cc b/paludis/user_dep_spec_TEST.cc
index a38d3b2..d18b9f3 100644
--- a/paludis/user_dep_spec_TEST.cc
+++ b/paludis/user_dep_spec_TEST.cc
@@ -135,11 +135,11 @@ UserDepSpecTest::check_spec(
}
if (from_repository.empty())
- EXPECT_TRUE(! spec.from_repository_ptr());
+ EXPECT_TRUE(! spec.from_repository_constraint());
else
{
- EXPECT_TRUE(bool(spec.from_repository_ptr()));
- EXPECT_EQ(from_repository, stringify(*spec.from_repository_ptr()));
+ EXPECT_TRUE(bool(spec.from_repository_constraint()));
+ EXPECT_EQ(from_repository, stringify(spec.from_repository_constraint()->name()));
}
if (in_repository.empty())
diff --git a/python/dep_spec.cc b/python/dep_spec.cc
index c3c75e0..5d5ce2f 100644
--- a/python/dep_spec.cc
+++ b/python/dep_spec.cc
@@ -80,7 +80,7 @@ namespace paludis
VersionRequirementsMode version_requirements_mode;
std::shared_ptr<const SlotRequirement> slot;
std::shared_ptr<const InRepositoryConstraint> in_repository;
- std::shared_ptr<const RepositoryName> from_repository;
+ std::shared_ptr<const FromRepositoryConstraint> from_repository;
std::shared_ptr<const AdditionalPackageDepSpecRequirements> additional_requirements;
const std::string str;
@@ -92,7 +92,7 @@ namespace paludis
const VersionRequirementsMode m,
const std::shared_ptr<const SlotRequirement> & s,
const std::shared_ptr<const InRepositoryConstraint> & ri,
- const std::shared_ptr<const RepositoryName> & rf,
+ const std::shared_ptr<const FromRepositoryConstraint> & rf,
const std::shared_ptr<const AdditionalPackageDepSpecRequirements> & u,
const std::string & st) :
package_name_constraint(q),
@@ -230,7 +230,7 @@ PythonPackageDepSpec::PythonPackageDepSpec(const PackageDepSpec & p) :
p.version_requirements_mode(),
p.slot_requirement_ptr(),
p.in_repository_constraint(),
- deep_copy(p.from_repository_ptr()),
+ p.from_repository_constraint(),
p.additional_requirements_ptr(),
stringify(p))
{
@@ -251,7 +251,7 @@ PythonPackageDepSpec::PythonPackageDepSpec(const PythonPackageDepSpec & p) :
p.version_requirements_mode(),
p.slot_requirement_ptr(),
p.in_repository_constraint(),
- deep_copy(p.from_repository_ptr()),
+ p.from_repository_constraint(),
p.additional_requirements_ptr(),
p.py_str())
{
@@ -284,8 +284,8 @@ PythonPackageDepSpec::operator PackageDepSpec() const
if (in_repository_constraint())
p.in_repository(in_repository_constraint()->name());
- if (from_repository_ptr())
- p.from_repository(*from_repository_ptr());
+ if (from_repository_constraint())
+ p.from_repository(from_repository_constraint()->name());
if (additional_requirements_ptr())
{
@@ -358,8 +358,8 @@ PythonPackageDepSpec::in_repository_constraint() const
return _imp->in_repository;
}
-std::shared_ptr<const RepositoryName>
-PythonPackageDepSpec::from_repository_ptr() const
+const std::shared_ptr<const FromRepositoryConstraint>
+PythonPackageDepSpec::from_repository_constraint() const
{
return _imp->from_repository;
}
@@ -1239,9 +1239,9 @@ void expose_dep_spec()
)
- .add_property("from_repository", &PythonPackageDepSpec::from_repository_ptr,
- "[ro] RepositoryName\n"
- "From repository name (may be None)."
+ .add_property("from_repository_constraint", &PythonPackageDepSpec::from_repository_constraint,
+ "[ro] FromRepositoryConstraint\n"
+ "From repository constraint (may be None)."
)
#if 0
diff --git a/python/dep_spec.hh b/python/dep_spec.hh
index 6993062..46963ac 100644
--- a/python/dep_spec.hh
+++ b/python/dep_spec.hh
@@ -176,12 +176,12 @@ namespace paludis
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;
+ const std::shared_ptr<const FromRepositoryConstraint> from_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> from_repository_ptr() const;
std::shared_ptr<const AdditionalPackageDepSpecRequirements> additional_requirements_ptr() const;
std::string py_str() const;
diff --git a/python/dep_spec_TEST.py b/python/dep_spec_TEST.py
index b81aabf..8f8e0a7 100755
--- a/python/dep_spec_TEST.py
+++ b/python/dep_spec_TEST.py
@@ -69,7 +69,7 @@ class TestCase_1_DepSpecs(unittest.TestCase):
def test_06_in_from_repository(self):
self.get_depspecs()
self.assertEqual(str(self.pds.in_repository_constraint.name), "testrepo")
- self.assertEqual(self.pds.from_repository, None)
+ self.assertEqual(self.pds.from_repository_constraint, None)
def test_07_version_requirements(self):
self.get_depspecs()
diff --git a/python/package_dep_spec_constraint.cc b/python/package_dep_spec_constraint.cc
index 6b4a9d3..e1e3b34 100644
--- a/python/package_dep_spec_constraint.cc
+++ b/python/package_dep_spec_constraint.cc
@@ -118,5 +118,20 @@ void expose_package_dep_spec_constraint()
"[RO] The ::repo name in question"
)
;
+
+ /**
+ * FromRepositoryConstraint
+ */
+ class_package_dep_spec_constraint<FromRepositoryConstraint>
+ (
+ "FromRepositoryConstraint",
+ "A ::repo-> constraint for a PackageDepSpec.",
+ bp::no_init
+ )
+
+ .add_property("name", &FromRepositoryConstraint::name,
+ "[RO] The ::repo-> name in question"
+ )
+ ;
}
diff --git a/ruby/dep_spec.cc b/ruby/dep_spec.cc
index 8da8626..ff3deb6 100644
--- a/ruby/dep_spec.cc
+++ b/ruby/dep_spec.cc
@@ -688,18 +688,18 @@ namespace
/*
* call-seq:
- * from_repository -> String or Nil
+ * from_repository_constraint -> FromRepositoryConstraint or Nil
*
- * Fetch the from-repository name.
+ * Fetch the from-repository constraint.
*/
VALUE
- package_dep_spec_from_repository_ptr(VALUE self)
+ package_dep_spec_from_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()->from_repository_ptr()))
+ if (! bool(std::static_pointer_cast<const WrappedSpec<PackageDepSpec> >(*ptr)->spec()->from_repository_constraint()))
return Qnil;
- return rb_str_new2(stringify((*std::static_pointer_cast<const WrappedSpec<PackageDepSpec> >(*ptr)->spec()->from_repository_ptr())).c_str());
+ return package_dep_spec_constraint_to_value(std::static_pointer_cast<const WrappedSpec<PackageDepSpec> >(*ptr)->spec()->from_repository_constraint());
}
/*
@@ -1114,7 +1114,7 @@ namespace
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_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, "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, "installed_at_path", RUBY_FUNC_CAST(&package_dep_spec_installed_at_path), 0);
rb_define_method(c_package_dep_spec, "installable_to_path", RUBY_FUNC_CAST(&package_dep_spec_installable_to_path), 0);
diff --git a/ruby/dep_spec_TEST.rb b/ruby/dep_spec_TEST.rb
index 1a1e2b1..58b8817 100644
--- a/ruby/dep_spec_TEST.rb
+++ b/ruby/dep_spec_TEST.rb
@@ -148,11 +148,11 @@ module Paludis
end
def test_from_repository
- assert_nil pda.from_repository
- assert_nil pdb.from_repository
- assert_nil pdc.from_repository
- assert_nil pdd.from_repository
- assert_equal "testrepo", pde.from_repository
+ assert_nil pda.from_repository_constraint
+ assert_nil pdb.from_repository_constraint
+ assert_nil pdc.from_repository_constraint
+ assert_nil pdd.from_repository_constraint
+ assert_equal "testrepo", pde.from_repository_constraint.name
end
def test_in_repository
diff --git a/ruby/package_dep_spec_constraint.cc b/ruby/package_dep_spec_constraint.cc
index 1ae743d..9e4757b 100644
--- a/ruby/package_dep_spec_constraint.cc
+++ b/ruby/package_dep_spec_constraint.cc
@@ -35,6 +35,7 @@ namespace
static VALUE c_package_name_part_constraint;
static VALUE c_category_name_part_constraint;
static VALUE c_in_repository_constraint;
+ static VALUE c_from_repository_constraint;
struct V
{
@@ -69,6 +70,12 @@ namespace
value = Data_Wrap_Struct(c_in_repository_constraint, 0, &Common<std::shared_ptr<const PackageDepSpecConstraint> >::free,
new std::shared_ptr<const PackageDepSpecConstraint>(mm));
}
+
+ void visit(const FromRepositoryConstraint &)
+ {
+ value = Data_Wrap_Struct(c_from_repository_constraint, 0, &Common<std::shared_ptr<const PackageDepSpecConstraint> >::free,
+ new std::shared_ptr<const PackageDepSpecConstraint>(mm));
+ }
};
/*
@@ -123,6 +130,19 @@ namespace
return rb_str_new2(stringify((std::static_pointer_cast<const InRepositoryConstraint>(*ptr))->name()).c_str());
}
+ /*
+ * Document-method: name
+ *
+ * The name constraint.
+ */
+ static VALUE
+ from_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 FromRepositoryConstraint>(*ptr))->name()).c_str());
+ }
+
void do_register_package_dep_spec_constraint()
{
/*
@@ -175,6 +195,17 @@ namespace
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);
+
+ /*
+ * Document-class: Paludis::FromRepositoryConstraint
+ *
+ * Represents a /pkg name constraint in a PackageDepSpec.
+ */
+ c_from_repository_constraint = rb_define_class_under(
+ paludis_module(), "InRepositoryConstraint", c_package_dep_spec_constraint);
+ rb_funcall(c_from_repository_constraint, rb_intern("private_class_method"), 1, rb_str_new2("new"));
+ rb_define_method(c_from_repository_constraint, "name", RUBY_FUNC_CAST(
+ &from_repository_constraint_name), 0);
}
}