aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2012-09-14 17:40:39 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2012-09-14 18:06:37 +0100
commit7ce0a00a008983de8a8e61d33d41a4f41147db9b (patch)
treeba35068b18f5745145d0eefe02df85c0cd0aa5cc
parent2bff9772cc069fe98e281432bddd0b35c1e934e4 (diff)
downloadpaludis-7ce0a00a008983de8a8e61d33d41a4f41147db9b.tar.gz
paludis-7ce0a00a008983de8a8e61d33d41a4f41147db9b.tar.xz
Refactor to allow subslots
-rw-r--r--doc/api/cplusplus/examples/example_metadata_key.cc4
-rw-r--r--paludis/common_sets.cc6
-rw-r--r--paludis/elike_package_dep_spec.cc6
-rw-r--r--paludis/elike_slot_requirement-fwd.hh8
-rw-r--r--paludis/elike_slot_requirement.cc86
-rw-r--r--paludis/elike_slot_requirement.hh45
-rw-r--r--paludis/environments/paludis/output_conf.cc3
-rw-r--r--paludis/files.m41
-rw-r--r--paludis/filter.cc6
-rw-r--r--paludis/literal_metadata_key.cc3
-rw-r--r--paludis/match_package.cc17
-rw-r--r--paludis/metadata_key.cc2
-rw-r--r--paludis/metadata_key.hh5
-rw-r--r--paludis/ndbam_merger.cc3
-rw-r--r--paludis/ndbam_unmerger.cc3
-rw-r--r--paludis/package_id.hh3
-rw-r--r--paludis/repositories/accounts/accounts_id.cc2
-rw-r--r--paludis/repositories/accounts/accounts_id.hh2
-rw-r--r--paludis/repositories/accounts/installed_accounts_id.cc2
-rw-r--r--paludis/repositories/accounts/installed_accounts_id.hh2
-rw-r--r--paludis/repositories/e/do_fetch_action.cc3
-rw-r--r--paludis/repositories/e/do_install_action.cc11
-rw-r--r--paludis/repositories/e/e_installed_repository_id.cc17
-rw-r--r--paludis/repositories/e/e_installed_repository_id.hh2
-rw-r--r--paludis/repositories/e/e_repository_sets.cc28
-rw-r--r--paludis/repositories/e/e_slot_key.cc17
-rw-r--r--paludis/repositories/e/e_slot_key.hh2
-rw-r--r--paludis/repositories/e/ebuild_flat_metadata_cache.cc3
-rw-r--r--paludis/repositories/e/ebuild_flat_metadata_cache_TEST.cc3
-rw-r--r--paludis/repositories/e/ebuild_id.cc13
-rw-r--r--paludis/repositories/e/ebuild_id.hh2
-rw-r--r--paludis/repositories/e/exndbam_repository.cc11
-rw-r--r--paludis/repositories/e/fix_locked_dependencies.cc82
-rw-r--r--paludis/repositories/e/pbin_merger.cc3
-rw-r--r--paludis/repositories/e/vdb_merger.cc3
-rw-r--r--paludis/repositories/e/vdb_repository.cc7
-rw-r--r--paludis/repositories/e/vdb_unmerger.cc3
-rw-r--r--paludis/repositories/fake/fake_package_id.cc27
-rw-r--r--paludis/repositories/fake/fake_package_id.hh2
-rw-r--r--paludis/repositories/gemcutter/gemcutter_id.cc11
-rw-r--r--paludis/repositories/gemcutter/gemcutter_id.hh2
-rw-r--r--paludis/repositories/repository/repository_id.cc2
-rw-r--r--paludis/repositories/repository/repository_id.hh2
-rw-r--r--paludis/repositories/unavailable/unavailable_package_id.cc27
-rw-r--r--paludis/repositories/unavailable/unavailable_package_id.hh2
-rw-r--r--paludis/repositories/unavailable/unavailable_repository_id.cc2
-rw-r--r--paludis/repositories/unavailable/unavailable_repository_id.hh2
-rw-r--r--paludis/repositories/unpackaged/installed_id.cc22
-rw-r--r--paludis/repositories/unpackaged/installed_id.hh2
-rw-r--r--paludis/repositories/unpackaged/installed_repository.cc9
-rw-r--r--paludis/repositories/unpackaged/installed_repository_TEST.cc5
-rw-r--r--paludis/repositories/unpackaged/unpackaged_id.cc28
-rw-r--r--paludis/repositories/unpackaged/unpackaged_id.hh2
-rw-r--r--paludis/repositories/unpackaged/unpackaged_repository_TEST.cc3
-rw-r--r--paludis/repositories/unwritten/unwritten_id.cc17
-rw-r--r--paludis/repositories/unwritten/unwritten_id.hh4
-rw-r--r--paludis/repositories/unwritten/unwritten_repository_file.cc8
-rw-r--r--paludis/repositories/unwritten/unwritten_repository_file.hh3
-rw-r--r--paludis/resolver/collect_depped_upon.cc4
-rw-r--r--paludis/resolver/decider.cc17
-rw-r--r--paludis/resolver/get_constraints_for_dependent_helper.cc3
-rw-r--r--paludis/resolver/get_constraints_for_purge_helper.cc3
-rw-r--r--paludis/resolver/get_sameness.cc6
-rw-r--r--paludis/resolver/resolvent.cc5
-rw-r--r--paludis/resolver/same_slot.cc4
-rw-r--r--paludis/selection.cc5
-rw-r--r--paludis/slot-fwd.hh28
-rw-r--r--paludis/slot.cc23
-rw-r--r--paludis/slot.hh65
-rw-r--r--paludis/slot_requirement-fwd.hh8
-rw-r--r--paludis/slot_requirement.hh62
-rw-r--r--paludis/user_dep_spec-fwd.hh4
-rw-r--r--paludis/user_dep_spec.cc21
-rw-r--r--paludis/user_dep_spec.hh8
-rwxr-xr-xpython/dep_spec_TEST.py2
-rw-r--r--python/metadata_key.cc19
-rw-r--r--python/name.cc17
-rwxr-xr-xpython/package_id_TEST.py4
-rw-r--r--python/slot_requirement.cc74
-rw-r--r--ruby/dep_spec.cc54
-rw-r--r--ruby/dep_spec_TEST.rb2
-rw-r--r--ruby/metadata_key.cc5
-rw-r--r--ruby/package_id.cc2
-rwxr-xr-xsrc/clients/cave/cmd_display_resolution.cc5
-rw-r--r--src/clients/cave/cmd_fix_linkage.cc3
-rw-r--r--src/clients/cave/cmd_generate_metadata.cc1
-rw-r--r--src/clients/cave/cmd_info.cc5
-rw-r--r--src/clients/cave/cmd_match.cc5
-rw-r--r--src/clients/cave/cmd_print_spec.cc2
-rw-r--r--src/clients/cave/cmd_show.cc7
-rw-r--r--src/clients/cave/cmd_uninstall.cc3
-rw-r--r--src/clients/cave/format_package_id.cc3
-rw-r--r--src/clients/cave/format_plain_metadata_key.cc5
93 files changed, 793 insertions, 292 deletions
diff --git a/doc/api/cplusplus/examples/example_metadata_key.cc b/doc/api/cplusplus/examples/example_metadata_key.cc
index 264317b..deffb0a 100644
--- a/doc/api/cplusplus/examples/example_metadata_key.cc
+++ b/doc/api/cplusplus/examples/example_metadata_key.cc
@@ -62,10 +62,10 @@ namespace
cout << indent << left << setw(30) << " Value:" << " " << key.parse_value() << endl;
}
- void visit(const MetadataValueKey<SlotName> & key)
+ void visit(const MetadataValueKey<Slot> & key)
{
cout << indent << left << setw(30) << " Class:" << " " << "MetadataValueKey<SlotName>" << endl;
- cout << indent << left << setw(30) << " Value:" << " " << key.parse_value() << endl;
+ cout << indent << left << setw(30) << " Value:" << " " << key.parse_value().raw_value() << endl;
}
void visit(const MetadataValueKey<long> & key)
diff --git a/paludis/common_sets.cc b/paludis/common_sets.cc
index eaefdec..633b641 100644
--- a/paludis/common_sets.cc
+++ b/paludis/common_sets.cc
@@ -27,8 +27,9 @@
#include <paludis/filtered_generator.hh>
#include <paludis/metadata_key.hh>
#include <paludis/package_id.hh>
-#include <paludis/elike_slot_requirement.hh>
+#include <paludis/user_dep_spec.hh>
#include <paludis/partially_made_package_dep_spec.hh>
+#include <paludis/slot.hh>
#include <paludis/util/sequence.hh>
#include <paludis/util/wrapped_forward_iterator.hh>
#include <paludis/util/stringify.hh>
@@ -59,8 +60,7 @@ namespace
result->top()->append(std::make_shared<PackageDepSpec>(
make_package_dep_spec({ })
.package((*i)->name())
- .slot_requirement(std::make_shared<ELikeSlotExactRequirement>(
- (*i)->slot_key()->parse_value(), false))
+ .slot_requirement(std::make_shared<UserSlotExactPartialRequirement>((*i)->slot_key()->parse_value().parallel_value()))
));
else
result->top()->append(std::make_shared<PackageDepSpec>(
diff --git a/paludis/elike_package_dep_spec.cc b/paludis/elike_package_dep_spec.cc
index a253ff3..c1b08a9 100644
--- a/paludis/elike_package_dep_spec.cc
+++ b/paludis/elike_package_dep_spec.cc
@@ -308,9 +308,9 @@ paludis::elike_remove_trailing_slot_if_exists(std::string & s, PartiallyMadePack
}
if (1 == match.length())
- result.slot_requirement(std::make_shared<ELikeSlotAnyLockedRequirement>());
+ result.slot_requirement(std::make_shared<ELikeSlotAnyAtAllLockedRequirement>());
else
- result.slot_requirement(std::make_shared<ELikeSlotExactRequirement>(SlotName(s.substr(slot_p + 2)), true));
+ result.slot_requirement(std::make_shared<ELikeSlotExactPartialRequirement>(SlotName(s.substr(slot_p + 2)), std::make_shared<ELikeSlotAnyAtAllLockedRequirement>()));
}
else
{
@@ -322,7 +322,7 @@ paludis::elike_remove_trailing_slot_if_exists(std::string & s, PartiallyMadePack
Log::get_instance()->message("e.package_dep_spec.slot_not_allowed", ll_warning, lc_context)
<< "Slot dependencies not safe for use here";
}
- result.slot_requirement(std::make_shared<ELikeSlotExactRequirement>(SlotName(s.substr(slot_p + 1)), false));
+ result.slot_requirement(std::make_shared<ELikeSlotExactPartialRequirement>(SlotName(s.substr(slot_p + 1)), make_null_shared_ptr()));
}
s.erase(slot_p);
}
diff --git a/paludis/elike_slot_requirement-fwd.hh b/paludis/elike_slot_requirement-fwd.hh
index 9ec1513..8614d3c 100644
--- a/paludis/elike_slot_requirement-fwd.hh
+++ b/paludis/elike_slot_requirement-fwd.hh
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2008 Ciaran McCreesh
+ * Copyright (c) 2008, 2011 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
@@ -22,8 +22,10 @@
namespace paludis
{
- class ELikeSlotExactRequirement;
- class ELikeSlotAnyLockedRequirement;
+ class ELikeSlotExactFullRequirement;
+ class ELikeSlotExactPartialRequirement;
+ class ELikeSlotAnyAtAllLockedRequirement;
+ class ELikeSlotAnyPartialLockedRequirement;
class ELikeSlotAnyUnlockedRequirement;
}
diff --git a/paludis/elike_slot_requirement.cc b/paludis/elike_slot_requirement.cc
index 04b2f21..90077e0 100644
--- a/paludis/elike_slot_requirement.cc
+++ b/paludis/elike_slot_requirement.cc
@@ -19,31 +19,62 @@
#include <paludis/elike_slot_requirement.hh>
#include <paludis/util/stringify.hh>
+#include <paludis/util/make_null_shared_ptr.hh>
using namespace paludis;
-ELikeSlotExactRequirement::ELikeSlotExactRequirement(const SlotName & s, const bool e) :
+ELikeSlotExactFullRequirement::ELikeSlotExactFullRequirement(const std::pair<SlotName, SlotName> & s, const std::shared_ptr<const SlotRequirement> & o) :
_s(s),
- _e(e)
+ _maybe_original_requirement_if_rewritten(o)
{
}
const std::string
-ELikeSlotExactRequirement::as_string() const
+ELikeSlotExactFullRequirement::as_string() const
{
- return ":" + std::string(_e ? "=" : "") + stringify(_s);
+ if (_maybe_original_requirement_if_rewritten)
+ return _maybe_original_requirement_if_rewritten->as_string() + stringify(_s.first) + "/" + stringify(_s.second);
+ else
+ return ":" + stringify(_s.first) + "/" + stringify(_s.second);
}
-const SlotName
-ELikeSlotExactRequirement::slot() const
+const std::shared_ptr<const SlotRequirement>
+ELikeSlotExactFullRequirement::maybe_original_requirement_if_rewritten() const
+{
+ return _maybe_original_requirement_if_rewritten;
+}
+
+ELikeSlotExactPartialRequirement::ELikeSlotExactPartialRequirement(const SlotName & s, const std::shared_ptr<const SlotRequirement> & o) :
+ _s(s),
+ _maybe_original_requirement_if_rewritten(o)
+{
+}
+
+const std::pair<SlotName, SlotName>
+ELikeSlotExactFullRequirement::slots() const
{
return _s;
}
-bool
-ELikeSlotExactRequirement::from_any_locked() const
+const std::string
+ELikeSlotExactPartialRequirement::as_string() const
{
- return _e;
+ if (_maybe_original_requirement_if_rewritten)
+ return _maybe_original_requirement_if_rewritten->as_string() + stringify(_s);
+ else
+ return ":" + stringify(_s);
+}
+
+const std::shared_ptr<const SlotRequirement>
+ELikeSlotExactPartialRequirement::maybe_original_requirement_if_rewritten() const
+{
+ return _maybe_original_requirement_if_rewritten;
+}
+
+const SlotName
+ELikeSlotExactPartialRequirement::slot() const
+{
+ return _s;
}
const std::string
@@ -52,9 +83,44 @@ ELikeSlotAnyUnlockedRequirement::as_string() const
return ":*";
}
+const std::shared_ptr<const SlotRequirement>
+ELikeSlotAnyUnlockedRequirement::maybe_original_requirement_if_rewritten() const
+{
+ return make_null_shared_ptr();
+}
+
const std::string
-ELikeSlotAnyLockedRequirement::as_string() const
+ELikeSlotAnyAtAllLockedRequirement::as_string() const
{
return ":=";
}
+const std::shared_ptr<const SlotRequirement>
+ELikeSlotAnyAtAllLockedRequirement::maybe_original_requirement_if_rewritten() const
+{
+ return make_null_shared_ptr();
+}
+
+ELikeSlotAnyPartialLockedRequirement::ELikeSlotAnyPartialLockedRequirement(const SlotName & s) :
+ _s(s)
+{
+}
+
+const std::string
+ELikeSlotAnyPartialLockedRequirement::as_string() const
+{
+ return ":" + stringify(_s) + "=";
+}
+
+const std::shared_ptr<const SlotRequirement>
+ELikeSlotAnyPartialLockedRequirement::maybe_original_requirement_if_rewritten() const
+{
+ return make_null_shared_ptr();
+}
+
+const SlotName
+ELikeSlotAnyPartialLockedRequirement::slot() const
+{
+ return _s;
+}
+
diff --git a/paludis/elike_slot_requirement.hh b/paludis/elike_slot_requirement.hh
index 83f6a2c..bdc4f7b 100644
--- a/paludis/elike_slot_requirement.hh
+++ b/paludis/elike_slot_requirement.hh
@@ -26,19 +26,34 @@
namespace paludis
{
- class PALUDIS_VISIBLE ELikeSlotExactRequirement :
- public SlotExactRequirement
+ class PALUDIS_VISIBLE ELikeSlotExactFullRequirement :
+ public SlotExactFullRequirement
+ {
+ private:
+ const std::pair<SlotName, SlotName> _s;
+ const std::shared_ptr<const SlotRequirement> _maybe_original_requirement_if_rewritten;
+
+ public:
+ ELikeSlotExactFullRequirement(const std::pair<SlotName, SlotName> &, const std::shared_ptr<const SlotRequirement> &);
+
+ virtual const std::string as_string() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual const std::shared_ptr<const SlotRequirement> maybe_original_requirement_if_rewritten() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual const std::pair<SlotName, SlotName> slots() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ };
+
+ class PALUDIS_VISIBLE ELikeSlotExactPartialRequirement :
+ public SlotExactPartialRequirement
{
private:
const SlotName _s;
- const bool _e;
+ const std::shared_ptr<const SlotRequirement> _maybe_original_requirement_if_rewritten;
public:
- ELikeSlotExactRequirement(const SlotName &, const bool equals);
+ ELikeSlotExactPartialRequirement(const SlotName &, const std::shared_ptr<const SlotRequirement> &);
virtual const std::string as_string() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual const std::shared_ptr<const SlotRequirement> maybe_original_requirement_if_rewritten() const PALUDIS_ATTRIBUTE((warn_unused_result));
virtual const SlotName slot() const PALUDIS_ATTRIBUTE((warn_unused_result));
- virtual bool from_any_locked() const PALUDIS_ATTRIBUTE((warn_unused_result));
};
class PALUDIS_VISIBLE ELikeSlotAnyUnlockedRequirement :
@@ -46,13 +61,29 @@ namespace paludis
{
public:
virtual const std::string as_string() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual const std::shared_ptr<const SlotRequirement> maybe_original_requirement_if_rewritten() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ };
+
+ class PALUDIS_VISIBLE ELikeSlotAnyAtAllLockedRequirement :
+ public SlotAnyAtAllLockedRequirement
+ {
+ public:
+ virtual const std::string as_string() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual const std::shared_ptr<const SlotRequirement> maybe_original_requirement_if_rewritten() const PALUDIS_ATTRIBUTE((warn_unused_result));
};
- class PALUDIS_VISIBLE ELikeSlotAnyLockedRequirement :
- public SlotAnyLockedRequirement
+ class PALUDIS_VISIBLE ELikeSlotAnyPartialLockedRequirement :
+ public SlotAnyPartialLockedRequirement
{
+ private:
+ const SlotName _s;
+
public:
+ ELikeSlotAnyPartialLockedRequirement(const SlotName &);
+
virtual const std::string as_string() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual const std::shared_ptr<const SlotRequirement> maybe_original_requirement_if_rewritten() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual const SlotName slot() const PALUDIS_ATTRIBUTE((warn_unused_result));
};
}
diff --git a/paludis/environments/paludis/output_conf.cc b/paludis/environments/paludis/output_conf.cc
index 94213d1..ccd5f51 100644
--- a/paludis/environments/paludis/output_conf.cc
+++ b/paludis/environments/paludis/output_conf.cc
@@ -48,6 +48,7 @@
#include <paludis/metadata_key.hh>
#include <paludis/distribution.hh>
#include <paludis/version_spec.hh>
+#include <paludis/slot.hh>
#include <list>
#include <vector>
@@ -276,7 +277,7 @@ namespace
m->insert("id", escape(stringify(*i.package_id())));
m->insert("full_name", escape(stringify(*i.package_id())));
if (i.package_id()->slot_key())
- m->insert("slot", stringify(i.package_id()->slot_key()->parse_value()));
+ m->insert("slot", stringify(i.package_id()->slot_key()->parse_value().raw_value()));
m->insert("version", stringify(i.package_id()->version()));
m->insert("repository", stringify(i.package_id()->repository_name()));
m->insert("category", stringify(i.package_id()->name().category()));
diff --git a/paludis/files.m4 b/paludis/files.m4
index d97a60d..03e8b23 100644
--- a/paludis/files.m4
+++ b/paludis/files.m4
@@ -92,6 +92,7 @@ add(`selection', `hh', `cc', `fwd', `gtest')
add(`selection_handler', `hh', `cc', `fwd')
add(`serialise', `hh', `cc', `fwd', `impl')
add(`set_file', `hh', `cc', `se', `gtest', `testscript')
+add(`slot', `hh', `fwd', `cc')
add(`slot_requirement', `hh', `fwd', `cc')
add(`spec_tree', `hh', `fwd', `cc')
add(`standard_output_manager', `hh', `cc', `fwd')
diff --git a/paludis/filter.cc b/paludis/filter.cc
index 3b513ec..53d8f8a 100644
--- a/paludis/filter.cc
+++ b/paludis/filter.cc
@@ -27,6 +27,7 @@
#include <paludis/match_package.hh>
#include <paludis/repository.hh>
#include <paludis/action_names.hh>
+#include <paludis/slot.hh>
#include <paludis/util/pimp-impl.hh>
#include <paludis/util/set.hh>
@@ -348,7 +349,7 @@ namespace
i != i_end ; ++i)
if (as_id->slot_key())
{
- if ((*i)->slot_key() && (*i)->slot_key()->parse_value() == as_id->slot_key()->parse_value())
+ if ((*i)->slot_key() && (*i)->slot_key()->parse_value().parallel_value() == as_id->slot_key()->parse_value().parallel_value())
result->insert(*i);
}
else
@@ -389,7 +390,7 @@ namespace
for (PackageIDSet::ConstIterator i(id->begin()), i_end(id->end()) ;
i != i_end ; ++i)
- if ((*i)->slot_key() && (*i)->slot_key()->parse_value() == slot)
+ if ((*i)->slot_key() && (*i)->slot_key()->parse_value().parallel_value() == slot)
result->insert(*i);
return result;
@@ -553,3 +554,4 @@ namespace paludis
template class filter::SupportsAction<InfoAction>;
template class filter::SupportsAction<PretendFetchAction>;
}
+
diff --git a/paludis/literal_metadata_key.cc b/paludis/literal_metadata_key.cc
index a670d4e..ec8fa29 100644
--- a/paludis/literal_metadata_key.cc
+++ b/paludis/literal_metadata_key.cc
@@ -29,6 +29,7 @@
#include <paludis/name.hh>
#include <paludis/pretty_printer.hh>
#include <paludis/call_pretty_printer.hh>
+#include <paludis/slot.hh>
#include <functional>
using namespace paludis;
@@ -462,7 +463,7 @@ namespace paludis
{
template class LiteralMetadataValueKey<FSPath>;
template class LiteralMetadataValueKey<std::string>;
- template class LiteralMetadataValueKey<SlotName>;
+ template class LiteralMetadataValueKey<Slot>;
template class LiteralMetadataValueKey<bool>;
template class LiteralMetadataValueKey<long>;
template class LiteralMetadataValueKey<std::shared_ptr<const PackageID> >;
diff --git a/paludis/match_package.cc b/paludis/match_package.cc
index e6a95d4..0f9bac3 100644
--- a/paludis/match_package.cc
+++ b/paludis/match_package.cc
@@ -29,6 +29,7 @@
#include <paludis/action.hh>
#include <paludis/repository.hh>
#include <paludis/additional_package_dep_spec_requirement.hh>
+#include <paludis/slot.hh>
#include <paludis/util/set.hh>
#include <paludis/util/options.hh>
@@ -60,12 +61,22 @@ namespace
{
}
- void visit(const SlotExactRequirement & s)
+ void visit(const SlotExactPartialRequirement & s)
{
- result = id->slot_key() && id->slot_key()->parse_value() == s.slot();
+ result = id->slot_key() && id->slot_key()->parse_value().match_values().first == s.slot();
}
- void visit(const SlotAnyLockedRequirement &)
+ void visit(const SlotExactFullRequirement & s)
+ {
+ result = id->slot_key() && id->slot_key()->parse_value().match_values() == s.slots();
+ }
+
+ void visit(const SlotAnyPartialLockedRequirement & s)
+ {
+ result = id->slot_key() && id->slot_key()->parse_value().match_values().first == s.slot();
+ }
+
+ void visit(const SlotAnyAtAllLockedRequirement &)
{
result = true;
}
diff --git a/paludis/metadata_key.cc b/paludis/metadata_key.cc
index 9694275..bb44785 100644
--- a/paludis/metadata_key.cc
+++ b/paludis/metadata_key.cc
@@ -90,7 +90,7 @@ namespace paludis
template class MetadataValueKey<long>;
template class MetadataValueKey<bool>;
template class MetadataValueKey<FSPath>;
- template class MetadataValueKey<SlotName>;
+ template class MetadataValueKey<Slot>;
template class MetadataValueKey<std::shared_ptr<const PackageID> >;
template class MetadataValueKey<std::shared_ptr<const Choices> >;
}
diff --git a/paludis/metadata_key.hh b/paludis/metadata_key.hh
index 8b17c3c..953c5f3 100644
--- a/paludis/metadata_key.hh
+++ b/paludis/metadata_key.hh
@@ -32,6 +32,8 @@
#include <paludis/pretty_printer-fwd.hh>
#include <paludis/pretty_print_options-fwd.hh>
#include <paludis/maintainer-fwd.hh>
+#include <paludis/slot-fwd.hh>
+
#include <paludis/util/fs_path-fwd.hh>
#include <paludis/util/attributes.hh>
#include <paludis/util/remove_shared_ptr.hh>
@@ -40,6 +42,7 @@
#include <paludis/util/timestamp-fwd.hh>
#include <paludis/util/set.hh>
#include <paludis/util/map.hh>
+
#include <type_traits>
#include <string>
@@ -103,7 +106,7 @@ namespace paludis
MetadataValueKey<long>,
MetadataValueKey<bool>,
MetadataValueKey<FSPath>,
- MetadataValueKey<SlotName>,
+ MetadataValueKey<Slot>,
MetadataValueKey<std::shared_ptr<const PackageID> >,
MetadataValueKey<std::shared_ptr<const Choices> >,
MetadataTimeKey,
diff --git a/paludis/ndbam_merger.cc b/paludis/ndbam_merger.cc
index 0dbbf12..7a0de31 100644
--- a/paludis/ndbam_merger.cc
+++ b/paludis/ndbam_merger.cc
@@ -43,6 +43,7 @@
#include <paludis/ndbam_merger.hh>
#include <paludis/metadata_key.hh>
#include <paludis/version_spec.hh>
+#include <paludis/slot.hh>
#include <iomanip>
#include <list>
@@ -105,7 +106,7 @@ NDBAMMerger::extend_hook(const Hook & h)
std::string pn(stringify(_imp->params.package_id()->name().package()));
std::string pvr(stringify(_imp->params.package_id()->version()));
std::string pv(stringify(_imp->params.package_id()->version().remove_revision()));
- std::string slot(_imp->params.package_id()->slot_key() ? stringify(_imp->params.package_id()->slot_key()->parse_value()) : "");
+ std::string slot(_imp->params.package_id()->slot_key() ? stringify(_imp->params.package_id()->slot_key()->parse_value().raw_value()) : "");
return FSMerger::extend_hook(h)
("P", pn + "-" + pv)
diff --git a/paludis/ndbam_unmerger.cc b/paludis/ndbam_unmerger.cc
index 6966b5e..57a9e99 100644
--- a/paludis/ndbam_unmerger.cc
+++ b/paludis/ndbam_unmerger.cc
@@ -26,6 +26,7 @@
#include <paludis/package_id.hh>
#include <paludis/output_manager.hh>
#include <paludis/metadata_key.hh>
+#include <paludis/slot.hh>
#include <paludis/util/destringify.hh>
#include <paludis/util/md5.hh>
@@ -101,7 +102,7 @@ NDBAMUnmerger::extend_hook(const Hook & h) const
std::string pn(stringify(_imp->options.package_id()->name().package()));
std::string pvr(stringify(_imp->options.package_id()->version()));
std::string pv(stringify(_imp->options.package_id()->version().remove_revision()));
- std::string slot(_imp->options.package_id()->slot_key() ? stringify(_imp->options.package_id()->slot_key()->parse_value()) : "");
+ std::string slot(_imp->options.package_id()->slot_key() ? stringify(_imp->options.package_id()->slot_key()->parse_value().raw_value()) : "");
return result
("P", pn + "-" + pv)
diff --git a/paludis/package_id.hh b/paludis/package_id.hh
index 91e932b..3ff1e9d 100644
--- a/paludis/package_id.hh
+++ b/paludis/package_id.hh
@@ -42,6 +42,7 @@
#include <paludis/contents-fwd.hh>
#include <paludis/version_spec-fwd.hh>
#include <paludis/choice-fwd.hh>
+#include <paludis/slot-fwd.hh>
#include <memory>
@@ -185,7 +186,7 @@ namespace paludis
*
* \since 0.36
*/
- virtual const std::shared_ptr<const MetadataValueKey<SlotName> > slot_key() const = 0;
+ virtual const std::shared_ptr<const MetadataValueKey<Slot> > slot_key() const = 0;
/**
* The keywords_key, if non-zero, is used by FindUnusedPackagesTask
diff --git a/paludis/repositories/accounts/accounts_id.cc b/paludis/repositories/accounts/accounts_id.cc
index 2c406d7..9f99aee 100644
--- a/paludis/repositories/accounts/accounts_id.cc
+++ b/paludis/repositories/accounts/accounts_id.cc
@@ -404,7 +404,7 @@ AccountsID::choices_key() const
return make_null_shared_ptr();
}
-const std::shared_ptr<const MetadataValueKey<SlotName> >
+const std::shared_ptr<const MetadataValueKey<Slot> >
AccountsID::slot_key() const
{
return make_null_shared_ptr();
diff --git a/paludis/repositories/accounts/accounts_id.hh b/paludis/repositories/accounts/accounts_id.hh
index 3fd41db..dd835b0 100644
--- a/paludis/repositories/accounts/accounts_id.hh
+++ b/paludis/repositories/accounts/accounts_id.hh
@@ -61,7 +61,7 @@ namespace paludis
///\name Specific metadata keys
///\{
- virtual const std::shared_ptr<const MetadataValueKey<SlotName> > slot_key() const;
+ virtual const std::shared_ptr<const MetadataValueKey<Slot> > slot_key() const;
virtual const std::shared_ptr<const MetadataCollectionKey<KeywordNameSet> > keywords_key() const;
virtual const std::shared_ptr<const MetadataSpecTreeKey<DependencySpecTree> > build_dependencies_key() const;
virtual const std::shared_ptr<const MetadataSpecTreeKey<DependencySpecTree> > run_dependencies_key() const;
diff --git a/paludis/repositories/accounts/installed_accounts_id.cc b/paludis/repositories/accounts/installed_accounts_id.cc
index ddccea4..1457d8b 100644
--- a/paludis/repositories/accounts/installed_accounts_id.cc
+++ b/paludis/repositories/accounts/installed_accounts_id.cc
@@ -313,7 +313,7 @@ InstalledAccountsID::choices_key() const
return make_null_shared_ptr();
}
-const std::shared_ptr<const MetadataValueKey<SlotName> >
+const std::shared_ptr<const MetadataValueKey<Slot> >
InstalledAccountsID::slot_key() const
{
return make_null_shared_ptr();
diff --git a/paludis/repositories/accounts/installed_accounts_id.hh b/paludis/repositories/accounts/installed_accounts_id.hh
index 02572f5..076dfa7 100644
--- a/paludis/repositories/accounts/installed_accounts_id.hh
+++ b/paludis/repositories/accounts/installed_accounts_id.hh
@@ -59,7 +59,7 @@ namespace paludis
///\name Specific metadata keys
///\{
- virtual const std::shared_ptr<const MetadataValueKey<SlotName> > slot_key() const;
+ virtual const std::shared_ptr<const MetadataValueKey<Slot> > slot_key() const;
virtual const std::shared_ptr<const MetadataCollectionKey<KeywordNameSet> > keywords_key() const;
virtual const std::shared_ptr<const MetadataSpecTreeKey<DependencySpecTree> > build_dependencies_key() const;
virtual const std::shared_ptr<const MetadataSpecTreeKey<DependencySpecTree> > run_dependencies_key() const;
diff --git a/paludis/repositories/e/do_fetch_action.cc b/paludis/repositories/e/do_fetch_action.cc
index 21dddbb..cd09397 100644
--- a/paludis/repositories/e/do_fetch_action.cc
+++ b/paludis/repositories/e/do_fetch_action.cc
@@ -43,6 +43,7 @@
#include <paludis/environment.hh>
#include <paludis/action.hh>
#include <paludis/output_manager.hh>
+#include <paludis/slot.hh>
#include <algorithm>
#include <set>
@@ -208,7 +209,7 @@ paludis::erepository::do_fetch_action(
n::loadsaveenv_dir() = package_builddir / "temp",
n::profiles() = repo->params().profiles(),
n::profiles_with_parents() = repo->profile()->profiles_with_parents(),
- n::slot() = id->slot_key() ? stringify(id->slot_key()->parse_value()) : "",
+ n::slot() = id->slot_key() ? stringify(id->slot_key()->parse_value().raw_value()) : "",
n::use() = use,
n::use_expand() = join(repo->profile()->use_expand()->begin(), repo->profile()->use_expand()->end(), " "),
n::use_expand_hidden() = join(repo->profile()->use_expand_hidden()->begin(), repo->profile()->use_expand_hidden()->end(), " ")
diff --git a/paludis/repositories/e/do_install_action.cc b/paludis/repositories/e/do_install_action.cc
index 0e429ec..72f90a6 100644
--- a/paludis/repositories/e/do_install_action.cc
+++ b/paludis/repositories/e/do_install_action.cc
@@ -48,6 +48,7 @@
#include <paludis/choice.hh>
#include <paludis/elike_choices.hh>
#include <paludis/output_manager.hh>
+#include <paludis/slot.hh>
#include <vector>
#include <algorithm>
@@ -99,11 +100,11 @@ namespace
s = v;
}
- bool slot_is_same(const std::shared_ptr<const PackageID> & a,
+ bool parallel_slot_is_same(const std::shared_ptr<const PackageID> & a,
const std::shared_ptr<const PackageID> & b)
{
if (a->slot_key())
- return b->slot_key() && a->slot_key()->parse_value() == b->slot_key()->parse_value();
+ return b->slot_key() && a->slot_key()->parse_value().parallel_value() == b->slot_key()->parse_value().parallel_value();
else
return ! b->slot_key();
}
@@ -394,7 +395,7 @@ paludis::erepository::do_install_action(
n::profiles() = repo->params().profiles(),
n::profiles_with_parents() = repo->profile()->profiles_with_parents(),
n::replacing_ids() = install_action.options.replacing(),
- n::slot() = id->slot_key() ? stringify(id->slot_key()->parse_value()) : "",
+ n::slot() = id->slot_key() ? stringify(id->slot_key()->parse_value().raw_value()) : "",
n::use() = use,
n::use_expand() = join(repo->profile()->use_expand()->begin(), repo->profile()->use_expand()->end(), " "),
n::use_expand_hidden() = join(repo->profile()->use_expand_hidden()->begin(), repo->profile()->use_expand_hidden()->end(), " ")
@@ -455,7 +456,7 @@ paludis::erepository::do_install_action(
n::profiles() = repo->params().profiles(),
n::profiles_with_parents() = repo->profile()->profiles_with_parents(),
n::replacing_ids() = install_action.options.replacing(),
- n::slot() = id->slot_key() ? stringify(id->slot_key()->parse_value()) : "",
+ n::slot() = id->slot_key() ? stringify(id->slot_key()->parse_value().raw_value()) : "",
n::use() = use,
n::use_expand() = join(repo->profile()->use_expand()->begin(), repo->profile()->use_expand()->end(), " "),
n::use_expand_hidden() = join(repo->profile()->use_expand_hidden()->begin(), repo->profile()->use_expand_hidden()->end(), " ")
@@ -481,7 +482,7 @@ paludis::erepository::do_install_action(
continue;
if (id->eapi()->supported()->ebuild_phases()->ebuild_new_upgrade_phase_order())
- if ((*i)->name() == id->name() && slot_is_same(*i, id))
+ if ((*i)->name() == id->name() && parallel_slot_is_same(*i, id))
continue;
UninstallActionOptions uo(make_named_values<UninstallActionOptions>(
diff --git a/paludis/repositories/e/e_installed_repository_id.cc b/paludis/repositories/e/e_installed_repository_id.cc
index 5c01d89..0cd2266 100644
--- a/paludis/repositories/e/e_installed_repository_id.cc
+++ b/paludis/repositories/e/e_installed_repository_id.cc
@@ -26,6 +26,7 @@
#include <paludis/repositories/e/dep_parser.hh>
#include <paludis/repositories/e/e_choice_value.hh>
#include <paludis/repositories/e/e_string_set_key.hh>
+#include <paludis/repositories/e/e_slot_key.hh>
#include <paludis/util/stringify.hh>
#include <paludis/util/log.hh>
@@ -51,6 +52,7 @@
#include <paludis/user_dep_spec.hh>
#include <paludis/elike_choices.hh>
#include <paludis/always_enabled_dependency_label.hh>
+#include <paludis/slot.hh>
#include <iterator>
@@ -68,7 +70,7 @@ namespace
struct EInstalledRepositoryIDKeys
{
- std::shared_ptr<const MetadataValueKey<SlotName> > slot;
+ std::shared_ptr<const MetadataValueKey<Slot> > slot;
std::shared_ptr<const MetadataCollectionKey<Set<std::string> > > raw_use;
std::shared_ptr<const MetadataCollectionKey<Set<std::string> > > inherited;
std::shared_ptr<const MetadataCollectionKey<Set<std::string > > > raw_iuse;
@@ -224,8 +226,7 @@ EInstalledRepositoryID::need_keys_added() const
if (! vars->slot()->name().empty())
if ((_imp->dir / vars->slot()->name()).stat().exists())
{
- _imp->keys->slot = std::make_shared<LiteralMetadataValueKey<SlotName>>(vars->slot()->name(), vars->slot()->description(),
- mkt_internal, SlotName(file_contents(_imp->dir / vars->slot()->name())));
+ _imp->keys->slot = ESlotKeyStore::get_instance()->fetch(vars->slot(), file_contents(_imp->dir / vars->slot()->name()), mkt_internal);
add_metadata_key(_imp->keys->slot);
}
@@ -618,14 +619,14 @@ EInstalledRepositoryID::canonical_form(const PackageIDCanonicalForm f) const
{
case idcf_full:
if (_imp->keys && _imp->keys->slot)
- return stringify(name()) + "-" + stringify(version()) + ":" + stringify(_imp->keys->slot->parse_value()) + "::" +
+ return stringify(name()) + "-" + stringify(version()) + ":" + stringify(_imp->keys->slot->parse_value().parallel_value()) + "::" +
stringify(repository_name());
return stringify(name()) + "-" + stringify(version()) + "::" + stringify(repository_name());
case idcf_no_version:
if (_imp->keys && _imp->keys->slot)
- return stringify(name()) + ":" + stringify(_imp->keys->slot->parse_value()) + "::" +
+ return stringify(name()) + ":" + stringify(_imp->keys->slot->parse_value().parallel_value()) + "::" +
stringify(repository_name());
return stringify(name()) + "::" + stringify(repository_name());
@@ -635,7 +636,7 @@ EInstalledRepositoryID::canonical_form(const PackageIDCanonicalForm f) const
case idcf_no_name:
if (_imp->keys && _imp->keys->slot)
- return stringify(version()) + ":" + stringify(_imp->keys->slot->parse_value()) + "::" +
+ return stringify(version()) + ":" + stringify(_imp->keys->slot->parse_value().parallel_value()) + "::" +
stringify(repository_name());
return stringify(version()) + "::" + stringify(repository_name());
@@ -651,7 +652,7 @@ PackageDepSpec
EInstalledRepositoryID::uniquely_identifying_spec() const
{
return parse_user_package_dep_spec("=" + stringify(name()) + "-" + stringify(version()) +
- (slot_key() ? ":" + stringify(slot_key()->parse_value()) : "") + "::" + stringify(repository_name()),
+ (slot_key() ? ":" + stringify(slot_key()->parse_value().parallel_value()) : "") + "::" + stringify(repository_name()),
_imp->environment, { });
}
@@ -1012,7 +1013,7 @@ EInstalledRepositoryID::perform_action(Action & a) const
a.accept(b);
}
-const std::shared_ptr<const MetadataValueKey<SlotName> >
+const std::shared_ptr<const MetadataValueKey<Slot> >
EInstalledRepositoryID::slot_key() const
{
need_keys_added();
diff --git a/paludis/repositories/e/e_installed_repository_id.hh b/paludis/repositories/e/e_installed_repository_id.hh
index ad6ec31..d6a76d4 100644
--- a/paludis/repositories/e/e_installed_repository_id.hh
+++ b/paludis/repositories/e/e_installed_repository_id.hh
@@ -57,7 +57,7 @@ namespace paludis
virtual const std::shared_ptr<const EAPI> eapi() const;
virtual bool is_installed() const PALUDIS_ATTRIBUTE((warn_unused_result));
- virtual const std::shared_ptr<const MetadataValueKey<SlotName> > slot_key() const;
+ virtual const std::shared_ptr<const MetadataValueKey<Slot> > slot_key() const;
virtual const std::shared_ptr<const MetadataCollectionKey<KeywordNameSet> > keywords_key() const;
virtual const std::shared_ptr<const MetadataSpecTreeKey<DependencySpecTree> > build_dependencies_key() const;
virtual const std::shared_ptr<const MetadataSpecTreeKey<DependencySpecTree> > run_dependencies_key() const;
diff --git a/paludis/repositories/e/e_repository_sets.cc b/paludis/repositories/e/e_repository_sets.cc
index a855880..b6c454d 100644
--- a/paludis/repositories/e/e_repository_sets.cc
+++ b/paludis/repositories/e/e_repository_sets.cc
@@ -31,11 +31,13 @@
#include <paludis/filter.hh>
#include <paludis/filtered_generator.hh>
#include <paludis/generator.hh>
+#include <paludis/match_package.hh>
#include <paludis/metadata_key.hh>
#include <paludis/package_id.hh>
#include <paludis/partially_made_package_dep_spec.hh>
#include <paludis/selection.hh>
#include <paludis/set_file.hh>
+#include <paludis/slot.hh>
#include <paludis/user_dep_spec.hh>
#include <paludis/version_operator.hh>
#include <paludis/version_requirements.hh>
@@ -169,13 +171,16 @@ ERepositorySets::sets_list() const
namespace
{
bool
- match_range(const PackageID & e, const erepository::GLSARange & r, const VersionSpecOptions & ver_options, const ELikePackageDepSpecOptions & pds_options)
+ match_range(const Environment * const env, const EAPI & eapi,
+ const std::shared_ptr<const PackageID> & id, const erepository::GLSARange & r, const VersionSpecOptions & ver_options, const ELikePackageDepSpecOptions & pds_options)
{
if (r.slot() != "*")
{
try
{
- if ((! e.slot_key()) || (e.slot_key()->parse_value() != SlotName(r.slot())))
+ PackageDepSpec spec(parse_elike_package_dep_spec(stringify(id->name()) + ":" + r.slot(), eapi.supported()->package_dep_spec_parse_options(),
+ eapi.supported()->version_spec_options()));
+ if (! match_package(*env, spec, id, make_null_shared_ptr(), { }))
return false;
}
catch (const SlotNameError &)
@@ -206,12 +211,12 @@ namespace
our_op = vo_greater_equal;
if (-1 != our_op)
- return (VersionOperator(our_op).as_version_spec_comparator()(e.version(), VersionSpec(ver, ver_options)));
+ return (VersionOperator(our_op).as_version_spec_comparator()(id->version(), VersionSpec(ver, ver_options)));
if (0 == r.op().compare(0, 1, "r"))
{
- return e.version().remove_revision() == VersionSpec(ver, ver_options).remove_revision() &&
- match_range(e, make_named_values<erepository::GLSARange>(
+ return id->version().remove_revision() == VersionSpec(ver, ver_options).remove_revision() &&
+ match_range(env, eapi, id, make_named_values<erepository::GLSARange>(
n::op() = r.op().substr(1),
n::slot() = r.slot(),
n::version() = r.version()),
@@ -222,14 +227,15 @@ namespace
}
bool
- is_vulnerable(const GLSAPackage & glsa_pkg, const PackageID & c, const VersionSpecOptions & ver_options, const ELikePackageDepSpecOptions & pds_options)
+ is_vulnerable(const Environment * const env, const EAPI & eapi,
+ const GLSAPackage & glsa_pkg, const std::shared_ptr<const PackageID> & id, const VersionSpecOptions & ver_options, const ELikePackageDepSpecOptions & pds_options)
{
/* a package is affected if it matches any vulnerable line, except if it matches
* any unaffected line. */
bool vulnerable(false);
for (GLSAPackage::RangesConstIterator r(glsa_pkg.begin_vulnerable()), r_end(glsa_pkg.end_vulnerable()) ;
r != r_end && ! vulnerable ; ++r)
- if (match_range(c, *r, ver_options, pds_options))
+ if (match_range(env, eapi, id, *r, ver_options, pds_options))
vulnerable = true;
if (! vulnerable)
@@ -237,7 +243,7 @@ namespace
for (GLSAPackage::RangesConstIterator r(glsa_pkg.begin_unaffected()), r_end(glsa_pkg.end_unaffected()) ;
r != r_end && vulnerable ; ++r)
- if (match_range(c, *r, ver_options, pds_options))
+ if (match_range(env, eapi, id, *r, ver_options, pds_options))
vulnerable = false;
return vulnerable;
@@ -289,7 +295,7 @@ ERepositorySets::security_set(bool insecurity) const
for (PackageIDSequence::ConstIterator c(candidates->begin()), c_end(candidates->end()) ;
c != c_end ; ++c)
{
- if (! is_vulnerable(*glsa_pkg, **c, ver_options, pds_options))
+ if (! is_vulnerable(_imp->environment, *eapi, *glsa_pkg, *c, ver_options, pds_options))
continue;
if (insecurity)
@@ -306,7 +312,7 @@ ERepositorySets::security_set(bool insecurity) const
else
{
Context local_local_local_context("When finding upgrade for '" + stringify(glsa_pkg->name()) + ":"
- + ((*c)->slot_key() ? stringify((*c)->slot_key()->parse_value()) : "(none)") + "'");
+ + ((*c)->slot_key() ? stringify((*c)->slot_key()->parse_value().raw_value()) : "(none)") + "'");
/* we need to find the best not vulnerable installable package that isn't masked
* that's in the same slot as our vulnerable installed package. */
@@ -320,7 +326,7 @@ ERepositorySets::security_set(bool insecurity) const
for (PackageIDSequence::ReverseConstIterator r(available->rbegin()), r_end(available->rend()) ; r != r_end ; ++r)
{
- if (is_vulnerable(*glsa_pkg, **r, ver_options, pds_options))
+ if (is_vulnerable(_imp->environment, *eapi, *glsa_pkg, *r, ver_options, pds_options))
{
Log::get_instance()->message("e.glsa.skipping_vulnerable", ll_debug, lc_context)
<< "Skipping '" << **r << "' due to is_vulnerable match";
diff --git a/paludis/repositories/e/e_slot_key.cc b/paludis/repositories/e/e_slot_key.cc
index 661d1af..b286f78 100644
--- a/paludis/repositories/e/e_slot_key.cc
+++ b/paludis/repositories/e/e_slot_key.cc
@@ -24,8 +24,10 @@
#include <paludis/util/hashes.hh>
#include <paludis/util/singleton-impl.hh>
#include <paludis/util/pimp-impl.hh>
+#include <paludis/util/make_named_values.hh>
#include <paludis/name.hh>
+#include <paludis/slot.hh>
#include <tuple>
#include <unordered_map>
@@ -36,13 +38,13 @@ using namespace paludis::erepository;
namespace
{
struct ESlotKey :
- MetadataValueKey<SlotName>
+ MetadataValueKey<Slot>
{
- const SlotName slot_value;
+ const Slot slot_value;
const std::shared_ptr<const EAPIMetadataVariable> variable;
const MetadataKeyType key_type;
- ESlotKey(const SlotName & v, const std::shared_ptr<const EAPIMetadataVariable> & m, const MetadataKeyType t) :
+ ESlotKey(const Slot & v, const std::shared_ptr<const EAPIMetadataVariable> & m, const MetadataKeyType t) :
slot_value(v),
variable(m),
key_type(t)
@@ -53,7 +55,7 @@ namespace
{
}
- virtual const SlotName parse_value() const
+ virtual const Slot parse_value() const
{
return slot_value;
}
@@ -107,7 +109,7 @@ ESlotKeyStore::ESlotKeyStore() :
ESlotKeyStore::~ESlotKeyStore() = default;
-const std::shared_ptr<const MetadataValueKey<SlotName> >
+const std::shared_ptr<const MetadataValueKey<Slot> >
ESlotKeyStore::fetch(
const std::shared_ptr<const EAPIMetadataVariable> & v,
const std::string & s,
@@ -118,7 +120,10 @@ ESlotKeyStore::fetch(
ESlotKeyStoreIndex x(v, s, t);
auto i(_imp->store.find(x));
if (i == _imp->store.end())
- i = _imp->store.insert(std::make_pair(x, std::make_shared<const ESlotKey>(SlotName(s), v, t))).first;
+ i = _imp->store.insert(std::make_pair(x, std::make_shared<const ESlotKey>(make_named_values<Slot>(
+ n::match_values() = std::make_pair(s, s),
+ n::parallel_value() = s,
+ n::raw_value() = s), v, t))).first;
return i->second;
}
diff --git a/paludis/repositories/e/e_slot_key.hh b/paludis/repositories/e/e_slot_key.hh
index 6b4e071..92aeee1 100644
--- a/paludis/repositories/e/e_slot_key.hh
+++ b/paludis/repositories/e/e_slot_key.hh
@@ -40,7 +40,7 @@ namespace paludis
~ESlotKeyStore();
public:
- const std::shared_ptr<const MetadataValueKey<SlotName> > fetch(
+ const std::shared_ptr<const MetadataValueKey<Slot> > fetch(
const std::shared_ptr<const EAPIMetadataVariable> &,
const std::string &,
const MetadataKeyType) const PALUDIS_ATTRIBUTE((warn_unused_result));
diff --git a/paludis/repositories/e/ebuild_flat_metadata_cache.cc b/paludis/repositories/e/ebuild_flat_metadata_cache.cc
index 9f1c3df..57b9baf 100644
--- a/paludis/repositories/e/ebuild_flat_metadata_cache.cc
+++ b/paludis/repositories/e/ebuild_flat_metadata_cache.cc
@@ -40,6 +40,7 @@
#include <paludis/environment.hh>
#include <paludis/unformatted_pretty_printer.hh>
#include <paludis/repository.hh>
+#include <paludis/slot.hh>
#include <set>
#include <map>
@@ -847,7 +848,7 @@ EbuildFlatMetadataCache::save(const std::shared_ptr<const EbuildID> & id)
write_kv(cache, m.run_depend()->name(), flatten(id->run_dependencies_key()->parse_value()));
if (! m.slot()->name().empty() && id->slot_key())
- write_kv(cache, m.slot()->name(), normalise(id->slot_key()->parse_value()));
+ write_kv(cache, m.slot()->name(), normalise(id->slot_key()->parse_value().raw_value()));
if (! m.src_uri()->name().empty() && id->fetches_key())
write_kv(cache, m.src_uri()->name(), flatten(id->fetches_key()->parse_value()));
diff --git a/paludis/repositories/e/ebuild_flat_metadata_cache_TEST.cc b/paludis/repositories/e/ebuild_flat_metadata_cache_TEST.cc
index f274759..9aecb84 100644
--- a/paludis/repositories/e/ebuild_flat_metadata_cache_TEST.cc
+++ b/paludis/repositories/e/ebuild_flat_metadata_cache_TEST.cc
@@ -28,6 +28,7 @@
#include <paludis/package_id.hh>
#include <paludis/selection.hh>
#include <paludis/user_dep_spec.hh>
+#include <paludis/slot.hh>
#include <paludis/util/map.hh>
#include <paludis/util/sequence.hh>
@@ -355,7 +356,7 @@ TEST(EbuildFlatMetadataCache, EmptyValue)
ASSERT_TRUE(bool(id->short_description_key()));
EXPECT_EQ("", id->short_description_key()->parse_value());
- EXPECT_EQ("the-slot", stringify(id->slot_key()->parse_value()));
+ EXPECT_EQ("the-slot", stringify(id->slot_key()->parse_value().raw_value()));
}
TEST(EbuildFlatMetadataCache, HashStale)
diff --git a/paludis/repositories/e/ebuild_id.cc b/paludis/repositories/e/ebuild_id.cc
index 9a6916d..180fd28 100644
--- a/paludis/repositories/e/ebuild_id.cc
+++ b/paludis/repositories/e/ebuild_id.cc
@@ -49,6 +49,7 @@
#include <paludis/user_dep_spec.hh>
#include <paludis/notifier_callback.hh>
#include <paludis/always_enabled_dependency_label.hh>
+#include <paludis/slot.hh>
#include <paludis/util/fs_error.hh>
#include <paludis/util/stringify.hh>
@@ -151,7 +152,7 @@ namespace paludis
const std::shared_ptr<const LiteralMetadataValueKey<FSPath> > fs_location;
- mutable std::shared_ptr<const MetadataValueKey<SlotName> > slot;
+ mutable std::shared_ptr<const MetadataValueKey<Slot> > slot;
mutable std::shared_ptr<const LiteralMetadataValueKey<std::string> > short_description;
mutable std::shared_ptr<const LiteralMetadataValueKey<std::string> > long_description;
mutable std::shared_ptr<const LiteralMetadataValueKey<std::string> > captured_stdout_key;
@@ -733,14 +734,14 @@ EbuildID::canonical_form(const PackageIDCanonicalForm f) const
{
case idcf_full:
if (_imp->slot)
- return stringify(name()) + "-" + stringify(version()) + ":" + stringify(_imp->slot->parse_value()) +
+ return stringify(name()) + "-" + stringify(version()) + ":" + stringify(_imp->slot->parse_value().parallel_value()) +
"::" + stringify(repository_name());
return stringify(name()) + "-" + stringify(version()) + "::" + stringify(repository_name());
case idcf_no_version:
if (_imp->slot)
- return stringify(name()) + ":" + stringify(_imp->slot->parse_value()) +
+ return stringify(name()) + ":" + stringify(_imp->slot->parse_value().parallel_value()) +
"::" + stringify(repository_name());
return stringify(name()) + "::" + stringify(repository_name());
@@ -750,7 +751,7 @@ EbuildID::canonical_form(const PackageIDCanonicalForm f) const
case idcf_no_name:
if (_imp->slot)
- return stringify(version()) + ":" + stringify(_imp->slot->parse_value()) + "::" +
+ return stringify(version()) + ":" + stringify(_imp->slot->parse_value().parallel_value()) + "::" +
stringify(repository_name());
return stringify(version()) + "::" + stringify(repository_name());
@@ -766,7 +767,7 @@ PackageDepSpec
EbuildID::uniquely_identifying_spec() const
{
return parse_user_package_dep_spec("=" + stringify(name()) + "-" + stringify(version()) +
- (slot_key() ? ":" + stringify(slot_key()->parse_value()) : "") + "::" + stringify(repository_name()),
+ (slot_key() ? ":" + stringify(slot_key()->parse_value().parallel_value()) : "") + "::" + stringify(repository_name()),
_imp->environment, { });
}
@@ -1473,7 +1474,7 @@ EbuildID::choices_key() const
return _imp->choices;
}
-const std::shared_ptr<const MetadataValueKey<SlotName> >
+const std::shared_ptr<const MetadataValueKey<Slot> >
EbuildID::slot_key() const
{
need_non_xml_keys_added();
diff --git a/paludis/repositories/e/ebuild_id.hh b/paludis/repositories/e/ebuild_id.hh
index 645c5f6..04014c6 100644
--- a/paludis/repositories/e/ebuild_id.hh
+++ b/paludis/repositories/e/ebuild_id.hh
@@ -71,7 +71,7 @@ namespace paludis
virtual const RepositoryName repository_name() const;
virtual bool is_installed() const PALUDIS_ATTRIBUTE((warn_unused_result));
- virtual const std::shared_ptr<const MetadataValueKey<SlotName> > slot_key() const;
+ virtual const std::shared_ptr<const MetadataValueKey<Slot> > slot_key() const;
virtual const std::shared_ptr<const MetadataCollectionKey<KeywordNameSet> > keywords_key() const;
virtual const std::shared_ptr<const MetadataSpecTreeKey<DependencySpecTree> > build_dependencies_key() const;
virtual const std::shared_ptr<const MetadataSpecTreeKey<DependencySpecTree> > run_dependencies_key() const;
diff --git a/paludis/repositories/e/exndbam_repository.cc b/paludis/repositories/e/exndbam_repository.cc
index f415354..86e314a 100644
--- a/paludis/repositories/e/exndbam_repository.cc
+++ b/paludis/repositories/e/exndbam_repository.cc
@@ -51,6 +51,7 @@
#include <paludis/package_id.hh>
#include <paludis/action.hh>
#include <paludis/literal_metadata_key.hh>
+#include <paludis/slot.hh>
#include <functional>
@@ -310,11 +311,11 @@ namespace
return std::make_pair(uid, gid);
}
- bool slot_is_same(const std::shared_ptr<const PackageID> & a,
+ bool parallel_slot_is_same(const std::shared_ptr<const PackageID> & a,
const std::shared_ptr<const PackageID> & b)
{
if (a->slot_key())
- return b->slot_key() && a->slot_key()->parse_value() == b->slot_key()->parse_value();
+ return b->slot_key() && a->slot_key()->parse_value().parallel_value() == b->slot_key()->parse_value().parallel_value();
else
return ! b->slot_key();
}
@@ -347,7 +348,7 @@ ExndbamRepository::merge(const MergeParams & m)
v != v_end ; ++v)
{
if_same_name_id = *v;
- if ((*v)->version() == m.package_id()->version() && slot_is_same(*v, m.package_id()))
+ if ((*v)->version() == m.package_id()->version() && parallel_slot_is_same(*v, m.package_id()))
{
if_overwritten_id = *v;
break;
@@ -370,7 +371,7 @@ ExndbamRepository::merge(const MergeParams & m)
}
FSPath target_ver_dir(uid_dir);
- target_ver_dir /= (stringify(m.package_id()->version()) + ":" + stringify(m.package_id()->slot_key()->parse_value()) + ":" + cookie());
+ target_ver_dir /= (stringify(m.package_id()->version()) + ":" + stringify(m.package_id()->slot_key()->parse_value().parallel_value()) + ":" + cookie());
if (target_ver_dir.stat().exists())
throw ActionFailedError("Temporary merge directory '" + stringify(target_ver_dir) + "' already exists, probably "
@@ -486,7 +487,7 @@ ExndbamRepository::merge(const MergeParams & m)
it_end(replace_candidates->end()); it_end != it; ++it)
{
std::shared_ptr<const ERepositoryID> candidate(std::static_pointer_cast<const ERepositoryID>(*it));
- if (candidate != if_overwritten_id && candidate->fs_location_key()->parse_value() != target_ver_dir && slot_is_same(candidate, m.package_id()))
+ if (candidate != if_overwritten_id && candidate->fs_location_key()->parse_value() != target_ver_dir && parallel_slot_is_same(candidate, m.package_id()))
{
UninstallActionOptions uo(make_named_values<UninstallActionOptions>(
n::config_protect() = config_protect,
diff --git a/paludis/repositories/e/fix_locked_dependencies.cc b/paludis/repositories/e/fix_locked_dependencies.cc
index cd2f816..1e9c249 100644
--- a/paludis/repositories/e/fix_locked_dependencies.cc
+++ b/paludis/repositories/e/fix_locked_dependencies.cc
@@ -25,6 +25,7 @@
#include <paludis/util/options.hh>
#include <paludis/util/indirect_iterator-impl.hh>
#include <paludis/util/accept_visitor.hh>
+#include <paludis/util/make_null_shared_ptr.hh>
#include <paludis/dep_spec.hh>
#include <paludis/environment.hh>
#include <paludis/package_id.hh>
@@ -35,6 +36,7 @@
#include <paludis/filtered_generator.hh>
#include <paludis/metadata_key.hh>
#include <paludis/partially_made_package_dep_spec.hh>
+#include <paludis/slot.hh>
#include <functional>
#include <algorithm>
#include <list>
@@ -51,6 +53,67 @@ namespace
throw InternalError(PALUDIS_HERE, "Got weird tree");
}
+ struct SlotRewriter
+ {
+ const Environment * const env;
+ const EAPI & eapi;
+ const std::shared_ptr<const PackageID> id;
+ const std::shared_ptr<const PackageDepSpec> spec;
+
+ std::shared_ptr<const SlotRequirement> visit(const SlotExactPartialRequirement &) const
+ {
+ return make_null_shared_ptr();
+ }
+
+ std::shared_ptr<const SlotRequirement> visit(const SlotExactFullRequirement &) const
+ {
+ return make_null_shared_ptr();
+ }
+
+ std::shared_ptr<const SlotRequirement> visit(const SlotAnyUnlockedRequirement &) const
+ {
+ return make_null_shared_ptr();
+ }
+
+ std::shared_ptr<const SlotRequirement> visit(const SlotAnyPartialLockedRequirement &) const
+ {
+ std::shared_ptr<const PackageIDSequence> matches((*env)[selection::AllVersionsSorted(
+ generator::Matches(*spec, id, { }) | filter::InstalledAtRoot(env->system_root_key()->parse_value()))]);
+ if (matches->empty())
+ return make_null_shared_ptr();
+
+ if ((*matches->last())->slot_key())
+ {
+ auto ss((*matches->last())->slot_key()->parse_value());
+ if (ss.match_values().first == ss.match_values().second)
+ return std::make_shared<ELikeSlotExactPartialRequirement>(ss.match_values().first, spec->slot_requirement_ptr());
+ else
+ return std::make_shared<ELikeSlotExactFullRequirement>(ss.match_values(), spec->slot_requirement_ptr());
+ }
+ else
+ return make_null_shared_ptr();
+ }
+
+ std::shared_ptr<const SlotRequirement> visit(const SlotAnyAtAllLockedRequirement &) const
+ {
+ std::shared_ptr<const PackageIDSequence> matches((*env)[selection::AllVersionsSorted(
+ generator::Matches(*spec, id, { }) | filter::InstalledAtRoot(env->system_root_key()->parse_value()))]);
+ if (matches->empty())
+ return make_null_shared_ptr();
+
+ if ((*matches->last())->slot_key())
+ {
+ auto ss((*matches->last())->slot_key()->parse_value());
+ if (ss.match_values().first == ss.match_values().second)
+ return std::make_shared<ELikeSlotExactPartialRequirement>(ss.match_values().first, spec->slot_requirement_ptr());
+ else
+ return std::make_shared<ELikeSlotExactFullRequirement>(ss.match_values(), spec->slot_requirement_ptr());
+ }
+ else
+ return make_null_shared_ptr();
+ }
+ };
+
struct Fixer
{
std::list<std::shared_ptr<DependencySpecTree::BasicInnerNode> > stack;
@@ -102,22 +165,13 @@ namespace
if (! node.spec()->slot_requirement_ptr())
break;
- const SlotAnyLockedRequirement * const r(visitor_cast<const SlotAnyLockedRequirement>(*node.spec()->slot_requirement_ptr()));
- if (! r)
- break;
-
- std::shared_ptr<const PackageIDSequence> matches((*env)[selection::AllVersionsSorted(
- generator::Matches(*node.spec(), id, { }) | filter::InstalledAtRoot(env->system_root_key()->parse_value()))]);
- if (matches->empty())
+ auto rewritten(node.spec()->slot_requirement_ptr()->accept_returning<std::shared_ptr<const SlotRequirement> >(SlotRewriter{env, eapi, id, node.spec()}));
+ if (! rewritten)
break;
- if ((*matches->last())->slot_key())
- {
- PackageDepSpec new_s(PartiallyMadePackageDepSpec(*node.spec()).slot_requirement(
- std::make_shared<ELikeSlotExactRequirement>((*matches->last())->slot_key()->parse_value(), true)));
- new_s.set_annotations(node.spec()->maybe_annotations());
- c = std::make_shared<PackageDepSpec>(new_s);
- }
+ PackageDepSpec new_s(PartiallyMadePackageDepSpec(*node.spec()).slot_requirement(rewritten));
+ new_s.set_annotations(node.spec()->maybe_annotations());
+ c = std::make_shared<PackageDepSpec>(new_s);
} while (false);
if (! c)
diff --git a/paludis/repositories/e/pbin_merger.cc b/paludis/repositories/e/pbin_merger.cc
index 98c2919..64eff3a 100644
--- a/paludis/repositories/e/pbin_merger.cc
+++ b/paludis/repositories/e/pbin_merger.cc
@@ -33,6 +33,7 @@
#include <paludis/version_spec.hh>
#include <paludis/metadata_key.hh>
#include <paludis/output_manager.hh>
+#include <paludis/slot.hh>
using namespace paludis;
using namespace paludis::erepository;
@@ -97,7 +98,7 @@ PbinMerger::extend_hook(const Hook & h)
std::string pn(stringify(_imp->params.package_id()->name().package()));
std::string pvr(stringify(_imp->params.package_id()->version()));
std::string pv(stringify(_imp->params.package_id()->version().remove_revision()));
- std::string slot(_imp->params.package_id()->slot_key() ? stringify(_imp->params.package_id()->slot_key()->parse_value()) : "");
+ std::string slot(_imp->params.package_id()->slot_key() ? stringify(_imp->params.package_id()->slot_key()->parse_value().raw_value()) : "");
return TarMerger::extend_hook(h)
("P", pn + "-" + pv)
diff --git a/paludis/repositories/e/vdb_merger.cc b/paludis/repositories/e/vdb_merger.cc
index 0247f81..0036c6c 100644
--- a/paludis/repositories/e/vdb_merger.cc
+++ b/paludis/repositories/e/vdb_merger.cc
@@ -44,6 +44,7 @@
#include <paludis/environment.hh>
#include <paludis/metadata_key.hh>
#include <paludis/version_spec.hh>
+#include <paludis/slot.hh>
#include <iomanip>
#include <list>
@@ -119,7 +120,7 @@ VDBMerger::extend_hook(const Hook & h)
std::string pn(stringify(_imp->params.package_id()->name().package()));
std::string pvr(stringify(_imp->params.package_id()->version()));
std::string pv(stringify(_imp->params.package_id()->version().remove_revision()));
- std::string slot(_imp->params.package_id()->slot_key() ? stringify(_imp->params.package_id()->slot_key()->parse_value()) : "");
+ std::string slot(_imp->params.package_id()->slot_key() ? stringify(_imp->params.package_id()->slot_key()->parse_value().raw_value()) : "");
return FSMerger::extend_hook(h)
("P", pn + "-" + pv)
diff --git a/paludis/repositories/e/vdb_repository.cc b/paludis/repositories/e/vdb_repository.cc
index d6dd99a..f7e210e 100644
--- a/paludis/repositories/e/vdb_repository.cc
+++ b/paludis/repositories/e/vdb_repository.cc
@@ -54,6 +54,7 @@
#include <paludis/partially_made_package_dep_spec.hh>
#include <paludis/dep_spec_annotations.hh>
#include <paludis/unformatted_pretty_printer.hh>
+#include <paludis/slot.hh>
#include <paludis/util/accept_visitor.hh>
#include <paludis/util/mutex.hh>
@@ -594,11 +595,11 @@ VDBRepository::category_names_containing_package(const PackageNamePart & p, cons
namespace
{
- bool slot_is_same(const std::shared_ptr<const PackageID> & a,
+ bool parallel_slot_is_same(const std::shared_ptr<const PackageID> & a,
const std::shared_ptr<const PackageID> & b)
{
if (a->slot_key())
- return b->slot_key() && a->slot_key()->parse_value() == b->slot_key()->parse_value();
+ return b->slot_key() && a->slot_key()->parse_value().parallel_value() == b->slot_key()->parse_value().parallel_value();
else
return ! b->slot_key();
}
@@ -772,7 +773,7 @@ VDBRepository::merge(const MergeParams & m)
it_end(replace_candidates->end()); it_end != it; ++it)
{
std::shared_ptr<const ERepositoryID> candidate(std::static_pointer_cast<const ERepositoryID>(*it));
- if (candidate != is_replace && candidate != new_id && slot_is_same(candidate, m.package_id()))
+ if (candidate != is_replace && candidate != new_id && parallel_slot_is_same(candidate, m.package_id()))
{
UninstallActionOptions uo(make_named_values<UninstallActionOptions>(
n::config_protect() = config_protect,
diff --git a/paludis/repositories/e/vdb_unmerger.cc b/paludis/repositories/e/vdb_unmerger.cc
index cb3b4d4..a2bcf96 100644
--- a/paludis/repositories/e/vdb_unmerger.cc
+++ b/paludis/repositories/e/vdb_unmerger.cc
@@ -44,6 +44,7 @@
#include <paludis/metadata_key.hh>
#include <paludis/contents.hh>
#include <paludis/output_manager.hh>
+#include <paludis/slot.hh>
#include <list>
#include <map>
@@ -101,7 +102,7 @@ VDBUnmerger::extend_hook(const Hook & h) const
std::string pn(stringify(_imp->options.package_id()->name().package()));
std::string pvr(stringify(_imp->options.package_id()->version()));
std::string pv(stringify(_imp->options.package_id()->version().remove_revision()));
- std::string slot(_imp->options.package_id()->slot_key() ? stringify(_imp->options.package_id()->slot_key()->parse_value()) : "");
+ std::string slot(_imp->options.package_id()->slot_key() ? stringify(_imp->options.package_id()->slot_key()->parse_value().raw_value()) : "");
return result
("P", pn + "-" + pv)
diff --git a/paludis/repositories/fake/fake_package_id.cc b/paludis/repositories/fake/fake_package_id.cc
index 6cf0012..4b2ad7d 100644
--- a/paludis/repositories/fake/fake_package_id.cc
+++ b/paludis/repositories/fake/fake_package_id.cc
@@ -32,6 +32,7 @@
#include <paludis/always_enabled_dependency_label.hh>
#include <paludis/pretty_printer.hh>
#include <paludis/call_pretty_printer.hh>
+#include <paludis/slot.hh>
#include <paludis/util/stringify.hh>
#include <paludis/util/mutex.hh>
@@ -641,7 +642,7 @@ namespace paludis
const QualifiedPackageName name;
const VersionSpec version;
- mutable std::shared_ptr<LiteralMetadataValueKey<SlotName> > slot;
+ mutable std::shared_ptr<LiteralMetadataValueKey<Slot> > slot;
mutable std::shared_ptr<FakeMetadataKeywordSetKey> keywords;
mutable std::shared_ptr<FakeMetadataSpecTreeKey<LicenseSpecTree> > license;
mutable std::shared_ptr<FakeMetadataSpecTreeKey<DependencySpecTree> > build_dependencies;
@@ -665,7 +666,10 @@ namespace paludis
repository_name(r),
name(q),
version(v),
- slot(std::make_shared<LiteralMetadataValueKey<SlotName>>("SLOT", "Slot", mkt_internal, SlotName("0"))),
+ slot(std::make_shared<LiteralMetadataValueKey<Slot>>("SLOT", "Slot", mkt_internal, make_named_values<Slot>(
+ n::match_values() = std::make_pair(SlotName("0"), SlotName("0")),
+ n::parallel_value() = SlotName("0"),
+ n::raw_value() = "0"))),
behaviours_set(std::make_shared<Set<std::string>>()),
has_masks(false)
{
@@ -689,17 +693,17 @@ FakePackageID::canonical_form(const PackageIDCanonicalForm f) const
switch (f)
{
case idcf_full:
- return stringify(_imp->name) + "-" + stringify(_imp->version) + ":" + stringify(_imp->slot->parse_value())
+ return stringify(_imp->name) + "-" + stringify(_imp->version) + ":" + stringify(_imp->slot->parse_value().parallel_value())
+ "::" + stringify(repository_name());
case idcf_version:
return stringify(_imp->version);
case idcf_no_version:
- return stringify(_imp->name) + ":" + stringify(_imp->slot->parse_value()) + "::" + stringify(repository_name());
+ return stringify(_imp->name) + ":" + stringify(_imp->slot->parse_value().parallel_value()) + "::" + stringify(repository_name());
case idcf_no_name:
- return stringify(_imp->version) + ":" + stringify(_imp->slot->parse_value())
+ return stringify(_imp->version) + ":" + stringify(_imp->slot->parse_value().parallel_value())
+ "::" + stringify(repository_name());
case last_idcf:
@@ -713,7 +717,7 @@ PackageDepSpec
FakePackageID::uniquely_identifying_spec() const
{
return parse_user_package_dep_spec("=" + stringify(name()) + "-" + stringify(version()) +
- (slot_key() ? ":" + stringify(slot_key()->parse_value()) : "") + "::" + stringify(repository_name()),
+ (slot_key() ? ":" + stringify(slot_key()->parse_value().parallel_value()) : "") + "::" + stringify(repository_name()),
_imp->env, { });
}
@@ -863,13 +867,16 @@ FakePackageID::from_repositories_key() const
void
FakePackageID::set_slot(const SlotName & s)
{
- _imp->slot->change_value(s);
+ _imp->slot->change_value(make_named_values<Slot>(
+ n::match_values() = std::make_pair(s, s),
+ n::parallel_value() = s,
+ n::raw_value() = stringify(s)));
}
bool
FakePackageID::arbitrary_less_than_comparison(const PackageID & other) const
{
- return slot_key()->parse_value().value() < (other.slot_key() ? stringify(other.slot_key()->parse_value()) : "");
+ return stringify(slot_key()->parse_value().raw_value()) < (other.slot_key() ? stringify(other.slot_key()->parse_value().raw_value()) : "");
}
void
@@ -929,7 +936,7 @@ FakePackageID::need_keys_added() const
std::size_t
FakePackageID::extra_hash_value() const
{
- return Hash<SlotName>()(slot_key()->parse_value());
+ return Hash<std::string>()(slot_key()->parse_value().raw_value());
}
bool
@@ -1169,7 +1176,7 @@ FakePackageID::choices_key()
return _imp->choices;
}
-const std::shared_ptr<const MetadataValueKey<SlotName> >
+const std::shared_ptr<const MetadataValueKey<Slot> >
FakePackageID::slot_key() const
{
need_keys_added();
diff --git a/paludis/repositories/fake/fake_package_id.hh b/paludis/repositories/fake/fake_package_id.hh
index 7ae2185..f5b966f 100644
--- a/paludis/repositories/fake/fake_package_id.hh
+++ b/paludis/repositories/fake/fake_package_id.hh
@@ -239,7 +239,7 @@ namespace paludis
virtual const RepositoryName repository_name() const;
virtual PackageDepSpec uniquely_identifying_spec() const;
- virtual const std::shared_ptr<const MetadataValueKey<SlotName> > slot_key() const;
+ virtual const std::shared_ptr<const MetadataValueKey<Slot> > slot_key() const;
virtual const std::shared_ptr<const MetadataCollectionKey<KeywordNameSet> > keywords_key() const;
virtual const std::shared_ptr<const MetadataSpecTreeKey<DependencySpecTree> > dependencies_key() const;
virtual const std::shared_ptr<const MetadataSpecTreeKey<DependencySpecTree> > build_dependencies_key() const;
diff --git a/paludis/repositories/gemcutter/gemcutter_id.cc b/paludis/repositories/gemcutter/gemcutter_id.cc
index 5206288..3e12a5f 100644
--- a/paludis/repositories/gemcutter/gemcutter_id.cc
+++ b/paludis/repositories/gemcutter/gemcutter_id.cc
@@ -29,12 +29,14 @@
#include <paludis/util/wrapped_forward_iterator.hh>
#include <paludis/util/make_null_shared_ptr.hh>
#include <paludis/util/singleton-impl.hh>
+#include <paludis/util/make_named_values.hh>
#include <paludis/name.hh>
#include <paludis/version_spec.hh>
#include <paludis/metadata_key.hh>
#include <paludis/literal_metadata_key.hh>
#include <paludis/action.hh>
#include <paludis/user_dep_spec.hh>
+#include <paludis/slot.hh>
using namespace paludis;
using namespace paludis::gemcutter_repository;
@@ -127,7 +129,7 @@ namespace paludis
const VersionSpec version;
const RepositoryName repository_name;
- std::shared_ptr<LiteralMetadataValueKey<SlotName> > slot_key;
+ std::shared_ptr<LiteralMetadataValueKey<Slot> > slot_key;
std::shared_ptr<LiteralMetadataValueKey<std::string> > authors_key;
std::shared_ptr<LiteralMetadataValueKey<std::string> > info_key;
std::shared_ptr<GemcutterURIKey> bug_tracker_uri_key;
@@ -144,7 +146,10 @@ namespace paludis
name(CategoryNamePart("gem"), PackageNamePart(e.info().name())),
version(e.info().version(), { }),
repository_name(e.repository()),
- slot_key(std::make_shared<LiteralMetadataValueKey<SlotName> >("slot", "Slot", mkt_internal, SlotName(e.info().version()))),
+ slot_key(std::make_shared<LiteralMetadataValueKey<Slot> >("slot", "Slot", mkt_internal, make_named_values<Slot>(
+ n::match_values() = std::make_pair(SlotName(e.info().version()), SlotName(e.info().version())),
+ n::parallel_value() = SlotName(e.info().version()),
+ n::raw_value() = e.info().version()))),
authors_key(make_string_key("authors", "Authors", mkt_author, e.info().authors())),
info_key(make_string_key("info", "Info", mkt_significant, e.info().info())),
bug_tracker_uri_key(make_uri(
@@ -401,7 +406,7 @@ GemcutterID::choices_key() const
return make_null_shared_ptr();
}
-const std::shared_ptr<const MetadataValueKey<SlotName> >
+const std::shared_ptr<const MetadataValueKey<Slot> >
GemcutterID::slot_key() const
{
return _imp->slot_key;
diff --git a/paludis/repositories/gemcutter/gemcutter_id.hh b/paludis/repositories/gemcutter/gemcutter_id.hh
index 6ea6485..9bb68e3 100644
--- a/paludis/repositories/gemcutter/gemcutter_id.hh
+++ b/paludis/repositories/gemcutter/gemcutter_id.hh
@@ -65,7 +65,7 @@ namespace paludis
const RepositoryName repository_name() const;
virtual PackageDepSpec uniquely_identifying_spec() const;
- const std::shared_ptr<const MetadataValueKey<SlotName> > slot_key() const;
+ const std::shared_ptr<const MetadataValueKey<Slot> > slot_key() const;
const std::shared_ptr<const MetadataCollectionKey<KeywordNameSet> > keywords_key() const;
const std::shared_ptr<const MetadataSpecTreeKey<DependencySpecTree> >
dependencies_key() const;
diff --git a/paludis/repositories/repository/repository_id.cc b/paludis/repositories/repository/repository_id.cc
index f2c6ac9..f35a6b0 100644
--- a/paludis/repositories/repository/repository_id.cc
+++ b/paludis/repositories/repository/repository_id.cc
@@ -264,7 +264,7 @@ RepositoryID::choices_key() const
return make_null_shared_ptr();
}
-const std::shared_ptr<const MetadataValueKey<SlotName> >
+const std::shared_ptr<const MetadataValueKey<Slot> >
RepositoryID::slot_key() const
{
return make_null_shared_ptr();
diff --git a/paludis/repositories/repository/repository_id.hh b/paludis/repositories/repository/repository_id.hh
index a03c4d3..4d3be4e 100644
--- a/paludis/repositories/repository/repository_id.hh
+++ b/paludis/repositories/repository/repository_id.hh
@@ -63,7 +63,7 @@ namespace paludis
const RepositoryName repository_name() const;
virtual PackageDepSpec uniquely_identifying_spec() const;
- const std::shared_ptr<const MetadataValueKey<SlotName> > slot_key() const;
+ const std::shared_ptr<const MetadataValueKey<Slot> > slot_key() const;
const std::shared_ptr<const MetadataCollectionKey<KeywordNameSet> > keywords_key() const;
const std::shared_ptr<const MetadataSpecTreeKey<DependencySpecTree> >
dependencies_key() const;
diff --git a/paludis/repositories/unavailable/unavailable_package_id.cc b/paludis/repositories/unavailable/unavailable_package_id.cc
index a271403..038b620 100644
--- a/paludis/repositories/unavailable/unavailable_package_id.cc
+++ b/paludis/repositories/unavailable/unavailable_package_id.cc
@@ -19,6 +19,7 @@
#include <paludis/repositories/unavailable/unavailable_package_id.hh>
#include <paludis/repositories/unavailable/unavailable_repository.hh>
+
#include <paludis/util/pimp-impl.hh>
#include <paludis/util/stringify.hh>
#include <paludis/util/visitor_cast.hh>
@@ -26,6 +27,8 @@
#include <paludis/util/hashes.hh>
#include <paludis/util/wrapped_forward_iterator.hh>
#include <paludis/util/make_null_shared_ptr.hh>
+#include <paludis/util/make_named_values.hh>
+
#include <paludis/name.hh>
#include <paludis/version_spec.hh>
#include <paludis/metadata_key.hh>
@@ -33,6 +36,7 @@
#include <paludis/action.hh>
#include <paludis/unchoices_key.hh>
#include <paludis/user_dep_spec.hh>
+#include <paludis/slot.hh>
using namespace paludis;
using namespace paludis::unavailable_repository;
@@ -47,7 +51,7 @@ namespace paludis
const VersionSpec version;
const RepositoryName repository_name;
- const std::shared_ptr<const MetadataValueKey<SlotName> > slot_key;
+ const std::shared_ptr<const MetadataValueKey<Slot> > slot_key;
const std::shared_ptr<const MetadataValueKey<std::string> > description_key;
const std::shared_ptr<const MetadataValueKey<std::string> > repository_homepage_key, repository_description_key;
const std::shared_ptr<const MetadataCollectionKey<Set<std::string> > > from_repositories_key;
@@ -60,7 +64,10 @@ namespace paludis
name(e.name()),
version(e.version()),
repository_name(e.repository()),
- slot_key(std::make_shared<LiteralMetadataValueKey<SlotName>>("SLOT", "Slot", mkt_internal, e.slot())),
+ slot_key(std::make_shared<LiteralMetadataValueKey<Slot> >("SLOT", "Slot", mkt_internal, make_named_values<Slot>(
+ n::match_values() = std::make_pair(e.slot(), e.slot()),
+ n::parallel_value() = e.slot(),
+ n::raw_value() = stringify(e.slot())))),
description_key(e.description()),
repository_homepage_key(e.repository_homepage()),
repository_description_key(e.repository_description()),
@@ -106,11 +113,11 @@ UnavailablePackageID::canonical_form(const PackageIDCanonicalForm f) const
{
case idcf_full:
return stringify(_imp->name) + "-" + stringify(_imp->version) +
- ":" + stringify(_imp->slot_key->parse_value()) + "::" + stringify(_imp->repository_name) +
+ ":" + stringify(_imp->slot_key->parse_value().parallel_value()) + "::" + stringify(_imp->repository_name) +
" (in ::" + *_imp->from_repositories_key->parse_value()->begin() + ")";
case idcf_no_version:
- return stringify(_imp->name) + ":" + stringify(_imp->slot_key->parse_value()) +
+ return stringify(_imp->name) + ":" + stringify(_imp->slot_key->parse_value().parallel_value()) +
"::" + stringify(_imp->repository_name) +
" (in ::" + *_imp->from_repositories_key->parse_value()->begin() + ")";
@@ -120,7 +127,7 @@ UnavailablePackageID::canonical_form(const PackageIDCanonicalForm f) const
case idcf_no_name:
return stringify(_imp->version) +
- ":" + stringify(_imp->slot_key->parse_value()) + "::" + stringify(_imp->repository_name) +
+ ":" + stringify(_imp->slot_key->parse_value().parallel_value()) + "::" + stringify(_imp->repository_name) +
" (in ::" + *_imp->from_repositories_key->parse_value()->begin() + ")";
case last_idcf:
@@ -134,7 +141,7 @@ PackageDepSpec
UnavailablePackageID::uniquely_identifying_spec() const
{
return parse_user_package_dep_spec("=" + stringify(name()) + "-" + stringify(version()) +
- (slot_key() ? ":" + stringify(slot_key()->parse_value()) : "") + "::" + stringify(repository_name()) +
+ (slot_key() ? ":" + stringify(slot_key()->parse_value().parallel_value()) : "") + "::" + stringify(repository_name()) +
"[." + _imp->from_repositories_key->raw_name() + "=" + *_imp->from_repositories_key->parse_value()->begin() + "]",
_imp->env, { });
}
@@ -181,9 +188,9 @@ UnavailablePackageID::arbitrary_less_than_comparison(const PackageID & other) co
if (! other.slot_key())
return false;
- if (slot_key()->parse_value() < other.slot_key()->parse_value())
+ if (slot_key()->parse_value().raw_value() < other.slot_key()->parse_value().raw_value())
return true;
- if (slot_key()->parse_value() > other.slot_key()->parse_value())
+ if (slot_key()->parse_value().raw_value() > other.slot_key()->parse_value().raw_value())
return false;
std::shared_ptr<const MetadataCollectionKey<Set<std::string > > > k(other.from_repositories_key());
@@ -201,7 +208,7 @@ std::size_t
UnavailablePackageID::extra_hash_value() const
{
return Hash<std::pair<SlotName, std::string> >()(std::make_pair(
- slot_key()->parse_value(), *_imp->from_repositories_key->parse_value()->begin()));
+ slot_key()->parse_value().raw_value(), *_imp->from_repositories_key->parse_value()->begin()));
}
const std::shared_ptr<const MetadataValueKey<FSPath> >
@@ -288,7 +295,7 @@ UnavailablePackageID::choices_key() const
return _imp->choices_key;
}
-const std::shared_ptr<const MetadataValueKey<SlotName> >
+const std::shared_ptr<const MetadataValueKey<Slot> >
UnavailablePackageID::slot_key() const
{
return _imp->slot_key;
diff --git a/paludis/repositories/unavailable/unavailable_package_id.hh b/paludis/repositories/unavailable/unavailable_package_id.hh
index c2604b8..5da7326 100644
--- a/paludis/repositories/unavailable/unavailable_package_id.hh
+++ b/paludis/repositories/unavailable/unavailable_package_id.hh
@@ -77,7 +77,7 @@ namespace paludis
const RepositoryName repository_name() const;
virtual PackageDepSpec uniquely_identifying_spec() const;
- const std::shared_ptr<const MetadataValueKey<SlotName> > slot_key() const;
+ const std::shared_ptr<const MetadataValueKey<Slot> > slot_key() const;
const std::shared_ptr<const MetadataCollectionKey<KeywordNameSet> > keywords_key() const;
const std::shared_ptr<const MetadataSpecTreeKey<DependencySpecTree> >
dependencies_key() const;
diff --git a/paludis/repositories/unavailable/unavailable_repository_id.cc b/paludis/repositories/unavailable/unavailable_repository_id.cc
index 99a961c..89922e8 100644
--- a/paludis/repositories/unavailable/unavailable_repository_id.cc
+++ b/paludis/repositories/unavailable/unavailable_repository_id.cc
@@ -399,7 +399,7 @@ UnavailableRepositoryID::choices_key() const
return make_null_shared_ptr();
}
-const std::shared_ptr<const MetadataValueKey<SlotName> >
+const std::shared_ptr<const MetadataValueKey<Slot> >
UnavailableRepositoryID::slot_key() const
{
return make_null_shared_ptr();
diff --git a/paludis/repositories/unavailable/unavailable_repository_id.hh b/paludis/repositories/unavailable/unavailable_repository_id.hh
index c50993e..0fc082a 100644
--- a/paludis/repositories/unavailable/unavailable_repository_id.hh
+++ b/paludis/repositories/unavailable/unavailable_repository_id.hh
@@ -77,7 +77,7 @@ namespace paludis
const RepositoryName repository_name() const;
virtual PackageDepSpec uniquely_identifying_spec() const;
- const std::shared_ptr<const MetadataValueKey<SlotName> > slot_key() const;
+ const std::shared_ptr<const MetadataValueKey<Slot> > slot_key() const;
const std::shared_ptr<const MetadataCollectionKey<KeywordNameSet> > keywords_key() const;
const std::shared_ptr<const MetadataSpecTreeKey<DependencySpecTree> >
dependencies_key() const;
diff --git a/paludis/repositories/unpackaged/installed_id.cc b/paludis/repositories/unpackaged/installed_id.cc
index ddbc8cf..6cd6697 100644
--- a/paludis/repositories/unpackaged/installed_id.cc
+++ b/paludis/repositories/unpackaged/installed_id.cc
@@ -52,6 +52,7 @@
#include <paludis/always_enabled_dependency_label.hh>
#include <paludis/pretty_printer.hh>
#include <paludis/call_pretty_printer.hh>
+#include <paludis/slot.hh>
#include <functional>
@@ -348,7 +349,7 @@ namespace paludis
const FSPath root;
const NDBAM * const ndbam;
- std::shared_ptr<LiteralMetadataValueKey<SlotName> > slot_key;
+ std::shared_ptr<LiteralMetadataValueKey<Slot> > slot_key;
std::shared_ptr<InstalledUnpackagedFSPathKey> fs_location_key;
std::shared_ptr<InstalledUnpackagedTimeKey> installed_time_key;
std::shared_ptr<InstalledUnpackagedStringSetKey> from_repositories_key;
@@ -373,7 +374,10 @@ namespace paludis
repository_name(r),
root(ro),
ndbam(d),
- slot_key(std::make_shared<LiteralMetadataValueKey<SlotName> >("slot", "Slot", mkt_internal, s)),
+ slot_key(std::make_shared<LiteralMetadataValueKey<Slot> >("slot", "Slot", mkt_internal, make_named_values<Slot>(
+ n::match_values() = std::make_pair(s, s),
+ n::parallel_value() = s,
+ n::raw_value() = stringify(s)))),
fs_location_key(std::make_shared<InstalledUnpackagedFSPathKey>(l)),
behaviours_key(InstalledUnpackagedIDData::get_instance()->behaviours_key)
{
@@ -444,18 +448,18 @@ InstalledUnpackagedID::canonical_form(const PackageIDCanonicalForm f) const
{
case idcf_full:
return stringify(_imp->name) + "-" + stringify(_imp->version) + ":" +
- stringify(slot_key()->parse_value()) + "::" + stringify(_imp->repository_name);
+ stringify(slot_key()->parse_value().parallel_value()) + "::" + stringify(_imp->repository_name);
case idcf_version:
return stringify(_imp->version);
case idcf_no_version:
- return stringify(_imp->name) + ":" + stringify(slot_key()->parse_value()) + "::" +
+ return stringify(_imp->name) + ":" + stringify(slot_key()->parse_value().parallel_value()) + "::" +
stringify(_imp->repository_name);
case idcf_no_name:
return stringify(_imp->version) + ":" +
- stringify(slot_key()->parse_value()) + "::" + stringify(_imp->repository_name);
+ stringify(slot_key()->parse_value().parallel_value()) + "::" + stringify(_imp->repository_name);
case last_idcf:
break;
@@ -468,7 +472,7 @@ PackageDepSpec
InstalledUnpackagedID::uniquely_identifying_spec() const
{
return parse_user_package_dep_spec("=" + stringify(name()) + "-" + stringify(version()) +
- (slot_key() ? ":" + stringify(slot_key()->parse_value()) : "") + "::" + stringify(repository_name()),
+ (slot_key() ? ":" + stringify(slot_key()->parse_value().parallel_value()) : "") + "::" + stringify(repository_name()),
_imp->env, { });
}
@@ -575,7 +579,7 @@ InstalledUnpackagedID::fs_location_key() const
return _imp->fs_location_key;
}
-const std::shared_ptr<const MetadataValueKey<SlotName> >
+const std::shared_ptr<const MetadataValueKey<Slot> >
InstalledUnpackagedID::slot_key() const
{
return _imp->slot_key;
@@ -728,13 +732,13 @@ InstalledUnpackagedID::breaks_portage() const
bool
InstalledUnpackagedID::arbitrary_less_than_comparison(const PackageID & other) const
{
- return slot_key()->parse_value().value() < (other.slot_key() ? stringify(other.slot_key()->parse_value()) : "");
+ return stringify(slot_key()->parse_value().raw_value()) < (other.slot_key() ? stringify(other.slot_key()->parse_value().raw_value()) : "");
}
std::size_t
InstalledUnpackagedID::extra_hash_value() const
{
- return Hash<SlotName>()(slot_key()->parse_value());
+ return Hash<std::string>()(slot_key()->parse_value().raw_value());
}
namespace
diff --git a/paludis/repositories/unpackaged/installed_id.hh b/paludis/repositories/unpackaged/installed_id.hh
index 558ebda..3c8f825 100644
--- a/paludis/repositories/unpackaged/installed_id.hh
+++ b/paludis/repositories/unpackaged/installed_id.hh
@@ -56,7 +56,7 @@ namespace paludis
virtual const RepositoryName repository_name() const;
virtual PackageDepSpec uniquely_identifying_spec() const;
- virtual const std::shared_ptr<const MetadataValueKey<SlotName> > slot_key() const;
+ virtual const std::shared_ptr<const MetadataValueKey<Slot> > slot_key() const;
virtual const std::shared_ptr<const MetadataCollectionKey<KeywordNameSet> > keywords_key() const;
virtual const std::shared_ptr<const MetadataSpecTreeKey<DependencySpecTree> > dependencies_key() const;
virtual const std::shared_ptr<const MetadataSpecTreeKey<DependencySpecTree> > build_dependencies_key() const;
diff --git a/paludis/repositories/unpackaged/installed_repository.cc b/paludis/repositories/unpackaged/installed_repository.cc
index 2413e36..46e68a1 100644
--- a/paludis/repositories/unpackaged/installed_repository.cc
+++ b/paludis/repositories/unpackaged/installed_repository.cc
@@ -51,6 +51,7 @@
#include <paludis/hook.hh>
#include <paludis/common_sets.hh>
#include <paludis/unformatted_pretty_printer.hh>
+#include <paludis/slot.hh>
#include <sstream>
#include <sys/time.h>
@@ -252,11 +253,11 @@ namespace
return std::make_pair(uid, gid);
}
- bool slot_is_same(const std::shared_ptr<const PackageID> & a,
+ bool parallel_slot_is_same(const std::shared_ptr<const PackageID> & a,
const std::shared_ptr<const PackageID> & b)
{
if (a->slot_key())
- return b->slot_key() && a->slot_key()->parse_value() == b->slot_key()->parse_value();
+ return b->slot_key() && a->slot_key()->parse_value().parallel_value() == b->slot_key()->parse_value().parallel_value();
else
return ! b->slot_key();
}
@@ -303,7 +304,7 @@ InstalledUnpackagedRepository::merge(const MergeParams & m)
v != v_end ; ++v)
{
if_same_name_id = *v;
- if ((*v)->version() == m.package_id()->version() && slot_is_same(*v, m.package_id()))
+ if ((*v)->version() == m.package_id()->version() && parallel_slot_is_same(*v, m.package_id()))
{
if_overwritten_id = *v;
break;
@@ -328,7 +329,7 @@ InstalledUnpackagedRepository::merge(const MergeParams & m)
}
FSPath target_ver_dir(uid_dir);
- target_ver_dir /= (stringify(m.package_id()->version()) + ":" + stringify(m.package_id()->slot_key()->parse_value()) + ":" + cookie());
+ target_ver_dir /= (stringify(m.package_id()->version()) + ":" + stringify(m.package_id()->slot_key()->parse_value().parallel_value()) + ":" + cookie());
if (target_ver_dir.stat().exists())
throw ActionFailedError("Temporary merge directory '" + stringify(target_ver_dir) + "' already exists, probably "
diff --git a/paludis/repositories/unpackaged/installed_repository_TEST.cc b/paludis/repositories/unpackaged/installed_repository_TEST.cc
index 197b9e9..7dc3d8a 100644
--- a/paludis/repositories/unpackaged/installed_repository_TEST.cc
+++ b/paludis/repositories/unpackaged/installed_repository_TEST.cc
@@ -32,6 +32,7 @@
#include <paludis/selection.hh>
#include <paludis/standard_output_manager.hh>
#include <paludis/contents.hh>
+#include <paludis/slot.hh>
#include <paludis/util/sequence.hh>
#include <paludis/util/join.hh>
@@ -133,7 +134,7 @@ TEST(InstalledRepository, Metadata)
&env, { }), make_null_shared_ptr(), { }))]->begin());
EXPECT_EQ(id1->version(), VersionSpec("1", { }));
- EXPECT_EQ(SlotName("0"), id1->slot_key()->parse_value());
+ EXPECT_EQ("0", id1->slot_key()->parse_value().raw_value());
EXPECT_EQ(QualifiedPackageName("cat-one/foo"), id1->name());
EXPECT_EQ(RepositoryName("installed-unpackaged"), id1->repository_name());
EXPECT_TRUE(bool(id1->fs_location_key()));
@@ -150,7 +151,7 @@ TEST(InstalledRepository, Metadata)
&env, { }), make_null_shared_ptr(), { }))]->begin());
EXPECT_EQ(id2->version(), VersionSpec("2", { }));
- EXPECT_EQ(SlotName("1"), id2->slot_key()->parse_value());
+ EXPECT_EQ("1", id2->slot_key()->parse_value().raw_value());
EXPECT_EQ(QualifiedPackageName("cat-one/foo"), id2->name());
EXPECT_EQ(RepositoryName("installed-unpackaged"), id2->repository_name());
EXPECT_TRUE(bool(id2->fs_location_key()));
diff --git a/paludis/repositories/unpackaged/unpackaged_id.cc b/paludis/repositories/unpackaged/unpackaged_id.cc
index b670d7f..a1524c4 100644
--- a/paludis/repositories/unpackaged/unpackaged_id.cc
+++ b/paludis/repositories/unpackaged/unpackaged_id.cc
@@ -45,6 +45,7 @@
#include <paludis/user_dep_spec.hh>
#include <paludis/always_enabled_dependency_label.hh>
#include <paludis/repository.hh>
+#include <paludis/slot.hh>
using namespace paludis;
using namespace paludis::unpackaged_repositories;
@@ -77,7 +78,7 @@ namespace paludis
const VersionSpec version;
const RepositoryName repository_name;
- const std::shared_ptr<LiteralMetadataValueKey<SlotName> > slot_key;
+ const std::shared_ptr<LiteralMetadataValueKey<Slot> > slot_key;
const std::shared_ptr<LiteralMetadataValueKey<FSPath> > fs_location_key;
const std::shared_ptr<const MetadataSpecTreeKey<DependencySpecTree> > build_dependencies_key;
const std::shared_ptr<const MetadataSpecTreeKey<DependencySpecTree> > run_dependencies_key;
@@ -102,7 +103,10 @@ namespace paludis
name(q),
version(v),
repository_name(n),
- slot_key(std::make_shared<LiteralMetadataValueKey<SlotName> >("slot", "Slot", mkt_internal, s)),
+ slot_key(std::make_shared<LiteralMetadataValueKey<Slot> >("slot", "Slot", mkt_internal, make_named_values<Slot>(
+ n::match_values() = std::make_pair(s, s),
+ n::parallel_value() = s,
+ n::raw_value() = stringify(s)))),
fs_location_key(std::make_shared<LiteralMetadataValueKey<FSPath> >("location", "Location", mkt_normal, l)),
build_dependencies_key(std::make_shared<UnpackagedDependencyKey>(env, "build_dependencies", "Build dependencies", mkt_dependencies,
UnpackagedIDData::get_instance()->build_dependencies_labels, b)),
@@ -157,18 +161,18 @@ UnpackagedID::canonical_form(const PackageIDCanonicalForm f) const
{
case idcf_full:
return stringify(_imp->name) + "-" + stringify(_imp->version) + ":" +
- stringify(slot_key()->parse_value()) + "::" + stringify(_imp->repository_name);
+ stringify(slot_key()->parse_value().parallel_value()) + "::" + stringify(_imp->repository_name);
case idcf_version:
return stringify(_imp->version);
case idcf_no_version:
- return stringify(_imp->name) + ":" + stringify(slot_key()->parse_value()) + "::" +
+ return stringify(_imp->name) + ":" + stringify(slot_key()->parse_value().parallel_value()) + "::" +
stringify(_imp->repository_name);
case idcf_no_name:
return stringify(_imp->version) + ":" +
- stringify(slot_key()->parse_value()) + "::" + stringify(_imp->repository_name);
+ stringify(slot_key()->parse_value().parallel_value()) + "::" + stringify(_imp->repository_name);
case last_idcf:
break;
@@ -181,7 +185,7 @@ PackageDepSpec
UnpackagedID::uniquely_identifying_spec() const
{
return parse_user_package_dep_spec("=" + stringify(name()) + "-" + stringify(version()) +
- (slot_key() ? ":" + stringify(slot_key()->parse_value()) : "") + "::" + stringify(repository_name()),
+ (slot_key() ? ":" + stringify(slot_key()->parse_value().parallel_value()) : "") + "::" + stringify(repository_name()),
_imp->env, { });
}
@@ -275,7 +279,7 @@ UnpackagedID::fs_location_key() const
return _imp->fs_location_key;
}
-const std::shared_ptr<const MetadataValueKey<SlotName> >
+const std::shared_ptr<const MetadataValueKey<Slot> >
UnpackagedID::slot_key() const
{
return _imp->slot_key;
@@ -307,11 +311,11 @@ UnpackagedID::supports_action(const SupportsActionTestBase & test) const
namespace
{
- bool slot_is_same(const std::shared_ptr<const PackageID> & a,
+ bool parallel_slot_is_same(const std::shared_ptr<const PackageID> & a,
const PackageID * const b)
{
if (a->slot_key())
- return b->slot_key() && a->slot_key()->parse_value() == b->slot_key()->parse_value();
+ return b->slot_key() && a->slot_key()->parse_value().parallel_value() == b->slot_key()->parse_value().parallel_value();
else
return ! b->slot_key();
}
@@ -463,7 +467,7 @@ UnpackagedID::perform_action(Action & action) const
i != i_end ; ++i)
{
Context local_context("When cleaning '" + stringify(**i) + "':");
- if ((*i)->name() == name() && (*i)->version() == version() && slot_is_same(*i, this))
+ if ((*i)->name() == name() && (*i)->version() == version() && parallel_slot_is_same(*i, this))
continue;
UninstallActionOptions uo(make_named_values<UninstallActionOptions>(
@@ -492,13 +496,13 @@ UnpackagedID::breaks_portage() const
bool
UnpackagedID::arbitrary_less_than_comparison(const PackageID & other) const
{
- return slot_key()->parse_value().value() < (other.slot_key() ? stringify(other.slot_key()->parse_value()) : "");
+ return stringify(slot_key()->parse_value().raw_value()) < (other.slot_key() ? stringify(other.slot_key()->parse_value().raw_value()) : "");
}
std::size_t
UnpackagedID::extra_hash_value() const
{
- return Hash<SlotName>()(slot_key()->parse_value());
+ return Hash<std::string>()(slot_key()->parse_value().raw_value());
}
const std::shared_ptr<const MetadataValueKey<std::shared_ptr<const Choices> > >
diff --git a/paludis/repositories/unpackaged/unpackaged_id.hh b/paludis/repositories/unpackaged/unpackaged_id.hh
index 89200a5..ad2de1d 100644
--- a/paludis/repositories/unpackaged/unpackaged_id.hh
+++ b/paludis/repositories/unpackaged/unpackaged_id.hh
@@ -55,7 +55,7 @@ namespace paludis
virtual const RepositoryName repository_name() const;
virtual PackageDepSpec uniquely_identifying_spec() const;
- virtual const std::shared_ptr<const MetadataValueKey<SlotName> > slot_key() const;
+ virtual const std::shared_ptr<const MetadataValueKey<Slot> > slot_key() const;
virtual const std::shared_ptr<const MetadataCollectionKey<KeywordNameSet> > keywords_key() const;
virtual const std::shared_ptr<const MetadataSpecTreeKey<DependencySpecTree> > dependencies_key() const;
virtual const std::shared_ptr<const MetadataSpecTreeKey<DependencySpecTree> > build_dependencies_key() const;
diff --git a/paludis/repositories/unpackaged/unpackaged_repository_TEST.cc b/paludis/repositories/unpackaged/unpackaged_repository_TEST.cc
index 78ad9b6..782aae9 100644
--- a/paludis/repositories/unpackaged/unpackaged_repository_TEST.cc
+++ b/paludis/repositories/unpackaged/unpackaged_repository_TEST.cc
@@ -30,6 +30,7 @@
#include <paludis/filtered_generator.hh>
#include <paludis/selection.hh>
#include <paludis/standard_output_manager.hh>
+#include <paludis/slot.hh>
#include <paludis/util/sequence.hh>
#include <paludis/util/join.hh>
@@ -116,7 +117,7 @@ TEST(UnpackagedRepository, Metadata)
*env[selection::RequireExactlyOne(generator::All())]->begin());
EXPECT_EQ(id->version(), VersionSpec("1.0", { }));
- EXPECT_EQ(SlotName("foo"), id->slot_key()->parse_value());
+ EXPECT_EQ("foo", id->slot_key()->parse_value().raw_value());
EXPECT_EQ(QualifiedPackageName("cat/pkg"), id->name());
EXPECT_EQ(RepositoryName("unpackaged"), id->repository_name());
ASSERT_TRUE(bool(id->fs_location_key()));
diff --git a/paludis/repositories/unwritten/unwritten_id.cc b/paludis/repositories/unwritten/unwritten_id.cc
index c9d3f46..2702f6f 100644
--- a/paludis/repositories/unwritten/unwritten_id.cc
+++ b/paludis/repositories/unwritten/unwritten_id.cc
@@ -31,6 +31,7 @@
#include <paludis/action.hh>
#include <paludis/unchoices_key.hh>
#include <paludis/user_dep_spec.hh>
+#include <paludis/slot.hh>
using namespace paludis;
using namespace paludis::unwritten_repository;
@@ -45,7 +46,7 @@ namespace paludis
const VersionSpec version;
const RepositoryName repository_name;
- const std::shared_ptr<const MetadataValueKey<SlotName> > slot_key;
+ const std::shared_ptr<const MetadataValueKey<Slot> > slot_key;
const std::shared_ptr<const MetadataValueKey<std::string> > description_key;
const std::shared_ptr<const MetadataValueKey<std::string> > added_by_key;
const std::shared_ptr<const MetadataValueKey<std::string> > comment_key;
@@ -128,10 +129,10 @@ UnwrittenID::canonical_form(const PackageIDCanonicalForm f) const
{
case idcf_full:
return stringify(_imp->name) + "-" + stringify(_imp->version) +
- ":" + stringify(slot_key()->parse_value()) + "::" + stringify(_imp->repository_name);
+ ":" + stringify(slot_key()->parse_value().parallel_value()) + "::" + stringify(_imp->repository_name);
case idcf_no_version:
- return stringify(_imp->name) + ":" + stringify(slot_key()->parse_value()) +
+ return stringify(_imp->name) + ":" + stringify(slot_key()->parse_value().parallel_value()) +
"::" + stringify(_imp->repository_name);
case idcf_version:
@@ -139,7 +140,7 @@ UnwrittenID::canonical_form(const PackageIDCanonicalForm f) const
case idcf_no_name:
return stringify(_imp->version) +
- ":" + stringify(slot_key()->parse_value()) + "::" + stringify(_imp->repository_name);
+ ":" + stringify(slot_key()->parse_value().parallel_value()) + "::" + stringify(_imp->repository_name);
case last_idcf:
break;
@@ -152,7 +153,7 @@ PackageDepSpec
UnwrittenID::uniquely_identifying_spec() const
{
return parse_user_package_dep_spec("=" + stringify(name()) + "-" + stringify(version()) +
- (slot_key() ? ":" + stringify(slot_key()->parse_value()) : "") + "::" + stringify(repository_name()),
+ (slot_key() ? ":" + stringify(slot_key()->parse_value().parallel_value()) : "") + "::" + stringify(repository_name()),
_imp->env, { });
}
@@ -195,13 +196,13 @@ UnwrittenID::breaks_portage() const
bool
UnwrittenID::arbitrary_less_than_comparison(const PackageID & other) const
{
- return slot_key()->parse_value().value() < (other.slot_key() ? stringify(other.slot_key()->parse_value()) : "");
+ return stringify(slot_key()->parse_value().raw_value()) < (other.slot_key() ? stringify(other.slot_key()->parse_value().raw_value()) : "");
}
std::size_t
UnwrittenID::extra_hash_value() const
{
- return Hash<SlotName>()(slot_key()->parse_value());
+ return Hash<std::string>()(slot_key()->parse_value().raw_value());
}
const std::shared_ptr<const MetadataValueKey<FSPath> >
@@ -246,7 +247,7 @@ UnwrittenID::post_dependencies_key() const
return std::shared_ptr<const MetadataSpecTreeKey<DependencySpecTree> >();
}
-const std::shared_ptr<const MetadataValueKey<SlotName> >
+const std::shared_ptr<const MetadataValueKey<Slot> >
UnwrittenID::slot_key() const
{
return _imp->slot_key;
diff --git a/paludis/repositories/unwritten/unwritten_id.hh b/paludis/repositories/unwritten/unwritten_id.hh
index 43518ce..169171c 100644
--- a/paludis/repositories/unwritten/unwritten_id.hh
+++ b/paludis/repositories/unwritten/unwritten_id.hh
@@ -65,7 +65,7 @@ namespace paludis
NamedValue<n::removed_by, std::shared_ptr<const MetadataValueKey<std::string> > > removed_by;
NamedValue<n::removed_from, std::shared_ptr<const MetadataCollectionKey<Set<std::string> > > > removed_from;
NamedValue<n::repository, RepositoryName> repository;
- NamedValue<n::slot, std::shared_ptr<const MetadataValueKey<SlotName> > > slot;
+ NamedValue<n::slot, std::shared_ptr<const MetadataValueKey<Slot> > > slot;
NamedValue<n::version, VersionSpec> version;
};
@@ -89,7 +89,7 @@ namespace paludis
const RepositoryName repository_name() const;
virtual PackageDepSpec uniquely_identifying_spec() const;
- const std::shared_ptr<const MetadataValueKey<SlotName> > slot_key() const;
+ const std::shared_ptr<const MetadataValueKey<Slot> > slot_key() const;
const std::shared_ptr<const MetadataCollectionKey<KeywordNameSet> > keywords_key() const;
const std::shared_ptr<const MetadataSpecTreeKey<DependencySpecTree> >
dependencies_key() const;
diff --git a/paludis/repositories/unwritten/unwritten_repository_file.cc b/paludis/repositories/unwritten/unwritten_repository_file.cc
index 57793a8..4cc435b 100644
--- a/paludis/repositories/unwritten/unwritten_repository_file.cc
+++ b/paludis/repositories/unwritten/unwritten_repository_file.cc
@@ -36,6 +36,7 @@
#include <paludis/user_dep_spec.hh>
#include <paludis/spec_tree.hh>
#include <paludis/pretty_printer.hh>
+#include <paludis/slot.hh>
#include <paludis/util/pimp-impl.hh>
#include <paludis/util/wrapped_forward_iterator-impl.hh>
@@ -203,7 +204,7 @@ UnwrittenRepositoryFile::_load(const FSPath & f)
CategoryNamePart category("x");
PackageNamePart package("x");
- std::shared_ptr<MetadataValueKey<SlotName> > slot;
+ std::shared_ptr<MetadataValueKey<Slot> > slot;
std::list<VersionSpec> versions;
std::shared_ptr<UnwrittenRepositoryFileEntry> entry;
while (std::getline(file, line))
@@ -250,7 +251,10 @@ UnwrittenRepositoryFile::_load(const FSPath & f)
(+simple_parser::any_of(" \t"))
))
{
- slot = std::make_shared<LiteralMetadataValueKey<SlotName>>("SLOT", "Slot", mkt_internal, SlotName(token));
+ slot = std::make_shared<LiteralMetadataValueKey<Slot>>("SLOT", "Slot", mkt_internal, make_named_values<Slot>(
+ n::match_values() = std::make_pair(SlotName(token), SlotName(token)),
+ n::parallel_value() = SlotName(token),
+ n::raw_value() = token));
if (entry)
{
diff --git a/paludis/repositories/unwritten/unwritten_repository_file.hh b/paludis/repositories/unwritten/unwritten_repository_file.hh
index 3cef83d..63e88ac 100644
--- a/paludis/repositories/unwritten/unwritten_repository_file.hh
+++ b/paludis/repositories/unwritten/unwritten_repository_file.hh
@@ -28,6 +28,7 @@
#include <paludis/name.hh>
#include <paludis/version_spec.hh>
#include <paludis/spec_tree-fwd.hh>
+#include <paludis/slot-fwd.hh>
namespace paludis
{
@@ -63,7 +64,7 @@ namespace paludis
NamedValue<n::remote_ids, std::shared_ptr<const MetadataCollectionKey<Sequence<std::string> > > > remote_ids;
NamedValue<n::removed_by, std::shared_ptr<const MetadataValueKey<std::string> > > removed_by;
NamedValue<n::removed_from, std::shared_ptr<const MetadataCollectionKey<Set<std::string> > > > removed_from;
- NamedValue<n::slot, std::shared_ptr<const MetadataValueKey<SlotName> > > slot;
+ NamedValue<n::slot, std::shared_ptr<const MetadataValueKey<Slot> > > slot;
NamedValue<n::version, VersionSpec> version;
};
diff --git a/paludis/resolver/collect_depped_upon.cc b/paludis/resolver/collect_depped_upon.cc
index e308989..3cc356d 100644
--- a/paludis/resolver/collect_depped_upon.cc
+++ b/paludis/resolver/collect_depped_upon.cc
@@ -40,6 +40,7 @@
#include <paludis/match_package.hh>
#include <paludis/version_spec.hh>
#include <paludis/serialise-impl.hh>
+#include <paludis/slot.hh>
#include <algorithm>
#include <sstream>
@@ -162,7 +163,7 @@ namespace
if (best_eventual_id && best_eventual_id->slot_key())
{
PartiallyMadePackageDepSpec part_spec(*s.spec());
- part_spec.slot_requirement(std::make_shared<ELikeSlotExactRequirement>(best_eventual_id->slot_key()->parse_value(), false));
+ part_spec.slot_requirement(std::make_shared<ELikeSlotExactPartialRequirement>(best_eventual_id->slot_key()->parse_value().parallel_value(), make_null_shared_ptr()));
spec = std::make_shared<PackageDepSpec>(part_spec);
}
}
@@ -343,3 +344,4 @@ namespace paludis
template class Sequence<DependentPackageID>;
template class WrappedForwardIterator<Sequence<DependentPackageID>::ConstIteratorTag, const DependentPackageID>;
}
+
diff --git a/paludis/resolver/decider.cc b/paludis/resolver/decider.cc
index 63e58e5..f01f76a 100644
--- a/paludis/resolver/decider.cc
+++ b/paludis/resolver/decider.cc
@@ -73,6 +73,7 @@
#include <paludis/additional_package_dep_spec_requirement.hh>
#include <paludis/partially_made_package_dep_spec.hh>
#include <paludis/dep_spec_annotations.hh>
+#include <paludis/slot.hh>
#include <paludis/util/pimp-impl.hh>
@@ -1336,17 +1337,27 @@ namespace
{
struct SlotNameFinder
{
- std::shared_ptr<SlotName> visit(const SlotExactRequirement & s)
+ std::shared_ptr<SlotName> visit(const SlotExactPartialRequirement & s)
{
return std::make_shared<SlotName>(s.slot());
}
+ std::shared_ptr<SlotName> visit(const SlotAnyPartialLockedRequirement & s)
+ {
+ return std::make_shared<SlotName>(s.slot());
+ }
+
+ std::shared_ptr<SlotName> visit(const SlotExactFullRequirement & s)
+ {
+ return std::make_shared<SlotName>(s.slots().first);
+ }
+
std::shared_ptr<SlotName> visit(const SlotAnyUnlockedRequirement &)
{
return make_null_shared_ptr();
}
- std::shared_ptr<SlotName> visit(const SlotAnyLockedRequirement &)
+ std::shared_ptr<SlotName> visit(const SlotAnyAtAllLockedRequirement &)
{
return make_null_shared_ptr();
}
@@ -1429,7 +1440,7 @@ Decider::_get_error_resolvents_for(
if (! ids->empty())
resolvent.slot() = make_named_values<SlotNameOrNull>(
n::name_or_null() = (*ids->rbegin())->slot_key() ?
- make_shared_copy((*ids->rbegin())->slot_key()->parse_value()) :
+ make_shared_copy((*ids->rbegin())->slot_key()->parse_value().parallel_value()) :
make_null_shared_ptr(),
n::null_means_unknown() = true
);
diff --git a/paludis/resolver/get_constraints_for_dependent_helper.cc b/paludis/resolver/get_constraints_for_dependent_helper.cc
index c1c8119..7604e18 100644
--- a/paludis/resolver/get_constraints_for_dependent_helper.cc
+++ b/paludis/resolver/get_constraints_for_dependent_helper.cc
@@ -36,6 +36,7 @@
#include <paludis/partially_made_package_dep_spec.hh>
#include <paludis/elike_slot_requirement.hh>
#include <paludis/metadata_key.hh>
+#include <paludis/slot.hh>
using namespace paludis;
using namespace paludis::resolver;
@@ -85,7 +86,7 @@ GetConstraintsForDependentHelper::operator() (
PartiallyMadePackageDepSpec partial_spec({ });
partial_spec.package(id->name());
if (id->slot_key())
- partial_spec.slot_requirement(std::make_shared<ELikeSlotExactRequirement>(id->slot_key()->parse_value(), false));
+ partial_spec.slot_requirement(std::make_shared<ELikeSlotExactPartialRequirement>(id->slot_key()->parse_value().parallel_value(), make_null_shared_ptr()));
spec = std::make_shared<PackageDepSpec>(partial_spec);
}
diff --git a/paludis/resolver/get_constraints_for_purge_helper.cc b/paludis/resolver/get_constraints_for_purge_helper.cc
index 60280c8..9bde04e 100644
--- a/paludis/resolver/get_constraints_for_purge_helper.cc
+++ b/paludis/resolver/get_constraints_for_purge_helper.cc
@@ -36,6 +36,7 @@
#include <paludis/partially_made_package_dep_spec.hh>
#include <paludis/elike_slot_requirement.hh>
#include <paludis/metadata_key.hh>
+#include <paludis/slot.hh>
using namespace paludis;
using namespace paludis::resolver;
@@ -80,7 +81,7 @@ GetConstraintsForPurgeHelper::operator() (
PartiallyMadePackageDepSpec partial_spec({ });
partial_spec.package(id->name());
if (id->slot_key())
- partial_spec.slot_requirement(std::make_shared<ELikeSlotExactRequirement>(id->slot_key()->parse_value(), false));
+ partial_spec.slot_requirement(std::make_shared<ELikeSlotExactPartialRequirement>(id->slot_key()->parse_value().parallel_value(), make_null_shared_ptr()));
PackageDepSpec spec(partial_spec);
const std::shared_ptr<WasUsedByReason> reason(std::make_shared<WasUsedByReason>(was_used_by_ids));
diff --git a/paludis/resolver/get_sameness.cc b/paludis/resolver/get_sameness.cc
index a993df4..4e3432c 100644
--- a/paludis/resolver/get_sameness.cc
+++ b/paludis/resolver/get_sameness.cc
@@ -73,9 +73,9 @@ namespace
if (s.slot_requirement_ptr())
{
- auto r(visitor_cast<const SlotExactRequirement>(*s.slot_requirement_ptr()));
- if (r && r->from_any_locked())
- tokens.insert("slot_requirement:" + stringify(*std::make_shared<ELikeSlotAnyLockedRequirement>()));
+ auto r(s.slot_requirement_ptr()->maybe_original_requirement_if_rewritten());
+ if (r)
+ tokens.insert("slot_requirement:" + stringify(*r));
else
tokens.insert("slot_requirement:" + stringify(*s.slot_requirement_ptr()));
}
diff --git a/paludis/resolver/resolvent.cc b/paludis/resolver/resolvent.cc
index 1936fae..80b4ff6 100644
--- a/paludis/resolver/resolvent.cc
+++ b/paludis/resolver/resolvent.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2009, 2010 Ciaran McCreesh
+ * Copyright (c) 2009, 2010, 2011 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
@@ -28,6 +28,7 @@
#include <paludis/filter.hh>
#include <paludis/package_id.hh>
#include <paludis/metadata_key.hh>
+#include <paludis/slot.hh>
#include <paludis/serialise-impl.hh>
using namespace paludis;
@@ -131,7 +132,7 @@ Resolvent::Resolvent(
package(id->name()),
slot(make_named_values<SlotNameOrNull>(
n::name_or_null() = id->slot_key() ?
- std::make_shared<SlotName>(id->slot_key()->parse_value()) :
+ std::make_shared<SlotName>(id->slot_key()->parse_value().parallel_value()) :
make_null_shared_ptr(),
n::null_means_unknown() = false
))
diff --git a/paludis/resolver/same_slot.cc b/paludis/resolver/same_slot.cc
index ee80d9f..0499057 100644
--- a/paludis/resolver/same_slot.cc
+++ b/paludis/resolver/same_slot.cc
@@ -22,6 +22,7 @@
#include <paludis/package_id.hh>
#include <paludis/metadata_key.hh>
#include <paludis/name.hh>
+#include <paludis/slot.hh>
using namespace paludis;
using namespace paludis::resolver;
@@ -32,9 +33,8 @@ paludis::resolver::same_slot(
const std::shared_ptr<const PackageID> & b)
{
if (a->slot_key())
- return b->slot_key() && a->slot_key()->parse_value() == b->slot_key()->parse_value();
+ return b->slot_key() && a->slot_key()->parse_value().parallel_value() == b->slot_key()->parse_value().parallel_value();
else
return ! b->slot_key();
}
-
diff --git a/paludis/selection.cc b/paludis/selection.cc
index e1e8d08..cad23be 100644
--- a/paludis/selection.cc
+++ b/paludis/selection.cc
@@ -36,6 +36,8 @@
#include <paludis/filtered_generator.hh>
#include <paludis/environment.hh>
#include <paludis/metadata_key.hh>
+#include <paludis/slot.hh>
+
#include <algorithm>
#include <functional>
#include <map>
@@ -102,7 +104,7 @@ namespace
std::string slot_as_string(const std::shared_ptr<const PackageID> & id)
{
if (id->slot_key())
- return stringify(id->slot_key()->parse_value());
+ return stringify(id->slot_key()->parse_value().parallel_value());
else
return "(none)";
}
@@ -506,3 +508,4 @@ namespace paludis
{
template class Pimp<Selection>;
}
+
diff --git a/paludis/slot-fwd.hh b/paludis/slot-fwd.hh
new file mode 100644
index 0000000..477fa97
--- /dev/null
+++ b/paludis/slot-fwd.hh
@@ -0,0 +1,28 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2012 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
+ * Public License version 2, as published by the Free Software Foundation.
+ *
+ * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef PALUDIS_GUARD_PALUDIS_SLOT_FWD_HH
+#define PALUDIS_GUARD_PALUDIS_SLOT_FWD_HH 1
+
+namespace paludis
+{
+ struct Slot;
+}
+
+#endif
diff --git a/paludis/slot.cc b/paludis/slot.cc
new file mode 100644
index 0000000..fb21dd3
--- /dev/null
+++ b/paludis/slot.cc
@@ -0,0 +1,23 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2012 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
+ * Public License version 2, as published by the Free Software Foundation.
+ *
+ * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include <paludis/slot.hh>
+
+using namespace paludis;
+
diff --git a/paludis/slot.hh b/paludis/slot.hh
new file mode 100644
index 0000000..db6e94a
--- /dev/null
+++ b/paludis/slot.hh
@@ -0,0 +1,65 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2012 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
+ * Public License version 2, as published by the Free Software Foundation.
+ *
+ * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef PALUDIS_GUARD_PALUDIS_SLOT_HH
+#define PALUDIS_GUARD_PALUDIS_SLOT_HH 1
+
+#include <paludis/slot-fwd.hh>
+
+#include <paludis/util/named_value.hh>
+#include <paludis/name.hh>
+#include <utility>
+
+namespace paludis
+{
+ namespace n
+ {
+ typedef Name<struct name_match_values> match_values;
+ typedef Name<struct name_parallel_value> parallel_value;
+ typedef Name<struct name_raw_value> raw_value;
+ }
+
+ /**
+ * Represents an ID's slot, possibly with sub-slot related information.
+ *
+ * \since 0.79
+ */
+ struct Slot
+ {
+ /**
+ * First value is the slot, second the sub-slot. Both should be the same
+ * when sub-slots are not being used. Matching is against the first
+ * value for a :slot, and against both for a :first/second.
+ */
+ NamedValue<n::match_values, std::pair<SlotName, SlotName> > match_values;
+
+ /**
+ * Used to determine what can be installed in parallel.
+ */
+ NamedValue<n::parallel_value, SlotName> parallel_value;
+
+ /**
+ * Used for output purposes, contains whatever the native representation
+ * is.
+ */
+ NamedValue<n::raw_value, std::string> raw_value;
+ };
+}
+
+#endif
diff --git a/paludis/slot_requirement-fwd.hh b/paludis/slot_requirement-fwd.hh
index 09852be..ceaa070 100644
--- a/paludis/slot_requirement-fwd.hh
+++ b/paludis/slot_requirement-fwd.hh
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2008 Ciaran McCreesh
+ * Copyright (c) 2008, 2011 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
@@ -26,8 +26,10 @@
namespace paludis
{
struct SlotRequirement;
- struct SlotExactRequirement;
- struct SlotAnyLockedRequirement;
+ struct SlotExactFullRequirement;
+ struct SlotExactPartialRequirement;
+ struct SlotAnyAtAllLockedRequirement;
+ struct SlotAnyPartialLockedRequirement;
struct SlotAnyUnlockedRequirement;
std::ostream & operator<< (std::ostream &, const SlotRequirement &) PALUDIS_VISIBLE;
diff --git a/paludis/slot_requirement.hh b/paludis/slot_requirement.hh
index a0b7a1d..db36c13 100644
--- a/paludis/slot_requirement.hh
+++ b/paludis/slot_requirement.hh
@@ -24,6 +24,7 @@
#include <paludis/name-fwd.hh>
#include <paludis/util/visitor.hh>
#include <paludis/util/type_list.hh>
+#include <memory>
namespace paludis
{
@@ -36,7 +37,7 @@ namespace paludis
*/
class PALUDIS_VISIBLE SlotRequirement :
public virtual DeclareAbstractAcceptMethods<SlotRequirement, MakeTypeList<
- SlotExactRequirement, SlotAnyLockedRequirement, SlotAnyUnlockedRequirement>::Type>
+ SlotExactPartialRequirement, SlotExactFullRequirement, SlotAnyAtAllLockedRequirement, SlotAnyPartialLockedRequirement, SlotAnyUnlockedRequirement>::Type>
{
public:
/**
@@ -44,44 +45,83 @@ namespace paludis
* for parsing.
*/
virtual const std::string as_string() const PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
+
+ /**
+ * If we are a rewritten slot, return what the original requirement
+ * would have been; otherwise, returns null.
+ *
+ * \since 0.79
+ */
+ virtual const std::shared_ptr<const SlotRequirement> maybe_original_requirement_if_rewritten() const PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
};
/**
- * A SlotExactRequirement is a SlotRequirement for exact
- * slot requirements, such as <code>:3</code> or <code>:=3</code>.
+ * A SlotExactPartialRequirement is a SlotRequirement for exact slot
+ * requirements on the main part of the slot, such as <code>:3</code> or
+ * <code>:3=3</code>.
*
* \ingroup g_dep_spec
*/
- class PALUDIS_VISIBLE SlotExactRequirement :
+ class PALUDIS_VISIBLE SlotExactPartialRequirement :
public SlotRequirement,
- public ImplementAcceptMethods<SlotRequirement, SlotExactRequirement>
+ public ImplementAcceptMethods<SlotRequirement, SlotExactPartialRequirement>
{
public:
/**
* The slot in question.
*/
virtual const SlotName slot() const PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
+ };
+ /**
+ * A SlotExactFullRequirement is a SlotRequirement for exact slot
+ * requirements on both parts of the slot, such as <code>:3/4</code>
+ * or <code>:3=3/4</code>.
+ *
+ * \ingroup g_dep_spec
+ */
+ class PALUDIS_VISIBLE SlotExactFullRequirement :
+ public SlotRequirement,
+ public ImplementAcceptMethods<SlotRequirement, SlotExactFullRequirement>
+ {
+ public:
/**
- * If true, indicates we are a <code>:=3</code> style dependency.
+ * The slot parts in question.
*/
- virtual bool from_any_locked() const PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
+ virtual const std::pair<SlotName, SlotName> slots() const PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
};
/**
- * A SlotAnyLockedRequirement is a SlotRequirement for
+ * A SlotAnyAtAllLockedRequirement is a SlotRequirement for
* <code>:=</code> slot requirements.
*
* \ingroup g_dep_spec
*/
- class PALUDIS_VISIBLE SlotAnyLockedRequirement :
+ class PALUDIS_VISIBLE SlotAnyAtAllLockedRequirement :
+ public SlotRequirement,
+ public ImplementAcceptMethods<SlotRequirement, SlotAnyAtAllLockedRequirement>
+ {
+ };
+
+ /**
+ * A SlotAnyPartialLockedRequirement is a SlotRequirement for
+ * <code>:3=</code> slot requirements that do not specify a sub-slot.
+ *
+ * \ingroup g_dep_spec
+ */
+ class PALUDIS_VISIBLE SlotAnyPartialLockedRequirement :
public SlotRequirement,
- public ImplementAcceptMethods<SlotRequirement, SlotAnyLockedRequirement>
+ public ImplementAcceptMethods<SlotRequirement, SlotAnyPartialLockedRequirement>
{
+ public:
+ /**
+ * The slot in question.
+ */
+ virtual const SlotName slot() const PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
};
/**
- * A SlotAnyLockedRequirement is a SlotRequirement for
+ * A SlotAnyUnlockedRequirement is a SlotRequirement for
* <code>:*</code> slot requirements.
*
* \ingroup g_dep_spec
diff --git a/paludis/user_dep_spec-fwd.hh b/paludis/user_dep_spec-fwd.hh
index 4a8a66d..224176a 100644
--- a/paludis/user_dep_spec-fwd.hh
+++ b/paludis/user_dep_spec-fwd.hh
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2005, 2006, 2007, 2008, 2009 Ciaran McCreesh
+ * Copyright (c) 2005, 2006, 2007, 2008, 2009, 2011 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
@@ -63,7 +63,7 @@ namespace paludis
///\}
};
- struct UserSlotExactRequirement;
+ struct UserSlotExactPartialRequirement;
struct UserKeyRequirement;
diff --git a/paludis/user_dep_spec.cc b/paludis/user_dep_spec.cc
index 7089d14..a35b461 100644
--- a/paludis/user_dep_spec.cc
+++ b/paludis/user_dep_spec.cc
@@ -32,6 +32,7 @@
#include <paludis/contents.hh>
#include <paludis/repository.hh>
#include <paludis/mask.hh>
+#include <paludis/slot.hh>
#include <paludis/util/options.hh>
#include <paludis/util/log.hh>
@@ -246,7 +247,7 @@ namespace
std::string::size_type slot_p(s.rfind(':'));
if (std::string::npos != slot_p)
{
- result.slot_requirement(std::make_shared<UserSlotExactRequirement>(SlotName(s.substr(slot_p + 1))));
+ result.slot_requirement(std::make_shared<UserSlotExactPartialRequirement>(SlotName(s.substr(slot_p + 1))));
s.erase(slot_p);
}
}
@@ -385,26 +386,27 @@ paludis::envless_parse_package_dep_spec_for_tests(const std::string & ss)
));
}
-UserSlotExactRequirement::UserSlotExactRequirement(const SlotName & s) :
+
+UserSlotExactPartialRequirement::UserSlotExactPartialRequirement(const SlotName & s) :
_s(s)
{
}
const SlotName
-UserSlotExactRequirement::slot() const
+UserSlotExactPartialRequirement::slot() const
{
return _s;
}
const std::string
-UserSlotExactRequirement::as_string() const
+UserSlotExactPartialRequirement::as_string() const
{
return ":" + stringify(_s);
}
-bool
-UserSlotExactRequirement::from_any_locked() const
+const std::shared_ptr<const SlotRequirement>
+UserSlotExactPartialRequirement::maybe_original_requirement_if_rewritten() const
{
- return false;
+ return make_null_shared_ptr();
}
GotASetNotAPackageDepSpec::GotASetNotAPackageDepSpec(const std::string & s) throw () :
@@ -614,9 +616,9 @@ namespace
return pattern == stringify(k.parse_value());
}
- bool visit(const MetadataValueKey<SlotName> & k) const
+ bool visit(const MetadataValueKey<Slot> & k) const
{
- return pattern == stringify(k.parse_value());
+ return pattern == stringify(k.parse_value().raw_value());
}
bool visit(const MetadataValueKey<FSPath> & k) const
@@ -1051,3 +1053,4 @@ namespace paludis
{
template class Pimp<UserKeyRequirement>;
}
+
diff --git a/paludis/user_dep_spec.hh b/paludis/user_dep_spec.hh
index c225620..92c01a9 100644
--- a/paludis/user_dep_spec.hh
+++ b/paludis/user_dep_spec.hh
@@ -53,8 +53,8 @@ namespace paludis
PackageDepSpec envless_parse_package_dep_spec_for_tests(
const std::string &) PALUDIS_VISIBLE;
- class PALUDIS_VISIBLE UserSlotExactRequirement :
- public SlotExactRequirement
+ class PALUDIS_VISIBLE UserSlotExactPartialRequirement :
+ public SlotExactPartialRequirement
{
private:
const SlotName _s;
@@ -63,13 +63,13 @@ namespace paludis
///\name Basic operations
///\{
- UserSlotExactRequirement(const SlotName &);
+ UserSlotExactPartialRequirement(const SlotName &);
///\}
virtual const SlotName slot() const PALUDIS_ATTRIBUTE((warn_unused_result));
virtual const std::string as_string() const PALUDIS_ATTRIBUTE((warn_unused_result));
- virtual bool from_any_locked() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual const std::shared_ptr<const SlotRequirement> maybe_original_requirement_if_rewritten() const PALUDIS_ATTRIBUTE((warn_unused_result));
};
/**
diff --git a/python/dep_spec_TEST.py b/python/dep_spec_TEST.py
index 9b28d28..b34a88f 100755
--- a/python/dep_spec_TEST.py
+++ b/python/dep_spec_TEST.py
@@ -60,7 +60,7 @@ class TestCase_1_DepSpecs(unittest.TestCase):
def test_04_slot(self):
self.get_depspecs()
- self.assert_(isinstance(self.pds.slot_requirement, SlotExactRequirement))
+ self.assert_(isinstance(self.pds.slot_requirement, SlotExactPartialRequirement))
self.assertEqual(str(self.pds.slot_requirement.slot), "100")
self.assertEqual(self.pds2.slot_requirement, None)
diff --git a/python/metadata_key.cc b/python/metadata_key.cc
index fac21c8..aaa0409 100644
--- a/python/metadata_key.cc
+++ b/python/metadata_key.cc
@@ -26,6 +26,7 @@
#include <paludis/dep_label.hh>
#include <paludis/environment.hh>
#include <paludis/maintainer.hh>
+#include <paludis/slot.hh>
#include <paludis/util/set.hh>
#include <paludis/util/sequence.hh>
#include <paludis/util/timestamp.hh>
@@ -57,9 +58,9 @@ class MetadataKeySptrToPythonVisitor
obj = bp::object(std::static_pointer_cast<const MetadataValueKey<std::string> >(_m_ptr));
}
- void visit(const MetadataValueKey<SlotName> &)
+ void visit(const MetadataValueKey<Slot> &)
{
- obj = bp::object(std::static_pointer_cast<const MetadataValueKey<SlotName> >(_m_ptr));
+ obj = bp::object(std::static_pointer_cast<const MetadataValueKey<Slot> >(_m_ptr));
}
void visit(const MetadataValueKey<long> &)
@@ -274,10 +275,10 @@ struct MetadataStringKeyWrapper :
};
struct MetadataSlotNameKeyWrapper :
- MetadataValueKey<SlotName> ,
- bp::wrapper<MetadataValueKey<SlotName> >
+ MetadataValueKey<Slot> ,
+ bp::wrapper<MetadataValueKey<Slot> >
{
- virtual const SlotName parse_value() const
+ virtual const Slot parse_value() const
PALUDIS_ATTRIBUTE((warn_unused_result))
{
Lock l(get_mutex());
@@ -996,14 +997,14 @@ void expose_metadata_key()
/**
* MetadataSlotNameKey
*/
- bp::register_ptr_to_python<std::shared_ptr<const MetadataValueKey<SlotName> > >();
+ bp::register_ptr_to_python<std::shared_ptr<const MetadataValueKey<Slot> > >();
bp::implicitly_convertible<std::shared_ptr<MetadataSlotNameKeyWrapper>,
std::shared_ptr<MetadataKey> >();
bp::class_<MetadataSlotNameKeyWrapper, std::shared_ptr<MetadataSlotNameKeyWrapper>,
bp::bases<MetadataKey>, boost::noncopyable>
(
"MetadataSlotNameKey",
- "A MetadataStringKey is a MetadataKey that has a SlotName as its\n"
+ "A MetadataStringKey is a MetadataKey that has a Slot as its\n"
"value.\n\n"
"This class can be subclassed in Python.",
@@ -1011,8 +1012,8 @@ void expose_metadata_key()
"__init__()"
)
)
- .def("parse_value", bp::pure_virtual(&MetadataValueKey<SlotName> ::parse_value),
- "parse_value() -> SlotName\n"
+ .def("parse_value", bp::pure_virtual(&MetadataValueKey<Slot> ::parse_value),
+ "parse_value() -> Slot\n"
"Fetch our value."
)
;
diff --git a/python/name.cc b/python/name.cc
index a2edce8..5d98ebf 100644
--- a/python/name.cc
+++ b/python/name.cc
@@ -25,6 +25,7 @@
#include <paludis/util/wrapped_forward_iterator.hh>
#include <paludis/name.hh>
+#include <paludis/slot.hh>
using namespace paludis;
using namespace paludis::python;
@@ -202,4 +203,20 @@ void expose_name()
true
);
+
+ /**
+ * Slot
+ */
+ bp::class_<Slot>
+ (
+ "Slot",
+ "Represents a slot",
+ bp::no_init
+ )
+
+ .add_property("raw_value",
+ &named_values_getter<Slot, n::raw_value, std::string, &Slot::raw_value>,
+ "[ro] String"
+ )
+ ;
}
diff --git a/python/package_id_TEST.py b/python/package_id_TEST.py
index 129571b..467672f 100755
--- a/python/package_id_TEST.py
+++ b/python/package_id_TEST.py
@@ -49,8 +49,8 @@ class TestCase_01_PackageID(unittest.TestCase):
self.assertEquals(self.ipid.version, VersionSpec("1"))
def test_04_slot(self):
- self.assertEquals(str(self.ipid.slot_key().parse_value()), "test_slot")
- self.assertEquals(str(self.pid.slot_key().parse_value()), "0")
+ self.assertEquals(str(self.ipid.slot_key().parse_value().raw_value), "test_slot")
+ self.assertEquals(str(self.pid.slot_key().parse_value().raw_value), "0")
def test_05_repository(self):
self.assertEquals(str(self.pid.repository_name), "testrepo")
diff --git a/python/slot_requirement.cc b/python/slot_requirement.cc
index e08a74b..58acbae 100644
--- a/python/slot_requirement.cc
+++ b/python/slot_requirement.cc
@@ -46,14 +46,24 @@ namespace
{
}
- void visit(const SlotExactRequirement &)
+ void visit(const SlotExactPartialRequirement &)
{
- obj = bp::object(std::static_pointer_cast<const SlotExactRequirement>(_m_ptr));
+ obj = bp::object(std::static_pointer_cast<const SlotExactPartialRequirement>(_m_ptr));
}
- void visit(const SlotAnyLockedRequirement &)
+ void visit(const SlotExactFullRequirement &)
{
- obj = bp::object(std::static_pointer_cast<const SlotAnyLockedRequirement>(_m_ptr));
+ obj = bp::object(std::static_pointer_cast<const SlotExactFullRequirement>(_m_ptr));
+ }
+
+ void visit(const SlotAnyAtAllLockedRequirement &)
+ {
+ obj = bp::object(std::static_pointer_cast<const SlotAnyAtAllLockedRequirement>(_m_ptr));
+ }
+
+ void visit(const SlotAnyPartialLockedRequirement &)
+ {
+ obj = bp::object(std::static_pointer_cast<const SlotAnyPartialLockedRequirement>(_m_ptr));
}
void visit(const SlotAnyUnlockedRequirement &)
@@ -101,38 +111,60 @@ void expose_slot_requirement()
;
/**
- * SlotExactRequirement
+ * SlotExactPartialRequirement
*/
- register_shared_ptrs_to_python<SlotExactRequirement>(rsp_const);
- bp::implicitly_convertible<std::shared_ptr<SlotExactRequirement>, std::shared_ptr<SlotRequirement> >();
- bp::class_<SlotExactRequirement, std::shared_ptr<SlotExactRequirement>, bp::bases<SlotRequirement>, boost::noncopyable>
+ register_shared_ptrs_to_python<SlotExactPartialRequirement>(rsp_const);
+ bp::implicitly_convertible<std::shared_ptr<SlotExactPartialRequirement>, std::shared_ptr<SlotRequirement> >();
+ bp::class_<SlotExactPartialRequirement, std::shared_ptr<SlotExactPartialRequirement>, bp::bases<SlotRequirement>, boost::noncopyable>
(
- "SlotExactRequirement",
- "A SlotExactRequirement is a SlotRequirement for exact slot requirements, "
+ "SlotExactPartialRequirement",
+ "A SlotExactPartialRequirement is a SlotRequirement for exact slot requirements, "
"such as :3 or :=3 .",
bp::no_init
)
- .add_property("slot", &SlotExactRequirement::slot,
+ .add_property("slot", &SlotExactPartialRequirement::slot,
"[ro] SlotName\n"
"The slot in question."
)
+ ;
- .add_property("from_any_locked", &SlotExactRequirement::from_any_locked,
- "[ro] bool\n"
- "If true, indicates we are a :=3 style dependency."
- )
+ /**
+ * SlotExactFullRequirement
+ */
+ register_shared_ptrs_to_python<SlotExactFullRequirement>(rsp_const);
+ bp::implicitly_convertible<std::shared_ptr<SlotExactFullRequirement>, std::shared_ptr<SlotRequirement> >();
+ bp::class_<SlotExactFullRequirement, std::shared_ptr<SlotExactFullRequirement>, bp::bases<SlotRequirement>, boost::noncopyable>
+ (
+ "SlotExactFullRequirement",
+ "A SlotExactFullRequirement is a SlotRequirement for exact slot requirements, "
+ "such as :3/3 or :=3/3 .",
+ bp::no_init
+ )
+ ;
+
+ /**
+ * SlotAnyAtAllLockedRequirement
+ */
+ register_shared_ptrs_to_python<SlotAnyAtAllLockedRequirement>(rsp_const);
+ bp::implicitly_convertible<std::shared_ptr<SlotAnyAtAllLockedRequirement>, std::shared_ptr<SlotRequirement> >();
+ bp::class_<SlotAnyAtAllLockedRequirement, std::shared_ptr<SlotAnyAtAllLockedRequirement>, bp::bases<SlotRequirement>, boost::noncopyable>
+ (
+ "SlotAnyAtAllLockedRequirement",
+ "A SlotAnyAtAllLockedRequirement is a SlotRequirement for := slot requirements.",
+ bp::no_init
+ )
;
/**
- * SlotAnyLockedRequirement
+ * SlotAnyPartialLockedRequirement
*/
- register_shared_ptrs_to_python<SlotAnyLockedRequirement>(rsp_const);
- bp::implicitly_convertible<std::shared_ptr<SlotAnyLockedRequirement>, std::shared_ptr<SlotRequirement> >();
- bp::class_<SlotAnyLockedRequirement, std::shared_ptr<SlotAnyLockedRequirement>, bp::bases<SlotRequirement>, boost::noncopyable>
+ register_shared_ptrs_to_python<SlotAnyPartialLockedRequirement>(rsp_const);
+ bp::implicitly_convertible<std::shared_ptr<SlotAnyPartialLockedRequirement>, std::shared_ptr<SlotRequirement> >();
+ bp::class_<SlotAnyPartialLockedRequirement, std::shared_ptr<SlotAnyPartialLockedRequirement>, bp::bases<SlotRequirement>, boost::noncopyable>
(
- "SlotAnyLockedRequirement",
- "A SlotAnyLockedRequirement is a SlotRequirement for := slot requirements.",
+ "SlotAnyPartialLockedRequirement",
+ "A SlotAnyPartialLockedRequirement is a SlotRequirement for :3= slot requirements.",
bp::no_init
)
;
diff --git a/ruby/dep_spec.cc b/ruby/dep_spec.cc
index 32d07b0..207b3f7 100644
--- a/ruby/dep_spec.cc
+++ b/ruby/dep_spec.cc
@@ -65,8 +65,10 @@ namespace
static VALUE c_version_requirements_mode;
static VALUE c_slot_requirement;
- static VALUE c_slot_exact_requirement;
- static VALUE c_slot_any_locked_requirement;
+ static VALUE c_slot_exact_partial_requirement;
+ static VALUE c_slot_exact_full_requirement;
+ static VALUE c_slot_any_partial_locked_requirement;
+ static VALUE c_slot_any_at_all_locked_requirement;
static VALUE c_slot_any_unlocked_requirement;
struct V
@@ -79,15 +81,27 @@ namespace
{
}
- void visit(const SlotExactRequirement &)
+ void visit(const SlotExactPartialRequirement &)
{
- value = Data_Wrap_Struct(c_slot_exact_requirement, 0, &Common<std::shared_ptr<const SlotRequirement> >::free,
+ value = Data_Wrap_Struct(c_slot_exact_partial_requirement, 0, &Common<std::shared_ptr<const SlotRequirement> >::free,
new std::shared_ptr<const SlotRequirement>(mm));
}
- void visit(const SlotAnyLockedRequirement &)
+ void visit(const SlotExactFullRequirement &)
{
- value = Data_Wrap_Struct(c_slot_any_locked_requirement, 0, &Common<std::shared_ptr<const SlotRequirement> >::free,
+ value = Data_Wrap_Struct(c_slot_exact_full_requirement, 0, &Common<std::shared_ptr<const SlotRequirement> >::free,
+ new std::shared_ptr<const SlotRequirement>(mm));
+ }
+
+ void visit(const SlotAnyAtAllLockedRequirement &)
+ {
+ value = Data_Wrap_Struct(c_slot_any_at_all_locked_requirement, 0, &Common<std::shared_ptr<const SlotRequirement> >::free,
+ new std::shared_ptr<const SlotRequirement>(mm));
+ }
+
+ void visit(const SlotAnyPartialLockedRequirement &)
+ {
+ value = Data_Wrap_Struct(c_slot_any_partial_locked_requirement, 0, &Common<std::shared_ptr<const SlotRequirement> >::free,
new std::shared_ptr<const SlotRequirement>(mm));
}
@@ -976,8 +990,8 @@ namespace
VALUE
slot_exact_requirement_slot(VALUE self)
{
- std::shared_ptr<const SlotExactRequirement> * ptr;
- Data_Get_Struct(self, std::shared_ptr<const SlotExactRequirement>, ptr);
+ std::shared_ptr<const SlotExactPartialRequirement> * ptr;
+ Data_Get_Struct(self, std::shared_ptr<const SlotExactPartialRequirement>, ptr);
return rb_str_new2(stringify((*ptr)->slot()).c_str());
}
@@ -1228,19 +1242,33 @@ namespace
rb_define_method(c_slot_requirement, "to_s", RUBY_FUNC_CAST(&Common<std::shared_ptr<const SlotRequirement> >::to_s_via_ptr), 0);
/*
- * Document-class: Paludis::ExactSlotRequirement
+ * Document-class: Paludis::SlotExactPartialRequirement
*
* An exact slot requiremet (:)
*/
- c_slot_exact_requirement = rb_define_class_under(paludis_module(), "SlotExactRequirement", c_slot_requirement);
- rb_define_method(c_slot_exact_requirement, "slot", RUBY_FUNC_CAST(&slot_exact_requirement_slot), 0);
+ c_slot_exact_partial_requirement = rb_define_class_under(paludis_module(), "SlotExactPartialRequirement", c_slot_requirement);
+ rb_define_method(c_slot_exact_partial_requirement, "slot", RUBY_FUNC_CAST(&slot_exact_requirement_slot), 0);
+
+ /*
+ * Document-class: Paludis::SlotExactFullRequirement
+ *
+ * An exact slot requiremet
+ */
+ c_slot_exact_full_requirement = rb_define_class_under(paludis_module(), "SlotExactFullRequirement", c_slot_requirement);
+
+ /*
+ * Document-class: Paludis::SlotAnyPartialLockedRequirement
+ *
+ * An any locked slot requiremet (:=)
+ */
+ c_slot_any_partial_locked_requirement = rb_define_class_under(paludis_module(), "SlotAnyPartialLockedRequirement", c_slot_requirement);
/*
- * Document-class: Paludis::SlotAnyLockedRequirement
+ * Document-class: Paludis::SlotAnyAtAllLockedRequirement
*
* An any locked slot requiremet (:=)
*/
- c_slot_any_locked_requirement = rb_define_class_under(paludis_module(), "SlotAnyLockedRequirement", c_slot_requirement);
+ c_slot_any_at_all_locked_requirement = rb_define_class_under(paludis_module(), "SlotAnyAtAllLockedRequirement", c_slot_requirement);
/*
* Document-class: Paludis::ExactSlotRequirement
diff --git a/ruby/dep_spec_TEST.rb b/ruby/dep_spec_TEST.rb
index 526186a..f9a2666 100644
--- a/ruby/dep_spec_TEST.rb
+++ b/ruby/dep_spec_TEST.rb
@@ -130,7 +130,7 @@ module Paludis
end
def test_slot
- assert_kind_of SlotExactRequirement, pda.slot_requirement
+ assert_kind_of SlotExactPartialRequirement, pda.slot_requirement
assert_equal ":100", pda.slot_requirement.to_s
assert_equal "100", pda.slot_requirement.slot
assert_nil pdb.slot_requirement
diff --git a/ruby/metadata_key.cc b/ruby/metadata_key.cc
index dba7cfa..188bd3d 100644
--- a/ruby/metadata_key.cc
+++ b/ruby/metadata_key.cc
@@ -23,6 +23,7 @@
#include <paludis/package_id.hh>
#include <paludis/metadata_key.hh>
#include <paludis/mask.hh>
+#include <paludis/slot.hh>
#include <paludis/util/set.hh>
#include <paludis/util/sequence.hh>
#include <paludis/util/visitor_cast.hh>
@@ -115,7 +116,7 @@ namespace
new std::shared_ptr<const MetadataKey>(mm));
}
- void visit(const MetadataValueKey<SlotName> &)
+ void visit(const MetadataValueKey<Slot> &)
{
value = Data_Wrap_Struct(c_metadata_slot_key, 0, &Common<std::shared_ptr<const MetadataKey> >::free,
new std::shared_ptr<const MetadataKey>(mm));
@@ -305,7 +306,7 @@ namespace
{
std::shared_ptr<const MetadataKey> * self_ptr;
Data_Get_Struct(self, std::shared_ptr<const MetadataKey>, self_ptr);
- return rb_str_new2(stringify((std::static_pointer_cast<const MetadataValueKey<SlotName> >(*self_ptr))->parse_value()).c_str());
+ return rb_str_new2(stringify((std::static_pointer_cast<const MetadataValueKey<Slot> >(*self_ptr))->parse_value().raw_value()).c_str());
}
catch (const std::exception & e)
{
diff --git a/ruby/package_id.cc b/ruby/package_id.cc
index 8b8ddfc..75e6232 100644
--- a/ruby/package_id.cc
+++ b/ruby/package_id.cc
@@ -573,7 +573,7 @@ namespace
rb_define_method(c_package_id, "choices_key", RUBY_FUNC_CAST((
&KeyValue<MetadataValueKey<std::shared_ptr<const Choices> >, &PackageID::choices_key>::fetch)), 0);
rb_define_method(c_package_id, "slot_key", RUBY_FUNC_CAST((
- &KeyValue<MetadataValueKey<SlotName>, &PackageID::slot_key>::fetch)), 0);
+ &KeyValue<MetadataValueKey<Slot>, &PackageID::slot_key>::fetch)), 0);
rb_define_method(c_package_id, "behaviours_key", RUBY_FUNC_CAST((
&KeyValue<MetadataCollectionKey<Set<std::string> >, &PackageID::behaviours_key>::fetch)), 0);
rb_define_method(c_package_id, "uniquely_identifying_spec", RUBY_FUNC_CAST(&package_id_uniquely_identifying_spec), 0);
diff --git a/src/clients/cave/cmd_display_resolution.cc b/src/clients/cave/cmd_display_resolution.cc
index 4651027..49adda4 100755
--- a/src/clients/cave/cmd_display_resolution.cc
+++ b/src/clients/cave/cmd_display_resolution.cc
@@ -84,6 +84,7 @@
#include <paludis/changed_choices.hh>
#include <paludis/mask_utils.hh>
#include <paludis/dep_spec_annotations.hh>
+#include <paludis/slot.hh>
#include <set>
#include <iterator>
@@ -956,9 +957,9 @@ namespace
cout << fuc(fs_mask_by(), fv<'i'>(indent), fv<'k'>(k.human_name()), fv<'v'>(stringify(k.parse_value())));
}
- void visit(const MetadataValueKey<SlotName> & k)
+ void visit(const MetadataValueKey<Slot> & k)
{
- cout << fuc(fs_mask_by(), fv<'i'>(indent), fv<'k'>(k.human_name()), fv<'v'>(stringify(k.parse_value())));
+ cout << fuc(fs_mask_by(), fv<'i'>(indent), fv<'k'>(k.human_name()), fv<'v'>(stringify(k.parse_value().raw_value())));
}
void visit(const MetadataValueKey<long> & k)
diff --git a/src/clients/cave/cmd_fix_linkage.cc b/src/clients/cave/cmd_fix_linkage.cc
index 051e2fe..01e94fb 100644
--- a/src/clients/cave/cmd_fix_linkage.cc
+++ b/src/clients/cave/cmd_fix_linkage.cc
@@ -39,6 +39,7 @@
#include <paludis/version_operator.hh>
#include <paludis/version_requirements.hh>
#include <paludis/partially_made_package_dep_spec.hh>
+#include <paludis/slot.hh>
#include <iostream>
#include <set>
@@ -219,7 +220,7 @@ FixLinkageCommand::run(
PartiallyMadePackageDepSpec part_spec({ });
part_spec.package((*pkg_it)->name());
if ((*pkg_it)->slot_key())
- part_spec.slot_requirement(std::make_shared<UserSlotExactRequirement>((*pkg_it)->slot_key()->parse_value()));
+ part_spec.slot_requirement(std::make_shared<UserSlotExactPartialRequirement>((*pkg_it)->slot_key()->parse_value().parallel_value()));
if (cmdline.a_exact.specified())
part_spec.version_requirement(make_named_values<VersionRequirement>(
diff --git a/src/clients/cave/cmd_generate_metadata.cc b/src/clients/cave/cmd_generate_metadata.cc
index 0925071..20551f4 100644
--- a/src/clients/cave/cmd_generate_metadata.cc
+++ b/src/clients/cave/cmd_generate_metadata.cc
@@ -43,6 +43,7 @@
#include <paludis/mask.hh>
#include <paludis/metadata_key.hh>
#include <paludis/notifier_callback.hh>
+#include <paludis/slot.hh>
#include <sys/sysinfo.h>
#include <cstdlib>
#include <iostream>
diff --git a/src/clients/cave/cmd_info.cc b/src/clients/cave/cmd_info.cc
index 075727f..62ae30d 100644
--- a/src/clients/cave/cmd_info.cc
+++ b/src/clients/cave/cmd_info.cc
@@ -37,6 +37,7 @@
#include <paludis/selection.hh>
#include <paludis/package_id.hh>
#include <paludis/metadata_key.hh>
+#include <paludis/slot.hh>
#include <paludis/util/set.hh>
#include <paludis/util/wrapped_forward_iterator.hh>
#include <paludis/util/visitor_cast.hh>
@@ -246,10 +247,10 @@ namespace
cout << fuc(fs_metadata(), fv<'h'>(k.human_name()), fv<'i'>(std::string(indent, ' ')), fv<'s'>(stringify(k.parse_value())));
}
- void visit(const MetadataValueKey<SlotName> & k)
+ void visit(const MetadataValueKey<Slot> & k)
{
ColourPrettyPrinter printer(env, make_null_shared_ptr(), indent);
- cout << fuc(fs_metadata(), fv<'h'>(k.human_name()), fv<'i'>(std::string(indent, ' ')), fv<'s'>(stringify(k.parse_value())));
+ cout << fuc(fs_metadata(), fv<'h'>(k.human_name()), fv<'i'>(std::string(indent, ' ')), fv<'s'>(stringify(k.parse_value().raw_value())));
}
void visit(const MetadataValueKey<long> & k)
diff --git a/src/clients/cave/cmd_match.cc b/src/clients/cave/cmd_match.cc
index f422ae6..e6e6e55 100644
--- a/src/clients/cave/cmd_match.cc
+++ b/src/clients/cave/cmd_match.cc
@@ -45,6 +45,7 @@
#include <paludis/metadata_key.hh>
#include <paludis/choice.hh>
#include <paludis/about.hh>
+#include <paludis/slot.hh>
#include <cstdlib>
#include <iostream>
#include <algorithm>
@@ -264,9 +265,9 @@ namespace
texts.push_back(stringify(k.parse_value()));
}
- void visit(const MetadataValueKey<SlotName> & k)
+ void visit(const MetadataValueKey<Slot> & k)
{
- texts.push_back(stringify(k.parse_value()));
+ texts.push_back(stringify(k.parse_value().raw_value()));
}
void visit(const MetadataValueKey<long> & k)
diff --git a/src/clients/cave/cmd_print_spec.cc b/src/clients/cave/cmd_print_spec.cc
index 00124bd..11b7824 100644
--- a/src/clients/cave/cmd_print_spec.cc
+++ b/src/clients/cave/cmd_print_spec.cc
@@ -133,7 +133,7 @@ namespace
if (cmdline.a_slot_requirement.argument().empty())
s.clear_slot_requirement();
else
- s.slot_requirement(std::make_shared<UserSlotExactRequirement>(SlotName(cmdline.a_slot_requirement.argument())));
+ s.slot_requirement(std::make_shared<UserSlotExactPartialRequirement>(SlotName(cmdline.a_slot_requirement.argument())));
}
if (cmdline.a_in_repository.specified())
diff --git a/src/clients/cave/cmd_show.cc b/src/clients/cave/cmd_show.cc
index b519c0f..6ad9d35 100644
--- a/src/clients/cave/cmd_show.cc
+++ b/src/clients/cave/cmd_show.cc
@@ -57,6 +57,7 @@
#include <paludis/dep_spec_data.hh>
#include <paludis/dep_spec_annotations.hh>
#include <paludis/match_package.hh>
+#include <paludis/slot.hh>
#include <cstdlib>
#include <iostream>
#include <algorithm>
@@ -164,7 +165,7 @@ namespace
std::string slot_as_string(const std::shared_ptr<const PackageID> & id)
{
if (id->slot_key())
- return stringify(id->slot_key()->parse_value());
+ return stringify(id->slot_key()->parse_value().raw_value());
else
return "";
}
@@ -698,12 +699,12 @@ namespace
);
}
- void visit(const MetadataValueKey<SlotName> & k)
+ void visit(const MetadataValueKey<Slot> & k)
{
out << fuc(
(cmdline.a_raw_names.specified() ? fs_metadata_value_raw() : fs_metadata_value_human()),
fv<'s'>(cmdline.a_raw_names.specified() ? k.raw_name() : k.human_name()),
- fv<'v'>(stringify(k.parse_value())),
+ fv<'v'>(stringify(k.parse_value().raw_value())),
fv<'i'>(std::string(indent, ' ')),
fv<'b'>(important ? "true" : ""),
fv<'p'>("")
diff --git a/src/clients/cave/cmd_uninstall.cc b/src/clients/cave/cmd_uninstall.cc
index 9d28f27..5f83901 100644
--- a/src/clients/cave/cmd_uninstall.cc
+++ b/src/clients/cave/cmd_uninstall.cc
@@ -35,6 +35,7 @@
#include <paludis/environment.hh>
#include <paludis/package_id.hh>
#include <paludis/metadata_key.hh>
+#include <paludis/slot.hh>
#include <algorithm>
#include <iostream>
@@ -150,7 +151,7 @@ UninstallCommand::run(
qpns_being_changed.insert((*i)->name());
std::string target("!" + stringify((*i)->name()));
if ((*i)->slot_key())
- target.append(":" + stringify((*i)->slot_key()->parse_value()));
+ target.append(":" + stringify((*i)->slot_key()->parse_value().raw_value()));
targets->push_back(std::make_pair(target, ""));
}
diff --git a/src/clients/cave/format_package_id.cc b/src/clients/cave/format_package_id.cc
index f6a0058..d48288b 100644
--- a/src/clients/cave/format_package_id.cc
+++ b/src/clients/cave/format_package_id.cc
@@ -30,6 +30,7 @@
#include <paludis/package_id.hh>
#include <paludis/version_spec.hh>
#include <paludis/dep_spec.hh>
+#include <paludis/slot.hh>
#include <string>
using namespace paludis;
@@ -44,7 +45,7 @@ paludis::cave::format_package_id(
m->insert('c', stringify(id->name().category()));
m->insert('p', stringify(id->name().package()));
m->insert('v', stringify(id->version()));
- m->insert('s', id->slot_key() ? stringify(id->slot_key()->parse_value()) : "");
+ m->insert('s', id->slot_key() ? stringify(id->slot_key()->parse_value().raw_value()) : "");
m->insert(':', id->slot_key() ? ":" : "");
m->insert('r', stringify(id->repository_name()));
m->insert('F', id->canonical_form(idcf_full));
diff --git a/src/clients/cave/format_plain_metadata_key.cc b/src/clients/cave/format_plain_metadata_key.cc
index 8587a1c..846f9a7 100644
--- a/src/clients/cave/format_plain_metadata_key.cc
+++ b/src/clients/cave/format_plain_metadata_key.cc
@@ -29,6 +29,7 @@
#include <paludis/mask.hh>
#include <paludis/unformatted_pretty_printer.hh>
#include <paludis/name.hh>
+#include <paludis/slot.hh>
#include <sstream>
using namespace paludis;
@@ -75,9 +76,9 @@ namespace
s << k.parse_value();
}
- void visit(const MetadataValueKey<SlotName> & k)
+ void visit(const MetadataValueKey<Slot> & k)
{
- s << k.parse_value();
+ s << k.parse_value().raw_value();
}
void visit(const MetadataSpecTreeKey<DependencySpecTree> & k)