aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-05-14 22:35:12 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-05-14 22:35:12 +0100
commit9c19e8c6ba9ad7f773c74ffaab36426e76c72dcc (patch)
treedb8957456e31369ef95dfb615aa082a116dde398
parent043b9ec3e042e0f2b127402dccf101af8ddb70fd (diff)
downloadpaludis-9c19e8c6ba9ad7f773c74ffaab36426e76c72dcc.tar.gz
paludis-9c19e8c6ba9ad7f773c74ffaab36426e76c72dcc.tar.xz
Comma separated deps will be used elsewhere too
-rw-r--r--.gitignore2
-rw-r--r--paludis/comma_separated_dep_parser.cc (renamed from paludis/repositories/unpackaged/dep_parser.cc)7
-rw-r--r--paludis/comma_separated_dep_parser.hh (renamed from paludis/repositories/unpackaged/dep_parser.hh)21
-rw-r--r--paludis/comma_separated_dep_parser_TEST.cc (renamed from paludis/repositories/unpackaged/dep_parser_TEST.cc)15
-rw-r--r--paludis/comma_separated_dep_printer.cc (renamed from paludis/repositories/unpackaged/dep_printer.cc)29
-rw-r--r--paludis/comma_separated_dep_printer.hh (renamed from paludis/repositories/unpackaged/dep_printer.hh)33
-rw-r--r--paludis/files.m42
-rw-r--r--paludis/repositories/unpackaged/Makefile.am21
-rw-r--r--paludis/repositories/unpackaged/installed_id.cc11
-rw-r--r--paludis/repositories/unpackaged/unpackaged_id.cc2
-rw-r--r--paludis/repositories/unpackaged/unpackaged_key.cc12
11 files changed, 65 insertions, 90 deletions
diff --git a/.gitignore b/.gitignore
index 2e2f007..5210215 100644
--- a/.gitignore
+++ b/.gitignore
@@ -191,6 +191,7 @@ paludis-*.*.*.tar.bz2
/paludis/about_TEST
/paludis/args/args_TEST
/paludis/broken_linkage_configuration_TEST
+/paludis/comma_separated_dep_parser_TEST
/paludis/dep_list_TEST
/paludis/dep_list_TEST_blockers
/paludis/dep_spec_TEST
@@ -315,7 +316,6 @@ paludis-*.*.*.tar.bz2
/paludis/repositories/gems/installed_gems_repository_TEST
/paludis/repositories/gems/yaml_TEST
/paludis/repositories/unavailable/unavailable_repository_TEST
-/paludis/repositories/unpackaged/dep_parser_TEST
/paludis/repositories/unpackaged/installed_repository_TEST
/paludis/repositories/unpackaged/unpackaged_repository_TEST
/paludis/repositories/unwritten/unwritten_repository_TEST
diff --git a/paludis/repositories/unpackaged/dep_parser.cc b/paludis/comma_separated_dep_parser.cc
index fa0f96e..d701bd0 100644
--- a/paludis/repositories/unpackaged/dep_parser.cc
+++ b/paludis/comma_separated_dep_parser.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2007, 2008, 2009 Ciaran McCreesh
+ * Copyright (c) 2007, 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
@@ -17,7 +17,7 @@
* Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#include <paludis/repositories/unpackaged/dep_parser.hh>
+#include <paludis/comma_separated_dep_parser.hh>
#include <paludis/util/tokeniser.hh>
#include <paludis/util/strip.hh>
#include <paludis/util/exception.hh>
@@ -29,10 +29,9 @@
#include <list>
using namespace paludis;
-using namespace paludis::unpackaged_repositories;
std::tr1::shared_ptr<const DependencySpecTree>
-DepParser::parse(const Environment * const env, const std::string & s)
+CommaSeparatedDepParser::parse(const Environment * const env, const std::string & s)
{
Context context("When parsing '" + s + "':");
diff --git a/paludis/repositories/unpackaged/dep_parser.hh b/paludis/comma_separated_dep_parser.hh
index 69482d8..e707709 100644
--- a/paludis/repositories/unpackaged/dep_parser.hh
+++ b/paludis/comma_separated_dep_parser.hh
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2007, 2008 Ciaran McCreesh
+ * Copyright (c) 2007, 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
@@ -17,8 +17,8 @@
* Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#ifndef PALUDIS_GUARD_PALUDIS_REPOSITORIES_UNPACKAGED_DEP_PARSER_HH
-#define PALUDIS_GUARD_PALUDIS_REPOSITORIES_UNPACKAGED_DEP_PARSER_HH 1
+#ifndef PALUDIS_GUARD_PALUDIS_COMMA_SEPARATED_DEP_PARSER_HH
+#define PALUDIS_GUARD_PALUDIS_COMMA_SEPARATED_DEP_PARSER_HH 1
#include <paludis/util/instantiation_policy.hh>
#include <paludis/spec_tree-fwd.hh>
@@ -26,16 +26,13 @@
namespace paludis
{
- namespace unpackaged_repositories
+ class PALUDIS_VISIBLE CommaSeparatedDepParser :
+ private InstantiationPolicy<CommaSeparatedDepParser, instantiation_method::NonInstantiableTag>
{
- class PALUDIS_VISIBLE DepParser :
- private InstantiationPolicy<DepParser, instantiation_method::NonInstantiableTag>
- {
- public:
- static std::tr1::shared_ptr<const DependencySpecTree> parse(
- const Environment * const env, const std::string &);
- };
- }
+ public:
+ static std::tr1::shared_ptr<const DependencySpecTree> parse(
+ const Environment * const env, const std::string &);
+ };
}
#endif
diff --git a/paludis/repositories/unpackaged/dep_parser_TEST.cc b/paludis/comma_separated_dep_parser_TEST.cc
index 85e478c..7d4eb88 100644
--- a/paludis/repositories/unpackaged/dep_parser_TEST.cc
+++ b/paludis/comma_separated_dep_parser_TEST.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2007, 2008, 2009 Ciaran McCreesh
+ * Copyright (c) 2007, 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
@@ -17,30 +17,29 @@
* Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#include <paludis/repositories/unpackaged/dep_parser.hh>
-#include <paludis/repositories/unpackaged/dep_printer.hh>
+#include <paludis/comma_separated_dep_parser.hh>
+#include <paludis/comma_separated_dep_printer.hh>
#include <paludis/environments/test/test_environment.hh>
#include <paludis/stringify_formatter.hh>
#include <test/test_framework.hh>
#include <test/test_runner.hh>
using namespace paludis;
-using namespace paludis::unpackaged_repositories;
using namespace test;
namespace test_cases
{
- struct DepParserTest : TestCase
+ struct CommaSeparatedDepParserTest : TestCase
{
- DepParserTest() : TestCase("dep parser") { }
+ CommaSeparatedDepParserTest() : TestCase("comma separated dep parser") { }
void run()
{
TestEnvironment env;
std::tr1::shared_ptr<const DependencySpecTree> spec(
- DepParser::parse(&env, "cat/one , cat/two, cat/three\n"));
+ CommaSeparatedDepParser::parse(&env, "cat/one , cat/two, cat/three\n"));
StringifyFormatter f;
- DepPrinter p(&env, f, true);
+ CommaSeparatedDepPrinter p(&env, f, true);
spec->root()->accept(p);
TEST_CHECK_EQUAL(p.result(), "cat/one, cat/two, cat/three");
}
diff --git a/paludis/repositories/unpackaged/dep_printer.cc b/paludis/comma_separated_dep_printer.cc
index fbadefe..2761860 100644
--- a/paludis/repositories/unpackaged/dep_printer.cc
+++ b/paludis/comma_separated_dep_printer.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2007, 2008, 2009 Ciaran McCreesh
+ * Copyright (c) 2007, 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
@@ -17,7 +17,7 @@
* Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#include <paludis/repositories/unpackaged/dep_printer.hh>
+#include <paludis/comma_separated_dep_printer.hh>
#include <paludis/util/private_implementation_pattern-impl.hh>
#include <paludis/util/fs_entry.hh>
#include <paludis/util/options.hh>
@@ -31,12 +31,11 @@
#include <sstream>
using namespace paludis;
-using namespace paludis::unpackaged_repositories;
namespace paludis
{
template <>
- struct Implementation<DepPrinter>
+ struct Implementation<CommaSeparatedDepPrinter>
{
std::stringstream s;
const Environment * const env;
@@ -60,18 +59,18 @@ namespace paludis
};
}
-DepPrinter::DepPrinter(const Environment * const e,
+CommaSeparatedDepPrinter::CommaSeparatedDepPrinter(const Environment * const e,
const DependencySpecTree::ItemFormatter & f, const bool flat) :
- PrivateImplementationPattern<DepPrinter>(new Implementation<DepPrinter>(e, f, 0, flat))
+ PrivateImplementationPattern<CommaSeparatedDepPrinter>(new Implementation<CommaSeparatedDepPrinter>(e, f, 0, flat))
{
}
-DepPrinter::~DepPrinter()
+CommaSeparatedDepPrinter::~CommaSeparatedDepPrinter()
{
}
void
-DepPrinter::visit(const DependencySpecTree::NodeType<PackageDepSpec>::Type & node)
+CommaSeparatedDepPrinter::visit(const DependencySpecTree::NodeType<PackageDepSpec>::Type & node)
{
if (! _imp->flat)
_imp->s << _imp->formatter.indent(_imp->indent);
@@ -99,35 +98,35 @@ DepPrinter::visit(const DependencySpecTree::NodeType<PackageDepSpec>::Type & nod
}
void
-DepPrinter::visit(const DependencySpecTree::NodeType<BlockDepSpec>::Type &)
+CommaSeparatedDepPrinter::visit(const DependencySpecTree::NodeType<BlockDepSpec>::Type &)
{
}
void
-DepPrinter::visit(const DependencySpecTree::NodeType<DependenciesLabelsDepSpec>::Type &)
+CommaSeparatedDepPrinter::visit(const DependencySpecTree::NodeType<DependenciesLabelsDepSpec>::Type &)
{
}
void
-DepPrinter::visit(const DependencySpecTree::NodeType<AllDepSpec>::Type & node)
+CommaSeparatedDepPrinter::visit(const DependencySpecTree::NodeType<AllDepSpec>::Type & node)
{
std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(*this));
}
void
-DepPrinter::visit(const DependencySpecTree::NodeType<AnyDepSpec>::Type & node)
+CommaSeparatedDepPrinter::visit(const DependencySpecTree::NodeType<AnyDepSpec>::Type & node)
{
std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(*this));
}
void
-DepPrinter::visit(const DependencySpecTree::NodeType<ConditionalDepSpec>::Type & node)
+CommaSeparatedDepPrinter::visit(const DependencySpecTree::NodeType<ConditionalDepSpec>::Type & node)
{
std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(*this));
}
void
-DepPrinter::visit(const DependencySpecTree::NodeType<NamedSetDepSpec>::Type & node)
+CommaSeparatedDepPrinter::visit(const DependencySpecTree::NodeType<NamedSetDepSpec>::Type & node)
{
if (! _imp->flat)
_imp->s << _imp->formatter.indent(_imp->indent);
@@ -143,7 +142,7 @@ DepPrinter::visit(const DependencySpecTree::NodeType<NamedSetDepSpec>::Type & no
}
const std::string
-DepPrinter::result() const
+CommaSeparatedDepPrinter::result() const
{
return _imp->s.str();
}
diff --git a/paludis/repositories/unpackaged/dep_printer.hh b/paludis/comma_separated_dep_printer.hh
index 2de14c5..adf38c8 100644
--- a/paludis/repositories/unpackaged/dep_printer.hh
+++ b/paludis/comma_separated_dep_printer.hh
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2007, 2008, 2009 Ciaran McCreesh
+ * Copyright (c) 2007, 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
@@ -27,26 +27,23 @@
namespace paludis
{
- namespace unpackaged_repositories
+ class PALUDIS_VISIBLE CommaSeparatedDepPrinter :
+ private PrivateImplementationPattern<CommaSeparatedDepPrinter>
{
- class PALUDIS_VISIBLE DepPrinter :
- private PrivateImplementationPattern<DepPrinter>
- {
- public:
- DepPrinter(const Environment * const, const DependencySpecTree::ItemFormatter &, const bool);
- ~DepPrinter();
+ public:
+ CommaSeparatedDepPrinter(const Environment * const, const DependencySpecTree::ItemFormatter &, const bool);
+ ~CommaSeparatedDepPrinter();
- const std::string result() const;
+ const std::string result() const;
- void visit(const DependencySpecTree::NodeType<PackageDepSpec>::Type & node);
- void visit(const DependencySpecTree::NodeType<BlockDepSpec>::Type & node);
- void visit(const DependencySpecTree::NodeType<DependenciesLabelsDepSpec>::Type & node);
- void visit(const DependencySpecTree::NodeType<NamedSetDepSpec>::Type & node);
- void visit(const DependencySpecTree::NodeType<AllDepSpec>::Type & node);
- void visit(const DependencySpecTree::NodeType<ConditionalDepSpec>::Type & node);
- void visit(const DependencySpecTree::NodeType<AnyDepSpec>::Type & node);
- };
- }
+ void visit(const DependencySpecTree::NodeType<PackageDepSpec>::Type & node);
+ void visit(const DependencySpecTree::NodeType<BlockDepSpec>::Type & node);
+ void visit(const DependencySpecTree::NodeType<DependenciesLabelsDepSpec>::Type & node);
+ void visit(const DependencySpecTree::NodeType<NamedSetDepSpec>::Type & node);
+ void visit(const DependencySpecTree::NodeType<AllDepSpec>::Type & node);
+ void visit(const DependencySpecTree::NodeType<ConditionalDepSpec>::Type & node);
+ void visit(const DependencySpecTree::NodeType<AnyDepSpec>::Type & node);
+ };
}
#endif
diff --git a/paludis/files.m4 b/paludis/files.m4
index 228bfb0..9be4205 100644
--- a/paludis/files.m4
+++ b/paludis/files.m4
@@ -16,6 +16,8 @@ add(`broken_linkage_configuration', `hh', `cc', `test', `testscript')
add(`broken_linkage_finder', `hh', `cc')
add(`buffer_output_manager', `hh', `cc', `fwd')
add(`choice', `hh', `cc', `fwd')
+add(`comma_separated_dep_parser', `hh', `cc', `test')
+add(`comma_separated_dep_printer', `hh', `cc')
add(`common_sets', `hh', `cc', `fwd')
add(`contents', `hh', `cc', `fwd')
add(`create_output_manager_info', `hh', `cc', `fwd', `se')
diff --git a/paludis/repositories/unpackaged/Makefile.am b/paludis/repositories/unpackaged/Makefile.am
index af8e867..2dfa85e 100644
--- a/paludis/repositories/unpackaged/Makefile.am
+++ b/paludis/repositories/unpackaged/Makefile.am
@@ -12,8 +12,6 @@ DEFS= \
noinst_LTLIBRARIES = libpaludisunpackagedrepository.la
noinst_HEADERS = \
- dep_parser.hh \
- dep_printer.hh \
exceptions.hh \
unpackaged_id.hh \
unpackaged_repository.hh \
@@ -23,8 +21,6 @@ noinst_HEADERS = \
installed_id.hh
libpaludisunpackagedrepository_la_SOURCES = \
- dep_parser.cc \
- dep_printer.cc \
exceptions.cc \
unpackaged_id.cc \
unpackaged_repository.cc \
@@ -57,17 +53,6 @@ installed_repository_TEST_LDADD = \
installed_repository_TEST_CXXFLAGS = $(AM_CXXFLAGS) @PALUDIS_CXXFLAGS_NO_DEBUGGING@
-dep_parser_TEST_SOURCES = dep_parser_TEST.cc
-
-dep_parser_TEST_LDADD = \
- $(top_builddir)/paludis/util/libpaludisutil_@PALUDIS_PC_SLOT@.la \
- $(top_builddir)/paludis/util/test_extras.o \
- $(top_builddir)/paludis/libpaludis_@PALUDIS_PC_SLOT@.la \
- $(top_builddir)/test/libtest.a \
- $(DYNAMIC_LD_LIBS)
-
-dep_parser_TEST_CXXFLAGS = $(AM_CXXFLAGS) @PALUDIS_CXXFLAGS_NO_DEBUGGING@
-
EXTRA_DIST = \
unpackaged_repository_TEST.cc \
unpackaged_repository_TEST_setup.sh \
@@ -75,8 +60,7 @@ EXTRA_DIST = \
installed_repository_TEST.cc \
installed_repository_TEST_setup.sh \
installed_repository_TEST_cleanup.sh \
- installed_id.cc \
- dep_parser_TEST.cc
+ installed_id.cc
check_SCRIPTS = \
unpackaged_repository_TEST_setup.sh \
@@ -86,8 +70,7 @@ check_SCRIPTS = \
TESTS = \
unpackaged_repository_TEST \
- installed_repository_TEST \
- dep_parser_TEST
+ installed_repository_TEST
check_PROGRAMS = $(TESTS)
diff --git a/paludis/repositories/unpackaged/installed_id.cc b/paludis/repositories/unpackaged/installed_id.cc
index 311a96a..d152979 100644
--- a/paludis/repositories/unpackaged/installed_id.cc
+++ b/paludis/repositories/unpackaged/installed_id.cc
@@ -21,8 +21,6 @@
#include <paludis/repositories/unpackaged/installed_repository.hh>
#include <paludis/ndbam.hh>
#include <paludis/ndbam_unmerger.hh>
-#include <paludis/repositories/unpackaged/dep_parser.hh>
-#include <paludis/repositories/unpackaged/dep_printer.hh>
#include <paludis/util/private_implementation_pattern-impl.hh>
#include <paludis/util/system.hh>
#include <paludis/util/fs_entry.hh>
@@ -46,6 +44,9 @@
#include <paludis/literal_metadata_key.hh>
#include <paludis/action.hh>
#include <paludis/user_dep_spec.hh>
+#include <paludis/comma_separated_dep_parser.hh>
+#include <paludis/comma_separated_dep_printer.hh>
+#include <paludis/formatter.hh>
#include <tr1/functional>
using namespace paludis;
@@ -337,7 +338,7 @@ namespace
Context context("When reading '" + stringify(_f) + "' as an InstalledUnpackagedDependencyKey:");
SafeIFStream f(_f);
- _v = DepParser::parse(_env, strip_trailing(
+ _v = CommaSeparatedDepParser::parse(_env, strip_trailing(
std::string((std::istreambuf_iterator<char>(f)), std::istreambuf_iterator<char>()), "\n"));
return _v;
}
@@ -345,7 +346,7 @@ namespace
std::string
pretty_print(const DependencySpecTree::ItemFormatter & f) const
{
- DepPrinter p(_env, f, false);
+ CommaSeparatedDepPrinter p(_env, f, false);
value()->root()->accept(p);
return p.result();
}
@@ -353,7 +354,7 @@ namespace
std::string
pretty_print_flat(const DependencySpecTree::ItemFormatter & f) const
{
- DepPrinter p(_env, f, true);
+ CommaSeparatedDepPrinter p(_env, f, true);
value()->root()->accept(p);
return p.result();
}
diff --git a/paludis/repositories/unpackaged/unpackaged_id.cc b/paludis/repositories/unpackaged/unpackaged_id.cc
index 6909668..6f6c426 100644
--- a/paludis/repositories/unpackaged/unpackaged_id.cc
+++ b/paludis/repositories/unpackaged/unpackaged_id.cc
@@ -20,8 +20,6 @@
#include <paludis/repositories/unpackaged/unpackaged_id.hh>
#include <paludis/repositories/unpackaged/unpackaged_key.hh>
#include <paludis/repositories/unpackaged/unpackaged_stripper.hh>
-#include <paludis/repositories/unpackaged/dep_parser.hh>
-#include <paludis/repositories/unpackaged/dep_printer.hh>
#include <paludis/util/private_implementation_pattern-impl.hh>
#include <paludis/util/fs_entry.hh>
#include <paludis/util/stringify.hh>
diff --git a/paludis/repositories/unpackaged/unpackaged_key.cc b/paludis/repositories/unpackaged/unpackaged_key.cc
index 96c7e7b..966168f 100644
--- a/paludis/repositories/unpackaged/unpackaged_key.cc
+++ b/paludis/repositories/unpackaged/unpackaged_key.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2007, 2008, 2009 Ciaran McCreesh
+ * Copyright (c) 2007, 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
@@ -18,8 +18,6 @@
*/
#include <paludis/repositories/unpackaged/unpackaged_key.hh>
-#include <paludis/repositories/unpackaged/dep_printer.hh>
-#include <paludis/repositories/unpackaged/dep_parser.hh>
#include <paludis/repositories/unpackaged/unpackaged_id.hh>
#include <paludis/util/private_implementation_pattern-impl.hh>
#include <paludis/util/fs_entry.hh>
@@ -30,6 +28,8 @@
#include <paludis/util/make_named_values.hh>
#include <paludis/choice.hh>
#include <paludis/elike_choices.hh>
+#include <paludis/comma_separated_dep_printer.hh>
+#include <paludis/comma_separated_dep_parser.hh>
#include <tr1/memory>
using namespace paludis;
@@ -52,7 +52,7 @@ namespace paludis
const std::tr1::shared_ptr<const DependenciesLabelSequence> & l,
const std::string & r, const std::string & h, const MetadataKeyType t) :
env(e),
- value(DepParser::parse(env, v)),
+ value(CommaSeparatedDepParser::parse(env, v)),
labels(l),
raw_name(r),
human_name(h),
@@ -101,7 +101,7 @@ UnpackagedDependencyKey::type() const
std::string
UnpackagedDependencyKey::pretty_print(const DependencySpecTree::ItemFormatter & f) const
{
- DepPrinter p(_imp->env, f, false);
+ CommaSeparatedDepPrinter p(_imp->env, f, false);
_imp->value->root()->accept(p);
return p.result();
}
@@ -109,7 +109,7 @@ UnpackagedDependencyKey::pretty_print(const DependencySpecTree::ItemFormatter &
std::string
UnpackagedDependencyKey::pretty_print_flat(const DependencySpecTree::ItemFormatter & f) const
{
- DepPrinter p(_imp->env, f, true);
+ CommaSeparatedDepPrinter p(_imp->env, f, true);
_imp->value->root()->accept(p);
return p.result();
}