aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Mike Kelly <pioto@pioto.org> 2007-08-08 22:03:51 +0000
committerAvatar Mike Kelly <pioto@pioto.org> 2007-08-08 22:03:51 +0000
commitd80b8d24f85242bc488e632ccc2921bca703db10 (patch)
tree93205773c705ba4d1c86be8c51c405a44005932f
parent1376539e3ac374c686a17d0a2eec3a01003cd165 (diff)
downloadpaludis-d80b8d24f85242bc488e632ccc2921bca703db10.tar.gz
paludis-d80b8d24f85242bc488e632ccc2921bca703db10.tar.xz
Fix manifest checking
-rw-r--r--paludis/repositories/e/check_fetched_files_visitor.cc44
-rw-r--r--paludis/repositories/e/check_fetched_files_visitor.hh3
-rw-r--r--paludis/repositories/e/ebuild_entries.cc2
-rw-r--r--paludis/repositories/e/manifest2_reader.cc8
4 files changed, 50 insertions, 7 deletions
diff --git a/paludis/repositories/e/check_fetched_files_visitor.cc b/paludis/repositories/e/check_fetched_files_visitor.cc
index e623971..311cde7 100644
--- a/paludis/repositories/e/check_fetched_files_visitor.cc
+++ b/paludis/repositories/e/check_fetched_files_visitor.cc
@@ -71,7 +71,8 @@ namespace paludis
const tr1::shared_ptr<const PackageID> & i,
const FSEntry & d,
const bool c,
- const bool n) :
+ const bool n,
+ const FSEntry & m2) :
env(e),
id(i),
distdir(d),
@@ -79,7 +80,7 @@ namespace paludis
failures(new Sequence<FetchActionFailure>),
need_nofetch(false),
in_nofetch(n),
- m2r(new Manifest2Reader(d / "Manifest"))
+ m2r(new Manifest2Reader(m2))
{
}
};
@@ -90,8 +91,9 @@ CheckFetchedFilesVisitor::CheckFetchedFilesVisitor(
const tr1::shared_ptr<const PackageID> & i,
const FSEntry & d,
const bool c,
- const bool n) :
- PrivateImplementationPattern<CheckFetchedFilesVisitor>(new Implementation<CheckFetchedFilesVisitor>(e, i, d, c, n))
+ const bool n,
+ const FSEntry & m2) :
+ PrivateImplementationPattern<CheckFetchedFilesVisitor>(new Implementation<CheckFetchedFilesVisitor>(e, i, d, c, n, m2))
{
}
@@ -169,12 +171,25 @@ CheckFetchedFilesVisitor::visit_leaf(const LabelsDepSpec<URILabelVisitorTypes> &
bool
CheckFetchedFilesVisitor::check_distfile_manifest(const FSEntry & distfile)
{
+ if (_imp->m2r->begin() == _imp->m2r->end())
+ {
+ Log::get_instance()->message(ll_debug, lc_context)
+ << "Empty or non-existent Manifest file";
+ return true;
+ }
+
+ bool found(false);
+
for (Manifest2Reader::Iterator m(_imp->m2r->begin()), m_end(_imp->m2r->end()) ;
m != m_end ; ++m)
{
if (distfile.basename() != m->name)
continue;
+ found = true;
+ Log::get_instance()->message(ll_debug, lc_context)
+ << "Actual size = " << distfile.file_size()
+ << "; Manifest file size = " << m->size;
if (distfile.file_size() != m->size)
{
Log::get_instance()->message(ll_debug, lc_context)
@@ -218,6 +233,8 @@ CheckFetchedFilesVisitor::check_distfile_manifest(const FSEntry & distfile)
);
return false;
}
+ Log::get_instance()->message(ll_debug, lc_context)
+ << "Actual RMD160 = " << rmd160sum.hexsum();
file_stream.clear();
file_stream.seekg(0, std::ios::beg);
}
@@ -238,6 +255,8 @@ CheckFetchedFilesVisitor::check_distfile_manifest(const FSEntry & distfile)
);
return false;
}
+ Log::get_instance()->message(ll_debug, lc_context)
+ << "Actual SHA256 = " << sha256sum.hexsum();
file_stream.clear();
file_stream.seekg(0, std::ios::beg);
}
@@ -258,8 +277,23 @@ CheckFetchedFilesVisitor::check_distfile_manifest(const FSEntry & distfile)
);
return false;
}
+ Log::get_instance()->message(ll_debug, lc_context)
+ << "Actual MD5 = " << md5sum.hexsum();
}
}
+
+ if (! found)
+ {
+ std::cout << "not in Manifest";
+ _imp->failures->push_back(FetchActionFailure::create()
+ .target_file(stringify(distfile.basename()))
+ .requires_manual_fetching(false)
+ .failed_integrity_checks("Not in Manifest")
+ .failed_automatic_fetching(false)
+ );
+ return false;
+ }
+
return true;
}
@@ -275,7 +309,7 @@ CheckFetchedFilesVisitor::visit_leaf(const URIDepSpec & u)
}
_imp->done.insert(u.filename());
- std::cout << "Checking '" << u.filename() << "'... ";
+ std::cout << "Checking '" << u.filename() << "'... " << std::flush;
if (! (_imp->distdir / u.filename()).is_regular_file())
{
diff --git a/paludis/repositories/e/check_fetched_files_visitor.hh b/paludis/repositories/e/check_fetched_files_visitor.hh
index 2d8ecea..56463d3 100644
--- a/paludis/repositories/e/check_fetched_files_visitor.hh
+++ b/paludis/repositories/e/check_fetched_files_visitor.hh
@@ -46,7 +46,8 @@ namespace paludis
const tr1::shared_ptr<const PackageID> &,
const FSEntry & distdir,
const bool check_unneeded,
- const bool fetch_restrict);
+ const bool fetch_restrict,
+ const FSEntry & m2);
~CheckFetchedFilesVisitor();
diff --git a/paludis/repositories/e/ebuild_entries.cc b/paludis/repositories/e/ebuild_entries.cc
index fd694f3..9ffb30c 100644
--- a/paludis/repositories/e/ebuild_entries.cc
+++ b/paludis/repositories/e/ebuild_entries.cc
@@ -413,7 +413,7 @@ EbuildEntries::fetch(const tr1::shared_ptr<const ERepositoryID> & id,
FetchVisitor f(_imp->params.environment, id, *id->eapi(),
_imp->e_repository->params().distdir, o.fetch_unneeded, fetch_userpriv_ok, mirrors_name, fetch_restrict);
id->src_uri_key()->value()->accept(f);
- CheckFetchedFilesVisitor c(_imp->environment, id, _imp->e_repository->params().distdir, o.fetch_unneeded, fetch_restrict);
+ CheckFetchedFilesVisitor c(_imp->environment, id, _imp->e_repository->params().distdir, o.fetch_unneeded, fetch_restrict, ((_imp->e_repository->layout()->package_directory(id->name())) / "Manifest"));
id->src_uri_key()->value()->accept(c);
if (c.need_nofetch())
diff --git a/paludis/repositories/e/manifest2_reader.cc b/paludis/repositories/e/manifest2_reader.cc
index cab2c21..7dc1d52 100644
--- a/paludis/repositories/e/manifest2_reader.cc
+++ b/paludis/repositories/e/manifest2_reader.cc
@@ -86,6 +86,14 @@ Manifest2Reader::Manifest2Reader(const FSEntry & f) :
continue;
type = (*t);
+ if ("EBUILD" != type
+ && "EBIN" != type
+ && "EXHERES" != type
+ && "MISC" != type
+ && "AUX" != type
+ && "DIST" != type)
+ continue;
+
++t;
if (t_end == t)
throw Manifest2Error("no file name found");