diff --git a/ChangeLog b/ChangeLog index d863577..6980554 100644 --- a/ChangeLog +++ b/ChangeLog @@ -35,6 +35,15 @@ Sat Jul 13 2013 Madrisan * italian manpage - Davide Madrisan: Document the new template ocaml-libs. + * test00_specsyntax - Davide Madrisan: + Remove the test about the provided infopages because it's a duplicate of + the test implemented in 'test01_pkgquality'. + ++ improvement + * test01_pkgquality - Davide Madrisan: + Improve the test for not or badly installed infopages and make a better + help message. + ------------------------------------------------------------------------------- Changes in version 1.16.3 diff --git a/tests/test00_specsyntax.in b/tests/test00_specsyntax.in index dd680ab..ff43c1e 100644 --- a/tests/test00_specsyntax.in +++ b/tests/test00_specsyntax.in @@ -1,6 +1,6 @@ #!/bin/bash # test00_specsyntax -- @package@ test (syntax checks of a specfile) -# Copyright (C) 2012 Davide Madrisan +# Copyright (C) 2012-2013 Davide Madrisan [ -z "$BASH" ] || [ ${BASH_VERSION:0:1} -lt 2 ] && echo $"this script requires bash version 2 or better" >&2 && exit 1 @@ -182,62 +182,7 @@ ${NOTE}"$"Hint"":${NORM} } test_number=$(($test_number + 1)) - # 7. check if the install/uninstall code is present - test.skip $test_number || { - notify.note "$(test.num2str). ${NOTE}"\ -$"info pages""${NORM}..." - - local infopages errors - # FIXME: non LSB compliant systems are unsupported - infopages="$(\ -grep "/share/info/\|^[ ]*%_infodir\|^[ ]*%{_infodir}" $specfile | \ -grep -v "^[ ]*#\|^[a-zA-Z]")" - - if [[ "$infopages" ]]; then - let "errors = 0" - if [ "$rpm_macro_installinfo" ]; then - grep -q "$rpm_macro_installinfo" $specfile || - { let "errors += 1" - notify.debug "rpm_macro_installinfo check failed"; } - fi - if [ "$rpm_macro_uninstallinfo" ]; then - grep -q "$rpm_macro_uninstallinfoo" $specfile || - { let "errors += 1" - notify.debug "rpm_macro_uninstallinfo check failed"; } - fi - if [ "$rpm_macro_installinfo_binary" ]; then - grep -q "\ -Requires(post)[ \t]*:[ \t]*${rpm_macro_installinfo_binary}" $specfile || - { let "errors += 1" - notify.debug "rpm_macro_installinfo_binary check failed"; } - fi - - [ "$errors" = "0" ] || - { notify.error "\ -"$"info pages are not installed/uninstalled in the correct way""${NORM} ---------------------------------------- -${NOTE}"$"Hint"":${NORM} -$([[ "$rpm_macro_installinfo_binary" ]] && - echo "Requires(post): $rpm_macro_installinfo_binary" || - echo "Requires(post): ${path_installinfo:-/sbin/install-info}") - -%post [] -$([[ "$rpm_macro_installinfo" ]] && - echo "$rpm_macro_installinfo %{name}.info" || - echo "${path_installinfo:-/sbin/install-info} %{name}.info") - -%preun [] -$([[ "$rpm_macro_uninstallinfo" ]] && - echo "$rpm_macro_uninstallinfo %{name}.info" || - echo "${path_installinfo:-/sbin/install-info} --delete %{name}.info") -exit 0 ---------------------------------------- -" - let "total_issues += $errors"; } - fi; } - test_number=$(($test_number + 1)) - - # 8. check for illegal 'Group's (see configuration file) + # 7. check for illegal 'Group's (see configuration file) test.skip $test_number || { if [ "${#rpm_allowed_groups[*]}" = 0 ]; then # 'rpm_allowed_groups' unset in the configuration files @@ -274,7 +219,7 @@ ${NOTE}@package@ --eval=rpm_allowed_groups${NORM} fi; } test_number=$(($test_number + 1)) - # 9. check for no approved 'License's (see configuration file) + # 8. check for no approved 'License's (see configuration file) test.skip $test_number || { if [ "${#rpm_approved_licenses[*]}" = 0 ]; then # 'rpm_approved_licenses' unset in the configuration files diff --git a/tests/test01_pkgquality.in b/tests/test01_pkgquality.in index a61c534..d196ea2 100644 --- a/tests/test01_pkgquality.in +++ b/tests/test01_pkgquality.in @@ -1,6 +1,6 @@ #!/bin/bash # test01_pkgquality -- @package@ test (rpm quality checks) -# Copyright (C) 2008,2012 Davide Madrisan +# Copyright (C) 2008,2012,2013 Davide Madrisan [ -z "$BASH" ] || [ ${BASH_VERSION:0:1} -lt 2 ] && echo $"this script requires bash version 2 or better" >&2 && exit 1 @@ -21,7 +21,7 @@ me=("test01_pkgquality" "@version@" "@date@") notify.debug $"loading"": \`test01_pkgquality'..." # check if all the needed tools are available -for tool in file find getopt grep ls ldd; do +for tool in file find getopt grep ls ldd wc; do [ "$(type -p $tool)" ] || notify.error $"utility not found"": \`$tool'" done @@ -327,26 +327,36 @@ $"checking if the info catalog is updated when necessary""${NORM}..." { let "i += 1"; continue; } # no info pages found #notify.debug "$FUNCNAME: info page(s) found" - [[ "$(rpm -p -q --scripts $pck | sed -n ' -/postinstall /,${/\/sbin\/install-info \/.*/p}')" ]] || let "error+=1" + [[ "$(rpm -p -q --requires $pck 2>/dev/null | sed -n ' +/^[ \t]*\/sbin\/install-info/p')" ]] || let "error+=1" - [[ "$(rpm -p -q --scripts $pck | sed -n ' -/preuninstall /,${/\/sbin\/install-info.*--[delete\|remove].*/p}')" ]] || \ - let "error+=1" + # note: we just check for at list two occurences of the command + # '/sbin/install-info' in the package scriptlets + [[ "$(rpm -p -q --scripts $pck 2>/dev/null | sed -n ' +/^[ \t]*\/sbin\/install-info/p' | wc -l)" -ge 2 ]] || let "error+=1" [ "$error" = "0" ] || { notify.warning "${NOTE}${pck##*/}${NORM}" notify.note $"info pages should be installed/uninstalled""${NORM} --------------------------------------- ${NOTE}"$"Hint"":${NORM} -$([[ "$rpm_macro_installinfo_binary" ]] && - echo "Requires(post):$rpm_macro_installinfo_binary" || - echo "Requires(post):${path_installinfo:-/sbin/install-info}") +%package [] +... +$(if [[ "$rpm_macro_installinfo_binary" ]]; then + echo "\ +Requires(post):$rpm_macro_installinfo_binary +Requires(preun):$rpm_macro_installinfo_binary" + else + echo "\ +Requires(post):${path_installinfo:-/sbin/install-info} +Requires(preun):${path_installinfo:-/sbin/install-info}" + fi) %post [] $([[ "$rpm_macro_installinfo" ]] && echo "$rpm_macro_installinfo %{name}.info" || echo "${path_installinfo:-/sbin/install-info} %{name}.info") +exit 0 %preun [] $([[ "$rpm_macro_uninstallinfo" ]] &&