test framework: remove the duplicate check for poor infopages installation

implemented in the module 'test00_specsyntax' and improve the test coded
   in 'test01_pkgquality' and its related help message.

Signed-off-by: Davide Madrisan <davide.madrisan@gmail.com>
This commit is contained in:
Davide Madrisan 2013-07-19 21:47:18 +02:00
parent 5e8e99ecdc
commit f1ba975689
3 changed files with 32 additions and 68 deletions

View File

@ -35,6 +35,15 @@ Sat Jul 13 2013 Madrisan <davide.madrisan(a)gmail.com>
* italian manpage - Davide Madrisan: * italian manpage - Davide Madrisan:
Document the new template ocaml-libs. 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 Changes in version 1.16.3

View File

@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
# test00_specsyntax -- @package@ test (syntax checks of a specfile) # test00_specsyntax -- @package@ test (syntax checks of a specfile)
# Copyright (C) 2012 Davide Madrisan <davide.madrisan@gmail.com> # Copyright (C) 2012-2013 Davide Madrisan <davide.madrisan@gmail.com>
[ -z "$BASH" ] || [ ${BASH_VERSION:0:1} -lt 2 ] && [ -z "$BASH" ] || [ ${BASH_VERSION:0:1} -lt 2 ] &&
echo $"this script requires bash version 2 or better" >&2 && exit 1 echo $"this script requires bash version 2 or better" >&2 && exit 1
@ -182,62 +182,7 @@ ${NOTE}"$"Hint"":${NORM}
} }
test_number=$(($test_number + 1)) test_number=$(($test_number + 1))
# 7. check if the install/uninstall code is present # 7. check for illegal 'Group's (see configuration file)
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 [<subpackage>]
$([[ "$rpm_macro_installinfo" ]] &&
echo "$rpm_macro_installinfo %{name}.info" ||
echo "${path_installinfo:-/sbin/install-info} %{name}.info")
%preun [<subpackage>]
$([[ "$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)
test.skip $test_number || { test.skip $test_number || {
if [ "${#rpm_allowed_groups[*]}" = 0 ]; then if [ "${#rpm_allowed_groups[*]}" = 0 ]; then
# 'rpm_allowed_groups' unset in the configuration files # 'rpm_allowed_groups' unset in the configuration files
@ -274,7 +219,7 @@ ${NOTE}@package@ --eval=rpm_allowed_groups${NORM}
fi; } fi; }
test_number=$(($test_number + 1)) 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 || { test.skip $test_number || {
if [ "${#rpm_approved_licenses[*]}" = 0 ]; then if [ "${#rpm_approved_licenses[*]}" = 0 ]; then
# 'rpm_approved_licenses' unset in the configuration files # 'rpm_approved_licenses' unset in the configuration files

View File

@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
# test01_pkgquality -- @package@ test (rpm quality checks) # test01_pkgquality -- @package@ test (rpm quality checks)
# Copyright (C) 2008,2012 Davide Madrisan <davide.madrisan@gmail.com> # Copyright (C) 2008,2012,2013 Davide Madrisan <davide.madrisan@gmail.com>
[ -z "$BASH" ] || [ ${BASH_VERSION:0:1} -lt 2 ] && [ -z "$BASH" ] || [ ${BASH_VERSION:0:1} -lt 2 ] &&
echo $"this script requires bash version 2 or better" >&2 && exit 1 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'..." notify.debug $"loading"": \`test01_pkgquality'..."
# check if all the needed tools are available # 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)" ] || [ "$(type -p $tool)" ] ||
notify.error $"utility not found"": \`$tool'" notify.error $"utility not found"": \`$tool'"
done done
@ -327,26 +327,36 @@ $"checking if the info catalog is updated when necessary""${NORM}..."
{ let "i += 1"; continue; } # no info pages found { let "i += 1"; continue; } # no info pages found
#notify.debug "$FUNCNAME: info page(s) found" #notify.debug "$FUNCNAME: info page(s) found"
[[ "$(rpm -p -q --scripts $pck | sed -n ' [[ "$(rpm -p -q --requires $pck 2>/dev/null | sed -n '
/postinstall /,${/\/sbin\/install-info \/.*/p}')" ]] || let "error+=1" /^[ \t]*\/sbin\/install-info/p')" ]] || let "error+=1"
[[ "$(rpm -p -q --scripts $pck | sed -n ' # note: we just check for at list two occurences of the command
/preuninstall /,${/\/sbin\/install-info.*--[delete\|remove].*/p}')" ]] || \ # '/sbin/install-info' in the package scriptlets
let "error+=1" [[ "$(rpm -p -q --scripts $pck 2>/dev/null | sed -n '
/^[ \t]*\/sbin\/install-info/p' | wc -l)" -ge 2 ]] || let "error+=1"
[ "$error" = "0" ] || [ "$error" = "0" ] ||
{ notify.warning "${NOTE}${pck##*/}${NORM}" { notify.warning "${NOTE}${pck##*/}${NORM}"
notify.note $"info pages should be installed/uninstalled""${NORM} notify.note $"info pages should be installed/uninstalled""${NORM}
--------------------------------------- ---------------------------------------
${NOTE}"$"Hint"":${NORM} ${NOTE}"$"Hint"":${NORM}
$([[ "$rpm_macro_installinfo_binary" ]] && %package [<subpackage>]
echo "Requires(post):$rpm_macro_installinfo_binary" || ...
echo "Requires(post):${path_installinfo:-/sbin/install-info}") $(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 [<subpackage>] %post [<subpackage>]
$([[ "$rpm_macro_installinfo" ]] && $([[ "$rpm_macro_installinfo" ]] &&
echo "$rpm_macro_installinfo %{name}.info" || echo "$rpm_macro_installinfo %{name}.info" ||
echo "${path_installinfo:-/sbin/install-info} %{name}.info") echo "${path_installinfo:-/sbin/install-info} %{name}.info")
exit 0
%preun [<subpackage>] %preun [<subpackage>]
$([[ "$rpm_macro_uninstallinfo" ]] && $([[ "$rpm_macro_uninstallinfo" ]] &&