SHA256
1
0
forked from pool/rpmlint
rpmlint/invalid-filerequires.diff

34 lines
1.6 KiB
Diff

--- TagsCheck.py
+++ TagsCheck.py
@@ -406,6 +406,7 @@ invalid_version_regex=re.compile('([0-9](?:rc|alpha|beta|pre).*)', re.IGNORECASE
forbidden_words_regex=re.compile('(' + Config.getOption('ForbiddenWords') + ')', re.IGNORECASE)
valid_buildhost_regex=re.compile(Config.getOption('ValidBuildHost'))
epoch_regex=re.compile('^[0-9]+:')
+valid_filedep_regex=re.compile('(?:/s?bin/|^/etc/|^/usr/lib/sendmail$)')
use_epoch=Config.getOption('UseEpoch', 0)
use_utf8=Config.getOption('UseUTF8', Config.USEUTF8_DEFAULT)
macro_regex=re.compile('^%(?:[\{\(]|\w{3,})')
@@ -490,6 +491,9 @@ class TagsCheck(AbstractCheck.AbstractCheck):
if d[0].startswith('/usr/bin/env'):
printWarning(pkg, 'invalid-dependency', d[0])
+ if d[0].startswith('/') and not valid_filedep_regex.search(d[0]):
+ printWarning(pkg, 'invalid-filepath-dependency', d[0])
+
if not devel_depend and not is_devel and not is_source:
if FilesCheck.devel_regex.search(d[0]):
printError(pkg, 'devel-dependency', d[0])
@@ -866,6 +870,12 @@ once.''',
'obsolete-on-name',
'''A package should not obsolete itself, as it can cause weird errors in tools.''',
+'invalid-filepath-dependency',
+'''A package has a file or path based dependency that is not resolveable for
+package solvers because it is not in the whitelist for path based dependencies
+and therefore not available in repository metadata. Please use a symbolic requires
+instead or require a file in bin or /etc.''',
+
'tag-not-utf8',
'''The character encoding of the value of this tag is not UTF-8.''',