aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2008-12-04 21:27:46 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2008-12-04 21:27:46 +0000
commit50300ac23003d16659efbf7e749ac2a79dd58e6d (patch)
tree2de72ddfafa956bc9fbff610efcbdda8e4d13b42
parentd02d72e0664ae11627dbfe826bfa3600dad1f4d8 (diff)
downloadpaludis-50300ac23003d16659efbf7e749ac2a79dd58e6d.tar.gz
paludis-50300ac23003d16659efbf7e749ac2a79dd58e6d.tar.xz
kill some sr
-rw-r--r--paludis/repositories/e/Makefile.am17
-rw-r--r--paludis/repositories/e/check_fetched_files_visitor.cc22
-rw-r--r--paludis/repositories/e/manifest2_entry.sr18
-rw-r--r--paludis/repositories/e/manifest2_reader.cc22
-rw-r--r--paludis/repositories/e/manifest2_reader.hh24
-rw-r--r--paludis/repositories/e/pretend_fetch_visitor.cc2
-rw-r--r--paludis/repositories/e/qa/manifest.cc42
7 files changed, 66 insertions, 81 deletions
diff --git a/paludis/repositories/e/Makefile.am b/paludis/repositories/e/Makefile.am
index a631c4b..39dce68 100644
--- a/paludis/repositories/e/Makefile.am
+++ b/paludis/repositories/e/Makefile.am
@@ -6,8 +6,7 @@ DISTCLEANFILES = \
e_repository_params-se.hh e_repository_params-se.cc \
vdb_repository-sr.hh vdb_repository-sr.cc \
dep_parser-se.hh dep_parser-se.cc \
- iuse-se.hh iuse-se.cc \
- manifest2_entry-sr.hh manifest2_entry-sr.cc
+ iuse-se.hh iuse-se.cc
MAINTAINERCLEANFILES = Makefile.in
@@ -76,7 +75,6 @@ paludis_repositories_e_include_HEADERS = \
fix_locked_dependencies.hh \
glsa.hh \
layout.hh \
- manifest2_entry-sr.hh \
manifest2_reader.hh \
metadata_xml.hh \
myoption.hh \
@@ -361,9 +359,6 @@ EXTRA_DIST = \
iuse.se \
iuse-se.hh \
iuse-se.cc \
- manifest2_entry.sr \
- manifest2_entry-sr.hh \
- manifest2_entry-sr.cc \
source_uri_finder_TEST.cc \
xml_things_TEST.cc \
xml_things_TEST_setup.sh \
@@ -395,9 +390,7 @@ BUILT_SOURCES = \
exndbam_repository-sr.hh \
exndbam_repository-sr.cc \
vdb_repository-sr.hh \
- vdb_repository-sr.cc \
- manifest2_entry-sr.hh \
- manifest2_entry-sr.cc
+ vdb_repository-sr.cc
check_SCRIPTS = \
e_repository_TEST_setup.sh e_repository_TEST_cleanup.sh \
@@ -443,12 +436,6 @@ e_repository_params-sr.hh : e_repository_params.sr $(top_srcdir)/misc/make_sr.ba
e_repository_params-sr.cc : e_repository_params.sr $(top_srcdir)/misc/make_sr.bash
$(top_srcdir)/misc/make_sr.bash --source $(srcdir)/e_repository_params.sr > $@
-manifest2_entry-sr.hh : manifest2_entry.sr $(top_srcdir)/misc/make_sr.bash
- $(top_srcdir)/misc/make_sr.bash --header $(srcdir)/manifest2_entry.sr > $@
-
-manifest2_entry-sr.cc : manifest2_entry.sr $(top_srcdir)/misc/make_sr.bash
- $(top_srcdir)/misc/make_sr.bash --source $(srcdir)/manifest2_entry.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/check_fetched_files_visitor.cc b/paludis/repositories/e/check_fetched_files_visitor.cc
index 3f76ca2..ab0e5f3 100644
--- a/paludis/repositories/e/check_fetched_files_visitor.cc
+++ b/paludis/repositories/e/check_fetched_files_visitor.cc
@@ -218,14 +218,14 @@ CheckFetchedFilesVisitor::check_distfile_manifest(const FSEntry & distfile)
for (Manifest2Reader::ConstIterator m(_imp->m2r->begin()), m_end(_imp->m2r->end()) ;
m != m_end ; ++m)
{
- if (distfile.basename() != m->name)
+ if (distfile.basename() != m->name())
continue;
found = true;
Log::get_instance()->message("e.manifest.size", ll_debug, lc_context)
<< "Actual size = " << distfile.file_size()
- << "; Manifest file size = " << m->size;
- if (distfile.file_size() != m->size)
+ << "; Manifest file size = " << m->size();
+ if (distfile.file_size() != m->size())
{
Log::get_instance()->message("e.manifest.no_size", ll_debug, lc_context)
<< "Malformed Manifest: no file size found";
@@ -252,10 +252,10 @@ CheckFetchedFilesVisitor::check_distfile_manifest(const FSEntry & distfile)
return false;
}
- if (! m->rmd160.empty())
+ if (! m->rmd160().empty())
{
RMD160 rmd160sum(file_stream);
- if (rmd160sum.hexsum() != m->rmd160)
+ if (rmd160sum.hexsum() != m->rmd160())
{
Log::get_instance()->message("e.manifest.rmd160.failure", ll_debug, lc_context)
<< "Malformed Manifest: failed RMD160 checksum";
@@ -274,10 +274,10 @@ CheckFetchedFilesVisitor::check_distfile_manifest(const FSEntry & distfile)
file_stream.seekg(0, std::ios::beg);
}
- if (! m->sha1.empty())
+ if (! m->sha1().empty())
{
SHA1 sha1sum(file_stream);
- if (sha1sum.hexsum() != m->sha1)
+ if (sha1sum.hexsum() != m->sha1())
{
Log::get_instance()->message("e.manifest.sha1.failure", ll_debug, lc_context)
<< "Malformed Manifest: failed SHA1 checksum";
@@ -296,10 +296,10 @@ CheckFetchedFilesVisitor::check_distfile_manifest(const FSEntry & distfile)
file_stream.seekg(0, std::ios::beg);
}
- if (! m->sha256.empty())
+ if (! m->sha256().empty())
{
SHA256 sha256sum(file_stream);
- if (sha256sum.hexsum() != m->sha256)
+ if (sha256sum.hexsum() != m->sha256())
{
Log::get_instance()->message("e.manifest.sha256.failure", ll_debug, lc_context)
<< "Malformed Manifest: failed SHA256 checksum";
@@ -318,10 +318,10 @@ CheckFetchedFilesVisitor::check_distfile_manifest(const FSEntry & distfile)
file_stream.seekg(0, std::ios::beg);
}
- if (! m->md5.empty())
+ if (! m->md5().empty())
{
MD5 md5sum(file_stream);
- if (md5sum.hexsum() != m->md5)
+ if (md5sum.hexsum() != m->md5())
{
Log::get_instance()->message("e.manifest.md5.failure", ll_debug, lc_context)
<< "Malformed Manifest: failed MD5 checksum";
diff --git a/paludis/repositories/e/manifest2_entry.sr b/paludis/repositories/e/manifest2_entry.sr
deleted file mode 100644
index 28fca22..0000000
--- a/paludis/repositories/e/manifest2_entry.sr
+++ /dev/null
@@ -1,18 +0,0 @@
-#!/usr/bin/env bash
-# vim: set sw=4 sts=4 et :
-
-make_class_Manifest2Entry()
-{
- visible
-
- key type "std::string"
- key name "std::string"
- key size "off_t"
-
- key sha1 "std::string"
- key sha256 "std::string"
- key rmd160 "std::string"
- key md5 "std::string"
-
- allow_named_args
-}
diff --git a/paludis/repositories/e/manifest2_reader.cc b/paludis/repositories/e/manifest2_reader.cc
index 080f458..10e7017 100644
--- a/paludis/repositories/e/manifest2_reader.cc
+++ b/paludis/repositories/e/manifest2_reader.cc
@@ -18,7 +18,6 @@
*/
#include <paludis/repositories/e/manifest2_reader.hh>
-
#include <paludis/util/config_file.hh>
#include <paludis/util/destringify.hh>
#include <paludis/util/fs_entry.hh>
@@ -29,12 +28,11 @@
#include <paludis/util/tokeniser.hh>
#include <paludis/util/private_implementation_pattern-impl.hh>
#include <paludis/util/member_iterator-impl.hh>
+#include <paludis/util/make_named_values.hh>
#include <list>
#include <map>
-#include <paludis/repositories/e/manifest2_entry-sr.cc>
-
using namespace paludis;
using namespace paludis::erepository;
@@ -122,15 +120,15 @@ Manifest2Reader::Manifest2Reader(const FSEntry & f) :
<< "Skipping unknown checksum type " << checksum_type;
}
- _imp->entries.insert(std::make_pair(std::make_pair(type,name), Manifest2Entry::create()
- .type(type)
- .size(size)
- .name(name)
- .sha1(sha1)
- .sha256(sha256)
- .rmd160(rmd160)
- .md5(md5)
- ));
+ _imp->entries.insert(std::make_pair(std::make_pair(type,name), make_named_values<Manifest2Entry>(
+ value_for<n::md5>(md5),
+ value_for<n::name>(name),
+ value_for<n::rmd160>(rmd160),
+ value_for<n::sha1>(sha1),
+ value_for<n::sha256>(sha256),
+ value_for<n::size>(size),
+ value_for<n::type>(type)
+ )));
}
}
diff --git a/paludis/repositories/e/manifest2_reader.hh b/paludis/repositories/e/manifest2_reader.hh
index 8aba06e..70ef782 100644
--- a/paludis/repositories/e/manifest2_reader.hh
+++ b/paludis/repositories/e/manifest2_reader.hh
@@ -25,9 +25,6 @@
#include <paludis/util/stringify.hh>
#include <paludis/util/sr.hh>
#include <paludis/util/wrapped_forward_iterator-fwd.hh>
-
-#include <paludis/repositories/e/manifest2_entry-sr.hh>
-
#include <string>
/** \file
@@ -38,9 +35,30 @@
namespace paludis
{
+ namespace n
+ {
+ struct md5;
+ struct name;
+ struct rmd160;
+ struct sha1;
+ struct sha256;
+ struct size;
+ struct type;
+ }
namespace erepository
{
+ struct Manifest2Entry
+ {
+ NamedValue<n::md5, std::string> md5;
+ NamedValue<n::name, std::string> name;
+ NamedValue<n::rmd160, std::string> rmd160;
+ NamedValue<n::sha1, std::string> sha1;
+ NamedValue<n::sha256, std::string> sha256;
+ NamedValue<n::size, off_t> size;
+ NamedValue<n::type, std::string> type;
+ };
+
/**
* Thrown if a Manifest2 file cannot be read properly.
*
diff --git a/paludis/repositories/e/pretend_fetch_visitor.cc b/paludis/repositories/e/pretend_fetch_visitor.cc
index 19a4fa3..d32a3be 100644
--- a/paludis/repositories/e/pretend_fetch_visitor.cc
+++ b/paludis/repositories/e/pretend_fetch_visitor.cc
@@ -137,6 +137,6 @@ PretendFetchVisitor::visit_leaf(const FetchableURIDepSpec & u)
if (_imp->manifest.end() == m)
return;
- _imp->action.will_fetch(destination, m->size);
+ _imp->action.will_fetch(destination, m->size());
}
diff --git a/paludis/repositories/e/qa/manifest.cc b/paludis/repositories/e/qa/manifest.cc
index 2bf7be3..1631478 100644
--- a/paludis/repositories/e/qa/manifest.cc
+++ b/paludis/repositories/e/qa/manifest.cc
@@ -113,11 +113,11 @@ namespace
void check_file(const Manifest2Entry & entry)
{
- if ("DIST" == entry.type)
+ if ("DIST" == entry.type())
{
- if (distfiles.end() == distfiles.find(entry.name))
+ if (distfiles.end() == distfiles.find(entry.name()))
{
- QAMessage m(manifest, qaml_minor, name, "DIST file '" + entry.name + "' is not used by any package");
+ QAMessage m(manifest, qaml_minor, name, "DIST file '" + entry.name() + "' is not used by any package");
for (PackageIDSequence::ConstIterator it(packages->begin()),
it_end(packages->end()); it_end != it; ++it)
{
@@ -128,11 +128,11 @@ namespace
reporter.message(m);
}
- accounted_distfiles.insert(entry.name);
+ accounted_distfiles.insert(entry.name());
return;
}
- FSEntry file("AUX" == entry.type ? dir / "files" / entry.name : dir / entry.name);
+ FSEntry file("AUX" == entry.type() ? dir / "files" / entry.name() : dir / entry.name());
Map<FSEntry, std::string>::ConstIterator it(files->find(file));
if (files->end() == it)
{
@@ -140,44 +140,44 @@ namespace
return;
}
- if (entry.type != it->second)
- reporter.message(QAMessage(file, qaml_normal, name, "File is of type '" + it->second + "', but Manifest lists '" + entry.type + "'"));
- if (entry.size != file.file_size())
- reporter.message(QAMessage(file, qaml_normal, name, "File size is '" + stringify(file.file_size()) + "', but Manifest lists '" + stringify(entry.size) + "'"));
+ if (entry.type() != it->second)
+ reporter.message(QAMessage(file, qaml_normal, name, "File is of type '" + it->second + "', but Manifest lists '" + entry.type() + "'"));
+ if (entry.size() != file.file_size())
+ reporter.message(QAMessage(file, qaml_normal, name, "File size is '" + stringify(file.file_size()) + "', but Manifest lists '" + stringify(entry.size()) + "'"));
- if (! entry.sha1.empty())
+ if (! entry.sha1().empty())
{
std::ifstream s(stringify(file).c_str());
SHA1 sha1(s);
- if (entry.sha1 != sha1.hexsum())
- reporter.message(QAMessage(file, qaml_normal, name, "File SHA1 is '" + sha1.hexsum() + "', but Manifest lists '" + entry.sha1 + "'"));
+ if (entry.sha1() != sha1.hexsum())
+ reporter.message(QAMessage(file, qaml_normal, name, "File SHA1 is '" + sha1.hexsum() + "', but Manifest lists '" + entry.sha1() + "'"));
}
- if (! entry.sha256.empty())
+ if (! entry.sha256().empty())
{
std::ifstream s(stringify(file).c_str());
SHA256 sha256(s);
- if (entry.sha256 != sha256.hexsum())
- reporter.message(QAMessage(file, qaml_normal, name, "File SHA256 is '" + sha256.hexsum() + "', but Manifest lists '" + entry.sha256 + "'"));
+ if (entry.sha256() != sha256.hexsum())
+ reporter.message(QAMessage(file, qaml_normal, name, "File SHA256 is '" + sha256.hexsum() + "', but Manifest lists '" + entry.sha256() + "'"));
}
- if (! entry.rmd160.empty())
+ if (! entry.rmd160().empty())
{
std::ifstream s(stringify(file).c_str());
RMD160 rmd160(s);
- if (entry.rmd160 != rmd160.hexsum())
- reporter.message(QAMessage(file, qaml_normal, name, "File RMD160 is '" + rmd160.hexsum() + "', but Manifest lists '" + entry.rmd160 + "'"));
+ if (entry.rmd160() != rmd160.hexsum())
+ reporter.message(QAMessage(file, qaml_normal, name, "File RMD160 is '" + rmd160.hexsum() + "', but Manifest lists '" + entry.rmd160() + "'"));
}
- if (! entry.md5.empty())
+ if (! entry.md5().empty())
{
std::ifstream s(stringify(file).c_str());
MD5 md5(s);
- if (entry.md5 != md5.hexsum())
- reporter.message(QAMessage(file, qaml_normal, name, "File MD5 is '" + md5.hexsum() + "', but Manifest lists '" + entry.md5 + "'"));
+ if (entry.md5() != md5.hexsum())
+ reporter.message(QAMessage(file, qaml_normal, name, "File MD5 is '" + md5.hexsum() + "', but Manifest lists '" + entry.md5() + "'"));
}