aboutsummaryrefslogtreecommitdiff
path: root/paludis/repositories/e
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/repositories/e
parent23d144895a2c80a2f3ff6cd7aa9d94705394ca04 (diff)
downloadpaludis-a0a35b8d0dd4ca00c91350e3d3acf1bc6208cad1.tar.gz
paludis-a0a35b8d0dd4ca00c91350e3d3acf1bc6208cad1.tar.xz
Make slot a metadata key.
Fixes: ticket:450
Diffstat (limited to 'paludis/repositories/e')
-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
20 files changed, 183 insertions, 96 deletions
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;