Hello community, here is the log from the commit of package rpmlint for openSUSE:Factory checked in at 2014-07-21 10:35:03 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/rpmlint (Old) and /work/SRC/openSUSE:Factory/.rpmlint.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "rpmlint" Changes: -------- --- /work/SRC/openSUSE:Factory/rpmlint/rpmlint.changes 2014-07-18 06:41:28.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.rpmlint.new/rpmlint.changes 2014-07-21 10:35:09.000000000 +0200 @@ -1,0 +2,5 @@ +Fri Jul 18 14:16:31 UTC 2014 - jsegitz@suse.com + +- updated rpmlint-checks-master.tar.gz to include CheckSystemdInstall.py + +------------------------------------------------------------------- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ config ++++++ --- /var/tmp/diff_new_pack.XspMDl/_old 2014-07-21 10:35:10.000000000 +0200 +++ /var/tmp/diff_new_pack.XspMDl/_new 2014-07-21 10:35:10.000000000 +0200 @@ -41,6 +41,7 @@ addCheck("CheckPAMModules") addCheck("CheckRCLinks") addCheck("CheckAppdata") +addCheck("CheckSystemdInstall") # stuff autobuild takes care about addFilter(".*invalid-version.*") ++++++ rpmlint-checks-master.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/rpmlint-checks-master/CheckSystemdInstall.py new/rpmlint-checks-master/CheckSystemdInstall.py --- old/rpmlint-checks-master/CheckSystemdInstall.py 1970-01-01 01:00:00.000000000 +0100 +++ new/rpmlint-checks-master/CheckSystemdInstall.py 2014-07-18 16:06:44.000000000 +0200 @@ -0,0 +1,93 @@ +# -*- coding: utf-8 -*- +#--------------------------------------------------------------- +# File : CheckSystemdInstall.py +# Author : Johannes Segitz +# Created On : Tue May 20 12:33:34 CEST 2014 +# Purpose : check that every .service|.socket file in SYSTEMD_SERVICE_DIRECTORY is handled in pre, post, preun and postun +#--------------------------------------------------------------- + +import os +import re +import rpm +import AbstractCheck +import Pkg +from Filter import addDetails, printWarning + +# check only for files copied to this directory +SYSTEMD_SERVICE_DIRECTORY = "/usr/lib/systemd/system" +# we could extend this later on +CHECKED_UNITS = [ 'service', 'socket', 'target' ] +CHECKED_UNITS_REGEXP = re.compile( SYSTEMD_SERVICE_DIRECTORY + ".+.(" + '|'.join(CHECKED_UNITS) + ")$" ) + +class CheckSystemdInstall(AbstractCheck.AbstractCheck): + + def __init__(self): + AbstractCheck.AbstractCheck.__init__(self, 'CheckSystemdInstall') + + def check(self, pkg): + # Check only binary package + if pkg.isSource(): + return + + pre = pkg[rpm.RPMTAG_PREIN] or pkg.scriptprog(pkg[rpm.RPMTAG_PREINPROG]) + post = pkg[rpm.RPMTAG_POSTIN] or pkg.scriptprog(pkg[rpm.RPMTAG_POSTINPROG]) + + preun = pkg[rpm.RPMTAG_PREUN] or pkg.scriptprog(pkg[rpm.RPMTAG_PREUNPROG]) + postun = pkg[rpm.RPMTAG_POSTUN] or pkg.scriptprog(pkg[rpm.RPMTAG_POSTUNPROG]) + + for fname, pkgfile in pkg.files().items(): + + if CHECKED_UNITS_REGEXP.search( fname ): + processed = { 'pre': False, 'post': False, 'preun': False, 'postun': False } + + escaped_basename = re.escape( os.path.basename( fname ) ) + PRE_POST_PATTERN = re.compile( 'for service in .*' + escaped_basename ) + PREUN_PATTERN = re.compile( 'systemctl stop .*' + escaped_basename ) + POSTUN_PATTERN = re.compile( 'systemctl try-restart .*' + escaped_basename ) + + for line in pre.split( "\n" ): + if PRE_POST_PATTERN.search( line ): + processed['pre'] = True + break + for line in post.split( "\n" ): + if PRE_POST_PATTERN.search( line ): + processed['post'] = True + break + for line in preun.split( "\n" ): + if PREUN_PATTERN.search( line ): + processed['preun'] = True + break + for line in postun.split( "\n" ): + if POSTUN_PATTERN.search( line ): + processed['postun'] = True + break + + if not processed['pre']: + printWarning( pkg, 'systemd-service-without-service_add_pre', os.path.basename( fname ) ) + if not processed['post']: + printWarning( pkg, 'systemd-service-without-service_add_post', os.path.basename( fname ) ) + if not processed['preun']: + printWarning( pkg, 'systemd-service-without-service_del_preun', os.path.basename( fname ) ) + if not processed['postun']: + printWarning( pkg, 'systemd-service-without-service_del_postun', os.path.basename( fname ) ) + +# Create an object to enable the auto registration of the test +check = CheckSystemdInstall() + +addDetails( +'systemd-service-without-service_add_pre', +'''The package contains a systemd service but doesn't contain a %pre with +a call to service_add_pre.''', + +'systemd-service-without-service_add_post', +'''The package contains a systemd service but doesn't contain a %post with +a call to service_add_post.''', + +'systemd-service-without-service_del_preun', +'''The package contains a systemd service but doesn't contain a %preun with +a call to service_del_preun.''', + +'systemd-service-without-service_del_postun', +'''The package contains a systemd service but doesn't contain a %postun with +a call to service_del_postun.''', +) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/rpmlint-checks-master/tests/CheckFilelists/systemd-bad.spec new/rpmlint-checks-master/tests/CheckFilelists/systemd-bad.spec --- old/rpmlint-checks-master/tests/CheckFilelists/systemd-bad.spec 1970-01-01 01:00:00.000000000 +0100 +++ new/rpmlint-checks-master/tests/CheckFilelists/systemd-bad.spec 2014-07-18 16:06:44.000000000 +0200 @@ -0,0 +1,21 @@ +Name: systemd-bad +Version: 0 +Release: 0 +Group: Development/Tools/Building +Summary: Bar +License: GPL +BuildRoot: %_tmppath/%name-%version-build + +%description +%_target +%_target_cpu + +%install +install -D -m 644 /dev/null %buildroot/usr/lib/systemd/system/mysql.service + +%clean +rm -rf %buildroot + +%files +%defattr(-,root,root) +/usr/lib/systemd/system/mysql.service diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/rpmlint-checks-master/tests/CheckFilelists/systemd-good.spec new/rpmlint-checks-master/tests/CheckFilelists/systemd-good.spec --- old/rpmlint-checks-master/tests/CheckFilelists/systemd-good.spec 1970-01-01 01:00:00.000000000 +0100 +++ new/rpmlint-checks-master/tests/CheckFilelists/systemd-good.spec 2014-07-18 16:06:44.000000000 +0200 @@ -0,0 +1,33 @@ +Name: systemd-bad +Version: 0 +Release: 0 +Group: Development/Tools/Building +Summary: Bar +License: GPL +BuildRoot: %_tmppath/%name-%version-build + +%description +%_target +%_target_cpu + +%install +install -D -m 644 /dev/null %buildroot/usr/lib/systemd/system/mysql.service + +%pre +%service_add_pre mysql.service + +%preun +%service_del_preun mysql.service + +%post +%service_add_post mysql.service + +%postun +%service_del_postun mysql.service + +%clean +rm -rf %buildroot + +%files +%defattr(-,root,root) +/usr/lib/systemd/system/mysql.service -- To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-commit+help@opensuse.org