aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Piotr Jaroszyński <peper@gentoo.org> 2007-05-09 22:20:48 +0000
committerAvatar Piotr Jaroszyński <peper@gentoo.org> 2007-05-09 22:20:48 +0000
commita6397bbe8be0725119da961155ecc898bb263b12 (patch)
tree87275594b7c3d401af2194315ec229a35bfedab9
parent737ee05a2dead2971a473d38d876e007f3a81c8e (diff)
downloadpaludis-a6397bbe8be0725119da961155ecc898bb263b12.tar.gz
paludis-a6397bbe8be0725119da961155ecc898bb263b12.tar.xz
Skip the digest_collisions_check when files dir is not present.
-rw-r--r--paludis/qa/digest_collisions_check.cc53
1 files changed, 27 insertions, 26 deletions
diff --git a/paludis/qa/digest_collisions_check.cc b/paludis/qa/digest_collisions_check.cc
index c6ffe96..37cca44 100644
--- a/paludis/qa/digest_collisions_check.cc
+++ b/paludis/qa/digest_collisions_check.cc
@@ -43,36 +43,39 @@ DigestCollisionsCheck::operator() (const FSEntry & d) const
{
CheckResult result(d, identifier());
- for (DirIterator i(d / "files") ; i != DirIterator() ; ++i)
+ if ((d / "files").is_directory())
{
- if (! is_file_with_prefix_extension(*i, "digest-", "", IsFileWithOptions()))
- continue;
-
- std::fstream f(stringify(*i).c_str());
- std::string line;
- Tokeniser<delim_kind::AnyOfTag, delim_mode::DelimiterTag> tokeniser(" \t\n");
- while (std::getline(f, line))
+ for (DirIterator i(d / "files") ; i != DirIterator() ; ++i)
{
- std::vector<std::string> entries;
- tokeniser.tokenise(line, std::back_inserter(entries));
-
- if (entries.size() != 4)
+ if (! is_file_with_prefix_extension(*i, "digest-", "", IsFileWithOptions()))
continue;
- if ("MD5" != entries.at(0))
- continue;
-
- MakeHashedMap<std::string, std::pair<std::string, FSEntry> >::Type::iterator existing(
- digests.find(entries.at(2)));
- if (digests.end() != existing)
+ std::fstream f(stringify(*i).c_str());
+ std::string line;
+ Tokeniser<delim_kind::AnyOfTag, delim_mode::DelimiterTag> tokeniser(" \t\n");
+ while (std::getline(f, line))
{
- if (entries.at(1) != existing->second.first)
- result << Message(qal_major, "Digest conflict on '" + entries.at(2) +
- "' in '" + stringify(*i) +
- "' (original was '" + stringify(existing->second.second) + "')");
+ std::vector<std::string> entries;
+ tokeniser.tokenise(line, std::back_inserter(entries));
+
+ if (entries.size() != 4)
+ continue;
+
+ if ("MD5" != entries.at(0))
+ continue;
+
+ MakeHashedMap<std::string, std::pair<std::string, FSEntry> >::Type::iterator existing(
+ digests.find(entries.at(2)));
+ if (digests.end() != existing)
+ {
+ if (entries.at(1) != existing->second.first)
+ result << Message(qal_major, "Digest conflict on '" + entries.at(2) +
+ "' in '" + stringify(*i) +
+ "' (original was '" + stringify(existing->second.second) + "')");
+ }
+ else
+ digests.insert(std::make_pair(entries.at(2), std::make_pair(entries.at(1), *i)));
}
- else
- digests.insert(std::make_pair(entries.at(2), std::make_pair(entries.at(1), *i)));
}
}
@@ -85,5 +88,3 @@ DigestCollisionsCheck::identifier()
static const std::string id("digest_collisions");
return id;
}
-
-