aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-02-16 21:07:35 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-02-16 21:07:35 +0000
commite3176e4b3eb9582615cc65bcb090aa421dd0ffe7 (patch)
treec8ea79b43d64e4165544458686aa0b8ee4502962
parent3d410c1193145aad25caa4fc5801ed6e3c676103 (diff)
downloadpaludis-e3176e4b3eb9582615cc65bcb090aa421dd0ffe7.tar.gz
paludis-e3176e4b3eb9582615cc65bcb090aa421dd0ffe7.tar.xz
Check ChangeLog header
-rw-r--r--paludis/qa/changelog_check.cc25
1 files changed, 25 insertions, 0 deletions
diff --git a/paludis/qa/changelog_check.cc b/paludis/qa/changelog_check.cc
index 650bbef..ae5b00d 100644
--- a/paludis/qa/changelog_check.cc
+++ b/paludis/qa/changelog_check.cc
@@ -19,6 +19,7 @@
#include "changelog_check.hh"
#include <paludis/pstream.hh>
+#include <fstream>
using namespace paludis;
using namespace paludis::qa;
@@ -36,6 +37,30 @@ ChangeLogCheck::operator() (const FSEntry & f) const
result << Message(qal_skip, "Not a ChangeLog");
else if (! f.is_regular_file())
result << Message(qal_major, "Not a regular file");
+ else
+ {
+ std::ifstream ff(stringify(f).c_str());
+ do
+ {
+ if (! ff)
+ {
+ result << Message(qal_major, "Can't read ChangeLog");
+ continue;
+ }
+
+ std::string s;
+ if (! std::getline(ff, s))
+ {
+ result << Message(qal_major, "Can't read ChangeLog header");
+ continue;
+ }
+
+ if (s != "# ChangeLog for " + stringify(f.dirname().dirname().basename())
+ + "/" + stringify(f.dirname().basename()))
+ result << Message(qal_minor, "ChangeLog header is incorrect");
+ }
+ while (false);
+ }
return result;
}