From 06a20119afe1e72d5fda69499d4f8c38ca10a65a Mon Sep 17 00:00:00 2001 From: =?utf8?q?Franti=C5=A1ek=20Dvo=C5=99=C3=A1k?= Date: Wed, 15 Feb 2012 23:12:38 +0000 Subject: [PATCH] Packaging compliance checks (EPEL/Fedora or Debian). --- .../LB/tests/lb-common-testbeds.sh | 5 +- org.glite.testsuites.ctb/LB/tests/lb-common.sh | 61 ++++++++++++++ .../LB/tests/lb-test-packaging.sh | 95 ++++++++++++++++++++++ .../PX/tests/px-common-testbeds.sh | 5 +- .../PX/tests/px-test-packaging.sh | 95 ++++++++++++++++++++++ .../gridsite/tests/gridsite-common-testbeds.sh | 5 +- .../gridsite/tests/gridsite-test-packaging.sh | 95 ++++++++++++++++++++++ 7 files changed, 358 insertions(+), 3 deletions(-) create mode 100755 org.glite.testsuites.ctb/LB/tests/lb-test-packaging.sh create mode 100755 org.glite.testsuites.ctb/PX/tests/px-test-packaging.sh create mode 100755 org.glite.testsuites.ctb/gridsite/tests/gridsite-test-packaging.sh diff --git a/org.glite.testsuites.ctb/LB/tests/lb-common-testbeds.sh b/org.glite.testsuites.ctb/LB/tests/lb-common-testbeds.sh index c9d392c..dacb464 100755 --- a/org.glite.testsuites.ctb/LB/tests/lb-common-testbeds.sh +++ b/org.glite.testsuites.ctb/LB/tests/lb-common-testbeds.sh @@ -25,8 +25,10 @@ COPYPROXY=$2 egrep -i "Debian|Ubuntu" /etc/issue if [ \$? = 0 ]; then INSTALLCMD="apt-get install -q --yes" + INSTALLPKGS="lintian" else INSTALLCMD="yum install -q -y --nogpgcheck" + INSTALLPKGS="rpmlint" fi cat << EndArrangeScript > arrange_lb_test_root.sh @@ -42,7 +44,7 @@ echo "Output format: \$OUTPUT_OPT " export LBTSTCOLS -${INSTALLCMD} globus-proxy-utils postgresql postgresql-server emi-lb-nagios-plugins voms-clients curl wget sudo bc +${INSTALLCMD} globus-proxy-utils postgresql postgresql-server emi-lb-nagios-plugins voms-clients curl wget sudo bc $INSTALLPKGS /etc/init.d/postgresql initdb >/dev/null 2>&1 /etc/init.d/postgresql start @@ -151,6 +153,7 @@ echo ./lb-test-statistics.sh \$OUTPUT_OPT >> arrange_lb_test_user.sh echo ./lb-test-threaded.sh \$OUTPUT_OPT >> arrange_lb_test_user.sh echo ./lb-test-harvester.sh \$OUTPUT_OPT >> arrange_lb_test_user.sh echo ./lb-test-nagios-probe.sh \$OUTPUT_OPT >> arrange_lb_test_user.sh +echo ./lb-test-packaging.sh \$OUTPUT_OPT >> arrange_lb_test_user.sh echo perl ./lb-test-purge.pl --i-want-to-purge $remotehost:9000 \$OUTPUT_OPT >> arrange_lb_test_user.sh echo 'echo ""' >> arrange_lb_test_user.sh echo 'echo ""' >> arrange_lb_test_user.sh diff --git a/org.glite.testsuites.ctb/LB/tests/lb-common.sh b/org.glite.testsuites.ctb/LB/tests/lb-common.sh index 5762a4b..f4fc255 100755 --- a/org.glite.testsuites.ctb/LB/tests/lb-common.sh +++ b/org.glite.testsuites.ctb/LB/tests/lb-common.sh @@ -356,3 +356,64 @@ function notif_wait() { echo $SYS_GREP ${jobid} $$_notifications.txt > /dev/null } + +function check_rpmlint() { + local pkg='' + local out='' + local ret=0 + + echo "Packages compliance check output:" + while test -n "$1"; do + for pkg in `rpm -qa --queryformat '%{NAME} ' $1`; do + echo $pkg + out="`rpmlint $pkg`" + echo "$out" + echo + if echo $out | grep -i '^E:' >/dev/null; then + ret=1 + fi + done + + shift + done + + return $ret +} + +function check_lintian() { + local dir=/tmp/lintian-check.$$ + local pkgs='' + local pkg='' + local out='' + local ret=0 + + while test -n "$1"; do + pkgs="$pkgs `dpkg-query -W -f '${Source}\n' $1 2>$dir/query.log`" + shift + done + pkgs=`echo "$pkgs" | sort | uniq` + + rm -f $dir + mkdir $dir + printf "Downloading packages..." + (cd $dir; apt-get -d source $pkgs >$dir/download.log) + if test $? -eq 0; then + test_done + else + test_failed + fi + + echo "Packages compliance check output:" + for pkg in $pkgs; do + echo $pkg: + out="`lintian $dir/${pkg}_*.dsc`" + echo "$out" + echo + if echo $out | grep -i '^E:' >/dev/null; then + ret=1 + fi + done + + rm -rf $dir + return $ret +} diff --git a/org.glite.testsuites.ctb/LB/tests/lb-test-packaging.sh b/org.glite.testsuites.ctb/LB/tests/lb-test-packaging.sh new file mode 100755 index 0000000..d41fa99 --- /dev/null +++ b/org.glite.testsuites.ctb/LB/tests/lb-test-packaging.sh @@ -0,0 +1,95 @@ +#!/bin/bash +# +# Copyright (c) Members of the EGEE Collaboration. 2004-2010. +# See http://www.eu-egee.org/partners for details on the copyright holders. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# show help and usage +progname=`basename $0` +showHelp() +{ +cat << EndHelpHeader +Script producing errors and warnings due to packaging. + +Prerequisities: + - installed all tested packages + - Scientific Linux: installed rpmlint + - Debian: installed lintian + +Tests called: + + called rpmlint or lintian on the packages + +Returned values: + Exit TEST_OK: Test Passed + Exit TEST_ERROR: Test Failed + Exit 2: Wrong Input + +EndHelpHeader + + echo "Usage: $progname [OPTIONS]" + echo "Options:" + echo " -h | --help Show this help message." + echo " -t | --text Format output as plain ASCII text." + echo " -c | --color Format output as text with ANSI colours (autodetected by default)." + echo " -x | --html Format output as html." +} + +# read common definitions and functions +COMMON=lb-common.sh +if [ ! -r ${COMMON} ]; then + printf "Common definitions '${COMMON}' missing!" + exit 2 +fi +source ${COMMON} + +while test -n "$1" +do + case "$1" in + "-h" | "--help") showHelp && exit 2 ;; + "-t" | "--text") setOutputASCII ;; + "-c" | "--color") setOutputColor ;; + "-x" | "--html") setOutputHTML ;; + esac + shift +done + + +## +# Starting the test +##################### + +test_start + + +if egrep -i "Debian|Ubuntu" /etc/issue >/dev/null; then + check_lintian \*glite-jobid\* \*glite-lbu\* \*glite-lbjp-\* \*glite-lb-\* emi-lb\* \*glite-security-gss\* \*glite-security-gsoap-plugin\* \*glite-jp-\* + ret=$? +else + check_rpmlint glite-jobid-\* glite-lbjp-\* glite-lb-\* emi-lb-\* + ret=$? +fi + +#printf "Packages compliance..." +#if test $ret -eq 0; then +# test_done +#else +# test_failed +#fi + + +test_end + +exit $TEST_OK diff --git a/org.glite.testsuites.ctb/PX/tests/px-common-testbeds.sh b/org.glite.testsuites.ctb/PX/tests/px-common-testbeds.sh index b08eb95..8278682 100755 --- a/org.glite.testsuites.ctb/PX/tests/px-common-testbeds.sh +++ b/org.glite.testsuites.ctb/PX/tests/px-common-testbeds.sh @@ -24,8 +24,10 @@ COPYPROXY=$2 egrep -i "Debian|Ubuntu" /etc/issue if [ \$? = 0 ]; then INSTALLCMD="apt-get install -q --yes" + INSTALLPKGS="lintian" else INSTALLCMD="yum install -q -y --nogpgcheck" + INSTALLPKGS="rpmlint" fi cat << EndArrangeScript > arrange_px_test_root.sh @@ -41,7 +43,7 @@ echo "Output format: \$OUTPUT_OPT " export PXTSTCOLS -${INSTALLCMD} globus-proxy-utils voms-clients curl wget xml-commons-apis +${INSTALLCMD} globus-proxy-utils voms-clients curl wget xml-commons-apis $INSTALLPKGS cd /tmp @@ -151,6 +153,7 @@ echo echo ======================== >> arrange_px_test_user.sh echo 'echo ""' >> arrange_px_test_user.sh echo 'echo ""' >> arrange_px_test_user.sh echo ./px-test-all.sh \$OUTPUT_OPT >> arrange_px_test_user.sh +echo ./px-test-packaging.sh \$OUTPUT_OPT >> arrange_px_test_user.sh echo 'echo ""' >> arrange_px_test_user.sh echo 'echo ""' >> arrange_px_test_user.sh echo echo ================== >> arrange_px_test_user.sh diff --git a/org.glite.testsuites.ctb/PX/tests/px-test-packaging.sh b/org.glite.testsuites.ctb/PX/tests/px-test-packaging.sh new file mode 100755 index 0000000..4ec6117 --- /dev/null +++ b/org.glite.testsuites.ctb/PX/tests/px-test-packaging.sh @@ -0,0 +1,95 @@ +#!/bin/bash +# +# Copyright (c) Members of the EGEE Collaboration. 2004-2010. +# See http://www.eu-egee.org/partners for details on the copyright holders. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# show help and usage +progname=`basename $0` +showHelp() +{ +cat << EndHelpHeader +Script producing errors and warnings due to packaging. + +Prerequisities: + - installed all tested packages + - Scientific Linux: installed rpmlint + - Debian: installed lintian + +Tests called: + + called rpmlint or lintian on the packages + +Returned values: + Exit TEST_OK: Test Passed + Exit TEST_ERROR: Test Failed + Exit 2: Wrong Input + +EndHelpHeader + + echo "Usage: $progname [OPTIONS]" + echo "Options:" + echo " -h | --help Show this help message." + echo " -t | --text Format output as plain ASCII text." + echo " -c | --color Format output as text with ANSI colours (autodetected by default)." + echo " -x | --html Format output as html." +} + +# read common definitions and functions +COMMON=px-common.sh +if [ ! -r ${COMMON} ]; then + printf "Common definitions '${COMMON}' missing!" + exit 2 +fi +source ${COMMON} + +while test -n "$1" +do + case "$1" in + "-h" | "--help") showHelp && exit 2 ;; + "-t" | "--text") setOutputASCII ;; + "-c" | "--color") setOutputColor ;; + "-x" | "--html") setOutputHTML ;; + esac + shift +done + + +## +# Starting the test +##################### + +test_start + + +if egrep -i "Debian|Ubuntu" /etc/issue >/dev/null; then + check_lintian glite-px-\* libglite-security-proxyrenewal-\* emi-px-\* + ret=$? +else + check_rpmlint glite-px-\* emi-px\* + ret=$? +fi + +#printf "Packages compliance..." +#if test $ret -eq 0; then +# test_done +#else +# test_failed +#fi + + +test_end + +exit $TEST_OK diff --git a/org.glite.testsuites.ctb/gridsite/tests/gridsite-common-testbeds.sh b/org.glite.testsuites.ctb/gridsite/tests/gridsite-common-testbeds.sh index 6149375..78bc22e 100755 --- a/org.glite.testsuites.ctb/gridsite/tests/gridsite-common-testbeds.sh +++ b/org.glite.testsuites.ctb/gridsite/tests/gridsite-common-testbeds.sh @@ -24,8 +24,10 @@ COPYPROXY=$2 egrep -i "Debian|Ubuntu" /etc/issue if [ \$? = 0 ]; then INSTALLCMD="apt-get install -q --yes" + INSTALLPKGS="lintian" else INSTALLCMD="yum install -q -y --nogpgcheck" + INSTALLPKGS="rpmlint" fi cat << EndArrangeScript > arrange_gridsite_test_root.sh @@ -41,7 +43,7 @@ echo "Output format: \$OUTPUT_OPT " export GSTSTCOLS -${INSTALLCMD} voms-clients httpd mod_ssl curl wget nc lsof +${INSTALLCMD} voms-clients httpd mod_ssl curl wget nc lsof $INSTALLPKGS HTTPD_CONFDIR=/tmp for dir in /etc/httpd /etc/apache /etc/apache2; do @@ -98,6 +100,7 @@ echo "" ./ping-remote.sh $remotehost \$OUTPUT_OPT ./ping-local.sh \$OUTPUT_OPT -f \$HTTPD_CONF ./gridsite-test-all.sh \$OUTPUT_OPT +./gridsite-test-packaging.sh \$OUTPUT_OPT echo "" echo "" echo ================== diff --git a/org.glite.testsuites.ctb/gridsite/tests/gridsite-test-packaging.sh b/org.glite.testsuites.ctb/gridsite/tests/gridsite-test-packaging.sh new file mode 100755 index 0000000..c996434 --- /dev/null +++ b/org.glite.testsuites.ctb/gridsite/tests/gridsite-test-packaging.sh @@ -0,0 +1,95 @@ +#!/bin/bash +# +# Copyright (c) Members of the EGEE Collaboration. 2004-2010. +# See http://www.eu-egee.org/partners for details on the copyright holders. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# show help and usage +progname=`basename $0` +showHelp() +{ +cat << EndHelpHeader +Script producing errors and warnings due to packaging. + +Prerequisities: + - installed all tested packages + - Scientific Linux: installed rpmlint + - Debian: installed lintian + +Tests called: + + called rpmlint or lintian on the packages + +Returned values: + Exit TEST_OK: Test Passed + Exit TEST_ERROR: Test Failed + Exit 2: Wrong Input + +EndHelpHeader + + echo "Usage: $progname [OPTIONS]" + echo "Options:" + echo " -h | --help Show this help message." + echo " -t | --text Format output as plain ASCII text." + echo " -c | --color Format output as text with ANSI colours (autodetected by default)." + echo " -x | --html Format output as html." +} + +# read common definitions and functions +COMMON=gridsite-common.sh +if [ ! -r ${COMMON} ]; then + printf "Common definitions '${COMMON}' missing!" + exit 2 +fi +source ${COMMON} + +while test -n "$1" +do + case "$1" in + "-h" | "--help") showHelp && exit 2 ;; + "-t" | "--text") setOutputASCII ;; + "-c" | "--color") setOutputColor ;; + "-x" | "--html") setOutputHTML ;; + esac + shift +done + + +## +# Starting the test +##################### + +test_start + + +if egrep -i "Debian|Ubuntu" /etc/issue >/dev/null; then + check_lintian libgridsite\* + ret=$? +else + check_rpmlint gridsite-\* + ret=$? +fi + +#printf "Packages compliance..." +#if test $ret -eq 0; then +# test_done +#else +# test_failed +#fi + + +test_end + +exit $TEST_OK -- 1.8.2.3