aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2008-12-04 21:06:59 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2008-12-04 21:06:59 +0000
commitd02d72e0664ae11627dbfe826bfa3600dad1f4d8 (patch)
tree8f08cc869792b01b559d39f40d6c9f5d3246d8f6
parent7d3ba0e39b9a83202be7bbc51496d7a21c3630a6 (diff)
downloadpaludis-d02d72e0664ae11627dbfe826bfa3600dad1f4d8.tar.gz
paludis-d02d72e0664ae11627dbfe826bfa3600dad1f4d8.tar.xz
kill some sr
-rw-r--r--paludis/repositories/e/Makefile.am13
-rw-r--r--paludis/repositories/e/e_repository_sets.cc30
-rw-r--r--paludis/repositories/e/glsa.cc12
-rw-r--r--paludis/repositories/e/glsa.hh24
-rw-r--r--paludis/repositories/e/glsa.sr20
-rw-r--r--paludis/repositories/e/xml_things.cc8
-rw-r--r--paludis/repositories/e/xml_things_TEST.cc16
7 files changed, 55 insertions, 68 deletions
diff --git a/paludis/repositories/e/Makefile.am b/paludis/repositories/e/Makefile.am
index c4479cc..a631c4b 100644
--- a/paludis/repositories/e/Makefile.am
+++ b/paludis/repositories/e/Makefile.am
@@ -1,7 +1,6 @@
SUBDIRS = eapis ebuild . qa
CLEANFILES = *~ gmon.out *.gcov *.gcno *.gcda *.loT *.epicfail
DISTCLEANFILES = \
- glsa-sr.hh glsa-sr.cc \
e_installed_repository-sr.hh e_installed_repository-sr.cc \
e_repository_params-sr.hh e_repository_params-sr.cc \
e_repository_params-se.hh e_repository_params-se.cc \
@@ -75,7 +74,6 @@ paludis_repositories_e_include_HEADERS = \
iuse-se.hh \
pretend_fetch_visitor.hh \
fix_locked_dependencies.hh \
- glsa-sr.hh \
glsa.hh \
layout.hh \
manifest2_entry-sr.hh \
@@ -332,9 +330,6 @@ EXTRA_DIST = \
dep_parser-se.cc \
dep_parser_TEST.cc \
dep_spec_pretty_printer_TEST.cc \
- glsa.sr \
- glsa-sr.hh \
- glsa-sr.cc \
e_repository_TEST.cc \
e_repository_TEST_setup.sh \
e_repository_TEST_cleanup.sh \
@@ -395,8 +390,6 @@ BUILT_SOURCES = \
e_repository_params-sr.cc \
e_repository_params-se.hh \
e_repository_params-se.cc \
- glsa-sr.hh \
- glsa-sr.cc \
iuse-se.hh \
iuse-se.cc \
exndbam_repository-sr.hh \
@@ -456,12 +449,6 @@ manifest2_entry-sr.hh : manifest2_entry.sr $(top_srcdir)/misc/make_sr.bash
manifest2_entry-sr.cc : manifest2_entry.sr $(top_srcdir)/misc/make_sr.bash
$(top_srcdir)/misc/make_sr.bash --source $(srcdir)/manifest2_entry.sr > $@
-glsa-sr.hh : glsa.sr $(top_srcdir)/misc/make_sr.bash
- $(top_srcdir)/misc/make_sr.bash --header $(srcdir)/glsa.sr > $@
-
-glsa-sr.cc : glsa.sr $(top_srcdir)/misc/make_sr.bash
- $(top_srcdir)/misc/make_sr.bash --source $(srcdir)/glsa.sr > $@
-
exndbam_repository-sr.hh : exndbam_repository.sr $(top_srcdir)/misc/make_sr.bash
$(top_srcdir)/misc/make_sr.bash --header $(srcdir)/exndbam_repository.sr > $@
diff --git a/paludis/repositories/e/e_repository_sets.cc b/paludis/repositories/e/e_repository_sets.cc
index 134d0cf..3ec730c 100644
--- a/paludis/repositories/e/e_repository_sets.cc
+++ b/paludis/repositories/e/e_repository_sets.cc
@@ -42,6 +42,7 @@
#include <paludis/util/set.hh>
#include <paludis/util/sequence.hh>
#include <paludis/util/make_shared_ptr.hh>
+#include <paludis/util/make_named_values.hh>
#include <paludis/dep_spec.hh>
#include <paludis/elike_slot_requirement.hh>
#include <paludis/selection.hh>
@@ -174,28 +175,28 @@ ERepositorySets::sets_list() const
namespace
{
bool
- match_range(const PackageID & e, const GLSARange & r)
+ match_range(const PackageID & e, const erepository::GLSARange & r)
{
- if (r.slot != "*")
+ if (r.slot() != "*")
{
try
{
- if (e.slot() != SlotName(r.slot))
+ if (e.slot() != SlotName(r.slot()))
return false;
}
catch (const SlotNameError &)
{
- throw GLSAError("Got bad slot '" + r.slot + "'");
+ throw GLSAError("Got bad slot '" + r.slot() + "'");
}
}
VersionOperatorValue our_op(static_cast<VersionOperatorValue>(-1));
- std::string ver(r.version);
- if (r.op == "le")
+ std::string ver(r.version());
+ if (r.op() == "le")
our_op = vo_less_equal;
- if (r.op == "lt")
+ if (r.op() == "lt")
our_op = vo_less;
- if (r.op == "eq")
+ if (r.op() == "eq")
{
if (! ver.empty() && '*' == ver.at(ver.length() - 1))
{
@@ -205,21 +206,24 @@ namespace
else
our_op = vo_equal;
}
- if (r.op == "gt")
+ if (r.op() == "gt")
our_op = vo_greater;
- if (r.op == "ge")
+ if (r.op() == "ge")
our_op = vo_greater_equal;
if (-1 != our_op)
return (VersionOperator(our_op).as_version_spec_comparator()(e.version(), VersionSpec(ver)));
- if (0 == r.op.compare(0, 1, "r"))
+ if (0 == r.op().compare(0, 1, "r"))
{
return e.version().remove_revision() == VersionSpec(ver).remove_revision() &&
- match_range(e, GLSARange::create().op(r.op.substr(1)).version(r.version).slot(r.slot));
+ match_range(e, make_named_values<erepository::GLSARange>(
+ value_for<n::op>(r.op().substr(1)),
+ value_for<n::slot>(r.slot()),
+ value_for<n::version>(r.version())));
}
- throw GLSAError("Got bad op '" + r.op + "'");
+ throw GLSAError("Got bad op '" + r.op() + "'");
}
bool
diff --git a/paludis/repositories/e/glsa.cc b/paludis/repositories/e/glsa.cc
index 709ebfe..b99833c 100644
--- a/paludis/repositories/e/glsa.cc
+++ b/paludis/repositories/e/glsa.cc
@@ -33,11 +33,9 @@
using namespace paludis;
template class WrappedForwardIterator<GLSAPackage::ArchsConstIteratorTag, const std::string>;
-template class WrappedForwardIterator<GLSAPackage::RangesConstIteratorTag, const GLSARange>;
+template class WrappedForwardIterator<GLSAPackage::RangesConstIteratorTag, const erepository::GLSARange>;
template class WrappedForwardIterator<GLSA::PackagesConstIteratorTag, const GLSAPackage>;
-#include "glsa-sr.cc"
-
namespace paludis
{
template<>
@@ -45,8 +43,8 @@ namespace paludis
{
QualifiedPackageName name;
std::list<std::string> archs;
- std::list<GLSARange> unaffected;
- std::list<GLSARange> vulnerable;
+ std::list<erepository::GLSARange> unaffected;
+ std::list<erepository::GLSARange> vulnerable;
Implementation(const QualifiedPackageName & n) :
name(n)
@@ -115,13 +113,13 @@ GLSAPackage::end_vulnerable() const
}
void
-GLSAPackage::add_unaffected(const GLSARange & r)
+GLSAPackage::add_unaffected(const erepository::GLSARange & r)
{
_imp->unaffected.push_back(r);
}
void
-GLSAPackage::add_vulnerable(const GLSARange & r)
+GLSAPackage::add_vulnerable(const erepository::GLSARange & r)
{
_imp->vulnerable.push_back(r);
}
diff --git a/paludis/repositories/e/glsa.hh b/paludis/repositories/e/glsa.hh
index 14b162c..a3fd2dd 100644
--- a/paludis/repositories/e/glsa.hh
+++ b/paludis/repositories/e/glsa.hh
@@ -21,8 +21,8 @@
#define PALUDIS_GUARD_PALUDIS_REPOSITORIES_E_GLSA_HH 1
#include <paludis/util/private_implementation_pattern.hh>
-#include <paludis/util/sr.hh>
#include <paludis/util/wrapped_forward_iterator-fwd.hh>
+#include <paludis/util/named_value.hh>
#include <paludis/name.hh>
#include <paludis/version_spec.hh>
#include <tr1/memory>
@@ -30,8 +30,22 @@
namespace paludis
{
+ namespace n
+ {
+ struct op;
+ struct slot;
+ struct version;
+ }
-#include <paludis/repositories/e/glsa-sr.hh>
+ namespace erepository
+ {
+ struct GLSARange
+ {
+ NamedValue<n::op, std::string> op;
+ NamedValue<n::slot, std::string> slot;
+ NamedValue<n::version, std::string> version;
+ };
+ }
/**
* Thrown if a bad GLSA is found.
@@ -90,7 +104,7 @@ namespace paludis
///\{
struct RangesConstIteratorTag;
- typedef WrappedForwardIterator<RangesConstIteratorTag, const GLSARange> RangesConstIterator;
+ typedef WrappedForwardIterator<RangesConstIteratorTag, const erepository::GLSARange> RangesConstIterator;
RangesConstIterator begin_unaffected() const;
RangesConstIterator end_unaffected() const;
RangesConstIterator begin_vulnerable() const;
@@ -101,12 +115,12 @@ namespace paludis
/**
* Add an unaffected package.
*/
- void add_unaffected(const GLSARange &);
+ void add_unaffected(const erepository::GLSARange &);
/**
* Add a vulnerable package.
*/
- void add_vulnerable(const GLSARange &);
+ void add_vulnerable(const erepository::GLSARange &);
/**
* Our package's name.
diff --git a/paludis/repositories/e/glsa.sr b/paludis/repositories/e/glsa.sr
deleted file mode 100644
index a182651..0000000
--- a/paludis/repositories/e/glsa.sr
+++ /dev/null
@@ -1,20 +0,0 @@
-make_class_GLSARange()
-{
- visible
-
- key op std::string
- # not a version, may be something like 1.3*
- key version std::string
- key slot std::string
-
- allow_named_args
-
- doxygen_comment << "END"
- /**
- * A version range in a GLSA.
- *
- * \see ERepositorySets
- * \ingroup grperepository
- */
-END
-}
diff --git a/paludis/repositories/e/xml_things.cc b/paludis/repositories/e/xml_things.cc
index 18ae6e3..c991cf4 100644
--- a/paludis/repositories/e/xml_things.cc
+++ b/paludis/repositories/e/xml_things.cc
@@ -206,8 +206,12 @@ namespace
std::string op, slot("*");
handle_range_range(doc, n->properties, op, slot);
std::string version(fix_whitespace(unstupid_libxml_string(xmlNodeListGetString(doc, n->xmlChildrenNode, 1))));
- ((*pkg).*(name == "unaffected" ? &GLSAPackage::add_unaffected : &GLSAPackage::add_vulnerable))
- (GLSARange::create().op(op).version(version).slot(slot));
+ ((*pkg).*(name == "unaffected" ? &GLSAPackage::add_unaffected : &GLSAPackage::add_vulnerable))(
+ make_named_values<erepository::GLSARange>(
+ value_for<n::op>(op),
+ value_for<n::slot>(slot),
+ value_for<n::version>(version)
+ ));
}
else
handle_node(doc, n->children);
diff --git a/paludis/repositories/e/xml_things_TEST.cc b/paludis/repositories/e/xml_things_TEST.cc
index 2653170..3709c46 100644
--- a/paludis/repositories/e/xml_things_TEST.cc
+++ b/paludis/repositories/e/xml_things_TEST.cc
@@ -47,14 +47,14 @@ namespace test_cases
TEST_CHECK_STRINGIFY_EQUAL("1", std::distance(glsa->begin_packages()->begin_unaffected(),
glsa->begin_packages()->end_unaffected()));
- TEST_CHECK_STRINGIFY_EQUAL("ge", glsa->begin_packages()->begin_unaffected()->op);
- TEST_CHECK_STRINGIFY_EQUAL("1.23", glsa->begin_packages()->begin_unaffected()->version);
+ TEST_CHECK_STRINGIFY_EQUAL("ge", glsa->begin_packages()->begin_unaffected()->op());
+ TEST_CHECK_STRINGIFY_EQUAL("1.23", glsa->begin_packages()->begin_unaffected()->version());
TEST_CHECK_STRINGIFY_EQUAL("1", std::distance(glsa->begin_packages(), glsa->end_packages()));
TEST_CHECK_STRINGIFY_EQUAL("1", std::distance(glsa->begin_packages()->begin_vulnerable(),
glsa->begin_packages()->end_vulnerable()));
- TEST_CHECK_STRINGIFY_EQUAL("lt", glsa->begin_packages()->begin_vulnerable()->op);
- TEST_CHECK_STRINGIFY_EQUAL("1.22", glsa->begin_packages()->begin_vulnerable()->version);
+ TEST_CHECK_STRINGIFY_EQUAL("lt", glsa->begin_packages()->begin_vulnerable()->op());
+ TEST_CHECK_STRINGIFY_EQUAL("1.22", glsa->begin_packages()->begin_vulnerable()->version());
}
} glsa_test_123456_78;
@@ -79,14 +79,14 @@ namespace test_cases
TEST_CHECK_STRINGIFY_EQUAL("1", std::distance(glsa->begin_packages()->begin_unaffected(),
glsa->begin_packages()->end_unaffected()));
- TEST_CHECK_STRINGIFY_EQUAL("ge", glsa->begin_packages()->begin_unaffected()->op);
- TEST_CHECK_STRINGIFY_EQUAL("12.34", glsa->begin_packages()->begin_unaffected()->version);
+ TEST_CHECK_STRINGIFY_EQUAL("ge", glsa->begin_packages()->begin_unaffected()->op());
+ TEST_CHECK_STRINGIFY_EQUAL("12.34", glsa->begin_packages()->begin_unaffected()->version());
TEST_CHECK_STRINGIFY_EQUAL("1", std::distance(glsa->begin_packages(), glsa->end_packages()));
TEST_CHECK_STRINGIFY_EQUAL("1", std::distance(glsa->begin_packages()->begin_vulnerable(),
glsa->begin_packages()->end_vulnerable()));
- TEST_CHECK_STRINGIFY_EQUAL("lt", glsa->begin_packages()->begin_vulnerable()->op);
- TEST_CHECK_STRINGIFY_EQUAL("12.34", glsa->begin_packages()->begin_vulnerable()->version);
+ TEST_CHECK_STRINGIFY_EQUAL("lt", glsa->begin_packages()->begin_vulnerable()->op());
+ TEST_CHECK_STRINGIFY_EQUAL("12.34", glsa->begin_packages()->begin_vulnerable()->version());
}
} glsa_test_987654_32;
}