Package repocop-unittest-init-condrestart: Specfile
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 | %define testname init-condrestart Name: repocop-unittest-%testname Version: 0.04 Release: alt1 BuildArch: noarch Packager: Igor Yu. Vlasenko <viy@altlinux.org> Summary: lsb-init integration tests for repocop test platform Group: Development/Other License: GPL or Artistic Url: http://repocop.altlinux.org Requires: repocop %description init-condrestart integration test for repocop test platform. The test warns packages that do not have condrestart and condstop goals in their init scripts. It is because alt-specific scripts /usr/sbin/post_service (used in %%post_service macro) and /usr/sbin/preun_service (used in %%preun_service macro) depends on condrestart and condstop respectively. %prep %build cat > test <<'EOF' #!/bin/sh files_exist() { [ -e "$1" ] } if files_exist $REPOCOP_PKG_ROOT/etc/init.d/*; then STATUS=warn MESSAGE="warning: found files in /etc/init.d/; better to use %%_initdir=%_initdir" else STATUS=ok MESSAGE= files_exist $REPOCOP_PKG_ROOT%_initdir/* || exec repocop-test-skip fi for i in $REPOCOP_PKG_ROOT%_initdir/* $REPOCOP_PKG_ROOT/etc/init.d/*; do filename=${i##$REPOCOP_PKG_ROOT} if [ -x $i ]; then HAS_CONDRESTART=`grep 'condrestart' $i` if [ -z "$HAS_CONDRESTART" ]; then if rpmquery --scripts -p $REPOCOP_PKG | grep post_service >/dev/null; then STATUS=fail MESSAGE="$MESSAGE$filename: missing condrestart target. ERROR: alt-specific script %%_sbindir/post_service (used in your %%post_service macro) depends on condrestart. Please, fix." else [ "$STATUS" != "fail" ] && STATUS=warn MESSAGE="$MESSAGE$filename: missing condrestart target. Note: alt-specific script %%_sbindir/post_service (used in %%post_service macro) depends on condrestart. It is wise to add condrestart anyway." fi fi HAS_CONDSTOP=`grep 'condstop' $i` if [ -z "$HAS_CONDSTOP" ]; then if rpmquery --scripts -p $REPOCOP_PKG | grep preun_service >/dev/null; then STATUS=fail MESSAGE="$MESSAGE$filename: missing condstop target. ERROR: alt-specific script %%_sbindir/preun_service (used in your %%preun_service macro) depends on condstop. Please, fix." else [ "$STATUS" != "fail" ] && STATUS=warn MESSAGE="$MESSAGE$filename: missing condstop target. Note: alt-specific script %%_sbindir/preun_service (used in %%preun_service macro) depends on condstop. It is wise to add condstop anyway." fi fi fi done repocop-test-$STATUS $MESSAGE EOF cat > description <<'EOF' The test warns packages that do not have condrestart and condstop goals in their init scripts. It is because alt-specific scripts /usr/sbin/post_service (used in %%post_service macro) and /usr/sbin/preun_service (used in %%preun_service macro) depends on condrestart and condstop respectively. TODO: write page on wiki. EOF cat > filepattern <<'EOF' ^/etc/rc.d/init.d/ EOF %install mkdir -p $RPM_BUILD_ROOT%_datadir/repocop/pkgtests/%testname/ install -m 755 test $RPM_BUILD_ROOT%_datadir/repocop/pkgtests/%testname/ install -m 644 description $RPM_BUILD_ROOT%_datadir/repocop/pkgtests/%testname/ install -m 644 filepattern $RPM_BUILD_ROOT%_datadir/repocop/pkgtests/%testname/ %files #doc README ChangeLog %_datadir/repocop/pkgtests/%testname %changelog * Thu Aug 18 2011 Igor Vlasenko <viy@altlinux.ru> 0.04-alt1 - added filepattern * Tue Mar 31 2009 Igor Vlasenko <viy@altlinux.ru> 0.03-alt2 - added url * Sat Mar 08 2008 Igor Vlasenko <viy@altlinux.ru> 0.03-alt1 - added check for /etc/init.d/ used instead of %%_initdir * Fri Mar 07 2008 Igor Vlasenko <viy@altlinux.ru> 0.02-alt1 - added check on condstop target * Sat Mar 01 2008 Igor Vlasenko <viy@altlinux.ru> 0.01-alt1 - First build for Sisyphus. |