diff options
author | 2011-09-04 22:08:23 +0100 | |
---|---|---|
committer | 2011-09-04 22:08:23 +0100 | |
commit | e4445c29bad5f4b6eca307dcb5927ab7ac021df7 (patch) | |
tree | 506cf193175dba526c81fbec54469fc7b3c1413c | |
parent | c90d4dec7920a8d70949d8e2e71e704d2800d2c1 (diff) | |
download | paludis-e4445c29bad5f4b6eca307dcb5927ab7ac021df7.tar.gz paludis-e4445c29bad5f4b6eca307dcb5927ab7ac021df7.tar.xz |
Remove PackageID::contents_key
49 files changed, 36 insertions, 194 deletions
diff --git a/doc/api/cplusplus/examples/example_contents.cc b/doc/api/cplusplus/examples/example_contents.cc index 43375a0f8..a338f6ad1 100644 --- a/doc/api/cplusplus/examples/example_contents.cc +++ b/doc/api/cplusplus/examples/example_contents.cc @@ -80,9 +80,9 @@ int main(int argc, char * argv[]) for (PackageIDSequence::ConstIterator i(ids->begin()), i_end(ids->end()) ; i != i_end ; ++i) { - /* Do we have a contents key? PackageID _key() methods can return - * a zero pointer. */ - if (! (*i)->contents_key()) + /* Do we have contents key?*/ + auto contents((*i)->contents()); + if (! contents) { cout << "ID '" << **i << "' does not provide a contents key." << endl; } @@ -94,7 +94,6 @@ int main(int argc, char * argv[]) * indirect_iterator because choices->begin() and ->end() return * iterators to std::shared_ptr<>s rather than raw objects. */ ContentsPrinter p; - auto contents((*i)->contents_key()->parse_value()); std::for_each( indirect_iterator(contents->begin()), indirect_iterator(contents->end()), diff --git a/doc/api/ruby/example_contents.rb b/doc/api/ruby/example_contents.rb index 0d5bb0906..98f7cf761 100644 --- a/doc/api/ruby/example_contents.rb +++ b/doc/api/ruby/example_contents.rb @@ -23,14 +23,15 @@ ids = env[Selection::AllVersionsSorted.new( # For each ID: ids.each do | id | - # Do we have a contents key? PackageID _key methods can return Nil. - if not id.contents_key + # Do we have contents? This can return nil + contents = id.contents + if contents puts "ID '#{id}' does not provide a contents key." else puts "ID '#{id}' provides contents key:" # Contents is made up of a collection of ContentsEntry instances. - id.contents_key.parse_value.each do | c | + contents.each do | c | # Some ContentsEntry subclasses contain more information than others if c.kind_of? ContentsOtherEntry diff --git a/paludis/broken_linkage_finder.cc b/paludis/broken_linkage_finder.cc index d8bdd9afb..2cc0cbaa9 100644 --- a/paludis/broken_linkage_finder.cc +++ b/paludis/broken_linkage_finder.cc @@ -331,10 +331,7 @@ Imp<BrokenLinkageFinder>::gather_package(const std::shared_ptr<const PackageID> Context ctx("When gathering the contents of " + stringify(*pkg) + ":"); - std::shared_ptr<const MetadataValueKey<std::shared_ptr<const Contents> > > key(pkg->contents_key()); - if (! key) - return; - std::shared_ptr<const Contents> contents(key->parse_value()); + auto contents(pkg->contents()); if (! contents) return; diff --git a/paludis/contents.hh b/paludis/contents.hh index 38fde1a19..818f55b84 100644 --- a/paludis/contents.hh +++ b/paludis/contents.hh @@ -191,7 +191,7 @@ namespace paludis }; /** - * A package's contents, obtainable by PackageID::contents_key. + * A package's contents, obtainable by PackageID::contents. * * \ingroup g_contents * \nosubgrouping diff --git a/paludis/package_id.hh b/paludis/package_id.hh index d1a43d5f0..65d32e8f7 100644 --- a/paludis/package_id.hh +++ b/paludis/package_id.hh @@ -246,14 +246,6 @@ namespace paludis virtual const std::shared_ptr<const MetadataValueKey<std::string> > long_description_key() const = 0; /** - * The contents_key, if non-zero, contains the contents of a - * package. For installed packages, this means the files installed; - * for installable packages, this means the files that will be - * installed (if known, which it may be for some binary packages). - */ - virtual const std::shared_ptr<const MetadataValueKey<std::shared_ptr<const Contents> > > contents_key() const = 0; - - /** * The installed_time_key, if non-zero, contains the time a package * was installed. It affects dependency resolution if DepList is * using dl_reinstall_scm_daily or dl_reinstall_scm_weekly. diff --git a/paludis/repositories/accounts/accounts_id.cc b/paludis/repositories/accounts/accounts_id.cc index 88a80affe..a0e7c1f91 100644 --- a/paludis/repositories/accounts/accounts_id.cc +++ b/paludis/repositories/accounts/accounts_id.cc @@ -371,12 +371,6 @@ AccountsID::long_description_key() const return make_null_shared_ptr(); } -const std::shared_ptr<const MetadataValueKey<std::shared_ptr<const Contents> > > -AccountsID::contents_key() const -{ - return make_null_shared_ptr(); -} - const std::shared_ptr<const MetadataTimeKey> AccountsID::installed_time_key() const { diff --git a/paludis/repositories/accounts/accounts_id.hh b/paludis/repositories/accounts/accounts_id.hh index a310b0528..3fd41db77 100644 --- a/paludis/repositories/accounts/accounts_id.hh +++ b/paludis/repositories/accounts/accounts_id.hh @@ -70,7 +70,6 @@ namespace paludis virtual const std::shared_ptr<const MetadataSpecTreeKey<SimpleURISpecTree> > homepage_key() const; virtual const std::shared_ptr<const MetadataValueKey<std::string> > short_description_key() const; virtual const std::shared_ptr<const MetadataValueKey<std::string> > long_description_key() const; - virtual const std::shared_ptr<const MetadataValueKey<std::shared_ptr<const Contents> > > contents_key() const; virtual const std::shared_ptr<const MetadataTimeKey> installed_time_key() const; virtual const std::shared_ptr<const MetadataCollectionKey<Set<std::string> > > from_repositories_key() const; virtual const std::shared_ptr<const MetadataValueKey<FSPath> > fs_location_key() const; diff --git a/paludis/repositories/accounts/installed_accounts_id.cc b/paludis/repositories/accounts/installed_accounts_id.cc index 50580c4c1..c69aa2889 100644 --- a/paludis/repositories/accounts/installed_accounts_id.cc +++ b/paludis/repositories/accounts/installed_accounts_id.cc @@ -282,12 +282,6 @@ InstalledAccountsID::long_description_key() const return make_null_shared_ptr(); } -const std::shared_ptr<const MetadataValueKey<std::shared_ptr<const Contents> > > -InstalledAccountsID::contents_key() const -{ - return make_null_shared_ptr(); -} - const std::shared_ptr<const MetadataTimeKey> InstalledAccountsID::installed_time_key() const { diff --git a/paludis/repositories/accounts/installed_accounts_id.hh b/paludis/repositories/accounts/installed_accounts_id.hh index 5328c2626..02572f525 100644 --- a/paludis/repositories/accounts/installed_accounts_id.hh +++ b/paludis/repositories/accounts/installed_accounts_id.hh @@ -68,7 +68,6 @@ namespace paludis virtual const std::shared_ptr<const MetadataSpecTreeKey<SimpleURISpecTree> > homepage_key() const; virtual const std::shared_ptr<const MetadataValueKey<std::string> > short_description_key() const; virtual const std::shared_ptr<const MetadataValueKey<std::string> > long_description_key() const; - virtual const std::shared_ptr<const MetadataValueKey<std::shared_ptr<const Contents> > > contents_key() const; virtual const std::shared_ptr<const MetadataTimeKey> installed_time_key() const; virtual const std::shared_ptr<const MetadataCollectionKey<Set<std::string> > > from_repositories_key() const; virtual const std::shared_ptr<const MetadataValueKey<FSPath> > fs_location_key() const; diff --git a/paludis/repositories/e/e_installed_repository_id.cc b/paludis/repositories/e/e_installed_repository_id.cc index 16bcea26d..a3a03b6ca 100644 --- a/paludis/repositories/e/e_installed_repository_id.cc +++ b/paludis/repositories/e/e_installed_repository_id.cc @@ -860,17 +860,11 @@ EInstalledRepositoryID::long_description_key() const return _imp->keys->long_description; } -const std::shared_ptr<const MetadataValueKey<std::shared_ptr<const Contents> > > -EInstalledRepositoryID::contents_key() const -{ - need_keys_added(); - return _imp->keys->contents; -} - const std::shared_ptr<const Contents> EInstalledRepositoryID::contents() const { - return contents_key()->parse_value(); + need_keys_added(); + return _imp->keys->contents->parse_value(); } const std::shared_ptr<const MetadataTimeKey> diff --git a/paludis/repositories/e/e_installed_repository_id.hh b/paludis/repositories/e/e_installed_repository_id.hh index 8fa93bc66..58000fc4d 100644 --- a/paludis/repositories/e/e_installed_repository_id.hh +++ b/paludis/repositories/e/e_installed_repository_id.hh @@ -69,7 +69,6 @@ namespace paludis virtual const std::shared_ptr<const MetadataSpecTreeKey<SimpleURISpecTree> > homepage_key() const; virtual const std::shared_ptr<const MetadataValueKey<std::string> > short_description_key() const; virtual const std::shared_ptr<const MetadataValueKey<std::string> > long_description_key() const; - virtual const std::shared_ptr<const MetadataValueKey<std::shared_ptr<const Contents> > > contents_key() const; virtual const std::shared_ptr<const MetadataTimeKey> installed_time_key() const; virtual const std::shared_ptr<const MetadataValueKey<FSPath> > fs_location_key() const; virtual const std::shared_ptr<const MetadataCollectionKey<Set<std::string> > > from_repositories_key() const; diff --git a/paludis/repositories/e/ebuild_id.cc b/paludis/repositories/e/ebuild_id.cc index 0a34b5779..5ced8bcd4 100644 --- a/paludis/repositories/e/ebuild_id.cc +++ b/paludis/repositories/e/ebuild_id.cc @@ -869,12 +869,6 @@ EbuildID::long_description_key() const return _imp->long_description; } -const std::shared_ptr<const MetadataValueKey<std::shared_ptr<const Contents> > > -EbuildID::contents_key() const -{ - return std::shared_ptr<const MetadataValueKey<std::shared_ptr<const Contents> > >(); -} - const std::shared_ptr<const MetadataTimeKey> EbuildID::installed_time_key() const { diff --git a/paludis/repositories/e/ebuild_id.hh b/paludis/repositories/e/ebuild_id.hh index db76271e8..bc9d706a2 100644 --- a/paludis/repositories/e/ebuild_id.hh +++ b/paludis/repositories/e/ebuild_id.hh @@ -79,7 +79,6 @@ namespace paludis virtual const std::shared_ptr<const MetadataSpecTreeKey<SimpleURISpecTree> > homepage_key() const; virtual const std::shared_ptr<const MetadataValueKey<std::string> > short_description_key() const; virtual const std::shared_ptr<const MetadataValueKey<std::string> > long_description_key() const; - virtual const std::shared_ptr<const MetadataValueKey<std::shared_ptr<const Contents> > > contents_key() const; virtual const std::shared_ptr<const MetadataTimeKey> installed_time_key() const; virtual const std::shared_ptr<const MetadataValueKey<FSPath> > fs_location_key() const; virtual const std::shared_ptr<const MetadataValueKey<std::shared_ptr<const Choices> > > choices_key() const; diff --git a/paludis/repositories/e/exndbam_id.cc b/paludis/repositories/e/exndbam_id.cc index 7cc08faa6..21c530ba6 100644 --- a/paludis/repositories/e/exndbam_id.cc +++ b/paludis/repositories/e/exndbam_id.cc @@ -119,4 +119,3 @@ ExndbamID::make_contents_key() const return std::make_shared<ExndbamContentsKey>(this, _ndbam); } - diff --git a/paludis/repositories/e/vdb_repository.cc b/paludis/repositories/e/vdb_repository.cc index fe26f26f4..902e7c605 100644 --- a/paludis/repositories/e/vdb_repository.cc +++ b/paludis/repositories/e/vdb_repository.cc @@ -443,7 +443,7 @@ VDBRepository::perform_uninstall( std::shared_ptr<const Contents> contents(a.options.override_contents()); if (! contents) - contents = id->contents_key()->parse_value(); + contents = id->contents(); /* unmerge */ VDBUnmerger unmerger( @@ -689,7 +689,7 @@ VDBRepository::merge(const MergeParams & m) std::shared_ptr<const Contents> is_replace_contents; if (is_replace) { - is_replace_contents = is_replace->contents_key()->parse_value(); + is_replace_contents = is_replace->contents(); FSPath old_vdb_dir(_imp->params.location()); old_vdb_dir /= stringify(is_replace->name().category()); diff --git a/paludis/repositories/e/vdb_repository_TEST.cc b/paludis/repositories/e/vdb_repository_TEST.cc index b1c764646..5c1c36fa6 100644 --- a/paludis/repositories/e/vdb_repository_TEST.cc +++ b/paludis/repositories/e/vdb_repository_TEST.cc @@ -222,7 +222,7 @@ TEST(VDBRepository, Contents) PackageDepSpec(parse_user_package_dep_spec("=cat-one/pkg-one-1", &env, { })), make_null_shared_ptr(), { }))]->begin()); ContentsGatherer gatherer; - auto contents(e1->contents_key()->parse_value()); + auto contents(e1->contents()); std::for_each(indirect_iterator(contents->begin()), indirect_iterator(contents->end()), accept_visitor(gatherer)); diff --git a/paludis/repositories/e/vdb_unmerger_TEST.cc b/paludis/repositories/e/vdb_unmerger_TEST.cc index 949c09f91..37c3809db 100644 --- a/paludis/repositories/e/vdb_unmerger_TEST.cc +++ b/paludis/repositories/e/vdb_unmerger_TEST.cc @@ -122,7 +122,7 @@ namespace unmerger = std::make_shared<VDBUnmergerNoDisplay>(make_named_values<VDBUnmergerOptions>( n::config_protect() = "/protected_file /protected_dir", n::config_protect_mask() = "/protected_dir/unprotected_file /protected_dir/unprotected_dir", - n::contents() = id->contents_key()->parse_value(), + n::contents() = id->contents(), n::environment() = &env, n::ignore() = &ignore_nothing, n::output_manager() = std::make_shared<StandardOutputManager>(), diff --git a/paludis/repositories/fake/fake_package_id.cc b/paludis/repositories/fake/fake_package_id.cc index 5fbc7aa43..37d0c58a9 100644 --- a/paludis/repositories/fake/fake_package_id.cc +++ b/paludis/repositories/fake/fake_package_id.cc @@ -841,13 +841,6 @@ FakePackageID::long_description_key() const return std::shared_ptr<const MetadataValueKey<std::string> >(); } -const std::shared_ptr<const MetadataValueKey<std::shared_ptr<const Contents> > > -FakePackageID::contents_key() const -{ - need_keys_added(); - return std::shared_ptr<const MetadataValueKey<std::shared_ptr<const Contents> > >(); -} - const std::shared_ptr<const MetadataTimeKey> FakePackageID::installed_time_key() const { diff --git a/paludis/repositories/fake/fake_package_id.hh b/paludis/repositories/fake/fake_package_id.hh index 59d5b9d1b..7ae2185ab 100644 --- a/paludis/repositories/fake/fake_package_id.hh +++ b/paludis/repositories/fake/fake_package_id.hh @@ -249,7 +249,6 @@ namespace paludis virtual const std::shared_ptr<const MetadataSpecTreeKey<SimpleURISpecTree> > homepage_key() const; virtual const std::shared_ptr<const MetadataValueKey<std::string> > short_description_key() const; virtual const std::shared_ptr<const MetadataValueKey<std::string> > long_description_key() const; - virtual const std::shared_ptr<const MetadataValueKey<std::shared_ptr<const Contents> > > contents_key() const; virtual const std::shared_ptr<const MetadataTimeKey> installed_time_key() const; virtual const std::shared_ptr<const MetadataValueKey<FSPath> > fs_location_key() const; virtual const std::shared_ptr<const MetadataValueKey<long> > size_of_download_required_key() const; diff --git a/paludis/repositories/gemcutter/gemcutter_id.cc b/paludis/repositories/gemcutter/gemcutter_id.cc index ef426b04a..520628826 100644 --- a/paludis/repositories/gemcutter/gemcutter_id.cc +++ b/paludis/repositories/gemcutter/gemcutter_id.cc @@ -383,12 +383,6 @@ GemcutterID::homepage_key() const return _imp->homepage_uri_key; } -const std::shared_ptr<const MetadataValueKey<std::shared_ptr<const Contents> > > -GemcutterID::contents_key() const -{ - return std::shared_ptr<const MetadataValueKey<std::shared_ptr<const Contents> > >(); -} - const std::shared_ptr<const MetadataTimeKey> GemcutterID::installed_time_key() const { diff --git a/paludis/repositories/gemcutter/gemcutter_id.hh b/paludis/repositories/gemcutter/gemcutter_id.hh index 495b787ff..6ea648537 100644 --- a/paludis/repositories/gemcutter/gemcutter_id.hh +++ b/paludis/repositories/gemcutter/gemcutter_id.hh @@ -79,8 +79,6 @@ namespace paludis const std::shared_ptr<const MetadataSpecTreeKey<SimpleURISpecTree> > homepage_key() const; const std::shared_ptr<const MetadataValueKey<std::string> > short_description_key() const; const std::shared_ptr<const MetadataValueKey<std::string> > long_description_key() const; - const std::shared_ptr<const MetadataValueKey<std::shared_ptr<const Contents> > > - contents_key() const; const std::shared_ptr<const MetadataTimeKey> installed_time_key() const; const std::shared_ptr<const MetadataValueKey<FSPath> > fs_location_key() const; const std::shared_ptr<const MetadataCollectionKey<Set<std::string> > > behaviours_key() const; diff --git a/paludis/repositories/repository/repository_id.cc b/paludis/repositories/repository/repository_id.cc index 2e2789305..f2c6ac9e2 100644 --- a/paludis/repositories/repository/repository_id.cc +++ b/paludis/repositories/repository/repository_id.cc @@ -246,12 +246,6 @@ RepositoryID::homepage_key() const return std::shared_ptr<const MetadataSpecTreeKey<SimpleURISpecTree> >(); } -const std::shared_ptr<const MetadataValueKey<std::shared_ptr<const Contents> > > -RepositoryID::contents_key() const -{ - return std::shared_ptr<const MetadataValueKey<std::shared_ptr<const Contents> > >(); -} - const std::shared_ptr<const MetadataTimeKey> RepositoryID::installed_time_key() const { diff --git a/paludis/repositories/repository/repository_id.hh b/paludis/repositories/repository/repository_id.hh index 71f439310..a03c4d359 100644 --- a/paludis/repositories/repository/repository_id.hh +++ b/paludis/repositories/repository/repository_id.hh @@ -77,8 +77,6 @@ namespace paludis const std::shared_ptr<const MetadataSpecTreeKey<SimpleURISpecTree> > homepage_key() const; const std::shared_ptr<const MetadataValueKey<std::string> > short_description_key() const; const std::shared_ptr<const MetadataValueKey<std::string> > long_description_key() const; - const std::shared_ptr<const MetadataValueKey<std::shared_ptr<const Contents> > > - contents_key() const; const std::shared_ptr<const MetadataTimeKey> installed_time_key() const; const std::shared_ptr<const MetadataValueKey<FSPath> > fs_location_key() const; const std::shared_ptr<const MetadataCollectionKey<Set<std::string> > > behaviours_key() const; diff --git a/paludis/repositories/unavailable/unavailable_package_id.cc b/paludis/repositories/unavailable/unavailable_package_id.cc index 6552c905e..a2714034b 100644 --- a/paludis/repositories/unavailable/unavailable_package_id.cc +++ b/paludis/repositories/unavailable/unavailable_package_id.cc @@ -270,12 +270,6 @@ UnavailablePackageID::homepage_key() const return std::shared_ptr<const MetadataSpecTreeKey<SimpleURISpecTree> >(); } -const std::shared_ptr<const MetadataValueKey<std::shared_ptr<const Contents> > > -UnavailablePackageID::contents_key() const -{ - return std::shared_ptr<const MetadataValueKey<std::shared_ptr<const Contents> > >(); -} - const std::shared_ptr<const MetadataTimeKey> UnavailablePackageID::installed_time_key() const { diff --git a/paludis/repositories/unavailable/unavailable_package_id.hh b/paludis/repositories/unavailable/unavailable_package_id.hh index c99c0eea5..c2604b83a 100644 --- a/paludis/repositories/unavailable/unavailable_package_id.hh +++ b/paludis/repositories/unavailable/unavailable_package_id.hh @@ -91,8 +91,6 @@ namespace paludis const std::shared_ptr<const MetadataSpecTreeKey<SimpleURISpecTree> > homepage_key() const; const std::shared_ptr<const MetadataValueKey<std::string> > short_description_key() const; const std::shared_ptr<const MetadataValueKey<std::string> > long_description_key() const; - const std::shared_ptr<const MetadataValueKey<std::shared_ptr<const Contents> > > - contents_key() const; const std::shared_ptr<const MetadataTimeKey> installed_time_key() const; const std::shared_ptr<const MetadataValueKey<FSPath> > fs_location_key() const; const std::shared_ptr<const MetadataCollectionKey<Set<std::string> > > behaviours_key() const; diff --git a/paludis/repositories/unavailable/unavailable_repository_id.cc b/paludis/repositories/unavailable/unavailable_repository_id.cc index a3f0c2f19..b1cc70c54 100644 --- a/paludis/repositories/unavailable/unavailable_repository_id.cc +++ b/paludis/repositories/unavailable/unavailable_repository_id.cc @@ -379,12 +379,6 @@ UnavailableRepositoryID::homepage_key() const return std::shared_ptr<const MetadataSpecTreeKey<SimpleURISpecTree> >(); } -const std::shared_ptr<const MetadataValueKey<std::shared_ptr<const Contents> > > -UnavailableRepositoryID::contents_key() const -{ - return std::shared_ptr<const MetadataValueKey<std::shared_ptr<const Contents> > >(); -} - const std::shared_ptr<const MetadataTimeKey> UnavailableRepositoryID::installed_time_key() const { diff --git a/paludis/repositories/unavailable/unavailable_repository_id.hh b/paludis/repositories/unavailable/unavailable_repository_id.hh index 7791d8341..c50993e10 100644 --- a/paludis/repositories/unavailable/unavailable_repository_id.hh +++ b/paludis/repositories/unavailable/unavailable_repository_id.hh @@ -91,8 +91,6 @@ namespace paludis const std::shared_ptr<const MetadataSpecTreeKey<SimpleURISpecTree> > homepage_key() const; const std::shared_ptr<const MetadataValueKey<std::string> > short_description_key() const; const std::shared_ptr<const MetadataValueKey<std::string> > long_description_key() const; - const std::shared_ptr<const MetadataValueKey<std::shared_ptr<const Contents> > > - contents_key() const; const std::shared_ptr<const MetadataTimeKey> installed_time_key() const; const std::shared_ptr<const MetadataValueKey<FSPath> > fs_location_key() const; const std::shared_ptr<const MetadataCollectionKey<Set<std::string> > > behaviours_key() const; diff --git a/paludis/repositories/unpackaged/installed_id.cc b/paludis/repositories/unpackaged/installed_id.cc index 79ebe9a3e..0d6a4bdfb 100644 --- a/paludis/repositories/unpackaged/installed_id.cc +++ b/paludis/repositories/unpackaged/installed_id.cc @@ -598,16 +598,10 @@ InstalledUnpackagedID::long_description_key() const return std::shared_ptr<const MetadataValueKey<std::string> >(); } -const std::shared_ptr<const MetadataValueKey<std::shared_ptr<const Contents> > > -InstalledUnpackagedID::contents_key() const -{ - return _imp->contents_key; -} - const std::shared_ptr<const Contents> InstalledUnpackagedID::contents() const { - return contents_key()->parse_value(); + return _imp->contents_key->parse_value(); } const std::shared_ptr<const MetadataTimeKey> diff --git a/paludis/repositories/unpackaged/installed_id.hh b/paludis/repositories/unpackaged/installed_id.hh index fbb36a10f..558ebdaaa 100644 --- a/paludis/repositories/unpackaged/installed_id.hh +++ b/paludis/repositories/unpackaged/installed_id.hh @@ -66,7 +66,6 @@ namespace paludis virtual const std::shared_ptr<const MetadataSpecTreeKey<SimpleURISpecTree> > homepage_key() const; virtual const std::shared_ptr<const MetadataValueKey<std::string> > short_description_key() const; virtual const std::shared_ptr<const MetadataValueKey<std::string> > long_description_key() const; - virtual const std::shared_ptr<const MetadataValueKey<std::shared_ptr<const Contents> > > contents_key() const; virtual const std::shared_ptr<const MetadataTimeKey> installed_time_key() const; virtual const std::shared_ptr<const MetadataValueKey<FSPath> > fs_location_key() const; virtual const std::shared_ptr<const MetadataCollectionKey<Set<std::string> > > behaviours_key() const; diff --git a/paludis/repositories/unpackaged/installed_repository_TEST.cc b/paludis/repositories/unpackaged/installed_repository_TEST.cc index 72c5e2a7c..70f047f40 100644 --- a/paludis/repositories/unpackaged/installed_repository_TEST.cc +++ b/paludis/repositories/unpackaged/installed_repository_TEST.cc @@ -139,9 +139,9 @@ TEST(InstalledRepository, Metadata) EXPECT_TRUE(bool(id1->fs_location_key())); EXPECT_EQ(id1->fs_location_key()->parse_value(), FSPath::cwd() / "installed_repository_TEST_dir/repo1/data/giant-space-weasel/1:0:foo/"); - EXPECT_TRUE(bool(id1->contents_key())); + EXPECT_TRUE(bool(id1->contents())); ContentsDumper d1; - auto contents1(id1->contents_key()->parse_value()); + auto contents1(id1->contents()); std::for_each(indirect_iterator(contents1->begin()), indirect_iterator(contents1->end()), accept_visitor(d1)); EXPECT_EQ("dir</fnord>", d1.s.str()); @@ -156,9 +156,9 @@ TEST(InstalledRepository, Metadata) EXPECT_TRUE(bool(id2->fs_location_key())); EXPECT_EQ(id2->fs_location_key()->parse_value(), FSPath::cwd() / "installed_repository_TEST_dir/repo1/data/giant-space-weasel/2:1:bar/"); - EXPECT_TRUE(bool(id2->contents_key())); + EXPECT_TRUE(bool(id2->contents())); ContentsDumper d2; - auto contents2(id2->contents_key()->parse_value()); + auto contents2(id2->contents()); std::for_each(indirect_iterator(contents2->begin()), indirect_iterator(contents2->end()), accept_visitor(d2)); EXPECT_EQ("dir</stilton>file</stilton/cheese>file</stilton/is delicious>", d2.s.str()); } diff --git a/paludis/repositories/unpackaged/unpackaged_id.cc b/paludis/repositories/unpackaged/unpackaged_id.cc index 65ec5d20e..5c312b8f7 100644 --- a/paludis/repositories/unpackaged/unpackaged_id.cc +++ b/paludis/repositories/unpackaged/unpackaged_id.cc @@ -257,12 +257,6 @@ UnpackagedID::long_description_key() const return std::shared_ptr<const MetadataValueKey<std::string> >(); } -const std::shared_ptr<const MetadataValueKey<std::shared_ptr<const Contents> > > -UnpackagedID::contents_key() const -{ - return std::shared_ptr<const MetadataValueKey<std::shared_ptr<const Contents> > >(); -} - const std::shared_ptr<const MetadataTimeKey> UnpackagedID::installed_time_key() const { diff --git a/paludis/repositories/unpackaged/unpackaged_id.hh b/paludis/repositories/unpackaged/unpackaged_id.hh index 71e948e2a..89200a5dd 100644 --- a/paludis/repositories/unpackaged/unpackaged_id.hh +++ b/paludis/repositories/unpackaged/unpackaged_id.hh @@ -65,7 +65,6 @@ namespace paludis virtual const std::shared_ptr<const MetadataSpecTreeKey<SimpleURISpecTree> > homepage_key() const; virtual const std::shared_ptr<const MetadataValueKey<std::string> > short_description_key() const; virtual const std::shared_ptr<const MetadataValueKey<std::string> > long_description_key() const; - virtual const std::shared_ptr<const MetadataValueKey<std::shared_ptr<const Contents> > > contents_key() const; virtual const std::shared_ptr<const MetadataTimeKey> installed_time_key() const; virtual const std::shared_ptr<const MetadataValueKey<FSPath> > fs_location_key() const; virtual const std::shared_ptr<const MetadataCollectionKey<Set<std::string> > > behaviours_key() const; diff --git a/paludis/repositories/unwritten/unwritten_id.cc b/paludis/repositories/unwritten/unwritten_id.cc index 83e22f5e1..c9d3f468e 100644 --- a/paludis/repositories/unwritten/unwritten_id.cc +++ b/paludis/repositories/unwritten/unwritten_id.cc @@ -276,12 +276,6 @@ UnwrittenID::homepage_key() const return _imp->homepage_key; } -const std::shared_ptr<const MetadataValueKey<std::shared_ptr<const Contents> > > -UnwrittenID::contents_key() const -{ - return std::shared_ptr<const MetadataValueKey<std::shared_ptr<const Contents> > >(); -} - const std::shared_ptr<const MetadataTimeKey> UnwrittenID::installed_time_key() const { diff --git a/paludis/repositories/unwritten/unwritten_id.hh b/paludis/repositories/unwritten/unwritten_id.hh index a4a4f9238..43518ceac 100644 --- a/paludis/repositories/unwritten/unwritten_id.hh +++ b/paludis/repositories/unwritten/unwritten_id.hh @@ -103,8 +103,6 @@ namespace paludis const std::shared_ptr<const MetadataSpecTreeKey<SimpleURISpecTree> > homepage_key() const; const std::shared_ptr<const MetadataValueKey<std::string> > short_description_key() const; const std::shared_ptr<const MetadataValueKey<std::string> > long_description_key() const; - const std::shared_ptr<const MetadataValueKey<std::shared_ptr<const Contents> > > - contents_key() const; const std::shared_ptr<const MetadataTimeKey> installed_time_key() const; const std::shared_ptr<const MetadataValueKey<FSPath> > fs_location_key() const; const std::shared_ptr<const MetadataCollectionKey<Set<std::string> > > behaviours_key() const; diff --git a/paludis/user_dep_spec.cc b/paludis/user_dep_spec.cc index 65453b391..7c336f686 100644 --- a/paludis/user_dep_spec.cc +++ b/paludis/user_dep_spec.cc @@ -929,8 +929,6 @@ UserKeyRequirement::requirement_met( key = id->build_dependencies_key().get(); else if (_imp->key == "$choices") key = id->choices_key().get(); - else if (_imp->key == "$contents") - key = id->contents_key().get(); else if (_imp->key == "$dependencies") key = id->dependencies_key().get(); else if (_imp->key == "$fetches") diff --git a/python/additional_tests.cc b/python/additional_tests.cc index 8f81263cf..f95492ff8 100644 --- a/python/additional_tests.cc +++ b/python/additional_tests.cc @@ -154,12 +154,6 @@ namespace metadata_key Timestamp PALUDIS_ATTRIBUTE((unused)) t(m.parse_value()); } - void test_metadata_contents_key(const MetadataValueKey<std::shared_ptr<const Contents> > & m) - { - test_metadata_key(m); - m.parse_value(); - } - void test_metadata_choices_key(const MetadataValueKey<std::shared_ptr<const Choices> > & m) { test_metadata_key(m); @@ -210,7 +204,6 @@ void expose_additional_tests() bp::def("test_metadata_package_id_key", &metadata_key::test_metadata_package_id_key); bp::def("test_metadata_string_key", &metadata_key::test_metadata_string_key); bp::def("test_metadata_time_key", &metadata_key::test_metadata_time_key); - bp::def("test_metadata_contents_key", &metadata_key::test_metadata_contents_key); bp::def("test_metadata_choices_key", &metadata_key::test_metadata_choices_key); bp::def("test_metadata_keyword_name_set_key", &metadata_key::test_metadata_set_key<KeywordNameSet>); bp::def("test_metadata_string_set_key", &metadata_key::test_metadata_set_key<Set<std::string> >); diff --git a/python/metadata_key_TEST.py b/python/metadata_key_TEST.py index a8ab3812d..7f0ba0468 100755 --- a/python/metadata_key_TEST.py +++ b/python/metadata_key_TEST.py @@ -126,26 +126,6 @@ class TestCase_02_MetadataKeys_suclassing(unittest.TestCase): test_metadata_time_key(TestKey()) - - def test_04_contents(self): - class TestKey(MetadataContentsKey): - def __init__(self): - MetadataContentsKey.__init__(self) - - def parse_value(self): - return Contents() - - def raw_name(self): - return "raw" - - def human_name(self): - return "human" - - def type(self): - return MetadataKeyType.NORMAL - - test_metadata_contents_key(TestKey()) - def test_06_keyword_name_iterable(self): class TestKey(MetadataKeywordNameIterableKey): def __init__(self): diff --git a/python/package_id.cc b/python/package_id.cc index 9f84efd4c..19fb03e98 100644 --- a/python/package_id.cc +++ b/python/package_id.cc @@ -148,13 +148,6 @@ void expose_package_id() "description of a package." ) - .def("contents_key", &PackageID::contents_key, - "The contents_key, if not None, contains the contents of a\n" - "package. For installed packages, this means the files installed;\n" - "for installable packages, this means the files that will be\n" - "installed (if known, which it may be for some binary packages)." - ) - .def("installed_time_key", &PackageID::installed_time_key, "The installed_time_key, if not None, contains the time a package\n" "was installed. It affects dependency resolution if DepList is\n" diff --git a/python/package_id_TEST.py b/python/package_id_TEST.py index 68b52b45e..129571bb5 100755 --- a/python/package_id_TEST.py +++ b/python/package_id_TEST.py @@ -133,10 +133,6 @@ class TestCase_01_PackageID(unittest.TestCase): self.assertEquals(self.pid.long_description_key(), None) self.assertEquals(self.ipid.long_description_key(), None) - def test_26_contents_key(self): - self.assertEquals(self.pid.contents_key(), None) - self.assert_(isinstance(self.ipid.contents_key(), MetadataContentsKey)) - def test_27_installed_time_key(self): self.assertEquals(self.pid.installed_time_key(), None) self.assert_(isinstance(self.ipid.installed_time_key(), MetadataTimeKey)) diff --git a/ruby/demos/find_unmanaged_files.rb b/ruby/demos/find_unmanaged_files.rb index 8e0544858..1e752db41 100755 --- a/ruby/demos/find_unmanaged_files.rb +++ b/ruby/demos/find_unmanaged_files.rb @@ -11,8 +11,8 @@ Log.instance.program_name = $0 def get_contents(pids, directories, root) in_contents= [] pids.each do |pid| - next if pid.contents_key.nil? - contents = pid.contents_key.parse_value + contents = pid.contents + next if contents.nil? contents.each do |entry| next if entry.kind_of? ContentsOtherEntry directories.each do |directory| diff --git a/ruby/package_id.cc b/ruby/package_id.cc index 10d9fa12f..8b8ddfc2d 100644 --- a/ruby/package_id.cc +++ b/ruby/package_id.cc @@ -424,14 +424,6 @@ namespace * Our long description */ /* - * Document-method: contents_key - * - * call-seq: - * contents_key -> MetadataContentsKey - * - * Our Contents - */ - /* * Document-method: installed_time_key * * call-seq: @@ -571,8 +563,6 @@ namespace &PackageID::short_description_key>::fetch)), 0); rb_define_method(c_package_id, "long_description_key", RUBY_FUNC_CAST((&KeyValue<MetadataValueKey<std::string>, &PackageID::long_description_key>::fetch)), 0); - rb_define_method(c_package_id, "contents_key", RUBY_FUNC_CAST((&KeyValue<MetadataValueKey<std::shared_ptr<const Contents> >, - &PackageID::contents_key>::fetch)), 0); rb_define_method(c_package_id, "installed_time_key", RUBY_FUNC_CAST((&KeyValue<MetadataTimeKey,&PackageID::installed_time_key>::fetch)), 0); rb_define_method(c_package_id, "from_repositories_key", RUBY_FUNC_CAST((&KeyValue<MetadataCollectionKey<Set<std::string> >, &PackageID::from_repositories_key>::fetch)), 0); diff --git a/ruby/package_id_TEST.rb b/ruby/package_id_TEST.rb index 4921baab0..cdd0c5907 100644 --- a/ruby/package_id_TEST.rb +++ b/ruby/package_id_TEST.rb @@ -107,7 +107,7 @@ module Paludis { :name => QualifiedPackageName, :version => VersionSpec, :repository_name => String, :keywords_key => MetadataKeywordNameSetKey, :choices_key => MetadataChoicesKey, :short_description_key => MetadataStringKey, :long_description_key => MetadataStringKey, - :contents_key => MetadataContentsKey, :installed_time_key => MetadataTimeKey, + :installed_time_key => MetadataTimeKey, :from_repositories_key => Array, :masks => Array, :overridden_masks => Array }.each_pair do | method, type | @@ -236,10 +236,6 @@ module Paludis assert_nil pid_testrepo.long_description_key end - def test_contents_key - assert_nil pid_testrepo.contents_key - end - def test_installed_time_key assert_nil pid_testrepo.installed_time_key end diff --git a/ruby/repository_TEST.rb b/ruby/repository_TEST.rb index 25fa4a24a..13adf5aa0 100644 --- a/ruby/repository_TEST.rb +++ b/ruby/repository_TEST.rb @@ -181,7 +181,7 @@ module Paludis include RepositoryTestCase def contents - contents = installed_pid.contents_key.parse_value + contents = installed_pid.contents end def entries diff --git a/src/clients/cave/cmd_contents.cc b/src/clients/cave/cmd_contents.cc index d726f3af8..23f00adc8 100644 --- a/src/clients/cave/cmd_contents.cc +++ b/src/clients/cave/cmd_contents.cc @@ -138,10 +138,10 @@ ContentsCommand::run( nothing_matching_error(env.get(), *cmdline.begin_parameters(), filter::InstalledAtRoot(env->preferred_root_key()->parse_value())); const std::shared_ptr<const PackageID> id(*entries->last()); - if (! id->contents_key()) + auto contents(id->contents()); + if (! contents) throw BadIDForCommand(spec, id, "does not support listing contents"); - auto contents(id->contents_key()->parse_value()); std::transform( contents->begin(), contents->end(), diff --git a/src/clients/cave/cmd_print_id_contents.cc b/src/clients/cave/cmd_print_id_contents.cc index 1ce38dbe2..83f6a095c 100644 --- a/src/clients/cave/cmd_print_id_contents.cc +++ b/src/clients/cave/cmd_print_id_contents.cc @@ -174,10 +174,10 @@ PrintIDContentsCommand::run( for (auto i(cmdline.a_best.specified() ? entries->last() : entries->begin()), i_end(entries->end()) ; i != i_end ; ++i) { - if (! (*i)->contents_key()) + auto contents((*i)->contents()); + if (! contents) throw BadIDForCommand(spec, (*i), "does not support listing contents"); - auto contents((*i)->contents_key()->parse_value()); for (auto c(contents->begin()), c_end(contents->end()) ; c != c_end ; ++c) if (match_type(cmdline.a_type, *c)) diff --git a/src/clients/cave/cmd_verify.cc b/src/clients/cave/cmd_verify.cc index 6590012c4..61badcf25 100644 --- a/src/clients/cave/cmd_verify.cc +++ b/src/clients/cave/cmd_verify.cc @@ -226,11 +226,11 @@ VerifyCommand::run( for (PackageIDSequence::ConstIterator i(entries->begin()), i_end(entries->end()) ; i != i_end ; ++i) { - if (! (*i)->contents_key()) + auto contents((*i)->contents()); + if (! contents) continue; Verifier v(*i); - auto contents((*i)->contents_key()->parse_value()); std::for_each(indirect_iterator(contents->begin()), indirect_iterator(contents->end()), accept_visitor(v)); exit_status |= v.exit_status; } diff --git a/src/clients/cave/executables_common.cc b/src/clients/cave/executables_common.cc index 962f1a485..1e76b3011 100644 --- a/src/clients/cave/executables_common.cc +++ b/src/clients/cave/executables_common.cc @@ -133,11 +133,9 @@ paludis::cave::executables_common( for (auto i(best ? entries->last() : entries->begin()), i_end(entries->end()) ; i != i_end ; ++i) { - if ((*i)->contents_key()) - { - std::shared_ptr<const Contents> contents((*i)->contents_key()->parse_value()); + auto contents((*i)->contents()); + if (contents) std::for_each(indirect_iterator(contents->begin()), indirect_iterator(contents->end()), accept_visitor(ed)); - } } return EXIT_SUCCESS; diff --git a/src/clients/cave/owner_common.cc b/src/clients/cave/owner_common.cc index 66f974ea9..e305f8acd 100644 --- a/src/clients/cave/owner_common.cc +++ b/src/clients/cave/owner_common.cc @@ -105,10 +105,10 @@ paludis::cave::owner_common( for (PackageIDSequence::ConstIterator p(ids->begin()), p_end(ids->end()); p != p_end; ++p) { - if (! (*p)->contents_key()) + std::shared_ptr<const Contents> contents((*p)->contents()); + if (! contents) continue; - std::shared_ptr<const Contents> contents((*p)->contents_key()->parse_value()); if (contents->end() != std::find_if(contents->begin(), contents->end(), std::bind(handler, query, std::placeholders::_1))) { diff --git a/src/clients/cave/size_common.cc b/src/clients/cave/size_common.cc index f5a7ddfba..df7080b33 100644 --- a/src/clients/cave/size_common.cc +++ b/src/clients/cave/size_common.cc @@ -105,11 +105,11 @@ paludis::cave::size_common( for (auto i(best ? entries->last() : entries->begin()), i_end(entries->end()) ; i != i_end ; ++i) { - if (! (*i)->contents_key()) + auto contents((*i)->contents()); + if (! contents) throw BadIDForCommand(spec, (*i), "does not support listing contents"); unsigned long size(0); - auto contents((*i)->contents_key()->parse_value()); for (auto c(contents->begin()), c_end(contents->end()) ; c != c_end ; ++c) size += (*c)->accept_returning<unsigned long>(GetSize()); |