diff --git a/_servicedata b/_servicedata index 28ca288..9757bd6 100644 --- a/_servicedata +++ b/_servicedata @@ -1,4 +1,4 @@ http://github.com/openSUSE/rpmlint-tests.git - 278efdf8570197e08c9d647af7187119cf891a61 \ No newline at end of file + a374c88b73eb58e49989ecab59e2d602aa11be94 \ No newline at end of file diff --git a/config b/config index 86fc2c0..6f9e89a 100644 --- a/config +++ b/config @@ -42,6 +42,7 @@ addCheck("CheckPAMModules") addCheck("CheckRCLinks") addCheck("CheckAppdata") addCheck("CheckSystemdInstall") +addCheck("TmpFilesCheck") # stuff autobuild takes care about addFilter(".*invalid-version.*") diff --git a/move-ghost-file-check-to-TmpFilesCh.diff b/move-ghost-file-check-to-TmpFilesCh.diff new file mode 100644 index 0000000..b6cffa8 --- /dev/null +++ b/move-ghost-file-check-to-TmpFilesCh.diff @@ -0,0 +1,123 @@ +From: Ludwig Nussel +Date: Wed, 20 May 2015 09:57:28 +0200 +Subject: [PATCH] move ghost file check to TmpFilesCheck + +files handled by the tmpfiles mechanism can be skipped by the normal +ghost check +--- + PostCheck.py | 18 ------------------ + TmpFilesCheck.py | 35 +++++++++++++++++++++++++++++++++++ + 2 files changed, 35 insertions(+), 18 deletions(-) + +diff --git a/PostCheck.py b/PostCheck.py +index aeb18d3..53f2d0c 100644 +--- a/PostCheck.py ++++ b/PostCheck.py +@@ -119,20 +119,6 @@ class PostCheck(AbstractCheck.AbstractCheck): + self.check_aux( + pkg, files, prog[idx], script[idx], tag[2], prereq) + +- ghost_files = pkg.ghostFiles() +- if ghost_files: +- postin = pkg[rpm.RPMTAG_POSTIN] +- prein = pkg[rpm.RPMTAG_PREIN] +- for f in ghost_files: +- if f in pkg.missingOkFiles(): +- continue +- if not postin and not prein: +- printWarning(pkg, 'ghost-files-without-postin') +- if (not postin or f not in postin) and \ +- (not prein or f not in prein): +- printWarning(pkg, +- 'postin-without-ghost-file-creation', f) +- + def check_aux(self, pkg, files, prog, script, tag, prereq): + if script: + if prog: +@@ -201,10 +187,6 @@ class PostCheck(AbstractCheck.AbstractCheck): + check = PostCheck() + + # Add information about checks +-addDetails( +-'postin-without-ghost-file-creation', +-'''A file tagged as ghost is not created during %prein nor during %postin.''', +-) + for scriptlet in map(lambda x: '%' + x, RPM_SCRIPTLETS): + addDetails( + 'one-line-command-in-%s' % scriptlet, +diff --git a/TmpFilesCheck.py b/TmpFilesCheck.py +index 8c4db8d..06be7bb 100644 +--- a/TmpFilesCheck.py ++++ b/TmpFilesCheck.py +@@ -14,6 +14,7 @@ from Filter import addDetails, printError, printWarning + import AbstractCheck + import Pkg + import stat ++import rpm + + class TmpFilesCheck(AbstractCheck.AbstractCheck): + '''Check systemd created tmpfiles are included in filelist''' +@@ -26,6 +27,11 @@ class TmpFilesCheck(AbstractCheck.AbstractCheck): + if pkg.isSource(): + return + ++ # file names handled by systemd-tmpfiles ++ tmp_files = set() ++ postin = pkg[rpm.RPMTAG_POSTIN] ++ prein = pkg[rpm.RPMTAG_PREIN] ++ + # see tmpfiles.d(5) + interesting_types = ('f', 'F', 'w', 'd', 'D', 'p', 'L', 'c', 'b') + +@@ -35,6 +41,13 @@ class TmpFilesCheck(AbstractCheck.AbstractCheck): + if not stat.S_ISREG(pkgfile.mode): + printWarning(pkg, "tmpfile-not-regular-file", fn) + continue ++ ++ pattern = re.compile(r'systemd-tmpfiles --create .*%s'%re.escape(fn)) ++ if (not postin or not pattern.match(postin)) and \ ++ (not prein or not pattern.match(prein)): ++ printWarning(pkg, ++ 'postin-without-tmpfile-creation', fn) ++ + for line in open(pkgfile.path): + # skip comments + line = line.split('#')[0].split('\n')[0] +@@ -54,15 +67,37 @@ class TmpFilesCheck(AbstractCheck.AbstractCheck): + if not t in interesting_types: + continue + ++ tmp_files.add(p) ++ + if not p in pkg.files(): + printWarning(pkg, "tmpfile-not-in-filelist", p) + continue + if not pkg.files()[p].is_ghost: + printWarning(pkg, "tmpfile-not-ghost", p) + ++ # now check remaining ghost files that are not already ++ # handled by systemd-tmpfiles ++ ghost_files = set(pkg.ghostFiles()) - tmp_files ++ if ghost_files: ++ for f in ghost_files: ++ if f in pkg.missingOkFiles(): ++ continue ++ if not postin and not prein: ++ printWarning(pkg, 'ghost-files-without-postin') ++ if (not postin or f not in postin) and \ ++ (not prein or f not in prein): ++ printWarning(pkg, ++ 'postin-without-ghost-file-creation', f) ++ ++ ++ + check = TmpFilesCheck() + + addDetails( ++'postin-without-ghost-file-creation', ++'''A file tagged as ghost is not created during %prein nor during %postin.''', ++'postin-without-tmpfile-creation', ++'''Please use the %tmpfiles_create macro in %post for each of your tmpfiles.d files''', + 'tmpfile-not-regular-file', + '''files in tmpfiles.d need to be regular files''', # otherwise we won't open it :-) + 'tmpfile-not-in-filelist', diff --git a/rpmlint-tests-13.2+git20150519.278efdf.tar.xz b/rpmlint-tests-13.2+git20150519.278efdf.tar.xz deleted file mode 100644 index 1fb0e37..0000000 --- a/rpmlint-tests-13.2+git20150519.278efdf.tar.xz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:889b4f6c005f69e34bd57410208c93665e14d3a46818c8913757ac17057dc2cc -size 10276 diff --git a/rpmlint-tests-13.2+git20150520.a374c88.tar.xz b/rpmlint-tests-13.2+git20150520.a374c88.tar.xz new file mode 100644 index 0000000..d353c22 --- /dev/null +++ b/rpmlint-tests-13.2+git20150520.a374c88.tar.xz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:81c5b5f0e7ec9015b33685d29b25aee433ae0f858087a08490abb69438e50c9c +size 10648 diff --git a/rpmlint-tests.changes b/rpmlint-tests.changes index 0c19786..e91f097 100644 --- a/rpmlint-tests.changes +++ b/rpmlint-tests.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Wed May 20 08:02:15 UTC 2015 - lnussel@suse.de + +- Update to version 13.2+git20150520.a374c88: + + add tmpfiles.d checks + ------------------------------------------------------------------- Tue May 19 12:21:46 UTC 2015 - lnussel@suse.de diff --git a/rpmlint-tests.spec b/rpmlint-tests.spec index ec3c21e..c8d3b4a 100644 --- a/rpmlint-tests.spec +++ b/rpmlint-tests.spec @@ -22,7 +22,7 @@ BuildRequires: rpmlint-mini Name: rpmlint-tests -Version: 13.2+git20150519.278efdf +Version: 13.2+git20150520.a374c88 Release: 0 Summary: rpmlint regression tests License: SUSE-Public-Domain diff --git a/rpmlint.changes b/rpmlint.changes index a88a156..9d85480 100644 --- a/rpmlint.changes +++ b/rpmlint.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Wed May 20 07:58:52 UTC 2015 - lnussel@suse.de + +- skip files handled by tmpfile mechnism in regular ghost file check + (move-ghost-file-check-to-TmpFilesCh.diff) + ------------------------------------------------------------------- Tue May 19 11:35:07 UTC 2015 - lnussel@suse.de diff --git a/rpmlint.spec b/rpmlint.spec index 080de57..dc40832 100644 --- a/rpmlint.spec +++ b/rpmlint.spec @@ -109,6 +109,7 @@ Patch50: save-content-to-an-array.diff Patch51: add-check-for-tmpfiles-created-at-r.diff Patch52: fix-ghost-file-handling.diff Patch53: remove-files-attr-not-set-check.diff +Patch54: move-ghost-file-check-to-TmpFilesCh.diff # PATCHLIST END # BuildArch must at the and. is a bug: https://bugzilla.suse.com/show_bug.cgi?id=926766 BuildArch: noarch