aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2009-09-14 16:37:25 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2009-09-14 16:37:25 +0100
commite9b158c79c03382410637ba42816692d1bae610d (patch)
tree1281fc16ee89f4cfbc36a15bff05a9130cd56db4
parent7f02a8cda8ed59df61c8dddbe5b15e3bd1f01611 (diff)
downloadpaludis-e9b158c79c03382410637ba42816692d1bae610d.tar.gz
paludis-e9b158c79c03382410637ba42816692d1bae610d.tar.xz
Tweak block specs
-rw-r--r--paludis/dep_list.cc26
-rw-r--r--paludis/dep_spec.cc29
-rw-r--r--paludis/dep_spec.hh21
-rw-r--r--paludis/dep_spec_TEST.cc4
-rw-r--r--paludis/query_visitor.cc4
-rw-r--r--paludis/repositories/e/dep_parser.cc12
-rw-r--r--paludis/repositories/fake/dep_parser.cc16
-rw-r--r--paludis/resolver/resolver.cc16
-rw-r--r--paludis/resolver/sanitised_dependencies.cc60
-rw-r--r--paludis/stringify_formatter_TEST.cc6
-rw-r--r--python/dep_spec.cc29
-rw-r--r--python/dep_spec.hh6
-rwxr-xr-xpython/dep_spec_TEST.py4
-rw-r--r--ruby/dep_spec.cc20
-rw-r--r--ruby/dep_spec_TEST.rb10
15 files changed, 153 insertions, 110 deletions
diff --git a/paludis/dep_list.cc b/paludis/dep_list.cc
index c5f2879..a2cefc0 100644
--- a/paludis/dep_list.cc
+++ b/paludis/dep_list.cc
@@ -828,17 +828,17 @@ DepList::AddVisitor::visit(const DependencySpecTree::NodeType<BlockDepSpec>::Typ
std::list<MergeList::const_iterator> will_be_installed;
std::tr1::shared_ptr<const PackageIDSequence> already_installed;
- if (node.spec()->blocked_spec()->package_ptr())
+ if (node.spec()->blocking().package_ptr())
{
PackageDepSpec just_package(make_package_dep_spec(PartiallyMadePackageDepSpecOptions()).package(
- *node.spec()->blocked_spec()->package_ptr()));
+ *node.spec()->blocking().package_ptr()));
already_installed = (*d->_imp->env)[selection::AllVersionsUnsorted(
generator::Matches(just_package, d->_imp->opts->match_package_options()) |
filter::InstalledAtRoot(d->_imp->env->root()))];
MatchDepListEntryAgainstPackageDepSpec m(d->_imp->env, just_package, d->_imp->opts->match_package_options());
for (std::pair<MergeListIndex::const_iterator, MergeListIndex::const_iterator> p(
- d->_imp->merge_list_index.equal_range(*node.spec()->blocked_spec()->package_ptr())) ;
+ d->_imp->merge_list_index.equal_range(*node.spec()->blocking().package_ptr())) ;
p.first != p.second ; ++p.first)
{
if (d->_imp->current_merge_list_entry != d->_imp->merge_list.end())
@@ -869,7 +869,7 @@ DepList::AddVisitor::visit(const DependencySpecTree::NodeType<BlockDepSpec>::Typ
for (PackageIDSequence::ConstIterator aa(already_installed->begin()),
aa_end(already_installed->end()) ; aa != aa_end ; ++aa)
{
- if (! match_package(*d->_imp->env, *node.spec()->blocked_spec(), **aa, d->_imp->opts->match_package_options()))
+ if (! match_package(*d->_imp->env, node.spec()->blocking(), **aa, d->_imp->opts->match_package_options()))
continue;
bool replaced(false);
@@ -892,7 +892,7 @@ DepList::AddVisitor::visit(const DependencySpecTree::NodeType<BlockDepSpec>::Typ
/* ignore if it's a virtual/blah (not <virtual/blah-1) block and it's blocking
* ourself */
- if (package_dep_spec_has_properties(*node.spec()->blocked_spec(), make_named_values<PackageDepSpecProperties>(
+ if (package_dep_spec_has_properties(node.spec()->blocking(), make_named_values<PackageDepSpecProperties>(
value_for<n::has_additional_requirements>(false),
value_for<n::has_category_name_part>(indeterminate),
value_for<n::has_from_repository>(false),
@@ -918,7 +918,7 @@ DepList::AddVisitor::visit(const DependencySpecTree::NodeType<BlockDepSpec>::Typ
switch (d->_imp->throw_on_blocker ? dl_blocks_error : d->_imp->opts->blocks())
{
case dl_blocks_error:
- throw BlockError(stringify(*node.spec()->blocked_spec()));
+ throw BlockError(stringify(node.spec()->blocking()));
case dl_blocks_discard:
Log::get_instance()->message("dep_list.discarding_block", ll_warning, lc_context) << "Discarding block '" << *node.spec() << "'";
@@ -928,7 +928,7 @@ DepList::AddVisitor::visit(const DependencySpecTree::NodeType<BlockDepSpec>::Typ
break;
case dl_blocks_accumulate:
- d->add_error_package(*aa, dlk_block, *node.spec()->blocked_spec());
+ d->add_error_package(*aa, dlk_block, node.spec()->blocking());
break;
case last_dl_blocks:
@@ -939,12 +939,12 @@ DepList::AddVisitor::visit(const DependencySpecTree::NodeType<BlockDepSpec>::Typ
for (std::list<MergeList::const_iterator>::const_iterator r(will_be_installed.begin()),
r_end(will_be_installed.end()) ; r != r_end ; ++r)
{
- if (! match_package(*d->_imp->env, *node.spec()->blocked_spec(), *(*r)->package_id(), d->_imp->opts->match_package_options()))
+ if (! match_package(*d->_imp->env, node.spec()->blocking(), *(*r)->package_id(), d->_imp->opts->match_package_options()))
continue;
/* ignore if it's a virtual/blah (not <virtual/blah-1) block and it's blocking
* ourself */
- if (package_dep_spec_has_properties(*node.spec()->blocked_spec(), make_named_values<PackageDepSpecProperties>(
+ if (package_dep_spec_has_properties(node.spec()->blocking(), make_named_values<PackageDepSpecProperties>(
value_for<n::has_additional_requirements>(false),
value_for<n::has_category_name_part>(indeterminate),
value_for<n::has_from_repository>(false),
@@ -968,7 +968,7 @@ DepList::AddVisitor::visit(const DependencySpecTree::NodeType<BlockDepSpec>::Typ
continue;
}
- throw BlockError(stringify(*node.spec()->blocked_spec()));
+ throw BlockError(stringify(node.spec()->blocking()));
}
if (check_whole_list)
@@ -976,12 +976,12 @@ DepList::AddVisitor::visit(const DependencySpecTree::NodeType<BlockDepSpec>::Typ
for (MergeList::const_iterator r(d->_imp->merge_list.begin()),
r_end(d->_imp->merge_list.end()) ; r != r_end ; ++r)
{
- if (! match_package(*d->_imp->env, *node.spec()->blocked_spec(), *r->package_id(), d->_imp->opts->match_package_options()))
+ if (! match_package(*d->_imp->env, node.spec()->blocking(), *r->package_id(), d->_imp->opts->match_package_options()))
continue;
/* ignore if it's a virtual/blah (not <virtual/blah-1) block and it's blocking
* ourself */
- if (package_dep_spec_has_properties(*node.spec()->blocked_spec(), make_named_values<PackageDepSpecProperties>(
+ if (package_dep_spec_has_properties(node.spec()->blocking(), make_named_values<PackageDepSpecProperties>(
value_for<n::has_additional_requirements>(false),
value_for<n::has_category_name_part>(indeterminate),
value_for<n::has_from_repository>(false),
@@ -1005,7 +1005,7 @@ DepList::AddVisitor::visit(const DependencySpecTree::NodeType<BlockDepSpec>::Typ
continue;
}
- throw BlockError(stringify(*node.spec()->blocked_spec()));
+ throw BlockError(stringify(node.spec()->blocking()));
}
}
}
diff --git a/paludis/dep_spec.cc b/paludis/dep_spec.cc
index 2d41312..ae5283e 100644
--- a/paludis/dep_spec.cc
+++ b/paludis/dep_spec.cc
@@ -275,21 +275,17 @@ PackageDepSpec::as_package_dep_spec() const
return this;
}
-BlockDepSpec::BlockDepSpec(const std::tr1::shared_ptr<const PackageDepSpec> & a) :
- StringDepSpec("!" + a->text()),
- _spec(a)
-{
-}
-
-BlockDepSpec::BlockDepSpec(const std::tr1::shared_ptr<const PackageDepSpec> & a, const std::string & t) :
- StringDepSpec(t),
- _spec(a)
+BlockDepSpec::BlockDepSpec(const std::string & s, const PackageDepSpec & p, const bool t) :
+ StringDepSpec(s),
+ _spec(p),
+ _strong(t)
{
}
BlockDepSpec::BlockDepSpec(const BlockDepSpec & other) :
StringDepSpec(other.text()),
- _spec(other.blocked_spec())
+ _spec(other._spec),
+ _strong(other._strong)
{
}
@@ -471,17 +467,22 @@ SimpleURIDepSpec::need_keys_added() const
{
}
-std::tr1::shared_ptr<const PackageDepSpec>
-BlockDepSpec::blocked_spec() const
+const PackageDepSpec
+BlockDepSpec::blocking() const
{
return _spec;
}
+bool
+BlockDepSpec::strong() const
+{
+ return _strong;
+}
+
std::tr1::shared_ptr<DepSpec>
BlockDepSpec::clone() const
{
- std::tr1::shared_ptr<BlockDepSpec> result(new BlockDepSpec(std::tr1::static_pointer_cast<PackageDepSpec>(
- _spec->clone())));
+ std::tr1::shared_ptr<BlockDepSpec> result(new BlockDepSpec(*this));
result->set_annotations_key(annotations_key());
return result;
}
diff --git a/paludis/dep_spec.hh b/paludis/dep_spec.hh
index 7ae28ec..bfb6bf1 100644
--- a/paludis/dep_spec.hh
+++ b/paludis/dep_spec.hh
@@ -875,7 +875,8 @@ namespace paludis
public StringDepSpec
{
private:
- std::tr1::shared_ptr<const PackageDepSpec> _spec;
+ PackageDepSpec _spec;
+ bool _strong;
protected:
virtual void need_keys_added() const;
@@ -884,16 +885,28 @@ namespace paludis
///\name Basic operations
///\{
- BlockDepSpec(const std::tr1::shared_ptr<const PackageDepSpec> & spec);
- BlockDepSpec(const std::tr1::shared_ptr<const PackageDepSpec> & spec, const std::string & text);
+ /**
+ * \since 0.41
+ */
+ BlockDepSpec(const std::string & text, const PackageDepSpec & spec, const bool strong);
+
BlockDepSpec(const BlockDepSpec &);
///\}
/**
* Fetch the spec we're blocking.
+ *
+ * \since 0.41
+ */
+ const PackageDepSpec blocking() const PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ /**
+ * Fetch whether we're a strong blocker.
+ *
+ * \since 0.41
*/
- std::tr1::shared_ptr<const PackageDepSpec> blocked_spec() const;
+ bool strong() const PALUDIS_ATTRIBUTE((warn_unused_result));
virtual std::tr1::shared_ptr<DepSpec> clone() const PALUDIS_ATTRIBUTE((warn_unused_result));
};
diff --git a/paludis/dep_spec_TEST.cc b/paludis/dep_spec_TEST.cc
index e9d96e5..1d6b930 100644
--- a/paludis/dep_spec_TEST.cc
+++ b/paludis/dep_spec_TEST.cc
@@ -83,9 +83,9 @@ namespace test_cases
std::tr1::shared_ptr<PackageDepSpec> c(std::tr1::static_pointer_cast<PackageDepSpec>(a.clone()));
TEST_CHECK_STRINGIFY_EQUAL(a, *c);
- BlockDepSpec d(c);
+ BlockDepSpec d("!" + stringify(*c), *c, false);
std::tr1::shared_ptr<BlockDepSpec> e(std::tr1::static_pointer_cast<BlockDepSpec>(d.clone()));
- TEST_CHECK_STRINGIFY_EQUAL(*(d.blocked_spec()), *(e->blocked_spec()));
+ TEST_CHECK_STRINGIFY_EQUAL(d.blocking(), e->blocking());
}
} test_dep_spec_clone;
}
diff --git a/paludis/query_visitor.cc b/paludis/query_visitor.cc
index cad62a1..8dff438 100644
--- a/paludis/query_visitor.cc
+++ b/paludis/query_visitor.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2005, 2006, 2007, 2008 Ciaran McCreesh
+ * Copyright (c) 2005, 2006, 2007, 2008, 2009 Ciaran McCreesh
*
* This file is part of the Paludis package manager. Paludis is free software;
* you can redistribute it and/or modify it under the terms of the GNU General
@@ -187,7 +187,7 @@ void
QueryVisitor::visit(const DependencySpecTree::NodeType<BlockDepSpec>::Type & node)
{
DependencySpecTree tree(make_shared_ptr(new AllDepSpec));
- tree.root()->append(node.spec()->blocked_spec());
+ tree.root()->append(std::tr1::static_pointer_cast<const PackageDepSpec>(node.spec()->blocking().clone()));
tree.root()->accept(*this);
_imp->result = !_imp->result;
}
diff --git a/paludis/repositories/e/dep_parser.cc b/paludis/repositories/e/dep_parser.cc
index 31ad46a..20b9f09 100644
--- a/paludis/repositories/e/dep_parser.cc
+++ b/paludis/repositories/e/dep_parser.cc
@@ -99,19 +99,23 @@ namespace
{
if ((! s.empty()) && ('!' == s.at(0)))
{
+ bool strong(false);
std::string::size_type specstart(1);
if (2 <= s.length() && '!' == s.at(1))
{
if (! eapi.supported()->dependency_spec_tree_parse_options()[dstpo_hard_soft_blocks])
throw EDepParseError(s, "Double-! blocks not allowed in this EAPI");
specstart = 2;
+ strong = true;
}
std::tr1::shared_ptr<BlockDepSpec> spec(new BlockDepSpec(
- make_shared_ptr(new PackageDepSpec(parse_elike_package_dep_spec(s.substr(specstart),
- eapi.supported()->package_dep_spec_parse_options(),
- eapi.supported()->version_spec_options(),
- id))), s));
+ s,
+ parse_elike_package_dep_spec(s.substr(specstart),
+ eapi.supported()->package_dep_spec_parse_options(),
+ eapi.supported()->version_spec_options(),
+ id),
+ strong));
h.begin()->item()->append(spec);
annotations_go_here(spec);
}
diff --git a/paludis/repositories/fake/dep_parser.cc b/paludis/repositories/fake/dep_parser.cc
index e30b427..ed265bd 100644
--- a/paludis/repositories/fake/dep_parser.cc
+++ b/paludis/repositories/fake/dep_parser.cc
@@ -67,14 +67,14 @@ namespace
{
if ((! s.empty()) && ('!' == s.at(0)))
{
- (*h.begin())->append(make_shared_ptr(new BlockDepSpec(
- make_shared_ptr(new PackageDepSpec(parse_elike_package_dep_spec(s.substr(1),
- ELikePackageDepSpecOptions() + epdso_allow_slot_deps
- + epdso_allow_slot_star_deps + epdso_allow_slot_equal_deps + epdso_allow_repository_deps
- + epdso_allow_use_deps + epdso_allow_ranged_deps + epdso_allow_tilde_greater_deps
- + epdso_strict_parsing,
- user_version_spec_options(),
- id))))));
+ (*h.begin())->append(make_shared_ptr(new BlockDepSpec(s,
+ parse_elike_package_dep_spec(s.substr(1),
+ ELikePackageDepSpecOptions() + epdso_allow_slot_deps
+ + epdso_allow_slot_star_deps + epdso_allow_slot_equal_deps + epdso_allow_repository_deps
+ + epdso_allow_use_deps + epdso_allow_ranged_deps + epdso_allow_tilde_greater_deps
+ + epdso_strict_parsing,
+ user_version_spec_options(),
+ id), false)));
}
else
package_dep_spec_string_handler<T_>(h, s, id);
diff --git a/paludis/resolver/resolver.cc b/paludis/resolver/resolver.cc
index 7a75e53..c0337e7 100644
--- a/paludis/resolver/resolver.cc
+++ b/paludis/resolver/resolver.cc
@@ -417,7 +417,7 @@ Resolver::_make_constraint_from_dependency(const QPN_S & qpn_s, const SanitisedD
{
/* nothing is fine too if there's nothing installed matching the block. */
const std::tr1::shared_ptr<const PackageIDSequence> ids((*_imp->env)[selection::SomeArbitraryVersion(
- generator::Matches(*dep.spec().if_block()->blocked_spec(), MatchPackageOptions()) |
+ generator::Matches(dep.spec().if_block()->blocking(), MatchPackageOptions()) |
filter::InstalledAtRoot(FSEntry("/")))]);
return make_shared_ptr(new Constraint(make_named_values<Constraint>(
@@ -458,7 +458,7 @@ Resolver::_verify_new_constraint(const QPN_S & qpn_s,
ok = match_package(*_imp->env, *constraint->spec().if_package(),
*resolution->decision()->if_package_id(), MatchPackageOptions());
else
- ok = ! match_package(*_imp->env, *constraint->spec().if_block()->blocked_spec(),
+ ok = ! match_package(*_imp->env, constraint->spec().if_block()->blocking(),
*resolution->decision()->if_package_id(), MatchPackageOptions());
}
else
@@ -634,7 +634,7 @@ Resolver::_care_about_dependency_spec(const QPN_S & qpn_s,
{
/* dirty dirty hack */
if (dep.spec().if_block())
- if (dep.spec().if_block()->blocked_spec()->package_ptr()->category() == CategoryNamePart("virtual"))
+ if (dep.spec().if_block()->blocking().package_ptr()->category() == CategoryNamePart("virtual"))
{
Log::get_instance()->message("resolver.virtual_haxx", ll_warning, lc_context)
<< "Ignoring " << dep.spec() << " from " << qpn_s << " for now";
@@ -1138,19 +1138,19 @@ Resolver::_get_qpn_s_s_for_blocker(const BlockDepSpec & spec) const
Context context("When finding slots for '" + stringify(spec) + "':");
std::tr1::shared_ptr<SlotName> exact_slot;
- if (spec.blocked_spec()->slot_requirement_ptr())
+ if (spec.blocking().slot_requirement_ptr())
{
SlotNameFinder f;
- exact_slot = spec.blocked_spec()->slot_requirement_ptr()->accept_returning<std::tr1::shared_ptr<SlotName> >(f);
+ exact_slot = spec.blocking().slot_requirement_ptr()->accept_returning<std::tr1::shared_ptr<SlotName> >(f);
}
std::tr1::shared_ptr<QPN_S_Sequence> result(new QPN_S_Sequence);
if (exact_slot)
- result->push_back(QPN_S(*spec.blocked_spec(), exact_slot));
+ result->push_back(QPN_S(spec.blocking(), exact_slot));
else
{
const std::tr1::shared_ptr<const PackageIDSequence> ids((*_imp->env)[selection::BestVersionInEachSlot(
- generator::Package(*spec.blocked_spec()->package_ptr())
+ generator::Package(*spec.blocking().package_ptr())
)]);
for (PackageIDSequence::ConstIterator i(ids->begin()), i_end(ids->end()) ;
i != i_end ; ++i)
@@ -1465,7 +1465,7 @@ Resolver::_find_id_for_from(
if ((*c)->spec().if_package())
ok = ok && match_package(*_imp->env, *(*c)->spec().if_package(), **i, MatchPackageOptions());
else
- ok = ok && ! match_package(*_imp->env, *(*c)->spec().if_block()->blocked_spec(), **i, MatchPackageOptions());
+ ok = ok && ! match_package(*_imp->env, (*c)->spec().if_block()->blocking(), **i, MatchPackageOptions());
if (! ok)
break;
diff --git a/paludis/resolver/sanitised_dependencies.cc b/paludis/resolver/sanitised_dependencies.cc
index a72eac2..07efa00 100644
--- a/paludis/resolver/sanitised_dependencies.cc
+++ b/paludis/resolver/sanitised_dependencies.cc
@@ -144,7 +144,7 @@ namespace
void visit_block_spec(const BlockDepSpec & spec)
{
- if (spec.blocked_spec()->package_ptr())
+ if (spec.blocking().package_ptr())
visit_package_or_block_spec(PackageOrBlockDepSpec(spec));
else
super_complicated = true;
@@ -496,10 +496,22 @@ PackageOrBlockDepSpec::PackageOrBlockDepSpec(const PackageDepSpec & s) :
void
PackageOrBlockDepSpec::serialise(Serialiser & s) const
{
- s.object("PackageOrBlockDepSpec")
- .member(SerialiserFlags<>(), "if_block", if_block() ? stringify(*if_block()) : "null")
- .member(SerialiserFlags<>(), "if_package", if_package() ? stringify(*if_package()) : "null")
- ;
+ if (if_block())
+ {
+ s.object("PackageOrBlockDepSpec")
+ .member(SerialiserFlags<>(), "block", true)
+ .member(SerialiserFlags<>(), "spec", stringify(if_block()->blocking()))
+ .member(SerialiserFlags<>(), "strong", if_block()->strong())
+ .member(SerialiserFlags<>(), "text", if_block()->text())
+ ;
+ }
+ else
+ {
+ s.object("PackageOrBlockDepSpec")
+ .member(SerialiserFlags<>(), "block", false)
+ .member(SerialiserFlags<>(), "spec", stringify(*if_package()))
+ ;
+ }
}
PackageOrBlockDepSpec
@@ -509,28 +521,24 @@ PackageOrBlockDepSpec::deserialise(Deserialisation & d, const std::tr1::shared_p
Deserialisator v(d, "PackageOrBlockDepSpec");
- std::string if_block(v.member<std::string>("if_block"));
- std::string if_package(v.member<std::string>("if_package"));
-
- if (if_block == "null")
- return PackageOrBlockDepSpec(parse_elike_package_dep_spec(if_package,
- ELikePackageDepSpecOptions() + epdso_allow_tilde_greater_deps + epdso_nice_equal_star +
- epdso_allow_ranged_deps + epdso_allow_use_deps + epdso_allow_use_deps_portage +
- epdso_allow_use_dep_defaults + epdso_allow_repository_deps + epdso_allow_slot_star_deps +
- epdso_allow_slot_equal_deps + epdso_allow_slot_deps + epdso_allow_key_requirements,
- VersionSpecOptions() + vso_flexible_dashes + vso_flexible_dots + vso_ignore_case +
- vso_letters_anywhere + vso_dotted_suffixes,
- for_id));
+ bool block(v.member<bool>("block"));
+ PackageDepSpec spec(parse_elike_package_dep_spec(v.member<std::string>("spec"),
+ ELikePackageDepSpecOptions() + epdso_allow_tilde_greater_deps + epdso_nice_equal_star +
+ epdso_allow_ranged_deps + epdso_allow_use_deps + epdso_allow_use_deps_portage +
+ epdso_allow_use_dep_defaults + epdso_allow_repository_deps + epdso_allow_slot_star_deps +
+ epdso_allow_slot_equal_deps + epdso_allow_slot_deps + epdso_allow_key_requirements,
+ VersionSpecOptions() + vso_flexible_dashes + vso_flexible_dots + vso_ignore_case +
+ vso_letters_anywhere + vso_dotted_suffixes,
+ for_id));
+
+ if (block)
+ {
+ bool strong(v.member<bool>("strong"));
+ std::string text(v.member<std::string>("text"));
+ return PackageOrBlockDepSpec(BlockDepSpec(text, spec, strong));
+ }
else
- return PackageOrBlockDepSpec(BlockDepSpec(make_shared_ptr(new PackageDepSpec(
- parse_elike_package_dep_spec(if_block.substr(if_block.find_first_not_of("!")),
- ELikePackageDepSpecOptions() + epdso_allow_tilde_greater_deps + epdso_nice_equal_star +
- epdso_allow_ranged_deps + epdso_allow_use_deps + epdso_allow_use_deps_portage +
- epdso_allow_use_dep_defaults + epdso_allow_repository_deps + epdso_allow_slot_star_deps +
- epdso_allow_slot_equal_deps + epdso_allow_slot_deps + epdso_allow_key_requirements,
- VersionSpecOptions() + vso_flexible_dashes + vso_flexible_dots + vso_ignore_case +
- vso_letters_anywhere + vso_dotted_suffixes,
- for_id)))));
+ return PackageOrBlockDepSpec(spec);
}
void
diff --git a/paludis/stringify_formatter_TEST.cc b/paludis/stringify_formatter_TEST.cc
index 325911e..6864a05 100644
--- a/paludis/stringify_formatter_TEST.cc
+++ b/paludis/stringify_formatter_TEST.cc
@@ -116,14 +116,14 @@ namespace test_cases
PartialFormatter f;
StringifyFormatter ff(f);
- BlockDepSpec b(make_shared_ptr(new PackageDepSpec(parse_user_package_dep_spec("cat/pkg", &env,
- UserPackageDepSpecOptions()))));
+ BlockDepSpec b("!!!!!cat/pkg", parse_user_package_dep_spec("cat/pkg",
+ &env, UserPackageDepSpecOptions()), false);
NamedSetDepSpec u(SetName("foo"));
std::string s(format_three(
parse_user_package_dep_spec("cat/pkg", &env, UserPackageDepSpecOptions()),
b, u,
ff));
- TEST_CHECK_EQUAL(s, "<cat/pkg> !cat/pkg foo");
+ TEST_CHECK_EQUAL(s, "<cat/pkg> !!!!!cat/pkg foo");
}
} test_stringify_formatter_partial;
}
diff --git a/python/dep_spec.cc b/python/dep_spec.cc
index 76f9366..375e3de 100644
--- a/python/dep_spec.cc
+++ b/python/dep_spec.cc
@@ -461,24 +461,32 @@ PythonSimpleURIDepSpec::PythonSimpleURIDepSpec(const SimpleURIDepSpec & d) :
{
}
-PythonBlockDepSpec::PythonBlockDepSpec(std::tr1::shared_ptr<const PythonPackageDepSpec> & a) :
- PythonStringDepSpec("!" + a->text()),
- _spec(a)
+PythonBlockDepSpec::PythonBlockDepSpec(const std::string & t, const std::tr1::shared_ptr<const PythonPackageDepSpec> & a, const bool s) :
+ PythonStringDepSpec(t),
+ _spec(a),
+ _strong(s)
{
}
PythonBlockDepSpec::PythonBlockDepSpec(const BlockDepSpec & d) :
PythonStringDepSpec(d.text()),
- _spec(make_shared_ptr(new PythonPackageDepSpec(*d.blocked_spec())))
+ _spec(make_shared_ptr(new PythonPackageDepSpec(d.blocking()))),
+ _strong(d.strong())
{
}
std::tr1::shared_ptr<const PythonPackageDepSpec>
-PythonBlockDepSpec::blocked_spec() const
+PythonBlockDepSpec::blocking() const
{
return _spec;
}
+bool
+PythonBlockDepSpec::strong() const
+{
+ return _strong;
+}
+
PythonFetchableURIDepSpec::PythonFetchableURIDepSpec(const std::string & s) :
PythonStringDepSpec(s)
{
@@ -939,7 +947,7 @@ template <typename H_>
void
SpecTreeFromPython<H_>::real_visit(const PythonBlockDepSpec & d)
{
- _add_to->append(make_shared_ptr(new BlockDepSpec(make_shared_ptr(new PackageDepSpec(*d.blocked_spec())))));
+ _add_to->append(make_shared_ptr(new BlockDepSpec(d.text(), *d.blocking(), d.strong())));
}
template <typename H_>
@@ -1363,13 +1371,18 @@ void expose_dep_spec()
"BlockDepSpec",
"A BlockDepSpec represents a block on a package name (for example, 'app-editors/vim'), \n"
"possibly with associated version and SLOT restrictions.",
- bp::init<std::tr1::shared_ptr<const PackageDepSpec> >("__init__(PackageDepSpec)")
+ bp::init<std::string, std::tr1::shared_ptr<const PythonPackageDepSpec>, bool>("__init__(string, PackageDepSpec, bool)")
)
- .add_property("blocked_spec", &PythonBlockDepSpec::blocked_spec,
+ .add_property("blocking", &PythonBlockDepSpec::blocking,
"[ro] PackageDepSpec\n"
"The spec we're blocking."
)
+ .add_property("strong", &PythonBlockDepSpec::strong,
+ "[ro] bool\n"
+ "Are we a strong block?"
+ )
+
//Work around epydoc bug
.add_property("text", &PythonBlockDepSpec::text,
"[ro] string\n"
diff --git a/python/dep_spec.hh b/python/dep_spec.hh
index 1b0455a..d6fe170 100644
--- a/python/dep_spec.hh
+++ b/python/dep_spec.hh
@@ -242,12 +242,14 @@ namespace paludis
{
private:
std::tr1::shared_ptr<const PythonPackageDepSpec> _spec;
+ bool _strong;
public:
- PythonBlockDepSpec(std::tr1::shared_ptr<const PythonPackageDepSpec> &);
+ PythonBlockDepSpec(const std::string &, const std::tr1::shared_ptr<const PythonPackageDepSpec> &, const bool);
PythonBlockDepSpec(const BlockDepSpec &);
- std::tr1::shared_ptr<const PythonPackageDepSpec> blocked_spec() const;
+ std::tr1::shared_ptr<const PythonPackageDepSpec> blocking() const;
+ bool strong() const;
};
class PALUDIS_VISIBLE PythonURILabelsDepSpec :
diff --git a/python/dep_spec_TEST.py b/python/dep_spec_TEST.py
index eb867cd..5254f36 100755
--- a/python/dep_spec_TEST.py
+++ b/python/dep_spec_TEST.py
@@ -31,7 +31,7 @@ class TestCase_1_DepSpecs(unittest.TestCase):
self.pds3 = parse_user_package_dep_spec("*/*::testrepo", self.env,
[UserPackageDepSpecOption.ALLOW_WILDCARDS])
self.pds4 = parse_user_package_dep_spec("cat/pkg::testrepo", self.env, [])
- self.bds = BlockDepSpec(self.pds)
+ self.bds = BlockDepSpec("!>=foo/bar-1:100::testrepo", self.pds, False)
self.nds = NamedSetDepSpec("system")
def test_01_init(self):
@@ -55,7 +55,7 @@ class TestCase_1_DepSpecs(unittest.TestCase):
self.get_depspecs()
self.assertEqual(str(self.ptds), "foo")
self.assertEqual(str(self.pds), ">=foo/bar-1:100::testrepo")
- self.assertEqual(str(self.bds.blocked_spec), ">=foo/bar-1:100::testrepo")
+ self.assertEqual(str(self.bds.blocking), ">=foo/bar-1:100::testrepo")
self.assertEqual(str(self.nds), "system")
### def test_04_slot(self):
diff --git a/ruby/dep_spec.cc b/ruby/dep_spec.cc
index f010e0d..05ff07f 100644
--- a/ruby/dep_spec.cc
+++ b/ruby/dep_spec.cc
@@ -462,15 +462,16 @@ namespace
}
VALUE
- block_dep_spec_new(VALUE self, VALUE spec)
+ block_dep_spec_new(VALUE self, VALUE str, VALUE spec, VALUE strong)
{
std::tr1::shared_ptr<const WrappedSpecBase> * ptr(0);
try
{
std::tr1::shared_ptr<const PackageDepSpec> pkg(value_to_package_dep_spec(spec));
- ptr = new std::tr1::shared_ptr<const WrappedSpecBase>(new WrappedSpec<BlockDepSpec>(make_shared_ptr(new BlockDepSpec(pkg))));
+ ptr = new std::tr1::shared_ptr<const WrappedSpecBase>(new WrappedSpec<BlockDepSpec>(make_shared_ptr(
+ new BlockDepSpec(StringValuePtr(str), *pkg, value_to_bool(strong)))));
VALUE tdata(Data_Wrap_Struct(self, 0, &Common<std::tr1::shared_ptr<const WrappedSpecBase> >::free, ptr));
- rb_obj_call_init(tdata, 1, &spec);
+ rb_obj_call_init(tdata, 3, &str);
return tdata;
}
catch (const std::exception & e)
@@ -482,16 +483,17 @@ namespace
/*
* call-seq:
- * blocked_spec -> DepSpec
+ * blocking -> DepSpec
*
* Fetch the DepSpec we're blocking.
*/
VALUE
- block_dep_spec_blocked_spec(VALUE self)
+ block_dep_spec_blocking(VALUE self)
{
std::tr1::shared_ptr<WrappedSpecBase> * p;
Data_Get_Struct(self, std::tr1::shared_ptr<WrappedSpecBase>, p);
- return package_dep_spec_to_value(std::tr1::static_pointer_cast<const WrappedSpec<BlockDepSpec> >(*p)->spec()->blocked_spec());
+ return package_dep_spec_to_value(make_shared_ptr(new PackageDepSpec(
+ std::tr1::static_pointer_cast<const WrappedSpec<BlockDepSpec> >(*p)->spec()->blocking())));
}
template <typename A_>
@@ -1291,9 +1293,9 @@ namespace
* associated version and SLOT restrictions.
*/
c_block_dep_spec = rb_define_class_under(paludis_module(), "BlockDepSpec", c_string_dep_spec);
- rb_define_singleton_method(c_block_dep_spec, "new", RUBY_FUNC_CAST(&block_dep_spec_new), 1);
- rb_define_method(c_block_dep_spec, "initialize", RUBY_FUNC_CAST(&dep_spec_init_1), 1);
- rb_define_method(c_block_dep_spec, "blocked_spec", RUBY_FUNC_CAST(&block_dep_spec_blocked_spec), 0);
+ rb_define_singleton_method(c_block_dep_spec, "new", RUBY_FUNC_CAST(&block_dep_spec_new), 3);
+ rb_define_method(c_block_dep_spec, "initialize", RUBY_FUNC_CAST(&dep_spec_init_1), 3);
+ rb_define_method(c_block_dep_spec, "blocking", RUBY_FUNC_CAST(&block_dep_spec_blocking), 0);
VALUE (* block_dep_spec_to_s) (VALUE) = &dep_spec_to_s<BlockDepSpec>;
rb_define_method(c_block_dep_spec, "to_s", RUBY_FUNC_CAST(block_dep_spec_to_s), 0);
diff --git a/ruby/dep_spec_TEST.rb b/ruby/dep_spec_TEST.rb
index ec6c0a4..5cbe074 100644
--- a/ruby/dep_spec_TEST.rb
+++ b/ruby/dep_spec_TEST.rb
@@ -281,22 +281,22 @@ module Paludis
end
def test_create
- v = BlockDepSpec.new(Paludis::parse_user_package_dep_spec(">=foo/bar-1", env, []))
+ v = BlockDepSpec.new("!>=foo/bar-1", Paludis::parse_user_package_dep_spec(">=foo/bar-1", env, []), false)
end
def test_create_error
assert_raise TypeError do
- v = BlockDepSpec.new(0)
+ v = BlockDepSpec.new("!>=foo/bar-1", 0, false)
end
assert_raise TypeError do
- v = BlockDepSpec.new(PlainTextDepSpec.new('foo-bar/baz'))
+ v = BlockDepSpec.new("!>=foo/bar-1", PlainTextDepSpec.new('foo-bar/baz'), false)
end
end
def test_blocked_spec
- assert_equal "foo/baz", BlockDepSpec.new(Paludis::parse_user_package_dep_spec(
- "foo/baz", env, [])).blocked_spec.to_s
+ assert_equal "foo/baz", BlockDepSpec.new("!foo/baz", Paludis::parse_user_package_dep_spec(
+ "foo/baz", env, []), false).blocking.to_s
end
end