aboutsummaryrefslogtreecommitdiff
path: root/paludis
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2009-02-05 12:25:42 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2009-02-05 01:33:54 +0000
commita0a35b8d0dd4ca00c91350e3d3acf1bc6208cad1 (patch)
tree83a8c5994577da21ed70242add8e4cf041ee554c /paludis
parent23d144895a2c80a2f3ff6cd7aa9d94705394ca04 (diff)
downloadpaludis-a0a35b8d0dd4ca00c91350e3d3acf1bc6208cad1.tar.gz
paludis-a0a35b8d0dd4ca00c91350e3d3acf1bc6208cad1.tar.xz
Make slot a metadata key.
Fixes: ticket:450
Diffstat (limited to 'paludis')
-rw-r--r--paludis/dep_list.cc36
-rw-r--r--paludis/filter.cc78
-rw-r--r--paludis/filter.hh6
-rw-r--r--paludis/find_unused_packages_task.cc18
-rw-r--r--paludis/install_task.cc28
-rw-r--r--paludis/literal_metadata_key.cc11
-rw-r--r--paludis/literal_metadata_key.hh5
-rw-r--r--paludis/match_package.cc12
-rw-r--r--paludis/metadata_key.cc1
-rw-r--r--paludis/metadata_key.hh1
-rw-r--r--paludis/ndbam_merger.cc5
-rw-r--r--paludis/ndbam_unmerger.cc7
-rw-r--r--paludis/package_id.hh14
-rw-r--r--paludis/repositories/accounts/accounts_id.cc25
-rw-r--r--paludis/repositories/accounts/accounts_id.hh2
-rw-r--r--paludis/repositories/accounts/installed_accounts_id.cc25
-rw-r--r--paludis/repositories/accounts/installed_accounts_id.hh2
-rw-r--r--paludis/repositories/cran/cran_package_id.cc18
-rw-r--r--paludis/repositories/cran/cran_package_id.hh4
-rw-r--r--paludis/repositories/e/e_installed_repository_id.cc43
-rw-r--r--paludis/repositories/e/e_installed_repository_id.hh4
-rw-r--r--paludis/repositories/e/e_key.cc51
-rw-r--r--paludis/repositories/e/e_key.hh17
-rw-r--r--paludis/repositories/e/e_repository_sets.cc11
-rw-r--r--paludis/repositories/e/ebuild.cc6
-rw-r--r--paludis/repositories/e/ebuild.hh4
-rw-r--r--paludis/repositories/e/ebuild_entries.cc2
-rw-r--r--paludis/repositories/e/ebuild_flat_metadata_cache.cc11
-rw-r--r--paludis/repositories/e/ebuild_flat_metadata_cache_TEST.cc2
-rw-r--r--paludis/repositories/e/ebuild_id.cc42
-rw-r--r--paludis/repositories/e/ebuild_id.hh4
-rw-r--r--paludis/repositories/e/exndbam_repository.cc17
-rw-r--r--paludis/repositories/e/fix_locked_dependencies.cc10
-rw-r--r--paludis/repositories/e/qa/metadata_keys.cc5
-rw-r--r--paludis/repositories/e/qa/spec_keys.cc4
-rw-r--r--paludis/repositories/e/vdb_merger.cc5
-rw-r--r--paludis/repositories/e/vdb_repository.cc14
-rw-r--r--paludis/repositories/e/vdb_repository_TEST.cc20
-rw-r--r--paludis/repositories/e/vdb_unmerger.cc7
-rw-r--r--paludis/repositories/fake/fake_package_id.cc29
-rw-r--r--paludis/repositories/fake/fake_package_id.hh2
-rw-r--r--paludis/repositories/gems/gem_specification.cc15
-rw-r--r--paludis/repositories/gems/gem_specification.hh4
-rw-r--r--paludis/repositories/unavailable/unavailable_id.cc33
-rw-r--r--paludis/repositories/unavailable/unavailable_id.hh4
-rw-r--r--paludis/repositories/unpackaged/installed_id.cc25
-rw-r--r--paludis/repositories/unpackaged/installed_id.hh4
-rw-r--r--paludis/repositories/unpackaged/installed_repository.cc13
-rw-r--r--paludis/repositories/unpackaged/installed_repository_TEST.cc4
-rw-r--r--paludis/repositories/unpackaged/unpackaged_id.cc25
-rw-r--r--paludis/repositories/unpackaged/unpackaged_id.hh4
-rw-r--r--paludis/repositories/unpackaged/unpackaged_repository_TEST.cc2
-rw-r--r--paludis/repositories/unwritten/unwritten_id.cc29
-rw-r--r--paludis/repositories/unwritten/unwritten_id.hh9
-rw-r--r--paludis/repositories/unwritten/unwritten_repository_file.cc4
-rw-r--r--paludis/repositories/unwritten/unwritten_repository_file.hh4
-rw-r--r--paludis/repositories/virtuals/package_id.cc15
-rw-r--r--paludis/repositories/virtuals/package_id.hh2
-rw-r--r--paludis/selection.cc23
-rw-r--r--paludis/util/files.m41
-rw-r--r--paludis/util/make_shared_copy-fwd.hh45
-rw-r--r--paludis/util/make_shared_copy.hh47
62 files changed, 590 insertions, 330 deletions
diff --git a/paludis/dep_list.cc b/paludis/dep_list.cc
index 3197673ea..ff068fdd9 100644
--- a/paludis/dep_list.cc
+++ b/paludis/dep_list.cc
@@ -345,6 +345,24 @@ namespace
{
}
};
+
+ bool slot_is_same(
+ const PackageID & a,
+ const PackageID & b)
+ {
+ if (a.slot_key())
+ return b.slot_key() && a.slot_key()->value() == b.slot_key()->value();
+ else
+ return ! b.slot_key();
+ }
+
+ std::string slot_as_human_string(const std::tr1::shared_ptr<const PackageID> & id)
+ {
+ if (! id->slot_key())
+ return "(no slot)";
+ else
+ return stringify(id->slot_key()->value());
+ }
}
void
@@ -551,7 +569,7 @@ DepList::AddVisitor::visit(const DependencySpecTree::NodeType<PackageDepSpec>::T
std::tr1::shared_ptr<PackageIDSequence> already_installed_in_same_slot(new PackageIDSequence);
for (PackageIDSequence::ConstIterator aa(already_installed->begin()),
aa_end(already_installed->end()) ; aa != aa_end ; ++aa)
- if ((*aa)->slot() == best_visible_candidate->slot())
+ if (slot_is_same(**aa, *best_visible_candidate))
already_installed_in_same_slot->push_back(*aa);
/* no need to sort already_installed_in_same_slot here, although if the above is
* changed then check that this still holds... */
@@ -590,8 +608,8 @@ DepList::AddVisitor::visit(const DependencySpecTree::NodeType<PackageDepSpec>::T
*best_visible_candidate << "' (in different slot)";
}
else
- Log::get_instance()->message("dep_list.no_installed", ll_debug, lc_context) << "No installed packages in SLOT '"
- << best_visible_candidate->slot() << "', taking uninstalled package '"
+ Log::get_instance()->message("dep_list.no_installed", ll_debug, lc_context) << "No installed packages in SLOT "
+ << slot_as_human_string(best_visible_candidate) << ", taking uninstalled package '"
<< *best_visible_candidate << "'";
/* if this is a downgrade, make sure that that's ok */
@@ -605,11 +623,9 @@ DepList::AddVisitor::visit(const DependencySpecTree::NodeType<PackageDepSpec>::T
{
std::tr1::shared_ptr<const PackageIDSequence> are_we_downgrading(
(*d->_imp->env)[selection::AllVersionsSorted(
- generator::Matches(make_package_dep_spec()
- .package(best_visible_candidate->name())
- .slot_requirement(make_shared_ptr(new UserSlotExactRequirement(best_visible_candidate->slot()))),
- d->_imp->opts->match_package_options()) |
- filter::SupportsAction<InstalledAction>())]);
+ generator::Package(best_visible_candidate->name()) |
+ filter::SupportsAction<InstalledAction>() |
+ filter::SameSlot(best_visible_candidate))]);
if (are_we_downgrading->empty())
break;
@@ -848,7 +864,7 @@ DepList::AddVisitor::visit(const DependencySpecTree::NodeType<BlockDepSpec>::Typ
bool replaced(false);
for (std::list<MergeList::const_iterator>::const_iterator r(will_be_installed.begin()),
r_end(will_be_installed.end()) ; r != r_end && ! replaced ; ++r)
- if ((*r)->package_id()->slot() == (*aa)->slot())
+ if (slot_is_same(*(*r)->package_id(), **aa))
{
/* if it's a virtual, it only replaces if it's the same package. */
if ((*r)->package_id()->virtual_for_key())
@@ -1643,7 +1659,7 @@ DepList::replaced(const PackageID & m) const
while (p.second != ((p.first = std::find_if(p.first, p.second,
MatchDepListEntryAgainstPackageDepSpec(_imp->env, spec, _imp->opts->match_package_options())))))
{
- if (p.first->second->package_id()->slot() != m.slot())
+ if (! slot_is_same(*p.first->second->package_id(), m))
p.first = next(p.first);
else
return true;
diff --git a/paludis/filter.cc b/paludis/filter.cc
index b6c3c8ddb..07bbd84b8 100644
--- a/paludis/filter.cc
+++ b/paludis/filter.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2008 Ciaran McCreesh
+ * Copyright (c) 2008, 2009 Ciaran McCreesh
*
* This file is part of the Paludis package manager. Paludis is free software;
* you can redistribute it and/or modify it under the terms of the GNU General
@@ -235,36 +235,6 @@ namespace
}
};
- struct SlotFilterHandler :
- AllFilterHandlerBase
- {
- const SlotName n;
-
- SlotFilterHandler(const SlotName & nn) :
- n(nn)
- {
- }
-
- virtual std::tr1::shared_ptr<const PackageIDSet> ids(
- const Environment * const,
- const std::tr1::shared_ptr<const PackageIDSet> & id) const
- {
- std::tr1::shared_ptr<PackageIDSet> result(new PackageIDSet);
-
- for (PackageIDSet::ConstIterator i(id->begin()), i_end(id->end()) ;
- i != i_end ; ++i)
- if ((*i)->slot() == n)
- result->insert(*i);
-
- return result;
- }
-
- virtual std::string as_string() const
- {
- return "slot is '" + stringify(n) + "'";
- }
- };
-
struct AndFilterHandler :
FilterHandler
{
@@ -312,6 +282,44 @@ namespace
return stringify(f1) + " filtered through " + stringify(f2);
}
};
+
+ struct SameSlotHandler :
+ AllFilterHandlerBase
+ {
+ const std::tr1::shared_ptr<const PackageID> as_id;
+
+ SameSlotHandler(const std::tr1::shared_ptr<const PackageID> & i) :
+ as_id(i)
+ {
+ }
+
+ virtual std::tr1::shared_ptr<const PackageIDSet> ids(
+ const Environment * const,
+ const std::tr1::shared_ptr<const PackageIDSet> & id) const
+ {
+ std::tr1::shared_ptr<PackageIDSet> result(new PackageIDSet);
+
+ for (PackageIDSet::ConstIterator i(id->begin()), i_end(id->end()) ;
+ i != i_end ; ++i)
+ if (as_id->slot_key())
+ {
+ if ((*i)->slot_key() && (*i)->slot_key()->value() == as_id->slot_key()->value())
+ result->insert(*i);
+ }
+ else
+ {
+ if (! (*i)->slot_key())
+ result->insert(*i);
+ }
+
+ return result;
+ }
+
+ virtual std::string as_string() const
+ {
+ return "not masked";
+ }
+ };
}
filter::All::All() :
@@ -335,13 +343,13 @@ filter::InstalledAtRoot::InstalledAtRoot(const FSEntry & r) :
{
}
-filter::Slot::Slot(const SlotName & n) :
- Filter(make_shared_ptr(new SlotFilterHandler(n)))
+filter::And::And(const Filter & f1, const Filter & f2) :
+ Filter(make_shared_ptr(new AndFilterHandler(f1, f2)))
{
}
-filter::And::And(const Filter & f1, const Filter & f2) :
- Filter(make_shared_ptr(new AndFilterHandler(f1, f2)))
+filter::SameSlot::SameSlot(const std::tr1::shared_ptr<const PackageID> & i) :
+ Filter(make_shared_ptr(new SameSlotHandler(i)))
{
}
diff --git a/paludis/filter.hh b/paludis/filter.hh
index 361565ee2..7f826cff5 100644
--- a/paludis/filter.hh
+++ b/paludis/filter.hh
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2008 Ciaran McCreesh
+ * Copyright (c) 2008, 2009 Ciaran McCreesh
*
* This file is part of the Paludis package manager. Paludis is free software;
* you can redistribute it and/or modify it under the terms of the GNU General
@@ -108,11 +108,11 @@ namespace paludis
And(const Filter &, const Filter &);
};
- class PALUDIS_VISIBLE Slot :
+ class PALUDIS_VISIBLE SameSlot :
public Filter
{
public:
- Slot(const SlotName &);
+ SameSlot(const std::tr1::shared_ptr<const PackageID> &);
};
}
diff --git a/paludis/find_unused_packages_task.cc b/paludis/find_unused_packages_task.cc
index 9c915947f..be0178a60 100644
--- a/paludis/find_unused_packages_task.cc
+++ b/paludis/find_unused_packages_task.cc
@@ -36,6 +36,17 @@
using namespace paludis;
+namespace
+{
+ std::string slot_as_string(const std::tr1::shared_ptr<const PackageID> & id)
+ {
+ if (id->slot_key())
+ return stringify(id->slot_key()->value());
+ else
+ return "(none)";
+ }
+}
+
FindUnusedPackagesTask::~FindUnusedPackagesTask()
{
}
@@ -49,7 +60,7 @@ FindUnusedPackagesTask::execute(const QualifiedPackageName & package)
generator::Package(package)
)]);
- SlotName old_slot("I_am_a_slot");
+ std::string old_slot("I am not a slot");
std::set<KeywordName> keywords;
for (PackageIDSequence::ReverseConstIterator p(packages->rbegin()), p_end(packages->rend()) ;
p != p_end ; ++p)
@@ -57,10 +68,10 @@ FindUnusedPackagesTask::execute(const QualifiedPackageName & package)
if (! (*p)->keywords_key())
continue;
- if ((*p)->slot() != old_slot)
+ if (slot_as_string(*p) != old_slot)
{
keywords.clear();
- old_slot = (*p)->slot();
+ old_slot = slot_as_string(*p);
}
std::tr1::shared_ptr<const KeywordNameSet> current_keywords((*p)->keywords_key()->value());
@@ -90,3 +101,4 @@ FindUnusedPackagesTask::execute(const QualifiedPackageName & package)
return result;
}
+
diff --git a/paludis/install_task.cc b/paludis/install_task.cc
index 3e42dc256..5fadd75da 100644
--- a/paludis/install_task.cc
+++ b/paludis/install_task.cc
@@ -44,6 +44,7 @@
#include <paludis/util/make_shared_ptr.hh>
#include <paludis/util/destringify.hh>
#include <paludis/util/make_shared_ptr.hh>
+#include <paludis/util/make_shared_copy.hh>
#include <paludis/util/make_named_values.hh>
#include <paludis/util/sequence.hh>
#include <paludis/util/indirect_iterator-impl.hh>
@@ -525,14 +526,17 @@ InstallTask::_add_package_id(const std::tr1::shared_ptr<const PackageID> & targe
if (! _imp->override_target_type)
_imp->dep_list.options()->target_type() = dl_target_package;
- std::tr1::shared_ptr<PackageDepSpec> spec(new PackageDepSpec(make_package_dep_spec()
- .package(target->name())
- .version_requirement(make_named_values<VersionRequirement>(
- value_for<n::version_operator>(vo_equal),
- value_for<n::version_spec>(target->version())))
- .slot_requirement(make_shared_ptr(new UserSlotExactRequirement(target->slot())))
- .in_repository(target->repository()->name())));
+ PartiallyMadePackageDepSpec part_spec;
+ part_spec.package(target->name());
+ part_spec.in_repository(target->repository()->name());
+ part_spec.version_requirement(make_named_values<VersionRequirement>(
+ value_for<n::version_operator>(vo_equal),
+ value_for<n::version_spec>(target->version())));
+ if (target->slot_key())
+ part_spec.slot_requirement(make_shared_ptr(new UserSlotExactRequirement(target->slot_key()->value())));
+
+ std::tr1::shared_ptr<PackageDepSpec> spec(make_shared_copy(PackageDepSpec(part_spec)));
spec->set_tag(std::tr1::shared_ptr<const DepTag>(new TargetDepTag));
_imp->targets->root()->append(spec);
@@ -831,12 +835,10 @@ InstallTask::_one(const DepList::Iterator dep, const int x, const int y, const i
if (dep->destination())
collision_list = (*_imp->env)[selection::AllVersionsSorted(
- generator::Matches(make_package_dep_spec()
- .package(dep->package_id()->name())
- .slot_requirement(make_shared_ptr(new UserSlotExactRequirement(dep->package_id()->slot())))
- .in_repository(dep->destination()->name()),
- MatchPackageOptions()) |
- filter::SupportsAction<UninstallAction>())];
+ generator::Package(dep->package_id()->name()) &
+ generator::InRepository(dep->destination()->name()) |
+ filter::SupportsAction<UninstallAction>() |
+ filter::SameSlot(dep->package_id()))];
// don't clean the thing we just installed
PackageIDSequence clean_list;
diff --git a/paludis/literal_metadata_key.cc b/paludis/literal_metadata_key.cc
index 95c134bed..4fcb04404 100644
--- a/paludis/literal_metadata_key.cc
+++ b/paludis/literal_metadata_key.cc
@@ -26,6 +26,7 @@
#include <paludis/formatter.hh>
#include <paludis/package_id.hh>
#include <paludis/action.hh>
+#include <paludis/name.hh>
#include <tr1/functional>
using namespace paludis;
@@ -95,7 +96,7 @@ namespace paludis
const std::string raw_name;
const std::string human_name;
const MetadataKeyType type;
- const T_ value;
+ T_ value;
Implementation(const std::string & r, const std::string & h, const MetadataKeyType t, const T_ & v) :
raw_name(r),
@@ -264,6 +265,13 @@ LiteralMetadataValueKey<T_>::raw_name() const
}
template <typename T_>
+void
+LiteralMetadataValueKey<T_>::change_value(const T_ & v)
+{
+ _imp->value = v;
+}
+
+template <typename T_>
MetadataKeyType
LiteralMetadataValueKey<T_>::type() const
{
@@ -335,6 +343,7 @@ LiteralMetadataValueKey<T_>::value() const
template class LiteralMetadataValueKey<FSEntry>;
template class LiteralMetadataValueKey<std::string>;
+template class LiteralMetadataValueKey<SlotName>;
template class LiteralMetadataValueKey<bool>;
template class LiteralMetadataValueKey<long>;
template class LiteralMetadataValueKey<std::tr1::shared_ptr<const PackageID> >;
diff --git a/paludis/literal_metadata_key.hh b/paludis/literal_metadata_key.hh
index 070398c7e..f1dea9d05 100644
--- a/paludis/literal_metadata_key.hh
+++ b/paludis/literal_metadata_key.hh
@@ -132,6 +132,11 @@ namespace paludis
virtual const std::string raw_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
virtual const std::string human_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
virtual MetadataKeyType type() const PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ /**
+ * \since 0.36
+ */
+ void change_value(const T_ &);
};
/**
diff --git a/paludis/match_package.cc b/paludis/match_package.cc
index d236bb63c..15ebb4b6c 100644
--- a/paludis/match_package.cc
+++ b/paludis/match_package.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2006, 2007, 2008 Ciaran McCreesh
+ * Copyright (c) 2006, 2007, 2008, 2009 Ciaran McCreesh
*
* This file is part of the Paludis package manager. Paludis is free software;
* you can redistribute it and/or modify it under the terms of the GNU General
@@ -47,18 +47,18 @@ namespace
{
struct SlotRequirementChecker
{
- const SlotName actual;
+ const PackageID & id;
bool result;
- SlotRequirementChecker(const SlotName & a) :
- actual(a),
+ SlotRequirementChecker(const PackageID & i) :
+ id(i),
result(true)
{
}
void visit(const SlotExactRequirement & s)
{
- result = (actual == s.slot());
+ result = id.slot_key() && id.slot_key()->value() == s.slot();
}
void visit(const SlotAnyLockedRequirement &)
@@ -190,7 +190,7 @@ paludis::match_package(
if (spec.slot_requirement_ptr())
{
- SlotRequirementChecker v(entry.slot());
+ SlotRequirementChecker v(entry);
spec.slot_requirement_ptr()->accept(v);
if (! v.result)
return false;
diff --git a/paludis/metadata_key.cc b/paludis/metadata_key.cc
index 1e9cddf46..334358c0f 100644
--- a/paludis/metadata_key.cc
+++ b/paludis/metadata_key.cc
@@ -117,6 +117,7 @@ template class MetadataValueKey<std::string>;
template class MetadataValueKey<long>;
template class MetadataValueKey<bool>;
template class MetadataValueKey<FSEntry>;
+template class MetadataValueKey<SlotName>;
template class MetadataValueKey<std::tr1::shared_ptr<const PackageID> >;
template class MetadataValueKey<std::tr1::shared_ptr<const Contents> >;
template class MetadataValueKey<std::tr1::shared_ptr<const RepositoryMaskInfo> >;
diff --git a/paludis/metadata_key.hh b/paludis/metadata_key.hh
index 6d30a819d..79d3c909c 100644
--- a/paludis/metadata_key.hh
+++ b/paludis/metadata_key.hh
@@ -100,6 +100,7 @@ namespace paludis
MetadataValueKey<long>,
MetadataValueKey<bool>,
MetadataValueKey<FSEntry>,
+ MetadataValueKey<SlotName>,
MetadataValueKey<std::tr1::shared_ptr<const PackageID> >,
MetadataValueKey<std::tr1::shared_ptr<const Contents> >,
MetadataValueKey<std::tr1::shared_ptr<const RepositoryMaskInfo> >,
diff --git a/paludis/ndbam_merger.cc b/paludis/ndbam_merger.cc
index 9807f4e98..c7e3b7b41 100644
--- a/paludis/ndbam_merger.cc
+++ b/paludis/ndbam_merger.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2007, 2008 Ciaran McCreesh
+ * Copyright (c) 2007, 2008, 2009 Ciaran McCreesh
*
* This file is part of the Paludis package manager. Paludis is free software;
* you can redistribute it and/or modify it under the terms of the GNU General
@@ -34,6 +34,7 @@
#include <paludis/environment.hh>
#include <paludis/package_database.hh>
#include <paludis/ndbam_merger.hh>
+#include <paludis/metadata_key.hh>
#include <fstream>
#include <iostream>
#include <iomanip>
@@ -93,7 +94,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(stringify(_imp->params.package_id()->slot()));
+ std::string slot(_imp->params.package_id()->slot_key() ? stringify(_imp->params.package_id()->slot_key()->value()) : "");
return Merger::extend_hook(h)
("P", pn + "-" + pv)
diff --git a/paludis/ndbam_unmerger.cc b/paludis/ndbam_unmerger.cc
index d0fd4853d..03d443911 100644
--- a/paludis/ndbam_unmerger.cc
+++ b/paludis/ndbam_unmerger.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2007, 2008 Ciaran McCreesh
+ * Copyright (c) 2007, 2008, 2009 Ciaran McCreesh
* Copyright (c) 2007 Piotr Jaroszyński
*
* This file is part of the Paludis package manager. Paludis is free software;
@@ -37,6 +37,7 @@
#include <paludis/util/strip.hh>
#include <paludis/util/wrapped_forward_iterator.hh>
#include <paludis/util/make_named_values.hh>
+#include <paludis/metadata_key.hh>
#include <tr1/functional>
#include <list>
#include <map>
@@ -131,6 +132,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()->value()) : "");
return result
("P", pn + "-" + pv)
@@ -142,7 +144,8 @@ NDBAMUnmerger::extend_hook(const Hook & h) const
("PVR", pvr)
("PF", pn + "-" + pvr)
("PNVR", pn + "-" + pvr)
- ("SLOT", stringify(_imp->options.package_id()->slot()));
+ ("SLOT", slot)
+ ;
}
return result;
diff --git a/paludis/package_id.hh b/paludis/package_id.hh
index 29e2fa6d4..3eab37aa8 100644
--- a/paludis/package_id.hh
+++ b/paludis/package_id.hh
@@ -67,7 +67,6 @@ namespace paludis
*
* - A name
* - A version
- * - A slot (which will be '0' if slots aren't used)
* - An owning repository
*
* It should be noted that the above together are not sufficient to uniquely
@@ -154,11 +153,6 @@ namespace paludis
virtual const VersionSpec version() const = 0;
/**
- * What is our package's slot?
- */
- virtual const SlotName slot() const = 0;
-
- /**
* What is our owning repository?
*/
virtual const std::tr1::shared_ptr<const Repository> repository() const = 0;
@@ -167,6 +161,14 @@ namespace paludis
///\{
/**
+ * The slot, if specified, controls whether the package can be
+ * installed in parallel with other versions of the same package.
+ *
+ * \since 0.36
+ */
+ virtual const std::tr1::shared_ptr<const MetadataValueKey<SlotName> > slot_key() const = 0;
+
+ /**
* The virtual_for_key, if non-zero, indicates that we are an
* (old-style) virtual for another package. This affects dependency
* resolution.
diff --git a/paludis/repositories/accounts/accounts_id.cc b/paludis/repositories/accounts/accounts_id.cc
index aea96914b..2f4b6a817 100644
--- a/paludis/repositories/accounts/accounts_id.cc
+++ b/paludis/repositories/accounts/accounts_id.cc
@@ -48,7 +48,6 @@ namespace paludis
const QualifiedPackageName name;
const VersionSpec version;
- const SlotName slot;
const std::tr1::shared_ptr<const Repository> repository;
const std::tr1::shared_ptr<const LiteralMetadataValueKey<FSEntry> > fs_location_key;
@@ -79,7 +78,6 @@ namespace paludis
env(e),
name(q),
version("0"),
- slot("0"),
repository(r),
fs_location_key(new LiteralMetadataValueKey<FSEntry>("location", "Location", mkt_internal, l)),
from_repositories_key(f),
@@ -243,12 +241,6 @@ AccountsID::version() const
return _imp->version;
}
-const SlotName
-AccountsID::slot() const
-{
- return _imp->slot;
-}
-
const std::tr1::shared_ptr<const Repository>
AccountsID::repository() const
{
@@ -261,10 +253,10 @@ AccountsID::canonical_form(const PackageIDCanonicalForm f) const
switch (f)
{
case idcf_full:
- return stringify(name()) + "-" + stringify(version()) + ":" + stringify(slot()) + "::" + stringify(repository()->name());
+ return stringify(name()) + "-" + stringify(version()) + "::" + stringify(repository()->name());
case idcf_no_version:
- return stringify(name()) + ":" + stringify(slot()) + "::" + stringify(repository()->name());
+ return stringify(name()) + "::" + stringify(repository()->name());
case idcf_version:
return stringify(version());
@@ -398,6 +390,12 @@ AccountsID::choices_key() const
return make_null_shared_ptr();
}
+const std::tr1::shared_ptr<const MetadataValueKey<SlotName> >
+AccountsID::slot_key() const
+{
+ return make_null_shared_ptr();
+}
+
std::tr1::shared_ptr<const Set<std::string> >
AccountsID::breaks_portage() const
{
@@ -405,18 +403,15 @@ AccountsID::breaks_portage() const
}
bool
-AccountsID::arbitrary_less_than_comparison(const PackageID & other) const
+AccountsID::arbitrary_less_than_comparison(const PackageID &) const
{
- if (slot() < other.slot())
- return true;
-
return false;
}
std::size_t
AccountsID::extra_hash_value() const
{
- return Hash<SlotName>()(slot());
+ return 0;
}
bool
diff --git a/paludis/repositories/accounts/accounts_id.hh b/paludis/repositories/accounts/accounts_id.hh
index 557294cbc..a2df4664d 100644
--- a/paludis/repositories/accounts/accounts_id.hh
+++ b/paludis/repositories/accounts/accounts_id.hh
@@ -56,12 +56,12 @@ namespace paludis
virtual const QualifiedPackageName name() const;
virtual const VersionSpec version() const;
- virtual const SlotName slot() const;
virtual const std::tr1::shared_ptr<const Repository> repository() const;
///\name Specific metadata keys
///\{
+ virtual const std::tr1::shared_ptr<const MetadataValueKey<SlotName> > slot_key() const;
virtual const std::tr1::shared_ptr<const MetadataValueKey<std::tr1::shared_ptr<const PackageID> > > virtual_for_key() const;
virtual const std::tr1::shared_ptr<const MetadataCollectionKey<KeywordNameSet> > keywords_key() const;
virtual const std::tr1::shared_ptr<const MetadataSpecTreeKey<ProvideSpecTree> > provide_key() const;
diff --git a/paludis/repositories/accounts/installed_accounts_id.cc b/paludis/repositories/accounts/installed_accounts_id.cc
index 67eaa159e..ab613a172 100644
--- a/paludis/repositories/accounts/installed_accounts_id.cc
+++ b/paludis/repositories/accounts/installed_accounts_id.cc
@@ -45,7 +45,6 @@ namespace paludis
const QualifiedPackageName name;
const VersionSpec version;
- const SlotName slot;
const std::tr1::shared_ptr<const Repository> repository;
const std::tr1::shared_ptr<const LiteralMetadataValueKey<bool> > transient_key;
@@ -58,7 +57,6 @@ namespace paludis
env(e),
name(q),
version("0"),
- slot("0"),
repository(r),
transient_key(new LiteralMetadataValueKey<bool>("transient", "Transient", mkt_internal, true)),
is_user(u)
@@ -106,12 +104,6 @@ InstalledAccountsID::version() const
return _imp->version;
}
-const SlotName
-InstalledAccountsID::slot() const
-{
- return _imp->slot;
-}
-
const std::tr1::shared_ptr<const Repository>
InstalledAccountsID::repository() const
{
@@ -124,10 +116,10 @@ InstalledAccountsID::canonical_form(const PackageIDCanonicalForm f) const
switch (f)
{
case idcf_full:
- return stringify(name()) + "-" + stringify(version()) + ":" + stringify(slot()) + "::" + stringify(repository()->name());
+ return stringify(name()) + "-" + stringify(version()) + "::" + stringify(repository()->name());
case idcf_no_version:
- return stringify(name()) + ":" + stringify(slot()) + "::" + stringify(repository()->name());
+ return stringify(name()) + "::" + stringify(repository()->name());
case idcf_version:
return stringify(version());
@@ -253,6 +245,12 @@ InstalledAccountsID::choices_key() const
return make_null_shared_ptr();
}
+const std::tr1::shared_ptr<const MetadataValueKey<SlotName> >
+InstalledAccountsID::slot_key() const
+{
+ return make_null_shared_ptr();
+}
+
std::tr1::shared_ptr<const Set<std::string> >
InstalledAccountsID::breaks_portage() const
{
@@ -260,18 +258,15 @@ InstalledAccountsID::breaks_portage() const
}
bool
-InstalledAccountsID::arbitrary_less_than_comparison(const PackageID & other) const
+InstalledAccountsID::arbitrary_less_than_comparison(const PackageID &) const
{
- if (slot() < other.slot())
- return true;
-
return false;
}
std::size_t
InstalledAccountsID::extra_hash_value() const
{
- return Hash<SlotName>()(slot());
+ return 0;
}
bool
diff --git a/paludis/repositories/accounts/installed_accounts_id.hh b/paludis/repositories/accounts/installed_accounts_id.hh
index 436dc2fd4..c6280b57f 100644
--- a/paludis/repositories/accounts/installed_accounts_id.hh
+++ b/paludis/repositories/accounts/installed_accounts_id.hh
@@ -54,12 +54,12 @@ namespace paludis
virtual const QualifiedPackageName name() const;
virtual const VersionSpec version() const;
- virtual const SlotName slot() const;
virtual const std::tr1::shared_ptr<const Repository> repository() const;
///\name Specific metadata keys
///\{
+ virtual const std::tr1::shared_ptr<const MetadataValueKey<SlotName> > slot_key() const;
virtual const std::tr1::shared_ptr<const MetadataValueKey<std::tr1::shared_ptr<const PackageID> > > virtual_for_key() const;
virtual const std::tr1::shared_ptr<const MetadataCollectionKey<KeywordNameSet> > keywords_key() const;
virtual const std::tr1::shared_ptr<const MetadataSpecTreeKey<ProvideSpecTree> > provide_key() const;
diff --git a/paludis/repositories/cran/cran_package_id.cc b/paludis/repositories/cran/cran_package_id.cc
index 60c71f777..685d05d3e 100644
--- a/paludis/repositories/cran/cran_package_id.cc
+++ b/paludis/repositories/cran/cran_package_id.cc
@@ -2,7 +2,7 @@
/*
* Copyright (c) 2006, 2007 Danny van Dyk
- * Copyright (c) 2007, 2008 Ciaran McCreesh
+ * Copyright (c) 2007, 2008, 2009 Ciaran McCreesh
*
* This file is part of the Paludis package manager. Paludis is free software;
* you can redistribute it and/or modify it under the terms of the GNU General
@@ -312,12 +312,6 @@ CRANPackageID::version() const
return _imp->version;
}
-const SlotName
-CRANPackageID::slot() const
-{
- return SlotName("0");
-}
-
const std::tr1::shared_ptr<const Repository>
CRANPackageID::repository() const
{
@@ -408,6 +402,12 @@ CRANPackageID::from_repositories_key() const
return std::tr1::shared_ptr<const MetadataCollectionKey<Set<std::string> > >();
}
+const std::tr1::shared_ptr<const MetadataValueKey<SlotName> >
+CRANPackageID::slot_key() const
+{
+ return make_null_shared_ptr();
+}
+
std::size_t
CRANPackageID::extra_hash_value() const
{
@@ -434,13 +434,13 @@ CRANPackageID::canonical_form(const PackageIDCanonicalForm f) const
switch (f)
{
case idcf_full:
- return stringify(_imp->name) + "-" + stringify(_imp->version) + ":" + stringify(slot()) + "::" + stringify(_imp->repository->name());
+ return stringify(_imp->name) + "-" + stringify(_imp->version) + "::" + stringify(_imp->repository->name());
case idcf_version:
return stringify(_imp->version);
case idcf_no_version:
- return stringify(_imp->name) + ":" + stringify(slot()) + "::" + stringify(_imp->repository->name());
+ return stringify(_imp->name) + "::" + stringify(_imp->repository->name());
case last_idcf:
break;
diff --git a/paludis/repositories/cran/cran_package_id.hh b/paludis/repositories/cran/cran_package_id.hh
index cff80a071..1b63c0fbc 100644
--- a/paludis/repositories/cran/cran_package_id.hh
+++ b/paludis/repositories/cran/cran_package_id.hh
@@ -2,7 +2,7 @@
/*
* Copyright (c) 2006 Danny van Dyk
- * Copyright (c) 2007, 2008 Ciaran McCreesh
+ * Copyright (c) 2007, 2008, 2009 Ciaran McCreesh
*
* This file is part of the Paludis package manager. Paludis is free software;
* you can redistribute it and/or modify it under the terms of the GNU General
@@ -54,9 +54,9 @@ namespace paludis
virtual const QualifiedPackageName name() const;
virtual const VersionSpec version() const;
- virtual const SlotName slot() const;
virtual const std::tr1::shared_ptr<const Repository> repository() const;
+ virtual const std::tr1::shared_ptr<const MetadataValueKey<SlotName> > slot_key() const;
virtual const std::tr1::shared_ptr<const MetadataValueKey<std::tr1::shared_ptr<const PackageID> > > virtual_for_key() const;
virtual const std::tr1::shared_ptr<const MetadataValueKey<std::tr1::shared_ptr<const Choices> > > choices_key() const;
virtual const std::tr1::shared_ptr<const MetadataCollectionKey<KeywordNameSet> > keywords_key() const;
diff --git a/paludis/repositories/e/e_installed_repository_id.cc b/paludis/repositories/e/e_installed_repository_id.cc
index 6c3791d6f..c4f1e8532 100644
--- a/paludis/repositories/e/e_installed_repository_id.cc
+++ b/paludis/repositories/e/e_installed_repository_id.cc
@@ -75,9 +75,9 @@ namespace paludis
const FSEntry dir;
mutable bool has_keys;
- std::tr1::shared_ptr<const SlotName> slot;
std::tr1::shared_ptr<const EAPI> eapi;
+ std::tr1::shared_ptr<const MetadataValueKey<SlotName> > slot;
std::tr1::shared_ptr<const MetadataValueKey<FSEntry> > fs_location;
std::tr1::shared_ptr<const MetadataCollectionKey<Set<std::string> > > raw_use;
std::tr1::shared_ptr<const MetadataCollectionKey<Set<std::string> > > inherited;
@@ -193,6 +193,14 @@ EInstalledRepositoryID::need_keys_added() const
add_metadata_key(_imp->raw_use);
}
+ if (! vars->slot()->name().empty())
+ if ((_imp->dir / vars->slot()->name()).exists())
+ {
+ _imp->slot.reset(new LiteralMetadataValueKey<SlotName>(vars->slot()->name(), vars->slot()->description(),
+ mkt_internal, SlotName(file_contents(_imp->dir / vars->slot()->name()))));
+ add_metadata_key(_imp->slot);
+ }
+
if (! vars->inherited()->name().empty())
if ((_imp->dir / vars->inherited()->name()).exists())
{
@@ -534,14 +542,14 @@ EInstalledRepositoryID::canonical_form(const PackageIDCanonicalForm f) const
{
case idcf_full:
if (_imp->slot)
- return stringify(name()) + "-" + stringify(version()) + ":" + stringify(slot()) + "::" +
+ return stringify(name()) + "-" + stringify(version()) + ":" + stringify(_imp->slot->value()) + "::" +
stringify(repository()->name());
return stringify(name()) + "-" + stringify(version()) + "::" + stringify(repository()->name());
case idcf_no_version:
if (_imp->slot)
- return stringify(name()) + ":" + stringify(slot()) + "::" +
+ return stringify(name()) + ":" + stringify(_imp->slot->value()) + "::" +
stringify(repository()->name());
return stringify(name()) + "::" + stringify(repository()->name());
@@ -568,28 +576,6 @@ EInstalledRepositoryID::version() const
return _imp->version;
}
-const SlotName
-EInstalledRepositoryID::slot() const
-{
- Lock l(_imp->mutex);
-
- if (_imp->slot)
- return *_imp->slot;
-
- Context context("When finding SLOT for '" + stringify(name()) + "-" + stringify(version()) + "::"
- + stringify(repository()->name()) + "':");
-
- if ((_imp->dir / "SLOT").exists())
- _imp->slot.reset(new SlotName(file_contents(_imp->dir / "SLOT")));
- else
- {
- Log::get_instance()->message("e.no_slot", ll_warning, lc_context) << "No SLOT entry in '" << _imp->dir << "', pretending '0'";
- _imp->slot.reset(new SlotName("0"));
- }
-
- return *_imp->slot;
-}
-
const std::tr1::shared_ptr<const Repository>
EInstalledRepositoryID::repository() const
{
@@ -955,6 +941,13 @@ EInstalledRepositoryID::contained_in_key() const
return std::tr1::shared_ptr<const MetadataValueKey<std::tr1::shared_ptr<const PackageID> > >();
}
+const std::tr1::shared_ptr<const MetadataValueKey<SlotName> >
+EInstalledRepositoryID::slot_key() const
+{
+ need_keys_added();
+ return _imp->slot;
+}
+
std::tr1::shared_ptr<ChoiceValue>
EInstalledRepositoryID::make_choice_value(const std::tr1::shared_ptr<const Choice> & c, const UnprefixedChoiceName & v,
const Tribool, const bool explicitly_listed, const std::string & override_description, const bool) const
diff --git a/paludis/repositories/e/e_installed_repository_id.hh b/paludis/repositories/e/e_installed_repository_id.hh
index 24a5c1e28..7d7be4007 100644
--- a/paludis/repositories/e/e_installed_repository_id.hh
+++ b/paludis/repositories/e/e_installed_repository_id.hh
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2007, 2008 Ciaran McCreesh
+ * Copyright (c) 2007, 2008, 2009 Ciaran McCreesh
*
* This file is part of the Paludis package manager. Paludis is free software;
* you can redistribute it and/or modify it under the terms of the GNU General
@@ -54,10 +54,10 @@ namespace paludis
virtual const QualifiedPackageName name() const;
virtual const VersionSpec version() const;
- virtual const SlotName slot() const;
virtual const std::tr1::shared_ptr<const Repository> repository() const;
virtual const std::tr1::shared_ptr<const EAPI> eapi() const;
+ virtual const std::tr1::shared_ptr<const MetadataValueKey<SlotName> > slot_key() const;
virtual const std::tr1::shared_ptr<const MetadataValueKey<std::tr1::shared_ptr<const PackageID> > > virtual_for_key() const;
virtual const std::tr1::shared_ptr<const MetadataCollectionKey<KeywordNameSet> > keywords_key() const;
virtual const std::tr1::shared_ptr<const MetadataSpecTreeKey<ProvideSpecTree> > provide_key() const;
diff --git a/paludis/repositories/e/e_key.cc b/paludis/repositories/e/e_key.cc
index 613607ea0..d284c6373 100644
--- a/paludis/repositories/e/e_key.cc
+++ b/paludis/repositories/e/e_key.cc
@@ -1120,3 +1120,54 @@ EMTimeKey::type() const
return _imp->type;
}
+namespace paludis
+{
+ template <>
+ struct Implementation<ESlotKey>
+ {
+ const SlotName value;
+ const std::tr1::shared_ptr<const EAPIMetadataVariable> variable;
+ const MetadataKeyType type;
+
+ Implementation(const SlotName & v, const std::tr1::shared_ptr<const EAPIMetadataVariable> & m, const MetadataKeyType t) :
+ value(v),
+ variable(m),
+ type(t)
+ {
+ }
+ };
+}
+
+ESlotKey::ESlotKey(const std::tr1::shared_ptr<const EAPIMetadataVariable> & m, const std::string & v, const MetadataKeyType t) :
+ PrivateImplementationPattern<ESlotKey>(new Implementation<ESlotKey>(SlotName(v), m, t))
+{
+}
+
+ESlotKey::~ESlotKey()
+{
+}
+
+const SlotName
+ESlotKey::value() const
+{
+ return _imp->value;
+}
+
+const std::string
+ESlotKey::raw_name() const
+{
+ return _imp->variable->name();
+}
+
+const std::string
+ESlotKey::human_name() const
+{
+ return _imp->variable->description();
+}
+
+MetadataKeyType
+ESlotKey::type() const
+{
+ return _imp->type;
+}
+
diff --git a/paludis/repositories/e/e_key.hh b/paludis/repositories/e/e_key.hh
index 0cb44092e..03c7b1e73 100644
--- a/paludis/repositories/e/e_key.hh
+++ b/paludis/repositories/e/e_key.hh
@@ -316,6 +316,23 @@ namespace paludis
virtual const std::string human_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
virtual MetadataKeyType type() const PALUDIS_ATTRIBUTE((warn_unused_result));
};
+
+ class ESlotKey :
+ public MetadataValueKey<SlotName>,
+ private PrivateImplementationPattern<ESlotKey>
+ {
+ public:
+ ESlotKey(
+ const std::tr1::shared_ptr<const EAPIMetadataVariable> &,
+ const std::string &, const MetadataKeyType);
+ ~ESlotKey();
+
+ virtual const SlotName value() const PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ virtual const std::string raw_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual const std::string human_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual MetadataKeyType type() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ };
}
}
diff --git a/paludis/repositories/e/e_repository_sets.cc b/paludis/repositories/e/e_repository_sets.cc
index d94cca68f..65610b8e7 100644
--- a/paludis/repositories/e/e_repository_sets.cc
+++ b/paludis/repositories/e/e_repository_sets.cc
@@ -50,6 +50,7 @@
#include <paludis/filter.hh>
#include <paludis/filtered_generator.hh>
#include <paludis/action-fwd.hh>
+#include <paludis/metadata_key.hh>
#include <tr1/functional>
#include <algorithm>
#include <list>
@@ -181,7 +182,7 @@ namespace
{
try
{
- if (e.slot() != SlotName(r.slot()))
+ if ((! e.slot_key()) || (e.slot_key()->value() != SlotName(r.slot())))
return false;
}
catch (const SlotNameError &)
@@ -310,17 +311,15 @@ ERepositorySets::security_set(bool insecurity) const
else
{
Context local_local_local_context("When finding upgrade for '" + stringify(glsa_pkg->name()) + ":"
- + stringify((*c)->slot()) + "'");
+ + ((*c)->slot_key() ? stringify((*c)->slot_key()->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. */
bool ok(false);
std::tr1::shared_ptr<const PackageIDSequence> available(
(*_imp->environment)[selection::AllVersionsSorted(
- generator::Matches(make_package_dep_spec()
- .package(glsa_pkg->name())
- .slot_requirement(make_shared_ptr(new ELikeSlotExactRequirement((*c)->slot(), false))),
- MatchPackageOptions()) |
+ generator::Package(glsa_pkg->name()) |
+ filter::SameSlot(*c) |
filter::SupportsAction<InstallAction>() |
filter::NotMasked())]);
diff --git a/paludis/repositories/e/ebuild.cc b/paludis/repositories/e/ebuild.cc
index 3406b89d8..245232a6b 100644
--- a/paludis/repositories/e/ebuild.cc
+++ b/paludis/repositories/e/ebuild.cc
@@ -397,7 +397,6 @@ EbuildMetadataCommand::load(const std::tr1::shared_ptr<const EbuildID> & id)
{
Log::get_instance()->message("e.ebuild.preload_eapi.unsupported", ll_debug, lc_context)
<< "ID pre-load EAPI '" << id->eapi()->name() << "' not supported";
- id->set_slot(SlotName("UNKNOWN"));
if (! captured_stderr.empty())
id->load_captured_stderr("STDERR", "Captured stderr", mkt_normal, captured_stderr);
@@ -418,7 +417,6 @@ EbuildMetadataCommand::load(const std::tr1::shared_ptr<const EbuildID> & id)
{
Log::get_instance()->message("e.ebuild.postload_eapi.unsupported", ll_debug, lc_context)
<< "ID post-load EAPI '" << id->eapi()->name() << "' not supported";
- id->set_slot(SlotName("UNKNOWN"));
if (! captured_stderr.empty())
id->load_captured_stderr("STDERR", "Captured stderr", mkt_normal, captured_stderr);
return;
@@ -474,7 +472,7 @@ EbuildMetadataCommand::load(const std::tr1::shared_ptr<const EbuildID> & id)
<< "Package '" << *id << "' set SLOT=\"\", using SLOT=\"0\" instead";
slot = "0";
}
- id->set_slot(SlotName(slot));
+ id->load_slot(m.slot(), slot);
}
catch (const InternalError &)
{
@@ -485,7 +483,7 @@ EbuildMetadataCommand::load(const std::tr1::shared_ptr<const EbuildID> & id)
Log::get_instance()->message("e.ebuild.bad_slot", ll_warning, lc_context)
<< "Setting SLOT for '" << *id << "' failed due to exception '"
<< e.message() << "' (" << e.what() << ")";
- id->set_slot(SlotName("0"));
+ id->load_slot(m.slot(), "0");
}
}
diff --git a/paludis/repositories/e/ebuild.hh b/paludis/repositories/e/ebuild.hh
index 289c4b87b..2e4613be4 100644
--- a/paludis/repositories/e/ebuild.hh
+++ b/paludis/repositories/e/ebuild.hh
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2006, 2007, 2008 Ciaran McCreesh
+ * Copyright (c) 2006, 2007, 2008, 2009 Ciaran McCreesh
*
* This file is part of the Paludis package manager. Paludis is free software;
* you can redistribute it and/or modify it under the terms of the GNU General
@@ -149,7 +149,7 @@ namespace paludis
NamedValue<n::loadsaveenv_dir, FSEntry> loadsaveenv_dir;
NamedValue<n::profiles, std::tr1::shared_ptr<const FSEntrySequence> > profiles;
NamedValue<n::root, std::string> root;
- NamedValue<n::slot, SlotName> slot;
+ NamedValue<n::slot, std::string> slot;
NamedValue<n::use, std::string> use;
NamedValue<n::use_expand, std::string> use_expand;
NamedValue<n::use_expand_hidden, std::string> use_expand_hidden;
diff --git a/paludis/repositories/e/ebuild_entries.cc b/paludis/repositories/e/ebuild_entries.cc
index c40b0201c..3b6bd4a8b 100644
--- a/paludis/repositories/e/ebuild_entries.cc
+++ b/paludis/repositories/e/ebuild_entries.cc
@@ -752,7 +752,7 @@ EbuildEntries::install(const std::tr1::shared_ptr<const ERepositoryID> & id,
value_for<n::loadsaveenv_dir>(_imp->params.builddir() / (stringify(id->name().category()) + "-" + stringify(id->name().package()) + "-" + stringify(id->version())) / "temp"),
value_for<n::profiles>(_imp->params.profiles()),
value_for<n::root>(o.destination()->installed_root_key() ? stringify(o.destination()->installed_root_key()->value()) : "/"),
- value_for<n::slot>(SlotName(id->slot())),
+ value_for<n::slot>(id->slot_key() ? stringify(id->slot_key()->value()) : ""),
value_for<n::use>(use),
value_for<n::use_expand>(join(p->use_expand()->begin(), p->use_expand()->end(), " ")),
value_for<n::use_expand_hidden>(join(p->use_expand_hidden()->begin(), p->use_expand_hidden()->end(), " "))
diff --git a/paludis/repositories/e/ebuild_flat_metadata_cache.cc b/paludis/repositories/e/ebuild_flat_metadata_cache.cc
index 8e6f83f2e..e8376ccd0 100644
--- a/paludis/repositories/e/ebuild_flat_metadata_cache.cc
+++ b/paludis/repositories/e/ebuild_flat_metadata_cache.cc
@@ -175,7 +175,7 @@ namespace
if (-1 != m.run_depend()->flat_list_index() && ! m.run_depend()->name().empty())
id->load_run_depend(m.run_depend()->name(), m.run_depend()->description(), lines.at(m.run_depend()->flat_list_index()));
- id->set_slot(SlotName(lines.at(m.slot()->flat_list_index())));
+ id->load_slot(m.slot(), lines.at(m.slot()->flat_list_index()));
if (-1 != m.src_uri()->flat_list_index() && ! m.src_uri()->name().empty())
id->load_src_uri(m.src_uri(), lines.at(m.src_uri()->flat_list_index()));
@@ -269,8 +269,6 @@ namespace
id->load_remote_ids(m.remote_ids(), value);
}
}
- else
- id->set_slot(SlotName("UNKNOWN"));
Log::get_instance()->message("e.cache.success", ll_debug, lc_context) << "Successfully loaded cache file";
return true;
@@ -491,7 +489,7 @@ EbuildFlatMetadataCache::load(const std::tr1::shared_ptr<const EbuildID> & id)
if (! m.run_depend()->name().empty())
id->load_run_depend(m.run_depend()->name(), m.run_depend()->description(), keys[m.run_depend()->name()]);
- id->set_slot(SlotName(keys[m.slot()->name()]));
+ id->load_slot(m.slot(), keys[m.slot()->name()]);
if (! m.src_uri()->name().empty())
id->load_src_uri(m.src_uri(), keys[m.src_uri()->name()]);
@@ -584,8 +582,6 @@ EbuildFlatMetadataCache::load(const std::tr1::shared_ptr<const EbuildID> & id)
id->load_remote_ids(m.remote_ids(), value);
}
}
- else
- id->set_slot(SlotName("UNKNOWN"));
Log::get_instance()->message("e.cache.success", ll_debug, lc_context) << "Successfully loaded cache file";
return true;
@@ -722,7 +718,8 @@ EbuildFlatMetadataCache::save(const std::tr1::shared_ptr<const EbuildID> & id)
if (! m.run_depend()->name().empty() && id->run_dependencies_key())
write_kv(cache, m.run_depend()->name(), flatten(id->run_dependencies_key()->value()));
- write_kv(cache, m.slot()->name(), normalise(id->slot()));
+ if (! m.slot()->name().empty() && id->slot_key())
+ write_kv(cache, m.slot()->name(), normalise(id->slot_key()->value()));
if (! m.src_uri()->name().empty() && id->fetches_key())
write_kv(cache, m.src_uri()->name(), flatten(id->fetches_key()->value()));
diff --git a/paludis/repositories/e/ebuild_flat_metadata_cache_TEST.cc b/paludis/repositories/e/ebuild_flat_metadata_cache_TEST.cc
index aa60697c3..53441c74f 100644
--- a/paludis/repositories/e/ebuild_flat_metadata_cache_TEST.cc
+++ b/paludis/repositories/e/ebuild_flat_metadata_cache_TEST.cc
@@ -305,7 +305,7 @@ namespace test_cases
TEST_CHECK(id->short_description_key());
TEST_CHECK_EQUAL(id->short_description_key()->value(), "");
- TEST_CHECK_STRINGIFY_EQUAL(id->slot(), "the-slot");
+ TEST_CHECK_STRINGIFY_EQUAL(id->slot_key()->value(), "the-slot");
}
} test_metadata_flat_hash_empty_value;
diff --git a/paludis/repositories/e/ebuild_id.cc b/paludis/repositories/e/ebuild_id.cc
index db3bbef79..bec57edd8 100644
--- a/paludis/repositories/e/ebuild_id.cc
+++ b/paludis/repositories/e/ebuild_id.cc
@@ -70,7 +70,6 @@ namespace paludis
const Environment * const environment;
const std::tr1::shared_ptr<const ERepository> repository;
const FSEntry ebuild;
- std::tr1::shared_ptr<const SlotName> slot;
mutable std::tr1::shared_ptr<const EAPI> eapi;
const std::string guessed_eapi;
const time_t master_mtime;
@@ -78,6 +77,7 @@ namespace paludis
mutable bool has_keys;
mutable bool has_masks;
+ mutable std::tr1::shared_ptr<const ESlotKey> slot;
mutable std::tr1::shared_ptr<const LiteralMetadataValueKey<FSEntry> > fs_location;
mutable std::tr1::shared_ptr<const LiteralMetadataValueKey<std::string> > short_description;
mutable std::tr1::shared_ptr<const LiteralMetadataValueKey<std::string> > long_description;
@@ -508,14 +508,14 @@ EbuildID::canonical_form(const PackageIDCanonicalForm f) const
{
case idcf_full:
if (_imp->slot)
- return stringify(name()) + "-" + stringify(version()) + ":" + stringify(*_imp->slot) +
+ return stringify(name()) + "-" + stringify(version()) + ":" + stringify(_imp->slot->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) +
+ return stringify(name()) + ":" + stringify(_imp->slot->value()) +
"::" + stringify(repository()->name());
return stringify(name()) + "::" + stringify(repository()->name());
@@ -542,20 +542,6 @@ EbuildID::version() const
return _imp->version;
}
-const SlotName
-EbuildID::slot() const
-{
- if (_imp->slot)
- return *_imp->slot;
-
- need_keys_added();
-
- if (! _imp->slot)
- throw InternalError(PALUDIS_HERE, "_imp->slot still not set");
-
- return *_imp->slot;
-}
-
const std::tr1::shared_ptr<const Repository>
EbuildID::repository() const
{
@@ -777,13 +763,6 @@ EbuildID::set_eapi(const std::string & s) const
_imp->eapi = EAPIData::get_instance()->eapi_from_string(s);
}
-void
-EbuildID::set_slot(const SlotName & s) const
-{
- Lock l(_imp->mutex);
- _imp->slot.reset(new SlotName(s));
-}
-
std::tr1::shared_ptr<const ERepository>
EbuildID::e_repository() const
{
@@ -980,6 +959,14 @@ EbuildID::load_remote_ids(const std::tr1::shared_ptr<const EAPIMetadataVariable>
add_metadata_key(_imp->remote_ids);
}
+void
+EbuildID::load_slot(const std::tr1::shared_ptr<const EAPIMetadataVariable> & m, const std::string & v) const
+{
+ Lock l(_imp->mutex);
+ _imp->slot.reset(new ESlotKey(m, v, mkt_internal));
+ add_metadata_key(_imp->slot);
+}
+
namespace
{
struct SupportsActionQuery
@@ -1168,6 +1155,13 @@ EbuildID::choices_key() const
return _imp->choices;
}
+const std::tr1::shared_ptr<const MetadataValueKey<SlotName> >
+EbuildID::slot_key() const
+{
+ need_keys_added();
+ return _imp->slot;
+}
+
std::tr1::shared_ptr<ChoiceValue>
EbuildID::make_choice_value(
const std::tr1::shared_ptr<const Choice> & choice,
diff --git a/paludis/repositories/e/ebuild_id.hh b/paludis/repositories/e/ebuild_id.hh
index 3694ceb64..943aec015 100644
--- a/paludis/repositories/e/ebuild_id.hh
+++ b/paludis/repositories/e/ebuild_id.hh
@@ -60,9 +60,9 @@ namespace paludis
virtual const QualifiedPackageName name() const;
virtual const VersionSpec version() const;
- virtual const SlotName slot() const;
virtual const std::tr1::shared_ptr<const Repository> repository() const;
+ virtual const std::tr1::shared_ptr<const MetadataValueKey<SlotName> > slot_key() const;
virtual const std::tr1::shared_ptr<const MetadataValueKey<std::tr1::shared_ptr<const PackageID> > > virtual_for_key() const;
virtual const std::tr1::shared_ptr<const MetadataCollectionKey<KeywordNameSet> > keywords_key() const;
virtual const std::tr1::shared_ptr<const MetadataSpecTreeKey<ProvideSpecTree> > provide_key() const;
@@ -111,7 +111,6 @@ namespace paludis
virtual std::tr1::shared_ptr<const ERepository> e_repository() const;
void set_eapi(const std::string &) const;
- void set_slot(const SlotName &) const;
void load_short_description(const std::string &, const std::string &, const std::string &) const;
void load_captured_stderr(const std::string &, const std::string &, const MetadataKeyType, const std::string &) const;
@@ -136,6 +135,7 @@ namespace paludis
void load_bugs_to(const std::tr1::shared_ptr<const EAPIMetadataVariable> &, const std::string &) const;
void load_remote_ids(const std::tr1::shared_ptr<const EAPIMetadataVariable> &, const std::string &) const;
void load_defined_phases(const std::string &, const std::string &, const std::string &) const;
+ void load_slot(const std::tr1::shared_ptr<const EAPIMetadataVariable> &, const std::string &) const;
virtual bool supports_action(const SupportsActionTestBase &) const PALUDIS_ATTRIBUTE((warn_unused_result));
virtual void perform_action(Action &) const;
diff --git a/paludis/repositories/e/exndbam_repository.cc b/paludis/repositories/e/exndbam_repository.cc
index 15d045e12..89d47b0d7 100644
--- a/paludis/repositories/e/exndbam_repository.cc
+++ b/paludis/repositories/e/exndbam_repository.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2008 Ciaran McCreesh
+ * Copyright (c) 2008, 2009 Ciaran McCreesh
*
* This file is part of the Paludis package manager. Paludis is free software;
* you can redistribute it and/or modify it under the terms of the GNU General
@@ -287,6 +287,15 @@ namespace
return std::make_pair(uid, gid);
}
+
+ bool slot_is_same(const std::tr1::shared_ptr<const PackageID> & a,
+ const std::tr1::shared_ptr<const PackageID> & b)
+ {
+ if (a->slot_key())
+ return b->slot_key() && a->slot_key()->value() == b->slot_key()->value();
+ else
+ return ! b->slot_key();
+ }
}
void
@@ -305,7 +314,7 @@ ExndbamRepository::merge(const MergeParams & m)
v != v_end ; ++v)
{
if_same_name_id = *v;
- if ((*v)->version() == m.package_id()->version() && (*v)->slot() == m.package_id()->slot())
+ if ((*v)->version() == m.package_id()->version() && slot_is_same(*v, m.package_id()))
{
if_overwritten_id = *v;
break;
@@ -326,7 +335,7 @@ ExndbamRepository::merge(const MergeParams & m)
}
FSEntry target_ver_dir(uid_dir);
- target_ver_dir /= (stringify(m.package_id()->version()) + ":" + stringify(m.package_id()->slot()) + ":" + cookie());
+ target_ver_dir /= (stringify(m.package_id()->version()) + ":" + stringify(m.package_id()->slot_key()->value()) + ":" + cookie());
if (target_ver_dir.exists())
throw InstallActionError("Temporary merge directory '" + stringify(target_ver_dir) + "' already exists, probably "
@@ -394,7 +403,7 @@ ExndbamRepository::merge(const MergeParams & m)
it_end(replace_candidates->end()); it_end != it; ++it)
{
std::tr1::shared_ptr<const ERepositoryID> candidate(std::tr1::static_pointer_cast<const ERepositoryID>(*it));
- if (candidate != if_overwritten_id && candidate->slot() == m.package_id()->slot())
+ if (candidate != if_overwritten_id && slot_is_same(candidate, m.package_id()))
perform_uninstall(candidate, false, "");
}
}
diff --git a/paludis/repositories/e/fix_locked_dependencies.cc b/paludis/repositories/e/fix_locked_dependencies.cc
index dcff49624..5fc969d20 100644
--- a/paludis/repositories/e/fix_locked_dependencies.cc
+++ b/paludis/repositories/e/fix_locked_dependencies.cc
@@ -34,6 +34,7 @@
#include <paludis/generator.hh>
#include <paludis/filter.hh>
#include <paludis/filtered_generator.hh>
+#include <paludis/metadata_key.hh>
#include <tr1/functional>
#include <algorithm>
#include <list>
@@ -110,9 +111,12 @@ namespace
if (matches->empty())
break;
- PackageDepSpec new_s(PartiallyMadePackageDepSpec(*node.spec()).slot_requirement(
- make_shared_ptr(new ELikeSlotExactRequirement((*matches->last())->slot(), true))));
- c.reset(new PackageDepSpec(new_s));
+ if ((*matches->last())->slot_key())
+ {
+ PackageDepSpec new_s(PartiallyMadePackageDepSpec(*node.spec()).slot_requirement(
+ make_shared_ptr(new ELikeSlotExactRequirement((*matches->last())->slot_key()->value(), true))));
+ c.reset(new PackageDepSpec(new_s));
+ }
} while (false);
if (! c)
diff --git a/paludis/repositories/e/qa/metadata_keys.cc b/paludis/repositories/e/qa/metadata_keys.cc
index 70806219a..c48f38a1c 100644
--- a/paludis/repositories/e/qa/metadata_keys.cc
+++ b/paludis/repositories/e/qa/metadata_keys.cc
@@ -39,6 +39,11 @@ namespace
const std::string & PALUDIS_ATTRIBUTE((unused)) s(k.value());
}
+ void visit(const MetadataValueKey<SlotName> & k)
+ {
+ const SlotName & PALUDIS_ATTRIBUTE((unused)) s(k.value());
+ }
+
void visit(const MetadataValueKey<long> & k)
{
long PALUDIS_ATTRIBUTE((unused)) t(k.value());
diff --git a/paludis/repositories/e/qa/spec_keys.cc b/paludis/repositories/e/qa/spec_keys.cc
index 717331d62..8a1d58e3d 100644
--- a/paludis/repositories/e/qa/spec_keys.cc
+++ b/paludis/repositories/e/qa/spec_keys.cc
@@ -311,6 +311,10 @@ namespace
{
}
+ void visit(const MetadataValueKey<SlotName> &)
+ {
+ }
+
void visit(const MetadataValueKey<long> &)
{
}
diff --git a/paludis/repositories/e/vdb_merger.cc b/paludis/repositories/e/vdb_merger.cc
index bf0c17f11..8cfbb546d 100644
--- a/paludis/repositories/e/vdb_merger.cc
+++ b/paludis/repositories/e/vdb_merger.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2007, 2008 Ciaran McCreesh
+ * Copyright (c) 2007, 2008, 2009 Ciaran McCreesh
*
* This file is part of the Paludis package manager. Paludis is free software;
* you can redistribute it and/or modify it under the terms of the GNU General
@@ -34,6 +34,7 @@
#include <paludis/util/md5.hh>
#include <paludis/environment.hh>
#include <paludis/package_database.hh>
+#include <paludis/metadata_key.hh>
#include <fstream>
#include <iostream>
#include <iomanip>
@@ -105,7 +106,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(stringify(_imp->params.package_id()->slot()));
+ std::string slot(_imp->params.package_id()->slot_key() ? stringify(_imp->params.package_id()->slot_key()->value()) : "");
return Merger::extend_hook(h)
("P", pn + "-" + pv)
diff --git a/paludis/repositories/e/vdb_repository.cc b/paludis/repositories/e/vdb_repository.cc
index da1fbf3a2..c6963b01f 100644
--- a/paludis/repositories/e/vdb_repository.cc
+++ b/paludis/repositories/e/vdb_repository.cc
@@ -779,6 +779,18 @@ VDBRepository::category_names_containing_package(const PackageNamePart & p) cons
return result ? result : Repository::category_names_containing_package(p);
}
+namespace
+{
+ bool slot_is_same(const std::tr1::shared_ptr<const PackageID> & a,
+ const std::tr1::shared_ptr<const PackageID> & b)
+ {
+ if (a->slot_key())
+ return b->slot_key() && a->slot_key()->value() == b->slot_key()->value();
+ else
+ return ! b->slot_key();
+ }
+}
+
void
VDBRepository::merge(const MergeParams & m)
{
@@ -873,7 +885,7 @@ VDBRepository::merge(const MergeParams & m)
it_end(replace_candidates->end()); it_end != it; ++it)
{
std::tr1::shared_ptr<const ERepositoryID> candidate(std::tr1::static_pointer_cast<const ERepositoryID>(*it));
- if (candidate != is_replace && candidate->slot() == m.package_id()->slot())
+ if (candidate != is_replace && slot_is_same(candidate, m.package_id()))
perform_uninstall(candidate, false, "");
}
}
diff --git a/paludis/repositories/e/vdb_repository_TEST.cc b/paludis/repositories/e/vdb_repository_TEST.cc
index a0c8e9c64..cedad9c93 100644
--- a/paludis/repositories/e/vdb_repository_TEST.cc
+++ b/paludis/repositories/e/vdb_repository_TEST.cc
@@ -867,15 +867,15 @@ namespace test_cases
RepositoryProvidesInterface::ProvidesSequence::ConstIterator it(seq->begin());
TEST_CHECK_STRINGIFY_EQUAL(it->virtual_name(), "virtual/foo");
- TEST_CHECK_STRINGIFY_EQUAL(*(*it++).provided_by(), "cat1/pkg1-1::installed");
+ TEST_CHECK_STRINGIFY_EQUAL(*(*it++).provided_by(), "cat1/pkg1-1:1::installed");
TEST_CHECK_STRINGIFY_EQUAL(it->virtual_name(), "virtual/foo");
- TEST_CHECK_STRINGIFY_EQUAL(*(*it++).provided_by(), "cat1/pkg1-2::installed");
+ TEST_CHECK_STRINGIFY_EQUAL(*(*it++).provided_by(), "cat1/pkg1-2:2::installed");
TEST_CHECK_STRINGIFY_EQUAL(it->virtual_name(), "virtual/foo");
- TEST_CHECK_STRINGIFY_EQUAL(*(*it++).provided_by(), "cat1/pkg2-1::installed");
+ TEST_CHECK_STRINGIFY_EQUAL(*(*it++).provided_by(), "cat1/pkg2-1:1::installed");
TEST_CHECK_STRINGIFY_EQUAL(it->virtual_name(), "virtual/bar");
- TEST_CHECK_STRINGIFY_EQUAL(*(*it++).provided_by(), "cat1/pkg2-1::installed");
+ TEST_CHECK_STRINGIFY_EQUAL(*(*it++).provided_by(), "cat1/pkg2-1:1::installed");
TEST_CHECK_STRINGIFY_EQUAL(it->virtual_name(), "virtual/bar");
- TEST_CHECK_STRINGIFY_EQUAL(*(*it++).provided_by(), "cat1/pkg2-2::installed");
+ TEST_CHECK_STRINGIFY_EQUAL(*(*it++).provided_by(), "cat1/pkg2-2:2::installed");
}
vdb_repo->regenerate_cache();
@@ -888,15 +888,15 @@ namespace test_cases
RepositoryProvidesInterface::ProvidesSequence::ConstIterator it(seq->begin());
TEST_CHECK_STRINGIFY_EQUAL(it->virtual_name(), "virtual/foo");
- TEST_CHECK_STRINGIFY_EQUAL(*(*it++).provided_by(), "cat1/pkg1-1::installed");
+ TEST_CHECK_STRINGIFY_EQUAL(*(*it++).provided_by(), "cat1/pkg1-1:1::installed");
TEST_CHECK_STRINGIFY_EQUAL(it->virtual_name(), "virtual/foo");
- TEST_CHECK_STRINGIFY_EQUAL(*(*it++).provided_by(), "cat1/pkg1-2::installed");
+ TEST_CHECK_STRINGIFY_EQUAL(*(*it++).provided_by(), "cat1/pkg1-2:2::installed");
TEST_CHECK_STRINGIFY_EQUAL(it->virtual_name(), "virtual/foo");
- TEST_CHECK_STRINGIFY_EQUAL(*(*it++).provided_by(), "cat1/pkg2-1::installed");
+ TEST_CHECK_STRINGIFY_EQUAL(*(*it++).provided_by(), "cat1/pkg2-1:1::installed");
TEST_CHECK_STRINGIFY_EQUAL(it->virtual_name(), "virtual/bar");
- TEST_CHECK_STRINGIFY_EQUAL(*(*it++).provided_by(), "cat1/pkg2-1::installed");
+ TEST_CHECK_STRINGIFY_EQUAL(*(*it++).provided_by(), "cat1/pkg2-1:1::installed");
TEST_CHECK_STRINGIFY_EQUAL(it->virtual_name(), "virtual/bar");
- TEST_CHECK_STRINGIFY_EQUAL(*(*it++).provided_by(), "cat1/pkg2-2::installed");
+ TEST_CHECK_STRINGIFY_EQUAL(*(*it++).provided_by(), "cat1/pkg2-2:2::installed");
}
}
diff --git a/paludis/repositories/e/vdb_unmerger.cc b/paludis/repositories/e/vdb_unmerger.cc
index f05a7eeb6..9103dfeef 100644
--- a/paludis/repositories/e/vdb_unmerger.cc
+++ b/paludis/repositories/e/vdb_unmerger.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2007, 2008 Ciaran McCreesh
+ * Copyright (c) 2007, 2008, 2009 Ciaran McCreesh
* Copyright (c) 2007 Piotr Jaroszyński
*
* This file is part of the Paludis package manager. Paludis is free software;
@@ -29,6 +29,7 @@ using namespace paludis;
#include <paludis/hook.hh>
#include <paludis/package_database.hh>
#include <paludis/package_id.hh>
+#include <paludis/metadata_key.hh>
#include <paludis/util/dir_iterator.hh>
#include <paludis/util/join.hh>
#include <paludis/util/wrapped_forward_iterator.hh>
@@ -146,6 +147,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()->value()) : "");
return result
("P", pn + "-" + pv)
@@ -157,7 +159,8 @@ VDBUnmerger::extend_hook(const Hook & h) const
("PVR", pvr)
("PF", pn + "-" + pvr)
("PNVR", pn + "-" + pvr)
- ("SLOT", stringify(_imp->options.package_id()->slot()));
+ ("SLOT", slot)
+ ;
}
return result;
diff --git a/paludis/repositories/fake/fake_package_id.cc b/paludis/repositories/fake/fake_package_id.cc
index f4eddcb86..fc3ff883d 100644
--- a/paludis/repositories/fake/fake_package_id.cc
+++ b/paludis/repositories/fake/fake_package_id.cc
@@ -606,13 +606,13 @@ namespace paludis
const std::tr1::shared_ptr<const FakeRepositoryBase> repository;
const QualifiedPackageName name;
const VersionSpec version;
- SlotName slot;
mutable std::tr1::shared_ptr<DependencyLabelSequence> build_dependencies_labels;
mutable std::tr1::shared_ptr<DependencyLabelSequence> run_dependencies_labels;
mutable std::tr1::shared_ptr<DependencyLabelSequence> post_dependencies_labels;
mutable std::tr1::shared_ptr<DependencyLabelSequence> suggested_dependencies_labels;
+ std::tr1::shared_ptr<LiteralMetadataValueKey<SlotName> > slot;
std::tr1::shared_ptr<LiteralMetadataValueKey<std::tr1::shared_ptr<const PackageID> > > package_id;
std::tr1::shared_ptr<LiteralMetadataValueKey<std::tr1::shared_ptr<const PackageID> > > virtual_for;
std::tr1::shared_ptr<FakeMetadataKeywordSetKey> keywords;
@@ -636,11 +636,11 @@ namespace paludis
repository(r),
name(q),
version(v),
- slot("0"),
build_dependencies_labels(new DependencyLabelSequence),
run_dependencies_labels(new DependencyLabelSequence),
post_dependencies_labels(new DependencyLabelSequence),
suggested_dependencies_labels(new DependencyLabelSequence),
+ slot(new LiteralMetadataValueKey<SlotName>("SLOT", "Slot", mkt_internal, SlotName("0"))),
keywords(new FakeMetadataKeywordSetKey("KEYWORDS", "Keywords", "test", mkt_normal, id, env)),
has_masks(false)
{
@@ -671,13 +671,14 @@ FakePackageID::canonical_form(const PackageIDCanonicalForm f) const
switch (f)
{
case idcf_full:
- return stringify(_imp->name) + "-" + stringify(_imp->version) + ":" + stringify(slot()) + "::" + stringify(_imp->repository->name());
+ return stringify(_imp->name) + "-" + stringify(_imp->version) + ":" + stringify(_imp->slot->value())
+ + "::" + stringify(_imp->repository->name());
case idcf_version:
return stringify(_imp->version);
case idcf_no_version:
- return stringify(_imp->name) + ":" + stringify(slot()) + "::" + stringify(_imp->repository->name());
+ return stringify(_imp->name) + ":" + stringify(_imp->slot->value()) + "::" + stringify(_imp->repository->name());
case last_idcf:
break;
@@ -698,12 +699,6 @@ FakePackageID::version() const
return _imp->version;
}
-const SlotName
-FakePackageID::slot() const
-{
- return _imp->slot;
-}
-
const std::tr1::shared_ptr<const Repository>
FakePackageID::repository() const
{
@@ -874,13 +869,13 @@ FakePackageID::from_repositories_key() const
void
FakePackageID::set_slot(const SlotName & s)
{
- _imp->slot = s;
+ _imp->slot->change_value(s);
}
bool
FakePackageID::arbitrary_less_than_comparison(const PackageID & other) const
{
- return slot().data() < other.slot().data();
+ return slot_key()->value().data() < (other.slot_key() ? stringify(other.slot_key()->value()) : "");
}
void
@@ -930,6 +925,7 @@ FakePackageID::need_keys_added() const
_imp->choices.reset(new FakeMetadataChoicesKey(_imp->env, shared_from_this()));
+ add_metadata_key(_imp->slot);
add_metadata_key(_imp->build_dependencies);
add_metadata_key(_imp->run_dependencies);
add_metadata_key(_imp->post_dependencies);
@@ -945,7 +941,7 @@ FakePackageID::need_keys_added() const
std::size_t
FakePackageID::extra_hash_value() const
{
- return Hash<SlotName>()(slot());
+ return Hash<SlotName>()(slot_key()->value());
}
bool
@@ -1239,6 +1235,13 @@ FakePackageID::choices_key()
return _imp->choices;
}
+const std::tr1::shared_ptr<const MetadataValueKey<SlotName> >
+FakePackageID::slot_key() const
+{
+ need_keys_added();
+ return _imp->slot;
+}
+
template class FakeMetadataSpecTreeKey<LicenseSpecTree>;
template class FakeMetadataSpecTreeKey<ProvideSpecTree>;
template class FakeMetadataSpecTreeKey<PlainTextSpecTree>;
diff --git a/paludis/repositories/fake/fake_package_id.hh b/paludis/repositories/fake/fake_package_id.hh
index 7f43ee902..1b71aa6ea 100644
--- a/paludis/repositories/fake/fake_package_id.hh
+++ b/paludis/repositories/fake/fake_package_id.hh
@@ -241,9 +241,9 @@ namespace paludis
virtual const QualifiedPackageName name() const;
virtual const VersionSpec version() const;
- virtual const SlotName slot() const;
virtual const std::tr1::shared_ptr<const Repository> repository() const;
+ virtual const std::tr1::shared_ptr<const MetadataValueKey<SlotName> > slot_key() const;
virtual const std::tr1::shared_ptr<const MetadataValueKey<std::tr1::shared_ptr<const PackageID> > > virtual_for_key() const;
virtual const std::tr1::shared_ptr<const MetadataCollectionKey<KeywordNameSet> > keywords_key() const;
virtual const std::tr1::shared_ptr<const MetadataSpecTreeKey<ProvideSpecTree> > provide_key() const;
diff --git a/paludis/repositories/gems/gem_specification.cc b/paludis/repositories/gems/gem_specification.cc
index 86c08b04b..84b127bfc 100644
--- a/paludis/repositories/gems/gem_specification.cc
+++ b/paludis/repositories/gems/gem_specification.cc
@@ -54,6 +54,7 @@ namespace paludis
std::tr1::shared_ptr<LiteralMetadataValueKey<std::string> > authors_key;
std::tr1::shared_ptr<LiteralMetadataValueKey<std::string> > rubyforge_project_key;
std::tr1::shared_ptr<LiteralMetadataValueKey<FSEntry> > fs_location_key;
+ std::tr1::shared_ptr<LiteralMetadataValueKey<SlotName> > slot_key;
std::tr1::shared_ptr<const FSEntry> load_from_file;
@@ -272,6 +273,8 @@ GemSpecification::GemSpecification(const Environment * const e, const std::tr1::
_imp->load_from_file.reset(new FSEntry(f));
_imp->fs_location_key.reset(new LiteralMetadataValueKey<FSEntry> ("GEM", "Gem Location", mkt_internal, f));
add_metadata_key(_imp->fs_location_key);
+ _imp->slot_key.reset(new LiteralMetadataValueKey<SlotName>("SLOT", "Slot", mkt_internal, SlotName(stringify(v))));
+ add_metadata_key(_imp->slot_key);
}
GemSpecification::~GemSpecification()
@@ -316,12 +319,6 @@ GemSpecification::version() const
return VersionSpec(_imp->version);
}
-const SlotName
-GemSpecification::slot() const
-{
- return SlotName(_imp->version);
-}
-
const std::tr1::shared_ptr<const Repository>
GemSpecification::repository() const
{
@@ -436,6 +433,12 @@ GemSpecification::transient_key() const
return std::tr1::shared_ptr<const MetadataValueKey<bool> >();
}
+const std::tr1::shared_ptr<const MetadataValueKey<SlotName> >
+GemSpecification::slot_key() const
+{
+ return _imp->slot_key;
+}
+
bool
GemSpecification::arbitrary_less_than_comparison(const PackageID &) const
{
diff --git a/paludis/repositories/gems/gem_specification.hh b/paludis/repositories/gems/gem_specification.hh
index ccd8198e7..5691dfafb 100644
--- a/paludis/repositories/gems/gem_specification.hh
+++ b/paludis/repositories/gems/gem_specification.hh
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2007, 2008 Ciaran McCreesh
+ * Copyright (c) 2007, 2008, 2009 Ciaran McCreesh
*
* This file is part of the Paludis package manager. Paludis is free software;
* you can redistribute it and/or modify it under the terms of the GNU General
@@ -87,9 +87,9 @@ namespace paludis
virtual const QualifiedPackageName name() const;
virtual const VersionSpec version() const;
- virtual const SlotName slot() const;
virtual const std::tr1::shared_ptr<const Repository> repository() const;
+ virtual const std::tr1::shared_ptr<const MetadataValueKey<SlotName> > slot_key() const;
virtual const std::tr1::shared_ptr<const MetadataValueKey<std::tr1::shared_ptr<const PackageID> > > virtual_for_key() const;
virtual const std::tr1::shared_ptr<const MetadataCollectionKey<KeywordNameSet> > keywords_key() const;
virtual const std::tr1::shared_ptr<const MetadataSpecTreeKey<ProvideSpecTree> > provide_key() const;
diff --git a/paludis/repositories/unavailable/unavailable_id.cc b/paludis/repositories/unavailable/unavailable_id.cc
index dd9bc1252..5682a495c 100644
--- a/paludis/repositories/unavailable/unavailable_id.cc
+++ b/paludis/repositories/unavailable/unavailable_id.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2008 Ciaran McCreesh
+ * Copyright (c) 2008, 2009 Ciaran McCreesh
*
* This file is part of the Paludis package manager. Paludis is free software;
* you can redistribute it and/or modify it under the terms of the GNU General
@@ -29,6 +29,7 @@
#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/unchoices_key.hh>
@@ -42,9 +43,9 @@ namespace paludis
{
const QualifiedPackageName name;
const VersionSpec version;
- const SlotName slot;
const UnavailableRepository * const repo;
+ const std::tr1::shared_ptr<const MetadataValueKey<SlotName> > slot_key;
const std::tr1::shared_ptr<const MetadataValueKey<std::string> > description_key;
const std::tr1::shared_ptr<const MetadataValueKey<std::string> > repository_homepage_key, repository_description_key;
const std::tr1::shared_ptr<const MetadataCollectionKey<Set<std::string> > > from_repositories_key;
@@ -55,8 +56,8 @@ namespace paludis
const UnavailableIDParams & e) :
name(e.name()),
version(e.version()),
- slot(e.slot()),
repo(e.repository()),
+ slot_key(new LiteralMetadataValueKey<SlotName>("SLOT", "Slot", mkt_internal, e.slot())),
description_key(e.description()),
repository_homepage_key(e.repository_homepage()),
repository_description_key(e.repository_description()),
@@ -72,6 +73,7 @@ UnavailableID::UnavailableID(const UnavailableIDParams & entry) :
PrivateImplementationPattern<UnavailableID>(new Implementation<UnavailableID>(entry)),
_imp(PrivateImplementationPattern<UnavailableID>::_imp)
{
+ add_metadata_key(_imp->slot_key);
add_metadata_key(_imp->description_key);
add_metadata_key(_imp->from_repositories_key);
if (_imp->repository_homepage_key)
@@ -102,11 +104,11 @@ UnavailableID::canonical_form(const PackageIDCanonicalForm f) const
{
case idcf_full:
return stringify(_imp->name) + "-" + stringify(_imp->version) +
- ":" + stringify(_imp->slot) + "::" + stringify(_imp->repo->name()) +
+ ":" + stringify(_imp->slot_key->value()) + "::" + stringify(_imp->repo->name()) +
" (in ::" + *_imp->from_repositories_key->value()->begin() + ")";
case idcf_no_version:
- return stringify(_imp->name) + ":" + stringify(_imp->slot) +
+ return stringify(_imp->name) + ":" + stringify(_imp->slot_key->value()) +
"::" + stringify(_imp->repo->name()) +
" (in ::" + *_imp->from_repositories_key->value()->begin() + ")";
@@ -133,12 +135,6 @@ UnavailableID::version() const
return _imp->version;
}
-const SlotName
-UnavailableID::slot() const
-{
- return _imp->slot;
-}
-
const std::tr1::shared_ptr<const Repository>
UnavailableID::repository() const
{
@@ -166,9 +162,12 @@ UnavailableID::breaks_portage() const
bool
UnavailableID::arbitrary_less_than_comparison(const PackageID & other) const
{
- if (slot() < other.slot())
+ if (! other.slot_key())
+ return false;
+
+ if (slot_key()->value() < other.slot_key()->value())
return true;
- if (slot() > other.slot())
+ if (slot_key()->value() > other.slot_key()->value())
return false;
std::tr1::shared_ptr<const MetadataCollectionKey<Set<std::string > > > k(other.from_repositories_key());
@@ -184,7 +183,7 @@ std::size_t
UnavailableID::extra_hash_value() const
{
return Hash<std::pair<SlotName, std::string> >()(std::make_pair(
- slot(), *_imp->from_repositories_key->value()->begin()));
+ slot_key()->value(), *_imp->from_repositories_key->value()->begin()));
}
const std::tr1::shared_ptr<const MetadataCollectionKey<PackageIDSequence> >
@@ -301,5 +300,11 @@ UnavailableID::choices_key() const
return _imp->choices_key;
}
+const std::tr1::shared_ptr<const MetadataValueKey<SlotName> >
+UnavailableID::slot_key() const
+{
+ return _imp->slot_key;
+}
+
template class PrivateImplementationPattern<UnavailableID>;
diff --git a/paludis/repositories/unavailable/unavailable_id.hh b/paludis/repositories/unavailable/unavailable_id.hh
index a97280a7f..49596eda4 100644
--- a/paludis/repositories/unavailable/unavailable_id.hh
+++ b/paludis/repositories/unavailable/unavailable_id.hh
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2008 Ciaran McCreesh
+ * Copyright (c) 2008, 2009 Ciaran McCreesh
*
* This file is part of the Paludis package manager. Paludis is free software;
* you can redistribute it and/or modify it under the terms of the GNU General
@@ -73,9 +73,9 @@ namespace paludis
const std::string canonical_form(const PackageIDCanonicalForm) const;
const QualifiedPackageName name() const;
const VersionSpec version() const;
- const SlotName slot() const;
const std::tr1::shared_ptr<const Repository> repository() const;
+ const std::tr1::shared_ptr<const MetadataValueKey<SlotName> > slot_key() const;
const std::tr1::shared_ptr<const MetadataValueKey<std::tr1::shared_ptr<const PackageID> > >
virtual_for_key() const;
const std::tr1::shared_ptr<const MetadataCollectionKey<KeywordNameSet> > keywords_key() const;
diff --git a/paludis/repositories/unpackaged/installed_id.cc b/paludis/repositories/unpackaged/installed_id.cc
index 33cafdc98..a54f62be9 100644
--- a/paludis/repositories/unpackaged/installed_id.cc
+++ b/paludis/repositories/unpackaged/installed_id.cc
@@ -395,7 +395,6 @@ namespace paludis
const Environment * const env;
const QualifiedPackageName name;
const VersionSpec version;
- const SlotName slot;
const RepositoryName repository_name;
const FSEntry root;
const NDBAM * const ndbam;
@@ -403,6 +402,7 @@ namespace paludis
std::tr1::shared_ptr<DependencyLabelSequence> build_dependencies_labels;
std::tr1::shared_ptr<DependencyLabelSequence> run_dependencies_labels;
+ std::tr1::shared_ptr<LiteralMetadataValueKey<SlotName> > slot_key;
std::tr1::shared_ptr<InstalledUnpackagedFSEntryKey> fs_location_key;
std::tr1::shared_ptr<InstalledUnpackagedContentsKey> contents_key;
std::tr1::shared_ptr<InstalledUnpackagedTimeKey> installed_time_key;
@@ -424,12 +424,12 @@ namespace paludis
env(e),
name(q),
version(v),
- slot(s),
repository_name(r),
root(ro),
ndbam(d),
build_dependencies_labels(new DependencyLabelSequence),
run_dependencies_labels(new DependencyLabelSequence),
+ slot_key(new LiteralMetadataValueKey<SlotName> ("slot", "Slot", mkt_internal, s)),
fs_location_key(new InstalledUnpackagedFSEntryKey(l))
{
build_dependencies_labels->push_back(make_shared_ptr(new DependencyBuildLabel("build_dependencies")));
@@ -471,6 +471,7 @@ InstalledUnpackagedID::InstalledUnpackagedID(const Environment * const e, const
_imp(PrivateImplementationPattern<InstalledUnpackagedID>::_imp)
{
add_metadata_key(_imp->fs_location_key);
+ add_metadata_key(_imp->slot_key);
if (_imp->contents_key)
add_metadata_key(_imp->contents_key);
if (_imp->installed_time_key)
@@ -506,13 +507,13 @@ InstalledUnpackagedID::canonical_form(const PackageIDCanonicalForm f) const
{
case idcf_full:
return stringify(_imp->name) + "-" + stringify(_imp->version) + ":" +
- stringify(slot()) + "::" + stringify(_imp->repository_name);
+ stringify(slot_key()->value()) + "::" + stringify(_imp->repository_name);
case idcf_version:
return stringify(_imp->version);
case idcf_no_version:
- return stringify(_imp->name) + ":" + stringify(slot()) + "::" +
+ return stringify(_imp->name) + ":" + stringify(slot_key()->value()) + "::" +
stringify(_imp->repository_name);
case last_idcf:
@@ -534,12 +535,6 @@ InstalledUnpackagedID::version() const
return _imp->version;
}
-const SlotName
-InstalledUnpackagedID::slot() const
-{
- return _imp->slot;
-}
-
const std::tr1::shared_ptr<const Repository>
InstalledUnpackagedID::repository() const
{
@@ -648,6 +643,12 @@ InstalledUnpackagedID::fs_location_key() const
return _imp->fs_location_key;
}
+const std::tr1::shared_ptr<const MetadataValueKey<SlotName> >
+InstalledUnpackagedID::slot_key() const
+{
+ return _imp->slot_key;
+}
+
namespace paludis
{
class InstalledUnpackagedTransientKey :
@@ -808,13 +809,13 @@ InstalledUnpackagedID::breaks_portage() const
bool
InstalledUnpackagedID::arbitrary_less_than_comparison(const PackageID & other) const
{
- return slot().data() < other.slot().data();
+ return slot_key()->value().data() < (other.slot_key() ? stringify(other.slot_key()->value()) : "");
}
std::size_t
InstalledUnpackagedID::extra_hash_value() const
{
- return Hash<SlotName>()(slot());
+ return Hash<SlotName>()(slot_key()->value());
}
void
diff --git a/paludis/repositories/unpackaged/installed_id.hh b/paludis/repositories/unpackaged/installed_id.hh
index e1a5f8d7a..a62bcddc9 100644
--- a/paludis/repositories/unpackaged/installed_id.hh
+++ b/paludis/repositories/unpackaged/installed_id.hh
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2007, 2008 Ciaran McCreesh
+ * Copyright (c) 2007, 2008, 2009 Ciaran McCreesh
*
* This file is part of the Paludis package manager. Paludis is free software;
* you can redistribute it and/or modify it under the terms of the GNU General
@@ -54,9 +54,9 @@ namespace paludis
virtual const std::string canonical_form(const PackageIDCanonicalForm) const;
virtual const QualifiedPackageName name() const;
virtual const VersionSpec version() const;
- virtual const SlotName slot() const;
virtual const std::tr1::shared_ptr<const Repository> repository() const;
+ virtual const std::tr1::shared_ptr<const MetadataValueKey<SlotName> > slot_key() const;
virtual const std::tr1::shared_ptr<const MetadataValueKey<std::tr1::shared_ptr<const PackageID> > > virtual_for_key() const;
virtual const std::tr1::shared_ptr<const MetadataCollectionKey<KeywordNameSet> > keywords_key() const;
virtual const std::tr1::shared_ptr<const MetadataSpecTreeKey<ProvideSpecTree> > provide_key() const;
diff --git a/paludis/repositories/unpackaged/installed_repository.cc b/paludis/repositories/unpackaged/installed_repository.cc
index 5f435bd13..488ab85c0 100644
--- a/paludis/repositories/unpackaged/installed_repository.cc
+++ b/paludis/repositories/unpackaged/installed_repository.cc
@@ -241,6 +241,15 @@ namespace
return std::make_pair(uid, gid);
}
+
+ bool slot_is_same(const std::tr1::shared_ptr<const PackageID> & a,
+ const std::tr1::shared_ptr<const PackageID> & b)
+ {
+ if (a->slot_key())
+ return b->slot_key() && a->slot_key()->value() == b->slot_key()->value();
+ else
+ return ! b->slot_key();
+ }
}
void
@@ -283,7 +292,7 @@ InstalledUnpackagedRepository::merge(const MergeParams & m)
v != v_end ; ++v)
{
if_same_name_id = *v;
- if ((*v)->version() == m.package_id()->version() && (*v)->slot() == m.package_id()->slot())
+ if ((*v)->version() == m.package_id()->version() && slot_is_same(*v, m.package_id()))
{
if_overwritten_id = *v;
break;
@@ -304,7 +313,7 @@ InstalledUnpackagedRepository::merge(const MergeParams & m)
}
FSEntry target_ver_dir(uid_dir);
- target_ver_dir /= (stringify(m.package_id()->version()) + ":" + stringify(m.package_id()->slot()) + ":" + cookie());
+ target_ver_dir /= (stringify(m.package_id()->version()) + ":" + stringify(m.package_id()->slot_key()->value()) + ":" + cookie());
if (target_ver_dir.exists())
throw InstallActionError("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 c3610a8fb..d98b4508b 100644
--- a/paludis/repositories/unpackaged/installed_repository_TEST.cc
+++ b/paludis/repositories/unpackaged/installed_repository_TEST.cc
@@ -134,7 +134,7 @@ namespace test_cases
&env, UserPackageDepSpecOptions()), MatchPackageOptions()))]->begin());
TEST_CHECK_EQUAL(id1->version(), VersionSpec("1"));
- TEST_CHECK_EQUAL(id1->slot(), SlotName("0"));
+ TEST_CHECK_EQUAL(id1->slot_key()->value(), SlotName("0"));
TEST_CHECK_EQUAL(id1->name(), QualifiedPackageName("cat-one/foo"));
TEST_CHECK_EQUAL(id1->repository()->name(), RepositoryName("installed-unpackaged"));
TEST_CHECK(id1->fs_location_key());
@@ -152,7 +152,7 @@ namespace test_cases
&env, UserPackageDepSpecOptions()), MatchPackageOptions()))]->begin());
TEST_CHECK_EQUAL(id2->version(), VersionSpec("2"));
- TEST_CHECK_EQUAL(id2->slot(), SlotName("1"));
+ TEST_CHECK_EQUAL(id2->slot_key()->value(), SlotName("1"));
TEST_CHECK_EQUAL(id2->name(), QualifiedPackageName("cat-one/foo"));
TEST_CHECK_EQUAL(id2->repository()->name(), RepositoryName("installed-unpackaged"));
TEST_CHECK(id2->fs_location_key());
diff --git a/paludis/repositories/unpackaged/unpackaged_id.cc b/paludis/repositories/unpackaged/unpackaged_id.cc
index 3a3e2320f..0564621b0 100644
--- a/paludis/repositories/unpackaged/unpackaged_id.cc
+++ b/paludis/repositories/unpackaged/unpackaged_id.cc
@@ -51,12 +51,12 @@ namespace paludis
const Environment * const env;
const QualifiedPackageName name;
const VersionSpec version;
- const SlotName slot;
const RepositoryName repository_name;
std::tr1::shared_ptr<DependencyLabelSequence> build_dependencies_labels;
std::tr1::shared_ptr<DependencyLabelSequence> run_dependencies_labels;
+ const std::tr1::shared_ptr<LiteralMetadataValueKey<SlotName> > slot_key;
const std::tr1::shared_ptr<LiteralMetadataValueKey<FSEntry> > fs_location_key;
const std::tr1::shared_ptr<const MetadataSpecTreeKey<DependencySpecTree> > build_dependencies_key;
const std::tr1::shared_ptr<const MetadataSpecTreeKey<DependencySpecTree> > run_dependencies_key;
@@ -76,10 +76,10 @@ namespace paludis
env(e),
name(q),
version(v),
- slot(s),
repository_name(n),
build_dependencies_labels(new DependencyLabelSequence),
run_dependencies_labels(new DependencyLabelSequence),
+ slot_key(new LiteralMetadataValueKey<SlotName> ("slot", "Slot", mkt_internal, s)),
fs_location_key(new LiteralMetadataValueKey<FSEntry> ("location", "Location", mkt_normal, l)),
build_dependencies_key(new UnpackagedDependencyKey(env, "build_dependencies", "Build dependencies", mkt_dependencies,
build_dependencies_labels, b)),
@@ -100,6 +100,7 @@ UnpackagedID::UnpackagedID(const Environment * const e, const QualifiedPackageNa
PrivateImplementationPattern<UnpackagedID>(new Implementation<UnpackagedID>(e, q, v, s, n, l, b, r, d, this)),
_imp(PrivateImplementationPattern<UnpackagedID>::_imp)
{
+ add_metadata_key(_imp->slot_key);
add_metadata_key(_imp->fs_location_key);
add_metadata_key(_imp->build_dependencies_key);
add_metadata_key(_imp->run_dependencies_key);
@@ -128,13 +129,13 @@ UnpackagedID::canonical_form(const PackageIDCanonicalForm f) const
{
case idcf_full:
return stringify(_imp->name) + "-" + stringify(_imp->version) + ":" +
- stringify(slot()) + "::" + stringify(_imp->repository_name);
+ stringify(slot_key()->value()) + "::" + stringify(_imp->repository_name);
case idcf_version:
return stringify(_imp->version);
case idcf_no_version:
- return stringify(_imp->name) + ":" + stringify(slot()) + "::" +
+ return stringify(_imp->name) + ":" + stringify(slot_key()->value()) + "::" +
stringify(_imp->repository_name);
case last_idcf:
@@ -156,12 +157,6 @@ UnpackagedID::version() const
return _imp->version;
}
-const SlotName
-UnpackagedID::slot() const
-{
- return _imp->slot;
-}
-
const std::tr1::shared_ptr<const Repository>
UnpackagedID::repository() const
{
@@ -270,6 +265,12 @@ UnpackagedID::fs_location_key() const
return _imp->fs_location_key;
}
+const std::tr1::shared_ptr<const MetadataValueKey<SlotName> >
+UnpackagedID::slot_key() const
+{
+ return _imp->slot_key;
+}
+
const std::tr1::shared_ptr<const MetadataValueKey<bool> >
UnpackagedID::transient_key() const
{
@@ -379,13 +380,13 @@ UnpackagedID::breaks_portage() const
bool
UnpackagedID::arbitrary_less_than_comparison(const PackageID & other) const
{
- return slot().data() < other.slot().data();
+ return slot_key()->value().data() < (other.slot_key() ? stringify(other.slot_key()->value()) : "");
}
std::size_t
UnpackagedID::extra_hash_value() const
{
- return Hash<SlotName>()(slot());
+ return Hash<SlotName>()(slot_key()->value());
}
const std::tr1::shared_ptr<const MetadataValueKey<std::tr1::shared_ptr<const Choices> > >
diff --git a/paludis/repositories/unpackaged/unpackaged_id.hh b/paludis/repositories/unpackaged/unpackaged_id.hh
index 7e987d2d4..7fe915933 100644
--- a/paludis/repositories/unpackaged/unpackaged_id.hh
+++ b/paludis/repositories/unpackaged/unpackaged_id.hh
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2007, 2008 Ciaran McCreesh
+ * Copyright (c) 2007, 2008, 2009 Ciaran McCreesh
*
* This file is part of the Paludis package manager. Paludis is free software;
* you can redistribute it and/or modify it under the terms of the GNU General
@@ -52,9 +52,9 @@ namespace paludis
virtual const std::string canonical_form(const PackageIDCanonicalForm) const;
virtual const QualifiedPackageName name() const;
virtual const VersionSpec version() const;
- virtual const SlotName slot() const;
virtual const std::tr1::shared_ptr<const Repository> repository() const;
+ virtual const std::tr1::shared_ptr<const MetadataValueKey<SlotName> > slot_key() const;
virtual const std::tr1::shared_ptr<const MetadataValueKey<std::tr1::shared_ptr<const PackageID> > > virtual_for_key() const;
virtual const std::tr1::shared_ptr<const MetadataCollectionKey<KeywordNameSet> > keywords_key() const;
virtual const std::tr1::shared_ptr<const MetadataSpecTreeKey<ProvideSpecTree> > provide_key() const;
diff --git a/paludis/repositories/unpackaged/unpackaged_repository_TEST.cc b/paludis/repositories/unpackaged/unpackaged_repository_TEST.cc
index 2d8e2b6e0..46913abdb 100644
--- a/paludis/repositories/unpackaged/unpackaged_repository_TEST.cc
+++ b/paludis/repositories/unpackaged/unpackaged_repository_TEST.cc
@@ -110,7 +110,7 @@ namespace test_cases
*env[selection::RequireExactlyOne(generator::All())]->begin());
TEST_CHECK_EQUAL(id->version(), VersionSpec("1.0"));
- TEST_CHECK_EQUAL(id->slot(), SlotName("foo"));
+ TEST_CHECK_EQUAL(id->slot_key()->value(), SlotName("foo"));
TEST_CHECK_EQUAL(id->name(), QualifiedPackageName("cat/pkg"));
TEST_CHECK_EQUAL(id->repository()->name(), RepositoryName("unpackaged"));
TEST_CHECK(id->fs_location_key());
diff --git a/paludis/repositories/unwritten/unwritten_id.cc b/paludis/repositories/unwritten/unwritten_id.cc
index c0c7609ff..64bc47806 100644
--- a/paludis/repositories/unwritten/unwritten_id.cc
+++ b/paludis/repositories/unwritten/unwritten_id.cc
@@ -41,9 +41,9 @@ namespace paludis
{
const QualifiedPackageName name;
const VersionSpec version;
- const SlotName slot;
const UnwrittenRepository * const repo;
+ const std::tr1::shared_ptr<const MetadataValueKey<SlotName> > slot_key;
const std::tr1::shared_ptr<const MetadataValueKey<std::string> > description_key;
const std::tr1::shared_ptr<const MetadataValueKey<std::string> > added_by_key;
const std::tr1::shared_ptr<const MetadataValueKey<std::string> > comment_key;
@@ -57,8 +57,8 @@ namespace paludis
const UnwrittenIDParams & e) :
name(e.name()),
version(e.version()),
- slot(e.slot()),
repo(e.repository()),
+ slot_key(e.slot()),
description_key(e.description()),
added_by_key(e.added_by()),
comment_key(e.comment()),
@@ -76,6 +76,8 @@ UnwrittenID::UnwrittenID(const UnwrittenIDParams & entry) :
PrivateImplementationPattern<UnwrittenID>(new Implementation<UnwrittenID>(entry)),
_imp(PrivateImplementationPattern<UnwrittenID>::_imp)
{
+ if (_imp->slot_key)
+ add_metadata_key(_imp->slot_key);
if (_imp->description_key)
add_metadata_key(_imp->description_key);
if (_imp->homepage_key)
@@ -112,10 +114,10 @@ UnwrittenID::canonical_form(const PackageIDCanonicalForm f) const
{
case idcf_full:
return stringify(_imp->name) + "-" + stringify(_imp->version) +
- ":" + stringify(_imp->slot) + "::" + stringify(_imp->repo->name());
+ ":" + stringify(slot_key()->value()) + "::" + stringify(_imp->repo->name());
case idcf_no_version:
- return stringify(_imp->name) + ":" + stringify(_imp->slot) +
+ return stringify(_imp->name) + ":" + stringify(slot_key()->value()) +
"::" + stringify(_imp->repo->name());
case idcf_version:
@@ -140,12 +142,6 @@ UnwrittenID::version() const
return _imp->version;
}
-const SlotName
-UnwrittenID::slot() const
-{
- return _imp->slot;
-}
-
const std::tr1::shared_ptr<const Repository>
UnwrittenID::repository() const
{
@@ -173,16 +169,13 @@ UnwrittenID::breaks_portage() const
bool
UnwrittenID::arbitrary_less_than_comparison(const PackageID & other) const
{
- if (slot() < other.slot())
- return true;
-
- return false;
+ return slot_key()->value().data() < (other.slot_key() ? stringify(other.slot_key()->value()) : "");
}
std::size_t
UnwrittenID::extra_hash_value() const
{
- return Hash<SlotName>()(slot());
+ return Hash<SlotName>()(slot_key()->value());
}
const std::tr1::shared_ptr<const MetadataCollectionKey<PackageIDSequence> >
@@ -251,6 +244,12 @@ UnwrittenID::suggested_dependencies_key() const
return std::tr1::shared_ptr<const MetadataSpecTreeKey<DependencySpecTree> >();
}
+const std::tr1::shared_ptr<const MetadataValueKey<SlotName> >
+UnwrittenID::slot_key() const
+{
+ return _imp->slot_key;
+}
+
const std::tr1::shared_ptr<const MetadataValueKey<std::string> >
UnwrittenID::short_description_key() const
{
diff --git a/paludis/repositories/unwritten/unwritten_id.hh b/paludis/repositories/unwritten/unwritten_id.hh
index 742b68d58..9ced43153 100644
--- a/paludis/repositories/unwritten/unwritten_id.hh
+++ b/paludis/repositories/unwritten/unwritten_id.hh
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2008 Ciaran McCreesh
+ * Copyright (c) 2008, 2009 Ciaran McCreesh
*
* This file is part of the Paludis package manager. Paludis is free software;
* you can redistribute it and/or modify it under the terms of the GNU General
@@ -57,7 +57,7 @@ namespace paludis
NamedValue<n::name, QualifiedPackageName> name;
NamedValue<n::remote_ids, std::tr1::shared_ptr<const MetadataCollectionKey<Sequence<std::string> > > > remote_ids;
NamedValue<n::repository, const UnwrittenRepository *> repository;
- NamedValue<n::slot, SlotName> slot;
+ NamedValue<n::slot, std::tr1::shared_ptr<const MetadataValueKey<SlotName> > > slot;
NamedValue<n::version, VersionSpec> version;
};
@@ -79,11 +79,10 @@ namespace paludis
const std::string canonical_form(const PackageIDCanonicalForm) const;
const QualifiedPackageName name() const;
const VersionSpec version() const;
- const SlotName slot() const;
const std::tr1::shared_ptr<const Repository> repository() const;
- const std::tr1::shared_ptr<const MetadataValueKey<std::tr1::shared_ptr<const PackageID> > >
- virtual_for_key() const;
+ const std::tr1::shared_ptr<const MetadataValueKey<SlotName> > slot_key() const;
+ const std::tr1::shared_ptr<const MetadataValueKey<std::tr1::shared_ptr<const PackageID> > > virtual_for_key() const;
const std::tr1::shared_ptr<const MetadataCollectionKey<KeywordNameSet> > keywords_key() const;
const std::tr1::shared_ptr<const MetadataSpecTreeKey<ProvideSpecTree> > provide_key() const;
const std::tr1::shared_ptr<const MetadataCollectionKey<PackageIDSequence> > contains_key() const;
diff --git a/paludis/repositories/unwritten/unwritten_repository_file.cc b/paludis/repositories/unwritten/unwritten_repository_file.cc
index d3fe389eb..d0e2860bb 100644
--- a/paludis/repositories/unwritten/unwritten_repository_file.cc
+++ b/paludis/repositories/unwritten/unwritten_repository_file.cc
@@ -195,7 +195,7 @@ UnwrittenRepositoryFile::_load(const FSEntry & f)
CategoryNamePart category("x");
PackageNamePart package("x");
- SlotName slot("x");
+ std::tr1::shared_ptr<MetadataValueKey<SlotName> > slot;
VersionSpec version("0");
std::tr1::shared_ptr<UnwrittenRepositoryFileEntry> entry;
while (std::getline(file, line))
@@ -242,7 +242,7 @@ UnwrittenRepositoryFile::_load(const FSEntry & f)
(+simple_parser::any_of(" \t"))
))
{
- slot = SlotName(token);
+ slot.reset(new LiteralMetadataValueKey<SlotName>("SLOT", "Slot", mkt_internal, SlotName(token)));
if (line_parser.consume(
(+simple_parser::any_except(" \t") >> token)
diff --git a/paludis/repositories/unwritten/unwritten_repository_file.hh b/paludis/repositories/unwritten/unwritten_repository_file.hh
index 89170c867..752a553da 100644
--- a/paludis/repositories/unwritten/unwritten_repository_file.hh
+++ b/paludis/repositories/unwritten/unwritten_repository_file.hh
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2008 Ciaran McCreesh
+ * Copyright (c) 2008, 2009 Ciaran McCreesh
*
* This file is part of the Paludis package manager. Paludis is free software;
* you can redistribute it and/or modify it under the terms of the GNU General
@@ -57,7 +57,7 @@ namespace paludis
NamedValue<n::homepage, std::tr1::shared_ptr<const MetadataSpecTreeKey<SimpleURISpecTree> > > homepage;
NamedValue<n::name, QualifiedPackageName> name;
NamedValue<n::remote_ids, std::tr1::shared_ptr<const MetadataCollectionKey<Sequence<std::string> > > > remote_ids;
- NamedValue<n::slot, SlotName> slot;
+ NamedValue<n::slot, std::tr1::shared_ptr<const MetadataValueKey<SlotName> > > slot;
NamedValue<n::version, VersionSpec> version;
};
diff --git a/paludis/repositories/virtuals/package_id.cc b/paludis/repositories/virtuals/package_id.cc
index 99654af27..e3334ccfb 100644
--- a/paludis/repositories/virtuals/package_id.cc
+++ b/paludis/repositories/virtuals/package_id.cc
@@ -72,7 +72,8 @@ namespace paludis
.version_requirement(make_named_values<VersionRequirement>(
value_for<n::version_operator>(vo_equal),
value_for<n::version_spec>(v->version())))
- .slot_requirement(make_shared_ptr(new UserSlotExactRequirement(v->slot())))
+ .slot_requirement(make_shared_ptr(new UserSlotExactRequirement(
+ v->slot_key() ? v->slot_key()->value() : SlotName("UNKNOWN"))))
.in_repository(v->repository()->name())))
:
make_shared_ptr(new PackageDepSpec(
@@ -249,12 +250,6 @@ VirtualsPackageID::version() const
return _imp->version;
}
-const SlotName
-VirtualsPackageID::slot() const
-{
- return _imp->virtual_for->value()->slot();
-}
-
const std::tr1::shared_ptr<const Repository>
VirtualsPackageID::repository() const
{
@@ -527,6 +522,12 @@ VirtualsPackageID::fs_location_key() const
return std::tr1::shared_ptr<const MetadataValueKey<FSEntry> >();
}
+const std::tr1::shared_ptr<const MetadataValueKey<SlotName> >
+VirtualsPackageID::slot_key() const
+{
+ return _imp->virtual_for->value()->slot_key();
+}
+
const std::tr1::shared_ptr<const MetadataValueKey<bool> >
VirtualsPackageID::transient_key() const
{
diff --git a/paludis/repositories/virtuals/package_id.hh b/paludis/repositories/virtuals/package_id.hh
index 95c2ee7a8..18ff6be48 100644
--- a/paludis/repositories/virtuals/package_id.hh
+++ b/paludis/repositories/virtuals/package_id.hh
@@ -84,9 +84,9 @@ namespace paludis
virtual const QualifiedPackageName name() const;
virtual const VersionSpec version() const;
- virtual const SlotName slot() const;
virtual const std::tr1::shared_ptr<const Repository> repository() const;
+ virtual const std::tr1::shared_ptr<const MetadataValueKey<SlotName> > slot_key() const;
virtual const std::tr1::shared_ptr<const MetadataValueKey<std::tr1::shared_ptr<const PackageID> > > virtual_for_key() const;
virtual const std::tr1::shared_ptr<const MetadataCollectionKey<KeywordNameSet> > keywords_key() const;
virtual const std::tr1::shared_ptr<const MetadataSpecTreeKey<ProvideSpecTree> > provide_key() const;
diff --git a/paludis/selection.cc b/paludis/selection.cc
index 738622de6..7d57078ca 100644
--- a/paludis/selection.cc
+++ b/paludis/selection.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2008 Ciaran McCreesh
+ * Copyright (c) 2008, 2009 Ciaran McCreesh
*
* This file is part of the Paludis package manager. Paludis is free software;
* you can redistribute it and/or modify it under the terms of the GNU General
@@ -37,6 +37,7 @@
#include <paludis/filter.hh>
#include <paludis/filtered_generator.hh>
#include <paludis/environment.hh>
+#include <paludis/metadata_key.hh>
#include <algorithm>
#include <functional>
#include <tr1/functional>
@@ -101,6 +102,14 @@ Selection::as_string() const
namespace
{
+ std::string slot_as_string(const std::tr1::shared_ptr<const PackageID> & id)
+ {
+ if (id->slot_key())
+ return stringify(id->slot_key()->value());
+ else
+ return "(none)";
+ }
+
class SomeArbitraryVersionSelectionHandler :
public SelectionHandler
{
@@ -300,14 +309,14 @@ namespace
std::tr1::shared_ptr<const PackageIDSet> id(_fg.filter().ids(env, _fg.generator().ids(env, r, p)));
- typedef std::map<std::pair<QualifiedPackageName, SlotName>, std::tr1::shared_ptr<PackageIDSequence> > SlotMap;
+ typedef std::map<std::pair<QualifiedPackageName, std::string>, std::tr1::shared_ptr<PackageIDSequence> > SlotMap;
SlotMap by_slot;
for (PackageIDSet::ConstIterator i(id->begin()), i_end(id->end()) ;
i != i_end ; ++i)
{
- SlotMap::iterator m(by_slot.find(std::make_pair((*i)->name(), (*i)->slot())));
+ SlotMap::iterator m(by_slot.find(std::make_pair((*i)->name(), slot_as_string(*i))));
if (m == by_slot.end())
- m = by_slot.insert(std::make_pair(std::make_pair((*i)->name(), (*i)->slot()),
+ m = by_slot.insert(std::make_pair(std::make_pair((*i)->name(), slot_as_string(*i)),
make_shared_ptr(new PackageIDSequence))).first;
m->second->push_back(*i);
}
@@ -366,14 +375,14 @@ namespace
std::tr1::shared_ptr<const PackageIDSet> id(_fg.filter().ids(env, _fg.generator().ids(env, r, p)));
- typedef std::map<std::pair<QualifiedPackageName, SlotName>, std::tr1::shared_ptr<PackageIDSequence> > SlotMap;
+ typedef std::map<std::pair<QualifiedPackageName, std::string>, std::tr1::shared_ptr<PackageIDSequence> > SlotMap;
SlotMap by_slot;
for (PackageIDSet::ConstIterator i(id->begin()), i_end(id->end()) ;
i != i_end ; ++i)
{
- SlotMap::iterator m(by_slot.find(std::make_pair((*i)->name(), (*i)->slot())));
+ SlotMap::iterator m(by_slot.find(std::make_pair((*i)->name(), slot_as_string(*i))));
if (m == by_slot.end())
- m = by_slot.insert(std::make_pair(std::make_pair((*i)->name(), (*i)->slot()),
+ m = by_slot.insert(std::make_pair(std::make_pair((*i)->name(), slot_as_string(*i)),
make_shared_ptr(new PackageIDSequence))).first;
m->second->push_back(*i);
}
diff --git a/paludis/util/files.m4 b/paludis/util/files.m4
index 0bb4849d2..45151d527 100644
--- a/paludis/util/files.m4
+++ b/paludis/util/files.m4
@@ -36,6 +36,7 @@ add(`is_file_with_extension', `hh', `cc', `se', `test', `testscript')
add(`join', `hh', `test')
add(`log', `hh', `cc', `se', `test')
add(`make_named_values', `hh', `cc')
+add(`make_shared_copy', `hh', `fwd')
add(`make_shared_ptr', `hh', `fwd')
add(`map', `hh', `fwd', `impl', `cc')
add(`member_iterator', `hh', `fwd', `impl', `test')
diff --git a/paludis/util/make_shared_copy-fwd.hh b/paludis/util/make_shared_copy-fwd.hh
new file mode 100644
index 000000000..993c2af22
--- /dev/null
+++ b/paludis/util/make_shared_copy-fwd.hh
@@ -0,0 +1,45 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2009 Ciaran McCreesh
+ *
+ * This file is part of the Paludis package manager. Paludis is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU General
+ * 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_UTIL_MAKE_SHARED_COPY_FWD_HH
+#define PALUDIS_GUARD_PALUDIS_UTIL_MAKE_SHARED_COPY_FWD_HH 1
+
+#include <paludis/util/attributes.hh>
+#include <tr1/memory>
+
+/** \file
+ * Forward declarations for paludis/make_shared_copy.hh .
+ *
+ * \ingroup g_utils
+ */
+
+namespace paludis
+{
+ /**
+ * Like make_shared_ptr(new T_(t)).
+ *
+ * \ingroup g_utils
+ * \since 0.36
+ */
+ template <typename T_>
+ std::tr1::shared_ptr<T_>
+ make_shared_copy(const T_ & t) PALUDIS_ATTRIBUTE((warn_unused_result));
+}
+
+#endif
diff --git a/paludis/util/make_shared_copy.hh b/paludis/util/make_shared_copy.hh
new file mode 100644
index 000000000..d966e3211
--- /dev/null
+++ b/paludis/util/make_shared_copy.hh
@@ -0,0 +1,47 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2009 Ciaran McCreesh
+ *
+ * This file is part of the Paludis package manager. Paludis is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU General
+ * 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_UTIL_MAKE_SHARED_COPY_HH
+#define PALUDIS_GUARD_PALUDIS_UTIL_MAKE_SHARED_COPY_HH 1
+
+#include <paludis/util/make_shared_copy-fwd.hh>
+#include <paludis/util/make_shared_ptr.hh>
+
+/** \file
+ * Declarations for the make_shared_copy function.
+ *
+ * \ingroup g_utils
+ *
+ * \section Examples
+ *
+ * - None at this time.
+ */
+
+namespace paludis
+{
+ template <typename T_>
+ std::tr1::shared_ptr<T_>
+ make_shared_copy(const T_ & t)
+ {
+ return make_shared_ptr(new T_(t));
+ }
+}
+
+#endif
+