This is an automated email from the git hooks/post-receive script. periapt pushed a commit to branch master in repository devscripts.
commit fd914851acaa716042b4219219e753f9be03319b Author: Nicholas Bamber <[email protected]> Date: Fri Dec 4 20:14:43 2015 +0000 Added test for life cycle of package --- debian/changelog | 1 + test/Makefile | 2 + test/test_package_lifecycle | 274 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 277 insertions(+) diff --git a/debian/changelog b/debian/changelog index 1dc53c0..2098b22 100644 --- a/debian/changelog +++ b/debian/changelog @@ -29,6 +29,7 @@ devscripts (2.15.10) UNRELEASED; urgency=medium + Added test for licensecheck versus Software::License + Resolved failure to find license from Software::License generated files from Artistic and Mozilla licenses + * Added test for life cycle of package [ Dominique Dumont ] * licensecheck: diff --git a/test/Makefile b/test/Makefile index 7746eec..342fe32 100644 --- a/test/Makefile +++ b/test/Makefile @@ -9,6 +9,7 @@ test: ./test_checkbashisms ./test_dd-list ./test_debchange + ./test_package_lifecycle ./test_debdiff ./test_licensecheck if [ $(check_unstable) = 0 ]; then \ @@ -24,6 +25,7 @@ test-installed: ./test_checkbashisms --installed ./test_dd-list --installed ./test_debchange --installed + ./test_package_lifecycle --installed ./test_debdiff --installed ./test_licensecheck --installed if [ $(check_unstable) = 0 ]; then \ diff --git a/test/test_package_lifecycle b/test/test_package_lifecycle new file mode 100755 index 0000000..842e565 --- /dev/null +++ b/test/test_package_lifecycle @@ -0,0 +1,274 @@ +#!/bin/bash + +# Copyright (C) 2015, Nicholas Bamber <[email protected]> +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +if test "$1" = --installed; then + INSTALLED=1 + shift +else + INSTALLED=0 +fi + +WORKDIR=$(readlink -f "${0%/*}") + +GPG=/usr/bin/gpg +if [ ! -x $GPG ];then + echo "$GPG missing" + GPG=/usr/bin/gpg2 + if [ ! -x $GPG ];then + echo "$GPG missing" + exit 1 + fi +fi + +PRIVATE_KEY=${WORKDIR}/uscan/PRIVATE_KEY.asc +PUBLIC_KEY=${WORKDIR}/uscan/PUBLIC_KEY.asc + +GPGHOME=$(readlink -f ${WORKDIR}/uscan/gpg) +rm -rf $GPGHOME +mkdir -p $GPGHOME +chmod 700 $GPGHOME +PRIVATE_KEYRING=$GPGHOME/secring.gpg +PUBLIC_KEYRING=$GPGHOME/pubring.gpg + +$GPG -v --homedir $GPGHOME --no-options -q --batch --no-default-keyring \ + --output $PRIVATE_KEYRING --dearmor $PRIVATE_KEY + +$GPG -v --homedir $GPGHOME --no-options -q --batch --no-default-keyring \ + --output $PUBLIC_KEYRING --dearmor $PUBLIC_KEY + +$GPG --homedir $GPGHOME --no-options -q --batch --no-default-keyring \ + --secret-keyring $PRIVATE_KEYRING --default-key 72543FAF \ + --list-keys --verbose + +. "${0%/*}/shunit2-helper-functions.sh" + +mkdir -p ${WORKDIR}/package_lifecycle/test/debian/source +cat > ${WORKDIR}/package_lifecycle/test/debian/control <<-EOS + Source: test + Section: devel + Priority: optional + Maintainer: Devscripts Devel Team <[email protected]> + Uploaders: Testophilus Testownik <[email protected]> + Standards-Version: 3.9.6 + + Package: test + Architecture: all + Description: Short description + Longer description +EOS +cp /usr/share/doc/debhelper/examples/rules.tiny ${WORKDIR}/package_lifecycle/test/debian/rules +_DATE=$(LC_ALL=C date '+%a, %d %b %Y %T +0000') +cat > ${WORKDIR}/package_lifecycle/test/debian/changelog <<-EOS + test (1.0-1) unstable; urgency=low + + * Initial packaging + + -- Testophilus Testownik <[email protected]> ${_DATE} +EOS +echo 9 > ${WORKDIR}/package_lifecycle/test/debian/compat +echo '3.0 (quilt)' > ${WORKDIR}/package_lifecycle/test/debian/source/format +touch ${WORKDIR}/package_lifecycle/test/CONTENTS +cd ${WORKDIR}/package_lifecycle/ && tar cvf test_1.0.orig.tar --exclude debian -- test/CONTENTS 2>&1 > /dev/null && xz -f test_1.0.orig.tar + +runCommandOutCmpFile() { + local param="$1" + local exp_stdoutfile="$2" + local exp_stderr="$3" + local exp_retval=$4 + local stdoutF="${SHUNIT_TMPDIR}/stdout" + local stderrF="${SHUNIT_TMPDIR}/stderr" + eval "${COMMAND} $param" 2> ${stderrF} | sed -e's!^ -- Testophilus Testownik <[email protected]>.*! -- Testophilus Testownik <[email protected]>!' > ${stdoutF} + retval=$? + eval "cmp ${stdoutF} ${exp_stdoutfile}" 3>&1 >/dev/null + local diffretval=$? + assertEquals "standard output of ${COMMAND} $param matches ${exp_stdoutfile}\n" "0" "$diffretval" || diff ${stdoutF} ${exp_stdoutfile} + assertEquals "error output of ${COMMAND} $param\n" "$exp_stderr" "$(cat ${stderrF})" + assertEquals "return value of ${COMMAND} $param\n" $exp_retval $retval +} + + +test_debuild() { + export GNUPGHOME=$GPGHOME + cd ${WORKDIR}/package_lifecycle/test + if [[ $INSTALLED == "1" ]]; then + COMMAND='debuild --no-conf' + else + COMMAND="perl -I ${WORKDIR}/../lib ${WORKDIR}/../scripts/debuild.pl --no-conf" + fi + local _ARCH=$(dpkg-architecture -qDEB_BUILD_ARCH) + cat > ${WORKDIR}/package_lifecycle/debuild.txt <<-EOS + dpkg-buildpackage -rfakeroot -D -us -uc + dpkg-buildpackage: source package test + dpkg-buildpackage: source version 1.0-1 + dpkg-buildpackage: source distribution unstable + dpkg-buildpackage: source changed by Testophilus Testownik <[email protected]> + dpkg-source --before-build test + dpkg-buildpackage: host architecture amd64 + fakeroot debian/rules clean + dh clean + dh_testdir + dh_auto_clean + dh_clean + dpkg-source -b test + dpkg-source: info: using source format '3.0 (quilt)' + dpkg-source: info: building test using existing ./test_1.0.orig.tar.xz + dpkg-source: info: building test in test_1.0-1.debian.tar.xz + dpkg-source: info: building test in test_1.0-1.dsc + debian/rules build + dh build + dh_testdir + dh_auto_configure + dh_auto_build + dh_auto_test + fakeroot debian/rules binary + dh binary + dh_testroot + dh_prep + dh_auto_install + dh_installdocs + dh_installchangelogs + dh_perl + dh_link + dh_strip_nondeterminism + dh_compress + dh_fixperms + dh_installdeb + dh_gencontrol + dh_md5sums + dh_builddeb + dpkg-deb: building package 'test' in '../test_1.0-1_all.deb'. + dpkg-genchanges >../test_1.0-1_${_ARCH}.changes + dpkg-genchanges: including full source code in upload + dpkg-source --after-build test + dpkg-buildpackage: full upload (original source is included) + Now running lintian... + W: test source: debhelper-but-no-misc-depends test + E: test source: package-uses-debhelper-but-lacks-build-depends + W: test source: package-needs-versioned-debhelper-build-depends 9 + W: test source: no-debian-copyright + I: test source: debian-watch-file-is-missing + P: test: no-upstream-changelog + W: test: new-package-should-close-itp-bug + E: test: no-copyright-file + I: test: extended-description-is-probably-too-short + P: test: no-homepage-field + W: test: empty-binary-package + Finished running lintian. + Now signing changes and any dsc files... + signfile test_1.0-1.dsc uscan test key (no secret) <[email protected]> + + signfile test_1.0-1_amd64.changes uscan test key (no secret) <[email protected]> + + Successfully signed dsc and changes files +EOS + runCommandOutCmpFile "-k'uscan test key (no secret) <[email protected]>'" "${WORKDIR}/package_lifecycle/debuild.txt" "" 0 + cd ${WORKDIR} +} + +test_dscverify () { + cd ${WORKDIR}/package_lifecycle + if [[ $INSTALLED == "1" ]]; then + COMMAND='dscverify --no-conf --keyring $GPGHOME/pubring.gpg' + else + COMMAND="perl -I ${WORKDIR}/../lib ${WORKDIR}/../scripts/dscverify.pl --no-conf --keyring $GPGHOME/pubring.gpg" + fi + cat > ${WORKDIR}/package_lifecycle/dscverify.txt <<-EOS + ${WORKDIR}/package_lifecycle/test_1.0-1.dsc: + Good signature found + validating test_1.0.orig.tar.xz + validating test_1.0-1.debian.tar.xz + All files validated successfully. +EOS + runCommandOutCmpFile "${WORKDIR}/package_lifecycle/test_1.0-1.dsc" "${WORKDIR}/package_lifecycle/dscverify.txt" "" 0 + cd ${WORKDIR} +} + +test_dscextractControl () { + cd ${WORKDIR}/package_lifecycle + if [[ $INSTALLED == "1" ]]; then + COMMAND='dscextract' + else + COMMAND="${WORKDIR}/../scripts/dscextract.sh" + fi + cat > ${WORKDIR}/package_lifecycle/dscextractControl.txt <<-EOS + Source: test + Section: devel + Priority: optional + Maintainer: Devscripts Devel Team <[email protected]> + Uploaders: Testophilus Testownik <[email protected]> + Standards-Version: 3.9.6 + + Package: test + Architecture: all + Description: Short description + Longer description +EOS + runCommandOutCmpFile "test_1.0-1.dsc debian/control" "dscextractControl.txt" "" 0 + cd ${WORKDIR} +} + +test_dscextractChangelog () { + cd ${WORKDIR}/package_lifecycle + if [[ $INSTALLED == "1" ]]; then + COMMAND='dscextract' + else + COMMAND="${WORKDIR}/../scripts/dscextract.sh" + fi + cat > ${WORKDIR}/package_lifecycle/dscextractChangelog.txt <<-EOS + test (1.0-1) unstable; urgency=low + + * Initial packaging + + -- Testophilus Testownik <[email protected]> +EOS + runCommandOutCmpFile "test_1.0-1.dsc debian/changelog" "dscextractChangelog.txt" "" 0 + cd ${WORKDIR} +} + +test_debchange () { + cd ${WORKDIR}/package_lifecycle/test + if [[ $INSTALLED == "1" ]]; then + COMMAND='debchange' + else + COMMAND="perl -I ${WORKDIR}/../lib ${WORKDIR}/../scripts/debchange.pl" + fi + export DEBFULLNAME='Testophilus Testownik' + export DEBEMAIL='[email protected]' + cat > ${WORKDIR}/package_lifecycle/debchange.txt <<-EOS + test (1.0-2) UNRELEASED; urgency=medium + + * new killer app functionality + + -- Testophilus Testownik <[email protected]> + + test (1.0-1) unstable; urgency=low + + * Initial packaging + + -- Testophilus Testownik <[email protected]> +EOS + runCommand "-i 'new killer app functionality'" "" "" 0 + COMMAND=cat + runCommandOutCmpFile "debian/changelog" "../debchange.txt" "" 0 + cd ${WORKDIR} +} + + +cd ${WORKDIR} +. shunit2 + +#rm -rf ${WORKDIR}/package_lifecycle -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/collab-maint/devscripts.git _______________________________________________ devscripts-devel mailing list [email protected] http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/devscripts-devel
