Репозиторий Sisyphus
Последнее обновление: 1 октября 2023 | Пакетов: 18631 | Посещений: 37561974
en ru br
Репозитории ALT
S:0.04-alt1
5.1: 0.03-alt2
4.1: 0.03-alt1
www.altlinux.org/Changes

Группа :: Разработка/Прочее
Пакет: repocop-unittest-init-condrestart

 Главная   Изменения   Спек   Патчи   Sources   Загрузить   Gear   Bugs and FR  Repocop 

%define testname init-condrestart

Name: repocop-unittest-%testname
Version: 0.03
Release: alt2
BuildArch: noarch
Packager: Igor Yu. Vlasenko <viy at altlinux.org>

Summary: lsb-init intergration tests for repocop test platform
Group: Development/Other
License: GPL or Artistic
Url: http://repocop.altlinux.org
Requires: repocop

%description
init-condrestart intergration 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

%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/

%files
#doc README ChangeLog
%_datadir/repocop/pkgtests/%testname

%changelog

Полный changelog можно просмотреть здесь

 
дизайн и разработка: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
текущий майнтейнер: Michael Shigorin