Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 0 additions & 17 deletions rpmlint/checks/TmpFilesCheck.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ def check(self, pkg):
continue

self._check_pre_tmpfile(fname, pkg)
self._check_post_tmpfile(fname, pkg)
self._check_tmpfile_in_filelist(pkgfile, pkg)

def _check_pre_tmpfile(self, fname, pkg):
Expand All @@ -49,22 +48,6 @@ def _check_pre_tmpfile(self, fname, pkg):
if pre and tmpfiles_regex.search(pre):
self.output.add_info('W', pkg, 'pre-with-tmpfile-creation', fname)

def _check_post_tmpfile(self, fname, pkg):
"""
Check if the %post section contains 'systemd-tmpfiles --create' call.

Print a warning if there is no such call in the %post section.
"""
post = pkg[rpm.RPMTAG_POSTIN]

basename = Path(fname).name
tmpfiles_regex = re.compile(r'systemd-tmpfiles --create .*%s'
% re.escape(basename))

if post and tmpfiles_regex.search(post):
return
self.output.add_info('W', pkg, 'post-without-tmpfile-creation', fname)

def _check_tmpfile_in_filelist(self, pkgfile, pkg):
"""
Check if the tmpfile is listed in the filelist and marked as %ghost.
Expand Down
5 changes: 0 additions & 5 deletions rpmlint/descriptions/TmpFilesCheck.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,6 @@ pre-with-tmpfile-creation="""
%pre section contains %tmpfiles_create macro that should be in the
%post section instead.
"""
post-without-tmpfile-creation="""
Please use the %tmpfiles_create macro in %post for each of your
tmpfiles.d files if you expect this file or directory to be
available after package installation (and before reboot).
"""
tmpfile-not-regular-file="""
Files in tmpfiles.d need to be regular files.
"""
Expand Down
3 changes: 0 additions & 3 deletions test/test_tmp_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ def test_tmpfiles(package, tmpfilescheck):
out = output.print_results(output.results)

assert 'W: pre-with-tmpfile-creation ' not in out
assert 'W: post-without-tmpfile-creation /usr/lib/tmpfiles.d/krb5.conf' in out
assert 'W: tmpfile-not-in-filelist /var/lib/kerberos' in out
assert 'W: tmpfile-not-regular-file /usr/lib/tmpfiles.d/symlink.conf' in out

Expand All @@ -37,7 +36,6 @@ def test_tmpfiles2(package, tmpfilescheck):
out = output.print_results(output.results)

assert 'W: pre-with-tmpfile-creation /usr/lib/tmpfiles.d/systemd-tmpfiles.conf' in out
assert 'W: post-without-tmpfile-creation' in out
assert 'W: tmpfile-not-in-filelist /run/my_new_directory' in out
assert 'W: tmpfile-not-regular-file' not in out

Expand All @@ -49,6 +47,5 @@ def test_tmpfiles_correct(package, tmpfilescheck):
out = output.print_results(output.results)

assert 'W: pre-with-tmpfile-creation' not in out
assert 'W: post-without-tmpfile-creation' not in out
assert 'W: tmpfile-not-regular-file' not in out
assert 'W: tmpfile-not-in-filelist' not in out
Loading