aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Danny van Dyk <dvandyk@exherbo.org> 2007-01-22 22:44:05 +0000
committerAvatar Danny van Dyk <dvandyk@exherbo.org> 2007-01-22 22:44:05 +0000
commit8e54a6a3df94b40e17f33aea997e30ee70d26d78 (patch)
tree47f47609fb4ce8b246bc217bd71b6dff4cb3674f
parentb3a138365116f14fcb39d271618c4eb89010b19b (diff)
downloadpaludis-8e54a6a3df94b40e17f33aea997e30ee70d26d78.tar.gz
paludis-8e54a6a3df94b40e17f33aea997e30ee70d26d78.tar.xz
Change check to use deprecated functions from text file. Add gnuconfig_update to the list of deprecated functions.
-rw-r--r--paludis/qa/deprecated_functions.txt2
-rw-r--r--paludis/qa/deprecated_functions_check.cc36
-rw-r--r--paludis/qa/files.m41
3 files changed, 35 insertions, 4 deletions
diff --git a/paludis/qa/deprecated_functions.txt b/paludis/qa/deprecated_functions.txt
new file mode 100644
index 0000000..fb851d8
--- /dev/null
+++ b/paludis/qa/deprecated_functions.txt
@@ -0,0 +1,2 @@
+check_KV
+gnuconfig_update
diff --git a/paludis/qa/deprecated_functions_check.cc b/paludis/qa/deprecated_functions_check.cc
index 3556820..703b1e3 100644
--- a/paludis/qa/deprecated_functions_check.cc
+++ b/paludis/qa/deprecated_functions_check.cc
@@ -18,10 +18,16 @@
*/
#include <fstream>
+#include <paludis/config_file.hh>
#include <paludis/qa/deprecated_functions_check.hh>
#include <paludis/util/is_file_with_extension.hh>
+#include <paludis/util/log.hh>
+#include <paludis/util/system.hh>
#include <pcre++.h>
+#include <set>
+#include <utility>
+
using namespace paludis;
using namespace paludis::qa;
@@ -35,7 +41,6 @@ DeprecatedFunctionsCheck::operator() (const FSEntry & f) const
CheckResult result(f, identifier());
static pcrepp::Pcre::Pcre r_comment("^\\s*#");
- static pcrepp::Pcre::Pcre r_check_kv("\\bcheck_KV\\b");
if (! f.is_regular_file())
result << Message(qal_skip, "Not a regular file");
@@ -49,6 +54,27 @@ DeprecatedFunctionsCheck::operator() (const FSEntry & f) const
result << Message(qal_major, "Can't read file");
else
{
+ static std::list<std::pair<std::string, pcrepp::Pcre::Pcre> > deprecated_functions;
+ if (deprecated_functions.empty())
+ {
+ deprecated_functions.push_back(std::make_pair(std::string("OFTEN_NOT_BEEN_ON_BOATS"), pcrepp::Pcre::Pcre("OFTEN_NOT_BEEN_ON_BOATS")));
+
+ try
+ {
+ LineConfigFile deprecated_functions_file(FSEntry(getenv_with_default(
+ "PALUDIS_QA_DATA_DIR", DATADIR "/paludis/qa/")) / "deprecated_functions.txt");
+ for (LineConfigFile::Iterator l(deprecated_functions_file.begin()),
+ l_end(deprecated_functions_file.end()) ; l != l_end ; ++l)
+ deprecated_functions.push_back(std::make_pair(*l, pcrepp::Pcre::Pcre("\\b" + *l + "\\b")));
+ }
+ catch (const Exception & eee)
+ {
+ Log::get_instance()->message(ll_warning, lc_context,
+ "Cannot load list of deprecated functions from deprecated_functions.txt due to exception '"
+ + eee.message() + "' (" + eee.what() + ")");
+ }
+ }
+
std::string s;
unsigned line_number(0);
while (std::getline(ff, s))
@@ -58,11 +84,13 @@ DeprecatedFunctionsCheck::operator() (const FSEntry & f) const
if (s.empty() || r_comment.search(s))
continue;
- if (r_check_kv.search(s))
+ for (std::list<std::pair<std::string, pcrepp::Pcre::Pcre> >::iterator
+ r(deprecated_functions.begin()), r_end(deprecated_functions.end()) ;
+ r != r_end ; ++r )
{
- result << Message(qal_major, "Deprecated call to check_KV on line "
+ if (r->second.search(s))
+ result << Message(qal_major, "Deprecated call to " + r->first + " on line "
+ stringify(line_number));
- continue;
}
}
}
diff --git a/paludis/qa/files.m4 b/paludis/qa/files.m4
index e917dbc..2c77298 100644
--- a/paludis/qa/files.m4
+++ b/paludis/qa/files.m4
@@ -18,6 +18,7 @@ add(`dep_any_check', `hh', `cc')
add(`dep_flags_check', `hh', `cc')
add(`dep_packages_check', `hh', `cc')
add(`deprecated_functions_check', `hh', `cc')
+add(`deprecated_functions', `txt')
add(`deps_exist_check', `hh', `cc')
add(`deps_visible_check', `hh', `cc', `test', `testscript')
add(`description_check', `hh', `cc')