1 # -*- coding: utf-8 -*-
2 #############################################################################
3 # File : ConfigCheck.py
5 # Author : Frederic Lepied
6 # Created on : Sun Oct 3 21:48:20 1999
7 # Version : $Id: ConfigCheck.py 1774 2010-04-20 20:07:10Z scop $
9 #############################################################################
11 from Filter import addDetails, printError, printWarning
15 class ConfigCheck(AbstractCheck.AbstractCheck):
18 AbstractCheck.AbstractCheck.__init__(self, "ConfigCheck")
21 # Check only binary package
25 config_files = pkg.configFiles()
26 noreplace_files = pkg.noreplaceFiles()
28 for c in config_files:
29 if c.startswith("/var/lib/games/"):
30 printError(pkg, "score-file-must-not-be-conffile", c)
31 elif not c.startswith("/etc/") and not c.startswith("/var/"):
32 printWarning(pkg, "non-etc-or-var-file-marked-as-conffile", c)
34 if c not in noreplace_files:
35 printWarning(pkg, "conffile-without-noreplace-flag", c)
37 # Create an object to enable the auto registration of the test
40 # Add information about checks
42 'score-file-must-not-be-conffile',
43 """A file in /var/lib/games/ is a configuration file. Store your conf
44 files in /etc instead.""",
46 'non-etc-or-var-file-marked-as-conffile',
47 """A file not in /etc or /var is marked as being a configuration file.
48 Please put your conf files in /etc or /var.""",
50 'conffile-without-noreplace-flag',
51 """A configuration file is stored in your package without the noreplace flag.
52 A way to resolve this is to put the following in your SPEC file:
54 %config(noreplace) /etc/your_config_file_here
59 # ConfigCheck.py ends here
62 # indent-tabs-mode: nil