aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2009-02-23 22:51:37 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2009-02-23 22:51:37 +0000
commit7fde3c02941822cdfb7e160cb244a76966ac752a (patch)
treea7513d0231bec955ceb2b4aea1c8b8a9205fa9e5
parentc0220371b5b821fb2a01aaa983046d0a330fe0b9 (diff)
downloadpaludis-7fde3c02941822cdfb7e160cb244a76966ac752a.tar.gz
paludis-7fde3c02941822cdfb7e160cb244a76966ac752a.tar.xz
PackageID::uniquely_identifying_spec()
-rw-r--r--paludis/package_id.hh15
-rw-r--r--paludis/repositories/accounts/accounts_id.cc8
-rw-r--r--paludis/repositories/accounts/accounts_id.hh1
-rw-r--r--paludis/repositories/accounts/installed_accounts_id.cc8
-rw-r--r--paludis/repositories/accounts/installed_accounts_id.hh1
-rw-r--r--paludis/repositories/cran/cran_package_id.cc8
-rw-r--r--paludis/repositories/cran/cran_package_id.hh1
-rw-r--r--paludis/repositories/e/e_installed_repository_id.cc9
-rw-r--r--paludis/repositories/e/e_installed_repository_id.hh1
-rw-r--r--paludis/repositories/e/ebuild_id.cc9
-rw-r--r--paludis/repositories/e/ebuild_id.hh1
-rw-r--r--paludis/repositories/fake/fake_package_id.cc9
-rw-r--r--paludis/repositories/fake/fake_package_id.hh1
-rw-r--r--paludis/repositories/gems/gem_specification.cc8
-rw-r--r--paludis/repositories/gems/gem_specification.hh1
-rw-r--r--paludis/repositories/unavailable/unavailable_id.cc12
-rw-r--r--paludis/repositories/unavailable/unavailable_id.hh3
-rw-r--r--paludis/repositories/unavailable/unavailable_repository_store.cc3
-rw-r--r--paludis/repositories/unpackaged/installed_id.cc9
-rw-r--r--paludis/repositories/unpackaged/installed_id.hh1
-rw-r--r--paludis/repositories/unpackaged/unpackaged_id.cc9
-rw-r--r--paludis/repositories/unpackaged/unpackaged_id.hh1
-rw-r--r--paludis/repositories/unwritten/unwritten_id.cc11
-rw-r--r--paludis/repositories/unwritten/unwritten_id.hh3
-rw-r--r--paludis/repositories/unwritten/unwritten_repository_store.cc5
-rw-r--r--paludis/repositories/virtuals/package_id.cc9
-rw-r--r--paludis/repositories/virtuals/package_id.hh1
27 files changed, 145 insertions, 3 deletions
diff --git a/paludis/package_id.hh b/paludis/package_id.hh
index 523ce4d..aded3c1 100644
--- a/paludis/package_id.hh
+++ b/paludis/package_id.hh
@@ -127,6 +127,9 @@ namespace paludis
///\}
+ ///\name Name related operations
+ ///\{
+
/**
* Return our canonical string representation.
*
@@ -157,6 +160,18 @@ namespace paludis
*/
virtual const std::tr1::shared_ptr<const Repository> repository() const = 0;
+ /**
+ * Return a PackageDepSpec that uniquely identifies us.
+ *
+ * When stringified, can be turned back into an equivalent unique
+ * PackageDepSpec by using parse_user_package_dep_spec.
+ *
+ * \since 0.36
+ */
+ virtual PackageDepSpec uniquely_identifying_spec() const = 0;
+
+ ///\}
+
///\name Specific metadata keys
///\{
diff --git a/paludis/repositories/accounts/accounts_id.cc b/paludis/repositories/accounts/accounts_id.cc
index 8204c32..83484b1 100644
--- a/paludis/repositories/accounts/accounts_id.cc
+++ b/paludis/repositories/accounts/accounts_id.cc
@@ -35,6 +35,7 @@
#include <paludis/literal_metadata_key.hh>
#include <paludis/repository.hh>
#include <paludis/action.hh>
+#include <paludis/user_dep_spec.hh>
#include <algorithm>
using namespace paludis;
@@ -269,6 +270,13 @@ AccountsID::canonical_form(const PackageIDCanonicalForm f) const
throw InternalError(PALUDIS_HERE, "Bad PackageIDCanonicalForm");
}
+PackageDepSpec
+AccountsID::uniquely_identifying_spec() const
+{
+ return parse_user_package_dep_spec(stringify(name()) + "::" + stringify(repository()->name()),
+ _imp->env, UserPackageDepSpecOptions());
+}
+
const std::tr1::shared_ptr<const MetadataValueKey<std::tr1::shared_ptr<const PackageID> > >
AccountsID::virtual_for_key() const
{
diff --git a/paludis/repositories/accounts/accounts_id.hh b/paludis/repositories/accounts/accounts_id.hh
index a2df466..aaf6494 100644
--- a/paludis/repositories/accounts/accounts_id.hh
+++ b/paludis/repositories/accounts/accounts_id.hh
@@ -57,6 +57,7 @@ namespace paludis
virtual const QualifiedPackageName name() const;
virtual const VersionSpec version() const;
virtual const std::tr1::shared_ptr<const Repository> repository() const;
+ virtual PackageDepSpec uniquely_identifying_spec() const;
///\name Specific metadata keys
///\{
diff --git a/paludis/repositories/accounts/installed_accounts_id.cc b/paludis/repositories/accounts/installed_accounts_id.cc
index ab613a1..689b3f1 100644
--- a/paludis/repositories/accounts/installed_accounts_id.cc
+++ b/paludis/repositories/accounts/installed_accounts_id.cc
@@ -32,6 +32,7 @@
#include <paludis/literal_metadata_key.hh>
#include <paludis/repository.hh>
#include <paludis/action.hh>
+#include <paludis/user_dep_spec.hh>
using namespace paludis;
using namespace paludis::accounts_repository;
@@ -131,6 +132,13 @@ InstalledAccountsID::canonical_form(const PackageIDCanonicalForm f) const
throw InternalError(PALUDIS_HERE, "Bad PackageIDCanonicalForm");
}
+PackageDepSpec
+InstalledAccountsID::uniquely_identifying_spec() const
+{
+ return parse_user_package_dep_spec(stringify(name()) + "::" + stringify(repository()->name()),
+ _imp->env, UserPackageDepSpecOptions());
+}
+
const std::tr1::shared_ptr<const MetadataValueKey<std::tr1::shared_ptr<const PackageID> > >
InstalledAccountsID::virtual_for_key() const
{
diff --git a/paludis/repositories/accounts/installed_accounts_id.hh b/paludis/repositories/accounts/installed_accounts_id.hh
index c6280b5..6eef045 100644
--- a/paludis/repositories/accounts/installed_accounts_id.hh
+++ b/paludis/repositories/accounts/installed_accounts_id.hh
@@ -55,6 +55,7 @@ namespace paludis
virtual const QualifiedPackageName name() const;
virtual const VersionSpec version() const;
virtual const std::tr1::shared_ptr<const Repository> repository() const;
+ virtual PackageDepSpec uniquely_identifying_spec() const;
///\name Specific metadata keys
///\{
diff --git a/paludis/repositories/cran/cran_package_id.cc b/paludis/repositories/cran/cran_package_id.cc
index 685d05d..18c8ecb 100644
--- a/paludis/repositories/cran/cran_package_id.cc
+++ b/paludis/repositories/cran/cran_package_id.cc
@@ -38,6 +38,7 @@
#include <paludis/version_spec.hh>
#include <paludis/action.hh>
#include <paludis/dep_label.hh>
+#include <paludis/user_dep_spec.hh>
#include <paludis/util/tokeniser.hh>
#include <string>
#include <algorithm>
@@ -449,6 +450,13 @@ CRANPackageID::canonical_form(const PackageIDCanonicalForm f) const
throw InternalError(PALUDIS_HERE, "Bad PackageIDCanonicalForm");
}
+PackageDepSpec
+CRANPackageID::uniquely_identifying_spec() const
+{
+ return parse_user_package_dep_spec("=" + stringify(name()) + "-" + stringify(version()) + "::" + stringify(repository()->name()),
+ _imp->env, UserPackageDepSpecOptions());
+}
+
namespace
{
struct SupportsActionQuery
diff --git a/paludis/repositories/cran/cran_package_id.hh b/paludis/repositories/cran/cran_package_id.hh
index 1b63c0f..ecb1075 100644
--- a/paludis/repositories/cran/cran_package_id.hh
+++ b/paludis/repositories/cran/cran_package_id.hh
@@ -55,6 +55,7 @@ namespace paludis
virtual const QualifiedPackageName name() const;
virtual const VersionSpec version() const;
virtual const std::tr1::shared_ptr<const Repository> repository() const;
+ virtual PackageDepSpec uniquely_identifying_spec() 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;
diff --git a/paludis/repositories/e/e_installed_repository_id.cc b/paludis/repositories/e/e_installed_repository_id.cc
index cb050f7..8c228d6 100644
--- a/paludis/repositories/e/e_installed_repository_id.cc
+++ b/paludis/repositories/e/e_installed_repository_id.cc
@@ -44,6 +44,7 @@
#include <paludis/util/safe_ifstream.hh>
#include <paludis/output_manager.hh>
#include <paludis/literal_metadata_key.hh>
+#include <paludis/user_dep_spec.hh>
#include <iterator>
using namespace paludis;
@@ -564,6 +565,14 @@ EInstalledRepositoryID::canonical_form(const PackageIDCanonicalForm f) const
throw InternalError(PALUDIS_HERE, "Bad PackageIDCanonicalForm");
}
+PackageDepSpec
+EInstalledRepositoryID::uniquely_identifying_spec() const
+{
+ return parse_user_package_dep_spec("=" + stringify(name()) + "-" + stringify(version()) +
+ (slot_key() ? ":" + stringify(slot_key()->value()) : "") + "::" + stringify(repository()->name()),
+ _imp->environment, UserPackageDepSpecOptions());
+}
+
const QualifiedPackageName
EInstalledRepositoryID::name() const
{
diff --git a/paludis/repositories/e/e_installed_repository_id.hh b/paludis/repositories/e/e_installed_repository_id.hh
index 7d7be40..d7f8880 100644
--- a/paludis/repositories/e/e_installed_repository_id.hh
+++ b/paludis/repositories/e/e_installed_repository_id.hh
@@ -51,6 +51,7 @@ namespace paludis
~EInstalledRepositoryID();
virtual const std::string canonical_form(const PackageIDCanonicalForm) const;
+ virtual PackageDepSpec uniquely_identifying_spec() const;
virtual const QualifiedPackageName name() const;
virtual const VersionSpec version() const;
diff --git a/paludis/repositories/e/ebuild_id.cc b/paludis/repositories/e/ebuild_id.cc
index a53a056..2656979 100644
--- a/paludis/repositories/e/ebuild_id.cc
+++ b/paludis/repositories/e/ebuild_id.cc
@@ -39,6 +39,7 @@
#include <paludis/action.hh>
#include <paludis/literal_metadata_key.hh>
#include <paludis/elike_choices.hh>
+#include <paludis/user_dep_spec.hh>
#include <paludis/util/fs_entry.hh>
#include <paludis/util/stringify.hh>
@@ -532,6 +533,14 @@ EbuildID::canonical_form(const PackageIDCanonicalForm f) const
throw InternalError(PALUDIS_HERE, "Bad PackageIDCanonicalForm");
}
+PackageDepSpec
+EbuildID::uniquely_identifying_spec() const
+{
+ return parse_user_package_dep_spec("=" + stringify(name()) + "-" + stringify(version()) +
+ (slot_key() ? ":" + stringify(slot_key()->value()) : "") + "::" + stringify(repository()->name()),
+ _imp->environment, UserPackageDepSpecOptions());
+}
+
const QualifiedPackageName
EbuildID::name() const
{
diff --git a/paludis/repositories/e/ebuild_id.hh b/paludis/repositories/e/ebuild_id.hh
index 943aec0..68ca3ec 100644
--- a/paludis/repositories/e/ebuild_id.hh
+++ b/paludis/repositories/e/ebuild_id.hh
@@ -57,6 +57,7 @@ namespace paludis
~EbuildID();
virtual const std::string canonical_form(const PackageIDCanonicalForm) const;
+ virtual PackageDepSpec uniquely_identifying_spec() const;
virtual const QualifiedPackageName name() const;
virtual const VersionSpec version() const;
diff --git a/paludis/repositories/fake/fake_package_id.cc b/paludis/repositories/fake/fake_package_id.cc
index fc3ff88..1969188 100644
--- a/paludis/repositories/fake/fake_package_id.cc
+++ b/paludis/repositories/fake/fake_package_id.cc
@@ -28,6 +28,7 @@
#include <paludis/literal_metadata_key.hh>
#include <paludis/dep_spec.hh>
#include <paludis/choice.hh>
+#include <paludis/user_dep_spec.hh>
#include <paludis/util/stringify.hh>
#include <paludis/util/mutex.hh>
#include <paludis/util/private_implementation_pattern-impl.hh>
@@ -687,6 +688,14 @@ FakePackageID::canonical_form(const PackageIDCanonicalForm f) const
throw InternalError(PALUDIS_HERE, "Bad PackageIDCanonicalForm");
}
+PackageDepSpec
+FakePackageID::uniquely_identifying_spec() const
+{
+ return parse_user_package_dep_spec("=" + stringify(name()) + "-" + stringify(version()) +
+ (slot_key() ? ":" + stringify(slot_key()->value()) : "") + "::" + stringify(repository()->name()),
+ _imp->env, UserPackageDepSpecOptions());
+}
+
const QualifiedPackageName
FakePackageID::name() const
{
diff --git a/paludis/repositories/fake/fake_package_id.hh b/paludis/repositories/fake/fake_package_id.hh
index 1b71aa6..2ffbb0f 100644
--- a/paludis/repositories/fake/fake_package_id.hh
+++ b/paludis/repositories/fake/fake_package_id.hh
@@ -242,6 +242,7 @@ namespace paludis
virtual const QualifiedPackageName name() const;
virtual const VersionSpec version() const;
virtual const std::tr1::shared_ptr<const Repository> repository() const;
+ virtual PackageDepSpec uniquely_identifying_spec() 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;
diff --git a/paludis/repositories/gems/gem_specification.cc b/paludis/repositories/gems/gem_specification.cc
index 84b127b..a05161d 100644
--- a/paludis/repositories/gems/gem_specification.cc
+++ b/paludis/repositories/gems/gem_specification.cc
@@ -31,6 +31,7 @@
#include <paludis/environment.hh>
#include <paludis/literal_metadata_key.hh>
#include <paludis/mask.hh>
+#include <paludis/user_dep_spec.hh>
#include <tr1/functional>
using namespace paludis;
@@ -307,6 +308,13 @@ GemSpecification::canonical_form(const PackageIDCanonicalForm f) const
throw InternalError(PALUDIS_HERE, "Bad PackageIDCanonicalForm");
}
+PackageDepSpec
+GemSpecification::uniquely_identifying_spec() const
+{
+ return parse_user_package_dep_spec("=" + stringify(name()) + "-" + stringify(version()) + "::" + stringify(repository()->name()),
+ _imp->environment, UserPackageDepSpecOptions());
+}
+
const QualifiedPackageName
GemSpecification::name() const
{
diff --git a/paludis/repositories/gems/gem_specification.hh b/paludis/repositories/gems/gem_specification.hh
index 5691dfa..752b379 100644
--- a/paludis/repositories/gems/gem_specification.hh
+++ b/paludis/repositories/gems/gem_specification.hh
@@ -88,6 +88,7 @@ namespace paludis
virtual const QualifiedPackageName name() const;
virtual const VersionSpec version() const;
virtual const std::tr1::shared_ptr<const Repository> repository() const;
+ virtual PackageDepSpec uniquely_identifying_spec() 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;
diff --git a/paludis/repositories/unavailable/unavailable_id.cc b/paludis/repositories/unavailable/unavailable_id.cc
index 5682a49..3ae025c 100644
--- a/paludis/repositories/unavailable/unavailable_id.cc
+++ b/paludis/repositories/unavailable/unavailable_id.cc
@@ -32,6 +32,7 @@
#include <paludis/literal_metadata_key.hh>
#include <paludis/action.hh>
#include <paludis/unchoices_key.hh>
+#include <paludis/user_dep_spec.hh>
using namespace paludis;
using namespace paludis::unavailable_repository;
@@ -41,6 +42,7 @@ namespace paludis
template <>
struct Implementation<UnavailableID>
{
+ const Environment * const env;
const QualifiedPackageName name;
const VersionSpec version;
const UnavailableRepository * const repo;
@@ -54,6 +56,7 @@ namespace paludis
Implementation(
const UnavailableIDParams & e) :
+ env(e.environment()),
name(e.name()),
version(e.version()),
repo(e.repository()),
@@ -123,6 +126,15 @@ UnavailableID::canonical_form(const PackageIDCanonicalForm f) const
throw InternalError(PALUDIS_HERE, "Bad PackageIDCanonicalForm");
}
+PackageDepSpec
+UnavailableID::uniquely_identifying_spec() const
+{
+ return parse_user_package_dep_spec("=" + stringify(name()) + "-" + stringify(version()) +
+ (slot_key() ? ":" + stringify(slot_key()->value()) : "") + "::" + stringify(repository()->name()) +
+ "[." + _imp->from_repositories_key->raw_name() + "=" + *_imp->from_repositories_key->value()->begin() + "]",
+ _imp->env, UserPackageDepSpecOptions());
+}
+
const QualifiedPackageName
UnavailableID::name() const
{
diff --git a/paludis/repositories/unavailable/unavailable_id.hh b/paludis/repositories/unavailable/unavailable_id.hh
index 49596ed..d28dd8c 100644
--- a/paludis/repositories/unavailable/unavailable_id.hh
+++ b/paludis/repositories/unavailable/unavailable_id.hh
@@ -30,6 +30,7 @@ namespace paludis
namespace n
{
struct description;
+ struct environment;
struct from_repositories;
struct mask;
struct name;
@@ -45,6 +46,7 @@ namespace paludis
struct UnavailableIDParams
{
NamedValue<n::description, std::tr1::shared_ptr<const MetadataValueKey<std::string> > > description;
+ NamedValue<n::environment, const Environment *> environment;
NamedValue<n::from_repositories, std::tr1::shared_ptr<const MetadataCollectionKey<Set<std::string> > > > from_repositories;
NamedValue<n::mask, std::tr1::shared_ptr<const Mask> > mask;
NamedValue<n::name, QualifiedPackageName> name;
@@ -74,6 +76,7 @@ namespace paludis
const QualifiedPackageName name() const;
const VersionSpec version() const;
const std::tr1::shared_ptr<const Repository> repository() const;
+ virtual PackageDepSpec uniquely_identifying_spec() 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> > >
diff --git a/paludis/repositories/unavailable/unavailable_repository_store.cc b/paludis/repositories/unavailable/unavailable_repository_store.cc
index 35cc41d..fbda50b 100644
--- a/paludis/repositories/unavailable/unavailable_repository_store.cc
+++ b/paludis/repositories/unavailable/unavailable_repository_store.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
@@ -164,6 +164,7 @@ UnavailableRepositoryStore::_populate_one(const Environment * const env, const F
ids->push_back(make_shared_ptr(new UnavailableID(make_named_values<UnavailableIDParams>(
value_for<n::description>((*i).description()),
+ value_for<n::environment>(env),
value_for<n::from_repositories>(from_repositories),
value_for<n::mask>(mask),
value_for<n::name>((*i).name()),
diff --git a/paludis/repositories/unpackaged/installed_id.cc b/paludis/repositories/unpackaged/installed_id.cc
index 78013ab..52ab32a 100644
--- a/paludis/repositories/unpackaged/installed_id.cc
+++ b/paludis/repositories/unpackaged/installed_id.cc
@@ -43,6 +43,7 @@
#include <paludis/metadata_key.hh>
#include <paludis/literal_metadata_key.hh>
#include <paludis/action.hh>
+#include <paludis/user_dep_spec.hh>
#include <tr1/functional>
using namespace paludis;
@@ -513,6 +514,14 @@ InstalledUnpackagedID::canonical_form(const PackageIDCanonicalForm f) const
throw InternalError(PALUDIS_HERE, "Bad PackageIDCanonicalForm");
}
+PackageDepSpec
+InstalledUnpackagedID::uniquely_identifying_spec() const
+{
+ return parse_user_package_dep_spec("=" + stringify(name()) + "-" + stringify(version()) +
+ (slot_key() ? ":" + stringify(slot_key()->value()) : "") + "::" + stringify(repository()->name()),
+ _imp->env, UserPackageDepSpecOptions());
+}
+
const QualifiedPackageName
InstalledUnpackagedID::name() const
{
diff --git a/paludis/repositories/unpackaged/installed_id.hh b/paludis/repositories/unpackaged/installed_id.hh
index f70c16e..a9bec88 100644
--- a/paludis/repositories/unpackaged/installed_id.hh
+++ b/paludis/repositories/unpackaged/installed_id.hh
@@ -56,6 +56,7 @@ namespace paludis
virtual const QualifiedPackageName name() const;
virtual const VersionSpec version() const;
virtual const std::tr1::shared_ptr<const Repository> repository() const;
+ virtual PackageDepSpec uniquely_identifying_spec() 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;
diff --git a/paludis/repositories/unpackaged/unpackaged_id.cc b/paludis/repositories/unpackaged/unpackaged_id.cc
index f50f733..4e2816e 100644
--- a/paludis/repositories/unpackaged/unpackaged_id.cc
+++ b/paludis/repositories/unpackaged/unpackaged_id.cc
@@ -40,6 +40,7 @@
#include <paludis/literal_metadata_key.hh>
#include <paludis/choice.hh>
#include <paludis/elike_choices.hh>
+#include <paludis/user_dep_spec.hh>
using namespace paludis;
using namespace paludis::unpackaged_repositories;
@@ -146,6 +147,14 @@ UnpackagedID::canonical_form(const PackageIDCanonicalForm f) const
throw InternalError(PALUDIS_HERE, "Bad PackageIDCanonicalForm");
}
+PackageDepSpec
+UnpackagedID::uniquely_identifying_spec() const
+{
+ return parse_user_package_dep_spec("=" + stringify(name()) + "-" + stringify(version()) +
+ (slot_key() ? ":" + stringify(slot_key()->value()) : "") + "::" + stringify(repository()->name()),
+ _imp->env, UserPackageDepSpecOptions());
+}
+
const QualifiedPackageName
UnpackagedID::name() const
{
diff --git a/paludis/repositories/unpackaged/unpackaged_id.hh b/paludis/repositories/unpackaged/unpackaged_id.hh
index 7fe9159..d7f5da4 100644
--- a/paludis/repositories/unpackaged/unpackaged_id.hh
+++ b/paludis/repositories/unpackaged/unpackaged_id.hh
@@ -53,6 +53,7 @@ namespace paludis
virtual const QualifiedPackageName name() const;
virtual const VersionSpec version() const;
virtual const std::tr1::shared_ptr<const Repository> repository() const;
+ virtual PackageDepSpec uniquely_identifying_spec() 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;
diff --git a/paludis/repositories/unwritten/unwritten_id.cc b/paludis/repositories/unwritten/unwritten_id.cc
index 64bc478..b4a61e9 100644
--- a/paludis/repositories/unwritten/unwritten_id.cc
+++ b/paludis/repositories/unwritten/unwritten_id.cc
@@ -30,6 +30,7 @@
#include <paludis/metadata_key.hh>
#include <paludis/action.hh>
#include <paludis/unchoices_key.hh>
+#include <paludis/user_dep_spec.hh>
using namespace paludis;
using namespace paludis::unwritten_repository;
@@ -39,6 +40,7 @@ namespace paludis
template <>
struct Implementation<UnwrittenID>
{
+ const Environment * const env;
const QualifiedPackageName name;
const VersionSpec version;
const UnwrittenRepository * const repo;
@@ -55,6 +57,7 @@ namespace paludis
Implementation(
const UnwrittenIDParams & e) :
+ env(e.environment()),
name(e.name()),
version(e.version()),
repo(e.repository()),
@@ -130,6 +133,14 @@ UnwrittenID::canonical_form(const PackageIDCanonicalForm f) const
throw InternalError(PALUDIS_HERE, "Bad PackageIDCanonicalForm");
}
+PackageDepSpec
+UnwrittenID::uniquely_identifying_spec() const
+{
+ return parse_user_package_dep_spec("=" + stringify(name()) + "-" + stringify(version()) +
+ (slot_key() ? ":" + stringify(slot_key()->value()) : "") + "::" + stringify(repository()->name()),
+ _imp->env, UserPackageDepSpecOptions());
+}
+
const QualifiedPackageName
UnwrittenID::name() const
{
diff --git a/paludis/repositories/unwritten/unwritten_id.hh b/paludis/repositories/unwritten/unwritten_id.hh
index 9ced431..8eecee9 100644
--- a/paludis/repositories/unwritten/unwritten_id.hh
+++ b/paludis/repositories/unwritten/unwritten_id.hh
@@ -33,6 +33,7 @@ namespace paludis
struct bug_ids;
struct comment;
struct description;
+ struct environment;
struct homepage;
struct mask;
struct name;
@@ -52,6 +53,7 @@ namespace paludis
NamedValue<n::bug_ids, std::tr1::shared_ptr<const MetadataCollectionKey<Sequence<std::string> > > > bug_ids;
NamedValue<n::comment, std::tr1::shared_ptr<const MetadataValueKey<std::string> > > comment;
NamedValue<n::description, std::tr1::shared_ptr<const MetadataValueKey<std::string> > > description;
+ NamedValue<n::environment, const Environment *> environment;
NamedValue<n::homepage, std::tr1::shared_ptr<const MetadataSpecTreeKey<SimpleURISpecTree> > > homepage;
NamedValue<n::mask, std::tr1::shared_ptr<const Mask> > mask;
NamedValue<n::name, QualifiedPackageName> name;
@@ -80,6 +82,7 @@ namespace paludis
const QualifiedPackageName name() const;
const VersionSpec version() const;
const std::tr1::shared_ptr<const Repository> repository() const;
+ virtual PackageDepSpec uniquely_identifying_spec() 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;
diff --git a/paludis/repositories/unwritten/unwritten_repository_store.cc b/paludis/repositories/unwritten/unwritten_repository_store.cc
index cf5fc36..b961860 100644
--- a/paludis/repositories/unwritten/unwritten_repository_store.cc
+++ b/paludis/repositories/unwritten/unwritten_repository_store.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
@@ -95,7 +95,7 @@ UnwrittenRepositoryStore::_populate(const Environment * const env, const FSEntry
}
void
-UnwrittenRepositoryStore::_populate_one(const Environment * const, const FSEntry & f)
+UnwrittenRepositoryStore::_populate_one(const Environment * const env, const FSEntry & f)
{
if (! is_file_with_extension(f, ".conf", IsFileWithOptions()))
return;
@@ -138,6 +138,7 @@ UnwrittenRepositoryStore::_populate_one(const Environment * const, const FSEntry
value_for<n::bug_ids>((*i).bug_ids()),
value_for<n::comment>((*i).comment()),
value_for<n::description>((*i).description()),
+ value_for<n::environment>(env),
value_for<n::homepage>((*i).homepage()),
value_for<n::mask>(mask),
value_for<n::name>((*i).name()),
diff --git a/paludis/repositories/virtuals/package_id.cc b/paludis/repositories/virtuals/package_id.cc
index e3334cc..58642b0 100644
--- a/paludis/repositories/virtuals/package_id.cc
+++ b/paludis/repositories/virtuals/package_id.cc
@@ -238,6 +238,15 @@ VirtualsPackageID::canonical_form(const PackageIDCanonicalForm f) const
throw InternalError(PALUDIS_HERE, "Bad PackageIDCanonicalForm");
}
+PackageDepSpec
+VirtualsPackageID::uniquely_identifying_spec() const
+{
+ return parse_user_package_dep_spec("=" + stringify(name()) + "-" + stringify(version()) +
+ (slot_key() ? ":" + stringify(slot_key()->value()) : "") + "::" + stringify(repository()->name()) +
+ "[." + _imp->virtual_for->raw_name() + "=" + stringify(*_imp->virtual_for->value()) + "]",
+ _imp->env, UserPackageDepSpecOptions());
+}
+
const QualifiedPackageName
VirtualsPackageID::name() const
{
diff --git a/paludis/repositories/virtuals/package_id.hh b/paludis/repositories/virtuals/package_id.hh
index 18ff6be..78f3ce1 100644
--- a/paludis/repositories/virtuals/package_id.hh
+++ b/paludis/repositories/virtuals/package_id.hh
@@ -85,6 +85,7 @@ namespace paludis
virtual const QualifiedPackageName name() const;
virtual const VersionSpec version() const;
virtual const std::tr1::shared_ptr<const Repository> repository() const;
+ virtual PackageDepSpec uniquely_identifying_spec() 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;