aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-11-28 21:56:40 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-11-28 21:56:40 +0000
commit8dcd5e80f234094c18905718067f946829f6924a (patch)
tree7324dab4f21495357e22db437bb23c6bd7e33cc1
parent057ce0bef81f7f95b09e464f3c6205c3f0b35dac (diff)
downloadpaludis-8dcd5e80f234094c18905718067f946829f6924a.tar.gz
paludis-8dcd5e80f234094c18905718067f946829f6924a.tar.xz
Support package origins. Show origins in --query
-rw-r--r--paludis/repositories/vdb/vdb_repository.cc5
-rw-r--r--paludis/version_metadata.cc8
-rw-r--r--paludis/version_metadata.sr20
-rw-r--r--src/paludis/query.cc7
4 files changed, 40 insertions, 0 deletions
diff --git a/paludis/repositories/vdb/vdb_repository.cc b/paludis/repositories/vdb/vdb_repository.cc
index 468c150..44c9e21 100644
--- a/paludis/repositories/vdb/vdb_repository.cc
+++ b/paludis/repositories/vdb/vdb_repository.cc
@@ -427,6 +427,11 @@ namespace paludis
}
p->metadata->slot = SlotName(slot);
+ std::string repo(file_contents(location, p->name, p->version, "REPOSITORY"));
+ if (! repo.empty())
+ p->metadata->origins.source.assign(new PackageDatabaseEntry(p->name, p->version,
+ RepositoryName(repo)));
+
std::string raw_use(file_contents(location, p->name, p->version, "USE"));
p->use.clear();
WhitespaceTokeniser::get_instance()->tokenise(raw_use,
diff --git a/paludis/version_metadata.cc b/paludis/version_metadata.cc
index 3786602..fce66bb 100644
--- a/paludis/version_metadata.cc
+++ b/paludis/version_metadata.cc
@@ -87,6 +87,7 @@ VersionMetadata::VersionMetadata(ParserFunction p) :
VersionMetadataBase(VersionMetadataBase::create()
.slot(SlotName("unset"))
.deps(VersionMetadataDeps(p))
+ .origins(VersionMetadataOrigins())
.homepage("")
.license_string("")
.description("")
@@ -106,6 +107,7 @@ VersionMetadata::VersionMetadata(ParserFunction p,
VersionMetadataBase(VersionMetadataBase::create()
.slot(SlotName("unset"))
.deps(VersionMetadataDeps(p))
+ .origins(VersionMetadataOrigins())
.homepage("")
.license_string("")
.description("")
@@ -153,3 +155,9 @@ VersionMetadata::Virtual::Virtual(ParserFunction p, const PackageDatabaseEntry &
{
}
+VersionMetadataOrigins::VersionMetadataOrigins() :
+ source(0),
+ binary(0)
+{
+}
+
diff --git a/paludis/version_metadata.sr b/paludis/version_metadata.sr
index 87e3a74..c7de2ca 100644
--- a/paludis/version_metadata.sr
+++ b/paludis/version_metadata.sr
@@ -39,9 +39,29 @@ END
END
}
+make_class_VersionMetadataOrigins()
+{
+ key "source" "CountedPtr<PackageDatabaseEntry, count_policy::ExternalCountTag>"
+ key "binary" "CountedPtr<PackageDatabaseEntry, count_policy::ExternalCountTag>"
+
+ extra_constructors <<END
+ VersionMetadataOrigins();
+END
+
+ doxygen_comment << "END"
+ /**
+ * Origins data for VersionMetadata.
+ *
+ * \see VersionMetadata
+ * \ingroup grpversions
+ */
+END
+}
+
make_class_VersionMetadataBase()
{
key deps VersionMetadataDeps
+ key origins VersionMetadataOrigins
key slot SlotName
key license_string std::string
key eapi std::string
diff --git a/src/paludis/query.cc b/src/paludis/query.cc
index c786758..0821f4f 100644
--- a/src/paludis/query.cc
+++ b/src/paludis/query.cc
@@ -258,6 +258,13 @@ void do_one_package_query(
}
}
+ if (metadata->origins.source)
+ cout << " " << std::setw(22) << std::left << "Source origin:" << std::setw(0)
+ << " " << colour(cl_package_name, *metadata->origins.source) << endl;
+ if (metadata->origins.binary)
+ cout << " " << std::setw(22) << std::left << "Binary origin:" << std::setw(0)
+ << " " << colour(cl_package_name, *metadata->origins.binary) << endl;
+
if (metadata->get_ebuild_interface())
{
if (! metadata->get_ebuild_interface()->provide_string.empty())