aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-05-14 22:52:32 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-05-14 22:52:32 +0100
commit0bcf854fd2a2e7a5f1d1840f3b982739b76cfabd (patch)
tree51a89f56e4ebb80b60d6f7ca3e33e1969440d714
parent9c19e8c6ba9ad7f773c74ffaab36426e76c72dcc (diff)
downloadpaludis-0bcf854fd2a2e7a5f1d1840f3b982739b76cfabd.tar.gz
paludis-0bcf854fd2a2e7a5f1d1840f3b982739b76cfabd.tar.xz
Track repo deps
-rw-r--r--paludis/repositories/unavailable/Makefile.am2
-rw-r--r--paludis/repositories/unavailable/unavailable_repository_dependencies_key.cc121
-rw-r--r--paludis/repositories/unavailable/unavailable_repository_dependencies_key.hh57
-rw-r--r--paludis/repositories/unavailable/unavailable_repository_file.cc10
-rw-r--r--paludis/repositories/unavailable/unavailable_repository_file.hh1
-rw-r--r--paludis/repositories/unavailable/unavailable_repository_id.cc8
-rw-r--r--paludis/repositories/unavailable/unavailable_repository_id.hh2
-rw-r--r--paludis/repositories/unavailable/unavailable_repository_store.cc7
8 files changed, 205 insertions, 3 deletions
diff --git a/paludis/repositories/unavailable/Makefile.am b/paludis/repositories/unavailable/Makefile.am
index 8c09c72..2ce2cb6 100644
--- a/paludis/repositories/unavailable/Makefile.am
+++ b/paludis/repositories/unavailable/Makefile.am
@@ -15,6 +15,7 @@ noinst_HEADERS = \
unavailable_repository.hh unavailable_repository-fwd.hh \
unavailable_package_id.hh \
unavailable_repository_id.hh \
+ unavailable_repository_dependencies_key.hh \
unavailable_mask.hh \
unavailable_repository_store.hh \
unavailable_repository_file.hh unavailable_repository_file-fwd.hh
@@ -23,6 +24,7 @@ libpaludisunavailablerepository_la_SOURCES = \
unavailable_repository.cc \
unavailable_package_id.cc \
unavailable_repository_id.cc \
+ unavailable_repository_dependencies_key.cc \
unavailable_mask.cc \
unavailable_repository_store.cc \
unavailable_repository_file.cc \
diff --git a/paludis/repositories/unavailable/unavailable_repository_dependencies_key.cc b/paludis/repositories/unavailable/unavailable_repository_dependencies_key.cc
new file mode 100644
index 0000000..07a18db
--- /dev/null
+++ b/paludis/repositories/unavailable/unavailable_repository_dependencies_key.cc
@@ -0,0 +1,121 @@
+/* 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_dependencies_key.hh>
+#include <paludis/util/private_implementation_pattern-impl.hh>
+#include <paludis/util/fs_entry.hh>
+#include <paludis/util/validated.hh>
+#include <paludis/util/make_shared_ptr.hh>
+#include <paludis/util/set.hh>
+#include <paludis/util/make_named_values.hh>
+#include <paludis/util/return_literal_function.hh>
+#include <paludis/dep_label.hh>
+#include <paludis/comma_separated_dep_parser.hh>
+#include <paludis/comma_separated_dep_printer.hh>
+#include <tr1/memory>
+
+using namespace paludis;
+using namespace paludis::unavailable_repository;
+
+namespace paludis
+{
+ template <>
+ struct Implementation<UnavailableRepositoryDependenciesKey>
+ {
+ const Environment * const env;
+ const std::tr1::shared_ptr<const DependencySpecTree> value;
+ const std::tr1::shared_ptr<DependenciesLabelSequence> labels;
+
+ const std::string raw_name;
+ const std::string human_name;
+ const MetadataKeyType type;
+
+ Implementation(const Environment * const e,
+ const std::string & r, const std::string & h, const MetadataKeyType t,
+ const std::string & v) :
+ env(e),
+ value(CommaSeparatedDepParser::parse(e, v)),
+ labels(new DependenciesLabelSequence),
+ raw_name(r),
+ human_name(h),
+ type(t)
+ {
+ labels->push_back(make_shared_ptr(new DependenciesBuildLabel("build", return_literal_function(true))));
+ }
+ };
+}
+
+UnavailableRepositoryDependenciesKey::UnavailableRepositoryDependenciesKey(const Environment * const env,
+ const std::string & r, const std::string & h, const MetadataKeyType t,
+ const std::string & v) :
+ PrivateImplementationPattern<UnavailableRepositoryDependenciesKey>(
+ new Implementation<UnavailableRepositoryDependenciesKey>(env, r, h, t, v))
+{
+}
+
+UnavailableRepositoryDependenciesKey::~UnavailableRepositoryDependenciesKey()
+{
+}
+
+const std::tr1::shared_ptr<const DependencySpecTree>
+UnavailableRepositoryDependenciesKey::value() const
+{
+ return _imp->value;
+}
+
+const std::string
+UnavailableRepositoryDependenciesKey::raw_name() const
+{
+ return _imp->raw_name;
+}
+
+const std::string
+UnavailableRepositoryDependenciesKey::human_name() const
+{
+ return _imp->human_name;
+}
+
+MetadataKeyType
+UnavailableRepositoryDependenciesKey::type() const
+{
+ return _imp->type;
+}
+
+std::string
+UnavailableRepositoryDependenciesKey::pretty_print(const DependencySpecTree::ItemFormatter & f) const
+{
+ CommaSeparatedDepPrinter p(_imp->env, f, false);
+ _imp->value->root()->accept(p);
+ return p.result();
+}
+
+std::string
+UnavailableRepositoryDependenciesKey::pretty_print_flat(const DependencySpecTree::ItemFormatter & f) const
+{
+ CommaSeparatedDepPrinter p(_imp->env, f, true);
+ _imp->value->root()->accept(p);
+ return p.result();
+}
+
+const std::tr1::shared_ptr<const DependenciesLabelSequence>
+UnavailableRepositoryDependenciesKey::initial_labels() const
+{
+ return _imp->labels;
+}
+
diff --git a/paludis/repositories/unavailable/unavailable_repository_dependencies_key.hh b/paludis/repositories/unavailable/unavailable_repository_dependencies_key.hh
new file mode 100644
index 0000000..751140e
--- /dev/null
+++ b/paludis/repositories/unavailable/unavailable_repository_dependencies_key.hh
@@ -0,0 +1,57 @@
+/* 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
+ */
+
+#ifndef PALUDIS_GUARD_PALUDIS_REPOSITORIES_UNAVAILABLE_UNAVAILABLE_REPOSITORY_DEPENDENCIES_KEY_HH
+#define PALUDIS_GUARD_PALUDIS_REPOSITORIES_UNAVAILABLE_UNAVAILABLE_REPOSITORY_DEPENDENCIES_KEY_HH 1
+
+#include <paludis/metadata_key.hh>
+#include <paludis/util/private_implementation_pattern.hh>
+
+namespace paludis
+{
+ namespace unavailable_repository
+ {
+ class UnavailableRepositoryDependenciesKey :
+ public MetadataSpecTreeKey<DependencySpecTree>,
+ private PrivateImplementationPattern<UnavailableRepositoryDependenciesKey>
+ {
+ public:
+ UnavailableRepositoryDependenciesKey(
+ const Environment * const env,
+ const std::string & r, const std::string & h, const MetadataKeyType t,
+ const std::string & v);
+ ~UnavailableRepositoryDependenciesKey();
+
+ const std::tr1::shared_ptr<const DependencySpecTree> value() const;
+
+ std::string pretty_print(const DependencySpecTree::ItemFormatter & f) const;
+
+ std::string pretty_print_flat(const DependencySpecTree::ItemFormatter & f) const;
+
+ virtual const std::tr1::shared_ptr<const DependenciesLabelSequence> initial_labels() const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ virtual const std::string raw_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual const std::string human_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual MetadataKeyType type() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ };
+ }
+}
+
+#endif
diff --git a/paludis/repositories/unavailable/unavailable_repository_file.cc b/paludis/repositories/unavailable/unavailable_repository_file.cc
index 58da42f..0d8db74 100644
--- a/paludis/repositories/unavailable/unavailable_repository_file.cc
+++ b/paludis/repositories/unavailable/unavailable_repository_file.cc
@@ -42,7 +42,7 @@ namespace paludis
template <>
struct Implementation<UnavailableRepositoryFile>
{
- std::string repo_name, homepage, description, sync, repo_format;
+ std::string repo_name, homepage, description, sync, repo_format, dependencies;
bool autoconfigurable;
Entries entries;
@@ -125,6 +125,8 @@ UnavailableRepositoryFile::_load(const FSEntry & f)
_imp->sync = value;
else if (key == "repo_format")
_imp->repo_format = value;
+ else if (key == "dependencies")
+ _imp->dependencies = value;
else
Log::get_instance()->message("unavailable_repository.file.unknown_key", ll_warning, lc_context)
<< "Ignoring unknown key '" << key << "' with value '" << value << "'";
@@ -255,6 +257,12 @@ UnavailableRepositoryFile::repo_format() const
return _imp->repo_format;
}
+std::string
+UnavailableRepositoryFile::dependencies() const
+{
+ return _imp->dependencies;
+}
+
bool
UnavailableRepositoryFile::autoconfigurable() const
{
diff --git a/paludis/repositories/unavailable/unavailable_repository_file.hh b/paludis/repositories/unavailable/unavailable_repository_file.hh
index 29790f0..a8841d9 100644
--- a/paludis/repositories/unavailable/unavailable_repository_file.hh
+++ b/paludis/repositories/unavailable/unavailable_repository_file.hh
@@ -49,6 +49,7 @@ namespace paludis
std::string description() const PALUDIS_ATTRIBUTE((warn_unused_result));
std::string sync() const PALUDIS_ATTRIBUTE((warn_unused_result));
std::string repo_format() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ std::string dependencies() const PALUDIS_ATTRIBUTE((warn_unused_result));
bool autoconfigurable() const PALUDIS_ATTRIBUTE((warn_unused_result));
};
}
diff --git a/paludis/repositories/unavailable/unavailable_repository_id.cc b/paludis/repositories/unavailable/unavailable_repository_id.cc
index d3c9612..44f27cf 100644
--- a/paludis/repositories/unavailable/unavailable_repository_id.cc
+++ b/paludis/repositories/unavailable/unavailable_repository_id.cc
@@ -49,6 +49,7 @@ namespace paludis
const VersionSpec version;
const UnavailableRepository * const repo;
+ const std::tr1::shared_ptr<const MetadataSpecTreeKey<DependencySpecTree> > dependencies_key;
const std::tr1::shared_ptr<const MetadataValueKey<std::string> > description_key;
const std::tr1::shared_ptr<const MetadataValueKey<std::string> > homepage_key;
const std::tr1::shared_ptr<const MetadataValueKey<std::string> > sync_key;
@@ -61,6 +62,7 @@ namespace paludis
name(e.name()),
version("0", VersionSpecOptions()),
repo(e.repository()),
+ dependencies_key(e.dependencies()),
description_key(e.description()),
homepage_key(e.homepage()),
sync_key(e.sync()),
@@ -75,6 +77,8 @@ UnavailableRepositoryID::UnavailableRepositoryID(const UnavailableRepositoryIDPa
PrivateImplementationPattern<UnavailableRepositoryID>(new Implementation<UnavailableRepositoryID>(entry)),
_imp(PrivateImplementationPattern<UnavailableRepositoryID>::_imp)
{
+ if (_imp->dependencies_key)
+ add_metadata_key(_imp->dependencies_key);
if (_imp->description_key)
add_metadata_key(_imp->description_key);
if (_imp->homepage_key)
@@ -307,13 +311,13 @@ UnavailableRepositoryID::provide_key() const
const std::tr1::shared_ptr<const MetadataSpecTreeKey<DependencySpecTree> >
UnavailableRepositoryID::dependencies_key() const
{
- return std::tr1::shared_ptr<const MetadataSpecTreeKey<DependencySpecTree> >();
+ return _imp->dependencies_key;
}
const std::tr1::shared_ptr<const MetadataSpecTreeKey<DependencySpecTree> >
UnavailableRepositoryID::build_dependencies_key() const
{
- return std::tr1::shared_ptr<const MetadataSpecTreeKey<DependencySpecTree> >();
+ return _imp->dependencies_key;
}
const std::tr1::shared_ptr<const MetadataSpecTreeKey<DependencySpecTree> >
diff --git a/paludis/repositories/unavailable/unavailable_repository_id.hh b/paludis/repositories/unavailable/unavailable_repository_id.hh
index b5e97d2..89d1bcf 100644
--- a/paludis/repositories/unavailable/unavailable_repository_id.hh
+++ b/paludis/repositories/unavailable/unavailable_repository_id.hh
@@ -30,6 +30,7 @@ namespace paludis
{
namespace n
{
+ struct dependencies;
struct description;
struct environment;
struct format;
@@ -44,6 +45,7 @@ namespace paludis
{
struct UnavailableRepositoryIDParams
{
+ NamedValue<n::dependencies, std::tr1::shared_ptr<const MetadataSpecTreeKey<DependencySpecTree> > > dependencies;
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;
diff --git a/paludis/repositories/unavailable/unavailable_repository_store.cc b/paludis/repositories/unavailable/unavailable_repository_store.cc
index 997443e..ba60160 100644
--- a/paludis/repositories/unavailable/unavailable_repository_store.cc
+++ b/paludis/repositories/unavailable/unavailable_repository_store.cc
@@ -21,6 +21,7 @@
#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_repository_dependencies_key.hh>
#include <paludis/repositories/unavailable/unavailable_mask.hh>
#include <paludis/util/private_implementation_pattern-impl.hh>
#include <paludis/util/fs_entry.hh>
@@ -191,8 +192,14 @@ UnavailableRepositoryStore::_populate_one(const Environment * const env, const F
if (file.autoconfigurable())
{
const std::tr1::shared_ptr<NoConfigurationInformationMask> no_configuration_mask(new NoConfigurationInformationMask);
+ std::tr1::shared_ptr<UnavailableRepositoryDependenciesKey> deps;
+ if (! file.dependencies().empty())
+ deps.reset(new UnavailableRepositoryDependenciesKey(env, "dependencies", "Dependencies", mkt_dependencies,
+ file.dependencies()));
+
const std::tr1::shared_ptr<UnavailableRepositoryID> id(new UnavailableRepositoryID(
make_named_values<UnavailableRepositoryIDParams>(
+ value_for<n::dependencies>(deps),
value_for<n::description>(repository_description),
value_for<n::environment>(env),
value_for<n::format>(repository_format),