aboutsummaryrefslogtreecommitdiff
path: root/paludis
diff options
context:
space:
mode:
Diffstat (limited to 'paludis')
-rw-r--r--paludis/files.m41
-rw-r--r--paludis/formatted_pretty_printer.cc6
-rw-r--r--paludis/formatted_pretty_printer.hh2
-rw-r--r--paludis/literal_metadata_key.cc60
-rw-r--r--paludis/literal_metadata_key.hh34
-rw-r--r--paludis/maintainer-fwd.hh36
-rw-r--r--paludis/maintainer.cc43
-rw-r--r--paludis/maintainer.hh54
-rw-r--r--paludis/metadata_key.cc2
-rw-r--r--paludis/metadata_key.hh2
-rw-r--r--paludis/pretty_printer.hh5
-rw-r--r--paludis/unformatted_pretty_printer.cc9
-rw-r--r--paludis/unformatted_pretty_printer.hh4
-rw-r--r--paludis/user_dep_spec.cc14
14 files changed, 269 insertions, 3 deletions
diff --git a/paludis/files.m4 b/paludis/files.m4
index 22052c86a..d97a60dbe 100644
--- a/paludis/files.m4
+++ b/paludis/files.m4
@@ -60,6 +60,7 @@ add(`ipc_output_manager', `hh', `cc', `fwd')
add(`libtool_linkage_checker', `hh', `cc')
add(`linkage_checker', `hh', `cc')
add(`literal_metadata_key', `hh', `cc')
+add(`maintainer', `hh', `cc', `fwd')
add(`mask', `hh', `cc', `fwd', `se')
add(`mask_utils', `hh', `cc', `fwd')
add(`match_package', `hh', `cc', `se', `fwd')
diff --git a/paludis/formatted_pretty_printer.cc b/paludis/formatted_pretty_printer.cc
index 99220f8b2..f73885876 100644
--- a/paludis/formatted_pretty_printer.cc
+++ b/paludis/formatted_pretty_printer.cc
@@ -205,6 +205,12 @@ FormattedPrettyPrinter::prettify(const std::string & v) const
}
const std::string
+FormattedPrettyPrinter::prettify(const Maintainer & v) const
+{
+ return format_plain(stringify(v));
+}
+
+const std::string
FormattedPrettyPrinter::prettify(const std::pair<const std::string, std::string> & v) const
{
if (v.first.empty())
diff --git a/paludis/formatted_pretty_printer.hh b/paludis/formatted_pretty_printer.hh
index 5b98a45a1..a8f55fd88 100644
--- a/paludis/formatted_pretty_printer.hh
+++ b/paludis/formatted_pretty_printer.hh
@@ -74,6 +74,8 @@ namespace paludis
virtual const std::string prettify(const FSPath &) const;
virtual const std::string prettify(const KeywordName &) const;
+
+ virtual const std::string prettify(const Maintainer &) const;
};
}
diff --git a/paludis/literal_metadata_key.cc b/paludis/literal_metadata_key.cc
index 889499ea8..a670d4e11 100644
--- a/paludis/literal_metadata_key.cc
+++ b/paludis/literal_metadata_key.cc
@@ -123,6 +123,24 @@ namespace paludis
{
}
};
+
+ template <>
+ struct Imp<LiteralMetadataMaintainersKey>
+ {
+ const std::string raw_name;
+ const std::string human_name;
+ const MetadataKeyType type;
+ const std::shared_ptr<const Maintainers> value;
+
+ Imp(const std::string & r, const std::string & h, const MetadataKeyType t,
+ const std::shared_ptr<const Maintainers> & v) :
+ raw_name(r),
+ human_name(h),
+ type(t),
+ value(v)
+ {
+ }
+ };
}
LiteralMetadataFSPathSequenceKey::LiteralMetadataFSPathSequenceKey(const std::string & r, const std::string & h,
@@ -399,6 +417,47 @@ LiteralMetadataTimeKey::parse_value() const
return _imp->value;
}
+LiteralMetadataMaintainersKey::LiteralMetadataMaintainersKey(const std::string & r, const std::string & h,
+ const MetadataKeyType t, const std::shared_ptr<const Maintainers> & v) :
+ _imp(r, h, t, v)
+{
+}
+
+LiteralMetadataMaintainersKey::~LiteralMetadataMaintainersKey()
+{
+}
+
+const std::shared_ptr<const Maintainers>
+LiteralMetadataMaintainersKey::parse_value() const
+{
+ return _imp->value;
+}
+
+const std::string
+LiteralMetadataMaintainersKey::pretty_print_value(
+ const PrettyPrinter & p, const PrettyPrintOptions &) const
+{
+ return join(_imp->value->begin(), _imp->value->end(), " ", CallPrettyPrinter(p));
+}
+
+const std::string
+LiteralMetadataMaintainersKey::human_name() const
+{
+ return _imp->human_name;
+}
+
+const std::string
+LiteralMetadataMaintainersKey::raw_name() const
+{
+ return _imp->raw_name;
+}
+
+MetadataKeyType
+LiteralMetadataMaintainersKey::type() const
+{
+ return _imp->type;
+}
+
namespace paludis
{
template class LiteralMetadataValueKey<FSPath>;
@@ -408,3 +467,4 @@ namespace paludis
template class LiteralMetadataValueKey<long>;
template class LiteralMetadataValueKey<std::shared_ptr<const PackageID> >;
}
+
diff --git a/paludis/literal_metadata_key.hh b/paludis/literal_metadata_key.hh
index 9a581cb18..2d81b114f 100644
--- a/paludis/literal_metadata_key.hh
+++ b/paludis/literal_metadata_key.hh
@@ -249,6 +249,40 @@ namespace paludis
const PrettyPrinter &,
const PrettyPrintOptions &) const PALUDIS_ATTRIBUTE((warn_unused_result));
};
+
+ /**
+ * A LiteralMetadataMaintainersKey is a MetadataCollectionKey<Maintainers>
+ * whose value is known at construction time.
+ *
+ * \ingroup g_literal_metadata_key
+ * \since 0.68
+ */
+ class PALUDIS_VISIBLE LiteralMetadataMaintainersKey :
+ public MetadataCollectionKey<Maintainers>
+ {
+ private:
+ Pimp<LiteralMetadataMaintainersKey> _imp;
+
+ public:
+ ///\name Basic operations
+ ///\{
+
+ LiteralMetadataMaintainersKey(const std::string &, const std::string &, const MetadataKeyType,
+ const std::shared_ptr<const Maintainers> &);
+ ~LiteralMetadataMaintainersKey();
+
+ ///\}
+
+ virtual const std::shared_ptr<const Maintainers> parse_value() 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));
+
+ virtual const std::string pretty_print_value(
+ const PrettyPrinter &,
+ const PrettyPrintOptions &) const PALUDIS_ATTRIBUTE((warn_unused_result));
+ };
}
#endif
diff --git a/paludis/maintainer-fwd.hh b/paludis/maintainer-fwd.hh
new file mode 100644
index 000000000..184bb2c41
--- /dev/null
+++ b/paludis/maintainer-fwd.hh
@@ -0,0 +1,36 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2011 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_MAINTAINER_FWD_HH
+#define PALUDIS_GUARD_PALUDIS_MAINTAINER_FWD_HH 1
+
+#include <paludis/util/sequence-fwd.hh>
+#include <paludis/util/attributes.hh>
+#include <iosfwd>
+
+namespace paludis
+{
+ struct Maintainer;
+
+ typedef Sequence<Maintainer> Maintainers;
+
+ std::ostream & operator<< (std::ostream &, const Maintainer &) PALUDIS_VISIBLE;
+}
+
+#endif
diff --git a/paludis/maintainer.cc b/paludis/maintainer.cc
new file mode 100644
index 000000000..33a555b1b
--- /dev/null
+++ b/paludis/maintainer.cc
@@ -0,0 +1,43 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2011 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/maintainer.hh>
+#include <paludis/util/sequence-impl.hh>
+#include <paludis/util/wrapped_forward_iterator-impl.hh>
+#include <ostream>
+
+using namespace paludis;
+
+std::ostream &
+paludis::operator<< (std::ostream & s, const Maintainer & m)
+{
+ if (! m.author().empty())
+ s << m.author() << " ";
+ s << "<" << m.email() << ">";
+ if (! m.description().empty())
+ s << " (" + m.description() + ")";
+ return s;
+}
+
+namespace paludis
+{
+ template class Sequence<Maintainer>;
+ template class WrappedForwardIterator<Sequence<Maintainer>::ConstIteratorTag, const Maintainer>;
+}
+
diff --git a/paludis/maintainer.hh b/paludis/maintainer.hh
new file mode 100644
index 000000000..cca6dc266
--- /dev/null
+++ b/paludis/maintainer.hh
@@ -0,0 +1,54 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2011 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_MAINTAINER_HH
+#define PALUDIS_GUARD_PALUDIS_MAINTAINER_HH 1
+
+#include <paludis/maintainer-fwd.hh>
+#include <paludis/util/sequence.hh>
+#include <paludis/util/wrapped_forward_iterator.hh>
+#include <paludis/util/named_value.hh>
+
+namespace paludis
+{
+ namespace n
+ {
+ typedef Name<struct name_author> author;
+ typedef Name<struct name_description> description;
+ typedef Name<struct name_email> email;
+ }
+
+ /**
+ * Represents a package maintainer.
+ *
+ * \since 0.68
+ * \ingroup g_metadata_key
+ */
+ struct Maintainer
+ {
+ NamedValue<n::author, std::string> author;
+ NamedValue<n::description, std::string> description;
+ NamedValue<n::email, std::string> email;
+ };
+
+ extern template class Sequence<Maintainer>;
+ extern template class WrappedForwardIterator<Sequence<Maintainer>::ConstIteratorTag, const Maintainer>;
+}
+
+#endif
diff --git a/paludis/metadata_key.cc b/paludis/metadata_key.cc
index 2f009e549..9694275fe 100644
--- a/paludis/metadata_key.cc
+++ b/paludis/metadata_key.cc
@@ -75,6 +75,7 @@ namespace paludis
template class MetadataCollectionKey<Map<std::string, std::string> >;
template class MetadataCollectionKey<PackageIDSequence>;
template class MetadataCollectionKey<FSPathSequence>;
+ template class MetadataCollectionKey<Maintainers>;
template class MetadataSpecTreeKey<LicenseSpecTree>;
template class MetadataSpecTreeKey<PlainTextSpecTree>;
@@ -93,3 +94,4 @@ namespace paludis
template class MetadataValueKey<std::shared_ptr<const PackageID> >;
template class MetadataValueKey<std::shared_ptr<const Choices> >;
}
+
diff --git a/paludis/metadata_key.hh b/paludis/metadata_key.hh
index ad7794288..8b17c3c27 100644
--- a/paludis/metadata_key.hh
+++ b/paludis/metadata_key.hh
@@ -31,6 +31,7 @@
#include <paludis/choice-fwd.hh>
#include <paludis/pretty_printer-fwd.hh>
#include <paludis/pretty_print_options-fwd.hh>
+#include <paludis/maintainer-fwd.hh>
#include <paludis/util/fs_path-fwd.hh>
#include <paludis/util/attributes.hh>
#include <paludis/util/remove_shared_ptr.hh>
@@ -91,6 +92,7 @@ namespace paludis
MetadataCollectionKey<PackageIDSequence>,
MetadataCollectionKey<FSPathSequence>,
MetadataCollectionKey<Map<std::string, std::string> >,
+ MetadataCollectionKey<Maintainers>,
MetadataSpecTreeKey<DependencySpecTree>,
MetadataSpecTreeKey<LicenseSpecTree>,
MetadataSpecTreeKey<FetchableURISpecTree>,
diff --git a/paludis/pretty_printer.hh b/paludis/pretty_printer.hh
index 9369d1bad..043c4dd39 100644
--- a/paludis/pretty_printer.hh
+++ b/paludis/pretty_printer.hh
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2010 Ciaran McCreesh
+ * Copyright (c) 2010, 2011 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
@@ -26,6 +26,7 @@
#include <paludis/dep_spec-fwd.hh>
#include <paludis/package_id-fwd.hh>
#include <paludis/name-fwd.hh>
+#include <paludis/maintainer-fwd.hh>
#include <string>
#include <memory>
@@ -68,6 +69,8 @@ namespace paludis
virtual const std::string prettify(const FSPath &) const = 0;
virtual const std::string prettify(const KeywordName &) const = 0;
+
+ virtual const std::string prettify(const Maintainer &) const = 0;
};
}
diff --git a/paludis/unformatted_pretty_printer.cc b/paludis/unformatted_pretty_printer.cc
index 793cf77bc..a66d257e8 100644
--- a/paludis/unformatted_pretty_printer.cc
+++ b/paludis/unformatted_pretty_printer.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2010 Ciaran McCreesh
+ * Copyright (c) 2010, 2011 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
@@ -20,6 +20,7 @@
#include <paludis/unformatted_pretty_printer.hh>
#include <paludis/util/stringify.hh>
#include <paludis/name.hh>
+#include <paludis/maintainer.hh>
using namespace paludis;
@@ -148,3 +149,9 @@ UnformattedPrettyPrinter::prettify(const KeywordName & v) const
return stringify(v);
}
+const std::string
+UnformattedPrettyPrinter::prettify(const Maintainer & v) const
+{
+ return stringify(v);
+}
+
diff --git a/paludis/unformatted_pretty_printer.hh b/paludis/unformatted_pretty_printer.hh
index a9de9b09f..113e54d49 100644
--- a/paludis/unformatted_pretty_printer.hh
+++ b/paludis/unformatted_pretty_printer.hh
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2010 Ciaran McCreesh
+ * Copyright (c) 2010, 2011 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
@@ -58,6 +58,8 @@ namespace paludis
virtual const std::string prettify(const FSPath &) const;
virtual const std::string prettify(const KeywordName &) const;
+
+ virtual const std::string prettify(const Maintainer &) const;
};
}
diff --git a/paludis/user_dep_spec.cc b/paludis/user_dep_spec.cc
index 6d8400514..4e810d0d6 100644
--- a/paludis/user_dep_spec.cc
+++ b/paludis/user_dep_spec.cc
@@ -820,6 +820,20 @@ namespace
return false;
}
+
+ bool visit(const MetadataCollectionKey<Maintainers> & s) const
+ {
+ auto v(s.parse_value());
+ switch (op)
+ {
+ case '=':
+ return pattern == join(v->begin(), v->end(), " ");
+ case '<':
+ return v->end() != std::find_if(v->begin(), v->end(), StringifyEqual(pattern));
+ }
+
+ return false;
+ }
};
struct AssociatedKeyFinder