rpmlint/check-cron-dependency.diff

35 lines
1.8 KiB
Diff

--- FilesCheck.py
+++ FilesCheck.py
@@ -832,6 +832,12 @@
logrotate_file=res or logrotate_file
if res and res.group(1) != pkg.name:
printError(pkg, 'incoherent-logrotate-file', f)
+ deps=[x[0] for x in pkg.requires()+pkg.recommends()+pkg.suggests()]
+ if res and not ('logrotate' in deps) and pkg.name != "logrotate":
+ printError(pkg, 'missing-dependency-to-logrotate', "for logrotate script", f)
+ if f.startswith('/etc/cron.') \
+ and not ('cron' in deps) and pkg.name != "cron":
+ printError(pkg, 'missing-dependency-to-cron', "for cron script", f)
link=enreg[3]
if link != '':
ext=compr_regex.search(link)
@@ -1464,6 +1470,18 @@
if there's no way to produce useful debuginfo out of it, disable creation of
the debuginfo package.''',
+'missing-dependency-to-cron',
+'''This package installs a file in /etc/cron.*/ but
+doesn't require cron to be installed. as cron is not part of the essential packages,
+your package should explicitely require cron to make sure that your cron job is
+executed. If it is an optional feature of your package, recommend or suggest cron.''',
+
+'missing-dependency-to-logrotate',
+'''This package installs a file in /etc/logrotate.d/ but
+doesn't require logrotate to be installed. Because logrotate is not part of the essential packages,
+your package should explicitely depend on logrotate to make sure that your logrotate
+job is executed. If it is an optional feature of your package, recommend or suggest logrotate.''',
+
'read-error',
'''This file could not be read. A reason for this could be that the info about
it in the rpm header indicates that it is supposed to be a readable normal file