diff options
7 files changed, 97 insertions, 4 deletions
diff --git a/paludis/repositories/unwritten/unwritten_id.cc b/paludis/repositories/unwritten/unwritten_id.cc index f385e4f60..6a5f30a44 100644 --- a/paludis/repositories/unwritten/unwritten_id.cc +++ b/paludis/repositories/unwritten/unwritten_id.cc @@ -52,6 +52,9 @@ namespace paludis const std::shared_ptr<const MetadataSpecTreeKey<SimpleURISpecTree> > homepage_key; const std::shared_ptr<const MetadataCollectionKey<Sequence<std::string> > > bug_ids_key; const std::shared_ptr<const MetadataCollectionKey<Sequence<std::string> > > remote_ids_key; + const std::shared_ptr<const MetadataCollectionKey<Set<std::string> > > removed_from_key; + const std::shared_ptr<const MetadataValueKey<std::string> > removed_by_key; + const std::shared_ptr<const MetadataValueKey<std::string> > commit_id_key; const std::shared_ptr<const MetadataValueKey<std::shared_ptr<const Choices> > > choices_key; const std::shared_ptr<const Mask> mask; @@ -68,6 +71,9 @@ namespace paludis homepage_key(e.homepage()), bug_ids_key(e.bug_ids()), remote_ids_key(e.remote_ids()), + removed_from_key(e.removed_from()), + removed_by_key(e.removed_by()), + commit_id_key(e.commit_id()), choices_key(unchoices_key()), mask(e.mask()) { @@ -93,6 +99,12 @@ UnwrittenID::UnwrittenID(const UnwrittenIDParams & entry) : add_metadata_key(_imp->bug_ids_key); if (_imp->remote_ids_key) add_metadata_key(_imp->remote_ids_key); + if (_imp->removed_from_key) + add_metadata_key(_imp->removed_from_key); + if (_imp->removed_by_key) + add_metadata_key(_imp->removed_by_key); + if (_imp->commit_id_key) + add_metadata_key(_imp->commit_id_key); add_mask(_imp->mask); } @@ -310,7 +322,7 @@ UnwrittenID::installed_time_key() const const std::shared_ptr<const MetadataCollectionKey<Set<std::string> > > UnwrittenID::from_repositories_key() const { - return std::shared_ptr<const MetadataCollectionKey<Set<std::string> > >(); + return _imp->removed_from_key; } const std::shared_ptr<const MetadataValueKey<std::shared_ptr<const Choices> > > diff --git a/paludis/repositories/unwritten/unwritten_id.hh b/paludis/repositories/unwritten/unwritten_id.hh index 2f1a96968..43c28d151 100644 --- a/paludis/repositories/unwritten/unwritten_id.hh +++ b/paludis/repositories/unwritten/unwritten_id.hh @@ -32,12 +32,15 @@ namespace paludis typedef Name<struct added_by_name> added_by; typedef Name<struct bug_ids_name> bug_ids; typedef Name<struct comment_name> comment; + typedef Name<struct commit_id_name> commit_id; typedef Name<struct description_name> description; typedef Name<struct environment_name> environment; typedef Name<struct homepage_name> homepage; typedef Name<struct mask_name> mask; typedef Name<struct name_name> name; typedef Name<struct remote_ids_name> remote_ids; + typedef Name<struct removed_by_name> removed_by; + typedef Name<struct removed_from_name> removed_from; typedef Name<struct repository_name> repository; typedef Name<struct slot_name> slot; typedef Name<struct version_name> version; @@ -52,12 +55,15 @@ namespace paludis NamedValue<n::added_by, std::shared_ptr<const MetadataValueKey<std::string> > > added_by; NamedValue<n::bug_ids, std::shared_ptr<const MetadataCollectionKey<Sequence<std::string> > > > bug_ids; NamedValue<n::comment, std::shared_ptr<const MetadataValueKey<std::string> > > comment; + NamedValue<n::commit_id, std::shared_ptr<const MetadataValueKey<std::string> > > commit_id; NamedValue<n::description, std::shared_ptr<const MetadataValueKey<std::string> > > description; NamedValue<n::environment, const Environment *> environment; NamedValue<n::homepage, std::shared_ptr<const MetadataSpecTreeKey<SimpleURISpecTree> > > homepage; NamedValue<n::mask, std::shared_ptr<const Mask> > mask; NamedValue<n::name, QualifiedPackageName> name; NamedValue<n::remote_ids, std::shared_ptr<const MetadataCollectionKey<Sequence<std::string> > > > remote_ids; + NamedValue<n::removed_by, std::shared_ptr<const MetadataValueKey<std::string> > > removed_by; + NamedValue<n::removed_from, std::shared_ptr<const MetadataCollectionKey<Set<std::string> > > > removed_from; NamedValue<n::repository, const UnwrittenRepository *> repository; NamedValue<n::slot, std::shared_ptr<const MetadataValueKey<SlotName> > > slot; NamedValue<n::version, VersionSpec> version; diff --git a/paludis/repositories/unwritten/unwritten_mask.cc b/paludis/repositories/unwritten/unwritten_mask.cc index ed8ca3400..441557637 100644 --- a/paludis/repositories/unwritten/unwritten_mask.cc +++ b/paludis/repositories/unwritten/unwritten_mask.cc @@ -1,7 +1,7 @@ /* vim: set sw=4 sts=4 et foldmethod=syntax : */ /* - * Copyright (c) 2008 Ciaran McCreesh + * Copyright (c) 2008, 2010 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 @@ -40,3 +40,21 @@ UnwrittenMask::explanation() const return "Package has not been written yet"; } +char +GraveyardMask::key() const +{ + return 'G'; +} + +const std::string +GraveyardMask::description() const +{ + return "graveyard"; +} + +const std::string +GraveyardMask::explanation() const +{ + return "Package has been deleted"; +} + diff --git a/paludis/repositories/unwritten/unwritten_mask.hh b/paludis/repositories/unwritten/unwritten_mask.hh index fc6982362..2789ee7f5 100644 --- a/paludis/repositories/unwritten/unwritten_mask.hh +++ b/paludis/repositories/unwritten/unwritten_mask.hh @@ -1,7 +1,7 @@ /* vim: set sw=4 sts=4 et foldmethod=syntax : */ /* - * Copyright (c) 2008 Ciaran McCreesh + * Copyright (c) 2008, 2010 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,15 @@ namespace paludis virtual char key() const; virtual const std::string description() const; }; + + class GraveyardMask : + public UnsupportedMask + { + public: + virtual const std::string explanation() const; + virtual char key() const; + virtual const std::string description() const; + }; } } diff --git a/paludis/repositories/unwritten/unwritten_repository_file.cc b/paludis/repositories/unwritten/unwritten_repository_file.cc index 0d3f5a966..cc6d6903c 100644 --- a/paludis/repositories/unwritten/unwritten_repository_file.cc +++ b/paludis/repositories/unwritten/unwritten_repository_file.cc @@ -55,6 +55,12 @@ namespace paludis struct Imp<UnwrittenRepositoryFile> { Entries entries; + bool is_graveyard; + + Imp() : + is_graveyard(false) + { + } }; template <> @@ -197,6 +203,16 @@ UnwrittenRepositoryFile::_load(const FSPath & f) throw UnwrittenRepositoryConfigurationError( "Unsupported format '" + value + "' in '" + stringify(f) + "'"); } + else if (key == "role") + { + if (value == "graveyard") + _imp->is_graveyard = true; + else if (value == "unwritten") + _imp->is_graveyard = false; + else + Log::get_instance()->message("unwritten_repository.file.unknown_key", ll_warning, lc_context) + << "Ignoring unknown key value '" << value << "' for key '" << key << "'"; + } else Log::get_instance()->message("unwritten_repository.file.unknown_key", ll_warning, lc_context) << "Ignoring unknown key '" << key << "' with value '" << value << "'"; @@ -293,10 +309,13 @@ UnwrittenRepositoryFile::_load(const FSPath & f) n::added_by() = std::shared_ptr<const MetadataValueKey<std::string> >(), n::bug_ids() = std::shared_ptr<const MetadataCollectionKey<Sequence<std::string> > >(), n::comment() = std::shared_ptr<const MetadataValueKey<std::string> >(), + n::commit_id() = std::shared_ptr<const MetadataValueKey<std::string> >(), n::description() = std::shared_ptr<const MetadataValueKey<std::string> >(), n::homepage() = std::shared_ptr<const MetadataSpecTreeKey<SimpleURISpecTree> >(), n::name() = category + package, n::remote_ids() = std::shared_ptr<const MetadataCollectionKey<Sequence<std::string> > >(), + n::removed_by() = std::shared_ptr<const MetadataValueKey<std::string> >(), + n::removed_from() = std::shared_ptr<const MetadataCollectionKey<Set<std::string> > >(), n::slot() = slot, n::version() = version )); @@ -316,8 +335,18 @@ UnwrittenRepositoryFile::_load(const FSPath & f) } else if (token == "comment") entry->comment() = std::make_shared<LiteralMetadataValueKey<std::string>>("comment", "Comment", mkt_normal, token2); + else if (token == "commit-id") + entry->commit_id() = std::make_shared<LiteralMetadataValueKey<std::string>>("commit-id", "Commit ID", mkt_normal, token2); else if (token == "added-by") entry->added_by() = std::make_shared<LiteralMetadataValueKey<std::string>>("added-by", "Added by", mkt_author, token2); + else if (token == "removed-by") + entry->removed_by() = std::make_shared<LiteralMetadataValueKey<std::string>>("removed-by", "Removed by", mkt_author, token2); + else if (token == "removed-from") + { + auto t2s(std::make_shared<Set<std::string> >()); + t2s->insert(token2); + entry->removed_from() = std::make_shared<LiteralMetadataStringSetKey>("removed-from", "Removed from", mkt_author, t2s); + } else if (token == "bug-ids") { std::shared_ptr<Sequence<std::string> > seq(std::make_shared<Sequence<std::string>>()); @@ -351,6 +380,12 @@ UnwrittenRepositoryFile::_load(const FSPath & f) _imp->entries.push_back(*entry); } +bool +UnwrittenRepositoryFile::is_graveyard() const +{ + return _imp->is_graveyard; +} + template class Pimp<UnwrittenRepositoryFile>; template class WrappedForwardIterator<UnwrittenRepositoryFile::ConstIteratorTag, const UnwrittenRepositoryFileEntry>; diff --git a/paludis/repositories/unwritten/unwritten_repository_file.hh b/paludis/repositories/unwritten/unwritten_repository_file.hh index 77d8dafe2..aac231fde 100644 --- a/paludis/repositories/unwritten/unwritten_repository_file.hh +++ b/paludis/repositories/unwritten/unwritten_repository_file.hh @@ -36,10 +36,13 @@ namespace paludis typedef Name<struct added_by_name> added_by; typedef Name<struct bug_ids_name> bug_ids; typedef Name<struct comment_name> comment; + typedef Name<struct commit_id_name> commit_id; typedef Name<struct description_name> description; typedef Name<struct homepage_name> homepage; typedef Name<struct name_name> name; typedef Name<struct remote_ids_name> remote_ids; + typedef Name<struct removed_by_name> removed_by; + typedef Name<struct removed_from_name> removed_from; typedef Name<struct slot_name> slot; typedef Name<struct version_name> version; } @@ -53,10 +56,13 @@ namespace paludis NamedValue<n::added_by, std::shared_ptr<const MetadataValueKey<std::string> > > added_by; NamedValue<n::bug_ids, std::shared_ptr<const MetadataCollectionKey<Sequence<std::string> > > > bug_ids; NamedValue<n::comment, std::shared_ptr<const MetadataValueKey<std::string> > > comment; + NamedValue<n::commit_id, std::shared_ptr<const MetadataValueKey<std::string> > > commit_id; NamedValue<n::description, std::shared_ptr<const MetadataValueKey<std::string> > > description; NamedValue<n::homepage, std::shared_ptr<const MetadataSpecTreeKey<SimpleURISpecTree> > > homepage; NamedValue<n::name, QualifiedPackageName> name; NamedValue<n::remote_ids, std::shared_ptr<const MetadataCollectionKey<Sequence<std::string> > > > remote_ids; + NamedValue<n::removed_by, std::shared_ptr<const MetadataValueKey<std::string> > > removed_by; + NamedValue<n::removed_from, std::shared_ptr<const MetadataCollectionKey<Set<std::string> > > > removed_from; NamedValue<n::slot, std::shared_ptr<const MetadataValueKey<SlotName> > > slot; NamedValue<n::version, VersionSpec> version; }; @@ -75,6 +81,8 @@ namespace paludis typedef WrappedForwardIterator<ConstIteratorTag, const UnwrittenRepositoryFileEntry> ConstIterator; ConstIterator begin() const PALUDIS_ATTRIBUTE((warn_unused_result)); ConstIterator end() const PALUDIS_ATTRIBUTE((warn_unused_result)); + + bool is_graveyard() const PALUDIS_ATTRIBUTE((warn_unused_result)); }; } diff --git a/paludis/repositories/unwritten/unwritten_repository_store.cc b/paludis/repositories/unwritten/unwritten_repository_store.cc index 1d9b077a2..d68032276 100644 --- a/paludis/repositories/unwritten/unwritten_repository_store.cc +++ b/paludis/repositories/unwritten/unwritten_repository_store.cc @@ -102,7 +102,9 @@ UnwrittenRepositoryStore::_populate_one(const Environment * const env, const FSP UnwrittenRepositoryFile file(f); - std::shared_ptr<Mask> mask(std::make_shared<UnwrittenMask>()); + std::shared_ptr<Mask> mask(file.is_graveyard() ? + std::shared_ptr<Mask>(std::make_shared<GraveyardMask>()) : + std::shared_ptr<Mask>(std::make_shared<UnwrittenMask>())); QualifiedPackageName old_name("x/x"); std::shared_ptr<QualifiedPackageNameSet> pkgs; @@ -135,12 +137,15 @@ UnwrittenRepositoryStore::_populate_one(const Environment * const env, const FSP n::added_by() = (*i).added_by(), n::bug_ids() = (*i).bug_ids(), n::comment() = (*i).comment(), + n::commit_id() = (*i).commit_id(), n::description() = (*i).description(), n::environment() = env, n::homepage() = (*i).homepage(), n::mask() = mask, n::name() = (*i).name(), n::remote_ids() = (*i).remote_ids(), + n::removed_by() = (*i).removed_by(), + n::removed_from() = (*i).removed_from(), n::repository() = _imp->repo, n::slot() = (*i).slot(), n::version() = (*i).version() |