aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-05-12 20:23:43 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-05-14 17:59:12 +0100
commitf90702f73199af1923cc35905d593ab0e4936cab (patch)
treefb7904f8b2c5d000072c931d93ceda3308065670
parent962018d649a70ed785c713b538e0d51c453f385b (diff)
downloadpaludis-f90702f73199af1923cc35905d593ab0e4936cab.tar.gz
paludis-f90702f73199af1923cc35905d593ab0e4936cab.tar.xz
Crude UnavailableRepositoryID support
-rw-r--r--paludis/repositories/unavailable/Makefile.am2
-rw-r--r--paludis/repositories/unavailable/unavailable_repository_TEST.cc9
-rw-r--r--paludis/repositories/unavailable/unavailable_repository_id.cc297
-rw-r--r--paludis/repositories/unavailable/unavailable_repository_id.hh120
-rw-r--r--paludis/repositories/unavailable/unavailable_repository_store.cc101
-rw-r--r--paludis/repositories/unavailable/unavailable_repository_store.hh4
6 files changed, 491 insertions, 42 deletions
diff --git a/paludis/repositories/unavailable/Makefile.am b/paludis/repositories/unavailable/Makefile.am
index 3465e49..8c09c72 100644
--- a/paludis/repositories/unavailable/Makefile.am
+++ b/paludis/repositories/unavailable/Makefile.am
@@ -14,6 +14,7 @@ noinst_LTLIBRARIES = libpaludisunavailablerepository.la
noinst_HEADERS = \
unavailable_repository.hh unavailable_repository-fwd.hh \
unavailable_package_id.hh \
+ unavailable_repository_id.hh \
unavailable_mask.hh \
unavailable_repository_store.hh \
unavailable_repository_file.hh unavailable_repository_file-fwd.hh
@@ -21,6 +22,7 @@ noinst_HEADERS = \
libpaludisunavailablerepository_la_SOURCES = \
unavailable_repository.cc \
unavailable_package_id.cc \
+ unavailable_repository_id.cc \
unavailable_mask.cc \
unavailable_repository_store.cc \
unavailable_repository_file.cc \
diff --git a/paludis/repositories/unavailable/unavailable_repository_TEST.cc b/paludis/repositories/unavailable/unavailable_repository_TEST.cc
index 75ea28c..9a63766 100644
--- a/paludis/repositories/unavailable/unavailable_repository_TEST.cc
+++ b/paludis/repositories/unavailable/unavailable_repository_TEST.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2008, 2009 Ciaran McCreesh
+ * Copyright (c) 2008, 2009, 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
@@ -93,7 +93,9 @@ namespace test_cases
"cat-one/pkg-six-3:0::unavailable (in ::bar) "
"cat-one/pkg-two-1:1::unavailable (in ::foo) "
"cat-one/pkg-two-2:2::unavailable (in ::foo) "
- "cat-two/pkg-six-1:0::unavailable (in ::bar)"
+ "cat-two/pkg-six-1:0::unavailable (in ::bar) "
+ "repository/bar-0::unavailable "
+ "repository/foo-0::unavailable"
);
const std::tr1::shared_ptr<FakeRepository> hide_bar(new FakeRepository(make_named_values<FakeRepositoryParams>(
@@ -114,7 +116,8 @@ namespace test_cases
"cat-one/pkg-one-2:0::unavailable (in ::foo) "
"cat-one/pkg-one-3:0::unavailable (in ::foo) "
"cat-one/pkg-two-1:1::unavailable (in ::foo) "
- "cat-one/pkg-two-2:2::unavailable (in ::foo)"
+ "cat-one/pkg-two-2:2::unavailable (in ::foo) "
+ "repository/foo-0::unavailable"
);
}
} test_contents;
diff --git a/paludis/repositories/unavailable/unavailable_repository_id.cc b/paludis/repositories/unavailable/unavailable_repository_id.cc
new file mode 100644
index 0000000..df29e74
--- /dev/null
+++ b/paludis/repositories/unavailable/unavailable_repository_id.cc
@@ -0,0 +1,297 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 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
+ * Public License version 2, as published by the Free Software Foundation.
+ *
+ * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include <paludis/repositories/unavailable/unavailable_repository_id.hh>
+#include <paludis/repositories/unavailable/unavailable_repository.hh>
+#include <paludis/util/private_implementation_pattern-impl.hh>
+#include <paludis/util/stringify.hh>
+#include <paludis/util/simple_visitor_cast.hh>
+#include <paludis/util/set.hh>
+#include <paludis/util/make_shared_ptr.hh>
+#include <paludis/util/hashes.hh>
+#include <paludis/util/wrapped_forward_iterator.hh>
+#include <paludis/name.hh>
+#include <paludis/version_spec.hh>
+#include <paludis/metadata_key.hh>
+#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;
+
+namespace paludis
+{
+ template <>
+ struct Implementation<UnavailableRepositoryID>
+ {
+ const Environment * const env;
+ const QualifiedPackageName name;
+ const VersionSpec version;
+ const UnavailableRepository * const repo;
+
+ const std::tr1::shared_ptr<const MetadataValueKey<std::string> > description_key;
+ const std::tr1::shared_ptr<const MetadataValueKey<std::string> > homepage_key;
+
+ Implementation(
+ const UnavailableRepositoryIDParams & e) :
+ env(e.environment()),
+ name(e.name()),
+ version("0", VersionSpecOptions()),
+ repo(e.repository()),
+ description_key(e.description()),
+ homepage_key(e.homepage())
+ {
+ }
+ };
+}
+
+UnavailableRepositoryID::UnavailableRepositoryID(const UnavailableRepositoryIDParams & entry) :
+ PrivateImplementationPattern<UnavailableRepositoryID>(new Implementation<UnavailableRepositoryID>(entry)),
+ _imp(PrivateImplementationPattern<UnavailableRepositoryID>::_imp)
+{
+ add_metadata_key(_imp->description_key);
+ if (_imp->homepage_key)
+ add_metadata_key(_imp->homepage_key);
+}
+
+UnavailableRepositoryID::~UnavailableRepositoryID()
+{
+}
+
+void
+UnavailableRepositoryID::need_keys_added() const
+{
+}
+
+void
+UnavailableRepositoryID::need_masks_added() const
+{
+}
+
+const std::string
+UnavailableRepositoryID::canonical_form(const PackageIDCanonicalForm f) const
+{
+ switch (f)
+ {
+ case idcf_full:
+ return stringify(_imp->name) + "-" + stringify(_imp->version) +
+ "::" + stringify(_imp->repo->name());
+
+ case idcf_no_version:
+ return stringify(_imp->name) + "::" + stringify(_imp->repo->name());
+
+ case idcf_version:
+ return stringify(_imp->version);
+
+ case idcf_no_name:
+ return stringify(_imp->version) + "::" + stringify(_imp->repo->name());
+
+ case last_idcf:
+ break;
+ }
+
+ throw InternalError(PALUDIS_HERE, "Bad PackageIDCanonicalForm");
+}
+
+PackageDepSpec
+UnavailableRepositoryID::uniquely_identifying_spec() const
+{
+ return parse_user_package_dep_spec("=" + stringify(name()) + "-" + stringify(version())
+ + "::" + stringify(repository()->name()),
+ _imp->env, UserPackageDepSpecOptions());
+}
+
+const QualifiedPackageName
+UnavailableRepositoryID::name() const
+{
+ return _imp->name;
+}
+
+const VersionSpec
+UnavailableRepositoryID::version() const
+{
+ return _imp->version;
+}
+
+const std::tr1::shared_ptr<const Repository>
+UnavailableRepositoryID::repository() const
+{
+ return _imp->repo->shared_from_this();
+}
+
+bool
+UnavailableRepositoryID::supports_action(const SupportsActionTestBase & a) const
+{
+ return simple_visitor_cast<const SupportsActionTest<InstallAction> >(a);
+}
+
+void
+UnavailableRepositoryID::perform_action(Action & a) const
+{
+ throw ActionFailedError("Unsupported action: " + a.simple_name());
+}
+
+std::tr1::shared_ptr<const Set<std::string> >
+UnavailableRepositoryID::breaks_portage() const
+{
+ return make_shared_ptr(new Set<std::string>);
+}
+
+bool
+UnavailableRepositoryID::arbitrary_less_than_comparison(const PackageID &) const
+{
+ return false;
+}
+
+std::size_t
+UnavailableRepositoryID::extra_hash_value() const
+{
+ return 0;
+}
+
+const std::tr1::shared_ptr<const MetadataCollectionKey<PackageIDSequence> >
+UnavailableRepositoryID::contains_key() const
+{
+ return std::tr1::shared_ptr<const MetadataCollectionKey<PackageIDSequence> >();
+}
+
+const std::tr1::shared_ptr<const MetadataValueKey<std::tr1::shared_ptr<const PackageID> > >
+UnavailableRepositoryID::contained_in_key() const
+{
+ return std::tr1::shared_ptr<const MetadataValueKey<std::tr1::shared_ptr<const PackageID> > >();
+}
+
+const std::tr1::shared_ptr<const MetadataValueKey<FSEntry> >
+UnavailableRepositoryID::fs_location_key() const
+{
+ return std::tr1::shared_ptr<const MetadataValueKey<FSEntry> >();
+}
+
+const std::tr1::shared_ptr<const MetadataValueKey<bool> >
+UnavailableRepositoryID::transient_key() const
+{
+ return std::tr1::shared_ptr<const MetadataValueKey<bool> >();
+}
+
+const std::tr1::shared_ptr<const MetadataValueKey<std::tr1::shared_ptr<const PackageID> > >
+UnavailableRepositoryID::virtual_for_key() const
+{
+ return std::tr1::shared_ptr<const MetadataValueKey<std::tr1::shared_ptr<const PackageID> > >();
+}
+
+const std::tr1::shared_ptr<const MetadataCollectionKey<KeywordNameSet> >
+UnavailableRepositoryID::keywords_key() const
+{
+ return std::tr1::shared_ptr<const MetadataCollectionKey<KeywordNameSet> >();
+}
+
+const std::tr1::shared_ptr<const MetadataSpecTreeKey<ProvideSpecTree> >
+UnavailableRepositoryID::provide_key() const
+{
+ return std::tr1::shared_ptr<const MetadataSpecTreeKey<ProvideSpecTree> >();
+}
+
+const std::tr1::shared_ptr<const MetadataSpecTreeKey<DependencySpecTree> >
+UnavailableRepositoryID::dependencies_key() const
+{
+ return std::tr1::shared_ptr<const MetadataSpecTreeKey<DependencySpecTree> >();
+}
+
+const std::tr1::shared_ptr<const MetadataSpecTreeKey<DependencySpecTree> >
+UnavailableRepositoryID::build_dependencies_key() const
+{
+ return std::tr1::shared_ptr<const MetadataSpecTreeKey<DependencySpecTree> >();
+}
+
+const std::tr1::shared_ptr<const MetadataSpecTreeKey<DependencySpecTree> >
+UnavailableRepositoryID::run_dependencies_key() const
+{
+ return std::tr1::shared_ptr<const MetadataSpecTreeKey<DependencySpecTree> >();
+}
+
+const std::tr1::shared_ptr<const MetadataSpecTreeKey<DependencySpecTree> >
+UnavailableRepositoryID::post_dependencies_key() const
+{
+ return std::tr1::shared_ptr<const MetadataSpecTreeKey<DependencySpecTree> >();
+}
+
+const std::tr1::shared_ptr<const MetadataSpecTreeKey<DependencySpecTree> >
+UnavailableRepositoryID::suggested_dependencies_key() const
+{
+ return std::tr1::shared_ptr<const MetadataSpecTreeKey<DependencySpecTree> >();
+}
+
+const std::tr1::shared_ptr<const MetadataValueKey<std::string> >
+UnavailableRepositoryID::short_description_key() const
+{
+ return _imp->description_key;
+}
+
+const std::tr1::shared_ptr<const MetadataValueKey<std::string> >
+UnavailableRepositoryID::long_description_key() const
+{
+ return std::tr1::shared_ptr<const MetadataValueKey<std::string> >();
+}
+
+const std::tr1::shared_ptr<const MetadataSpecTreeKey<FetchableURISpecTree> >
+UnavailableRepositoryID::fetches_key() const
+{
+ return std::tr1::shared_ptr<const MetadataSpecTreeKey<FetchableURISpecTree> >();
+}
+
+const std::tr1::shared_ptr<const MetadataSpecTreeKey<SimpleURISpecTree> >
+UnavailableRepositoryID::homepage_key() const
+{
+ return std::tr1::shared_ptr<const MetadataSpecTreeKey<SimpleURISpecTree> >();
+}
+
+const std::tr1::shared_ptr<const MetadataValueKey<std::tr1::shared_ptr<const Contents> > >
+UnavailableRepositoryID::contents_key() const
+{
+ return std::tr1::shared_ptr<const MetadataValueKey<std::tr1::shared_ptr<const Contents> > >();
+}
+
+const std::tr1::shared_ptr<const MetadataTimeKey>
+UnavailableRepositoryID::installed_time_key() const
+{
+ return std::tr1::shared_ptr<const MetadataTimeKey>();
+}
+
+const std::tr1::shared_ptr<const MetadataCollectionKey<Set<std::string> > >
+UnavailableRepositoryID::from_repositories_key() const
+{
+ return make_null_shared_ptr();
+}
+
+const std::tr1::shared_ptr<const MetadataValueKey<std::tr1::shared_ptr<const Choices> > >
+UnavailableRepositoryID::choices_key() const
+{
+ return make_null_shared_ptr();
+}
+
+const std::tr1::shared_ptr<const MetadataValueKey<SlotName> >
+UnavailableRepositoryID::slot_key() const
+{
+ return make_null_shared_ptr();
+}
+
+template class PrivateImplementationPattern<UnavailableRepositoryID>;
+
diff --git a/paludis/repositories/unavailable/unavailable_repository_id.hh b/paludis/repositories/unavailable/unavailable_repository_id.hh
new file mode 100644
index 0000000..da1d160
--- /dev/null
+++ b/paludis/repositories/unavailable/unavailable_repository_id.hh
@@ -0,0 +1,120 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2008, 2009, 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
+ * Public License version 2, as published by the Free Software Foundation.
+ *
+ * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef PALUDIS_GUARD_PALUDIS_REPOSITORIES_UNAVAILABLE_UNAVAILABLE_REPOSITORY_ID_HH
+#define PALUDIS_GUARD_PALUDIS_REPOSITORIES_UNAVAILABLE_UNAVAILABLE_REPOSITORY_ID_HH 1
+
+#include <paludis/util/named_value.hh>
+#include <paludis/package_id.hh>
+#include <paludis/repositories/unavailable/unavailable_repository_file-fwd.hh>
+#include <paludis/repositories/unavailable/unavailable_repository-fwd.hh>
+
+namespace paludis
+{
+ namespace n
+ {
+ struct description;
+ struct environment;
+ struct format;
+ struct homepage;
+ struct name;
+ struct repository;
+ struct sync;
+ }
+
+ namespace unavailable_repository
+ {
+ struct UnavailableRepositoryIDParams
+ {
+ NamedValue<n::description, std::tr1::shared_ptr<const MetadataValueKey<std::string> > > description;
+ NamedValue<n::environment, const Environment *> environment;
+ NamedValue<n::format, std::tr1::shared_ptr<const MetadataValueKey<std::string> > > format;
+ NamedValue<n::homepage, std::tr1::shared_ptr<const MetadataValueKey<std::string> > > homepage;
+ NamedValue<n::name, QualifiedPackageName> name;
+ NamedValue<n::repository, const UnavailableRepository *> repository;
+ NamedValue<n::sync, std::tr1::shared_ptr<const MetadataValueKey<std::string> > > sync;
+ };
+
+ class PALUDIS_VISIBLE UnavailableRepositoryID :
+ public PackageID,
+ private PrivateImplementationPattern<UnavailableRepositoryID>
+ {
+ private:
+ PrivateImplementationPattern<UnavailableRepositoryID>::ImpPtr & _imp;
+
+ protected:
+ void need_keys_added() const;
+ void need_masks_added() const;
+
+ public:
+ UnavailableRepositoryID(const UnavailableRepositoryIDParams &);
+ ~UnavailableRepositoryID();
+
+ const std::string canonical_form(const PackageIDCanonicalForm) const;
+ 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;
+ const std::tr1::shared_ptr<const MetadataCollectionKey<KeywordNameSet> > keywords_key() const;
+ const std::tr1::shared_ptr<const MetadataSpecTreeKey<ProvideSpecTree> > provide_key() const;
+ const std::tr1::shared_ptr<const MetadataCollectionKey<PackageIDSequence> > contains_key() const;
+ const std::tr1::shared_ptr<const MetadataValueKey<std::tr1::shared_ptr<const PackageID> > >
+ contained_in_key() const;
+ const std::tr1::shared_ptr<const MetadataSpecTreeKey<DependencySpecTree> >
+ dependencies_key() const;
+ const std::tr1::shared_ptr<const MetadataSpecTreeKey<DependencySpecTree> >
+ build_dependencies_key() const;
+ const std::tr1::shared_ptr<const MetadataSpecTreeKey<DependencySpecTree> >
+ run_dependencies_key() const;
+ const std::tr1::shared_ptr<const MetadataSpecTreeKey<DependencySpecTree> >
+ post_dependencies_key() const;
+ const std::tr1::shared_ptr<const MetadataSpecTreeKey<DependencySpecTree> >
+ suggested_dependencies_key() const;
+ const std::tr1::shared_ptr<const MetadataSpecTreeKey<FetchableURISpecTree> > fetches_key() const;
+ const std::tr1::shared_ptr<const MetadataSpecTreeKey<SimpleURISpecTree> > homepage_key() const;
+ const std::tr1::shared_ptr<const MetadataValueKey<std::string> > short_description_key() const;
+ const std::tr1::shared_ptr<const MetadataValueKey<std::string> > long_description_key() const;
+ const std::tr1::shared_ptr<const MetadataValueKey<std::tr1::shared_ptr<const Contents> > >
+ contents_key() const;
+ const std::tr1::shared_ptr<const MetadataTimeKey> installed_time_key() const;
+ const std::tr1::shared_ptr<const MetadataValueKey<FSEntry> > fs_location_key() const;
+ const std::tr1::shared_ptr<const MetadataValueKey<bool> > transient_key() const;
+ const std::tr1::shared_ptr<const MetadataCollectionKey<Set<std::string> > > from_repositories_key() const;
+ const std::tr1::shared_ptr<const MetadataValueKey<std::tr1::shared_ptr<const Choices> > > choices_key() const;
+
+ bool supports_action(const SupportsActionTestBase &) const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
+ void perform_action(Action &) const PALUDIS_ATTRIBUTE((noreturn));
+
+ std::tr1::shared_ptr<const Set<std::string> > breaks_portage() const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ bool arbitrary_less_than_comparison(const PackageID &) const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
+ std::size_t extra_hash_value() const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
+ };
+ }
+}
+
+#endif
diff --git a/paludis/repositories/unavailable/unavailable_repository_store.cc b/paludis/repositories/unavailable/unavailable_repository_store.cc
index f33c4a2..2744731 100644
--- a/paludis/repositories/unavailable/unavailable_repository_store.cc
+++ b/paludis/repositories/unavailable/unavailable_repository_store.cc
@@ -20,6 +20,7 @@
#include <paludis/repositories/unavailable/unavailable_repository_store.hh>
#include <paludis/repositories/unavailable/unavailable_repository_file.hh>
#include <paludis/repositories/unavailable/unavailable_package_id.hh>
+#include <paludis/repositories/unavailable/unavailable_repository_id.hh>
#include <paludis/repositories/unavailable/unavailable_mask.hh>
#include <paludis/util/private_implementation_pattern-impl.hh>
#include <paludis/util/fs_entry.hh>
@@ -135,48 +136,73 @@ UnavailableRepositoryStore::_populate_one(const Environment * const env, const F
repository_description.reset(new LiteralMetadataValueKey<std::string>(
"REPOSITORY_DESCRIPTION", "Repository description", mkt_normal, file.description()));
- QualifiedPackageName old_name("x/x");
- std::tr1::shared_ptr<QualifiedPackageNameSet> pkgs;
- std::tr1::shared_ptr<PackageIDSequence> ids;
- for (UnavailableRepositoryFile::ConstIterator i(file.begin()), i_end(file.end()) ;
- i != i_end ; ++i)
{
- if (old_name.category() != (*i).name().category())
+ QualifiedPackageName old_name("x/x");
+ std::tr1::shared_ptr<QualifiedPackageNameSet> pkgs;
+ std::tr1::shared_ptr<PackageIDSequence> ids;
+ for (UnavailableRepositoryFile::ConstIterator i(file.begin()), i_end(file.end()) ;
+ i != i_end ; ++i)
{
- _imp->categories->insert((*i).name().category());
- PackageNames::iterator p(_imp->package_names.find((*i).name().category()));
- if (_imp->package_names.end() == p)
- p = _imp->package_names.insert(std::make_pair((*i).name().category(),
- make_shared_ptr(new QualifiedPackageNameSet))).first;
- pkgs = p->second;
+ if (old_name.category() != (*i).name().category())
+ {
+ _imp->categories->insert((*i).name().category());
+ PackageNames::iterator p(_imp->package_names.find((*i).name().category()));
+ if (_imp->package_names.end() == p)
+ p = _imp->package_names.insert(std::make_pair((*i).name().category(),
+ make_shared_ptr(new QualifiedPackageNameSet))).first;
+ pkgs = p->second;
+ }
+
+ if (old_name != (*i).name())
+ {
+ pkgs->insert((*i).name());
+ IDs::iterator p(_imp->ids.find((*i).name()));
+ if (_imp->ids.end() == p)
+ p = _imp->ids.insert(std::make_pair((*i).name(),
+ make_shared_ptr(new PackageIDSequence))).first;
+
+ ids = p->second;
+ }
+
+ ids->push_back(make_shared_ptr(new UnavailablePackageID(make_named_values<UnavailablePackageIDParams>(
+ 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()),
+ value_for<n::repository>(_imp->repo),
+ value_for<n::repository_description>(repository_description),
+ value_for<n::repository_homepage>(repository_homepage),
+ value_for<n::slot>((*i).slot()),
+ value_for<n::version>((*i).version())
+ ))));
+
+ old_name = (*i).name();
}
+ }
- if (old_name != (*i).name())
- {
- pkgs->insert((*i).name());
- IDs::iterator p(_imp->ids.find((*i).name()));
- if (_imp->ids.end() == p)
- p = _imp->ids.insert(std::make_pair((*i).name(),
- make_shared_ptr(new PackageIDSequence))).first;
-
- ids = p->second;
- }
+ const std::tr1::shared_ptr<UnavailableRepositoryID> id(new UnavailableRepositoryID(
+ make_named_values<UnavailableRepositoryIDParams>(
+ value_for<n::description>(repository_description),
+ value_for<n::environment>(env),
+ value_for<n::format>(make_null_shared_ptr()),
+ value_for<n::homepage>(repository_homepage),
+ value_for<n::name>(CategoryNamePart("repository") + PackageNamePart(file.repo_name())),
+ value_for<n::repository>(_imp->repo),
+ value_for<n::sync>(make_null_shared_ptr())
+ )));
+
+ _imp->categories->insert(id->name().category());
+ PackageNames::iterator p(_imp->package_names.find(id->name().category()));
+ if (_imp->package_names.end() == p)
+ p = _imp->package_names.insert(std::make_pair(id->name().category(),
+ make_shared_ptr(new QualifiedPackageNameSet))).first;
+ p->second->insert(id->name());
- ids->push_back(make_shared_ptr(new UnavailablePackageID(make_named_values<UnavailablePackageIDParams>(
- 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()),
- value_for<n::repository>(_imp->repo),
- value_for<n::repository_description>(repository_description),
- value_for<n::repository_homepage>(repository_homepage),
- value_for<n::slot>((*i).slot()),
- value_for<n::version>((*i).version())
- ))));
-
- old_name = (*i).name();
- }
+ IDs::iterator i(_imp->ids.find(id->name()));
+ if (_imp->ids.end() == i)
+ i = _imp->ids.insert(std::make_pair(id->name(), make_shared_ptr(new PackageIDSequence))).first;
+ i->second->push_back(id);
}
bool
@@ -202,6 +228,7 @@ UnavailableRepositoryStore::unimportant_category_names() const
{
std::tr1::shared_ptr<CategoryNamePartSet> result(make_shared_ptr(new CategoryNamePartSet));
result->insert(CategoryNamePart("virtual"));
+ result->insert(CategoryNamePart("repository"));
return result;
}
diff --git a/paludis/repositories/unavailable/unavailable_repository_store.hh b/paludis/repositories/unavailable/unavailable_repository_store.hh
index 94746d2..1f78809 100644
--- a/paludis/repositories/unavailable/unavailable_repository_store.hh
+++ b/paludis/repositories/unavailable/unavailable_repository_store.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
@@ -36,8 +36,8 @@ namespace paludis
private PrivateImplementationPattern<UnavailableRepositoryStore>
{
private:
- void _populate_one(const Environment * const env, const FSEntry & f);
void _populate(const Environment * const env, const FSEntry & f);
+ void _populate_one(const Environment * const env, const FSEntry & f);
public:
UnavailableRepositoryStore(