[Merge] lp:~allanlesage/pkgbinarymangler/coverage-mangler into lp:ubuntu/pkgbinarymangler
Adam Conrad
adconrad at 0c3.net
Tue Aug 26 21:40:59 UTC 2014
Diff comments:
> === modified file 'debian/changelog'
> --- debian/changelog 2014-03-18 07:50:06 +0000
> +++ debian/changelog 2014-08-25 23:25:55 +0000
> @@ -1,3 +1,9 @@
> +pkgbinarymangler (121~alesage24) utopic; urgency=medium
> +
> + * Test of producing coverage.xml under dh_ build.
> +
> + -- Allan LeSage <allan.lesage at canonical.com> Tue, 12 Aug 2014 14:32:24 -0500
> +
> pkgbinarymangler (120) trusty; urgency=medium
>
> * pkgstripfiles: Fix escaping of % characters to also work with bash 4.3.
>
> === modified file 'debian/control'
> --- debian/control 2014-01-15 09:28:07 +0000
> +++ debian/control 2014-08-25 23:25:55 +0000
> @@ -18,7 +18,10 @@
> Depends: ${misc:Depends},
> lockfile-progs,
> advancecomp,
> - optipng
> + optipng,
> + gcovr,
For the record, I don't consider making any of these packages build-essential for the sake of a few packages wanting to do coverage tests at build time an even remotely sane thing.
> + lcov,
> + cmake-extras,
> Description: strips translations and alters maintainers during build
> pkgbinarymangler consists of a dpkg-deb wrapper that calls the following
> helper applications while building a debian binary package:
>
> === modified file 'debian/pkgbinarymangler.install'
> --- debian/pkgbinarymangler.install 2011-11-29 08:59:57 +0000
> +++ debian/pkgbinarymangler.install 2014-08-25 23:25:55 +0000
> @@ -1,5 +1,9 @@
> dpkg-deb usr/bin
> dh_builddeb usr/bin
> +src/dh_auto_configure usr/bin
> +src/dh_auto_build usr/bin
> +src/dh_auto_test usr/bin
> +dpkg-gensymbols usr/bin
> pkgstriptranslations usr/bin
> pkgmaintainermangler usr/bin
> pkgsanitychecks usr/bin
>
> === modified file 'debian/pkgbinarymangler.postrm'
> --- debian/pkgbinarymangler.postrm 2011-11-29 08:59:57 +0000
> +++ debian/pkgbinarymangler.postrm 2014-08-25 23:25:55 +0000
> @@ -7,6 +7,10 @@
> # Remove our diversions
> dpkg-divert --remove --rename --package pkgbinarymangler --divert /usr/bin/dpkg-deb.pkgbinarymangler /usr/bin/dpkg-deb > /dev/null
> dpkg-divert --remove --rename --package pkgbinarymangler --divert /usr/bin/dh_builddeb.pkgbinarymangler /usr/bin/dh_builddeb > /dev/null
> + dpkg-divert --remove --rename --package pkgbinarymangler --divert /usr/bin/pkgbinarymangler/dh_auto_configure /usr/bin/dh_auto_configure > /dev/null
> + dpkg-divert --remove --rename --package pkgbinarymangler --divert /usr/bin/pkgbinarymangler/dh_auto_build /usr/bin/dh_auto_build > /dev/null
> + dpkg-divert --remove --rename --package pkgbinarymangler --divert /usr/bin/pkgbinarymangler/dh_auto_test /usr/bin/dh_auto_test > /dev/null
> + dpkg-divert --remove --rename --package pkgbinarymangler --divert /usr/bin/dpkg-gensymbols.pkgbinarymangler /usr/bin/dpkg-gensymbols > /dev/null
> ;;
> esac
>
>
> === modified file 'debian/pkgbinarymangler.preinst'
> --- debian/pkgbinarymangler.preinst 2011-11-29 09:19:59 +0000
> +++ debian/pkgbinarymangler.preinst 2014-08-25 23:25:55 +0000
> @@ -14,6 +14,11 @@
> fi
>
> dpkg-divert --add --rename --package pkgbinarymangler --divert /usr/bin/dh_builddeb.pkgbinarymangler /usr/bin/dh_builddeb > /dev/null
> + mkdir -p /usr/bin/pkgbinarymangler
> + dpkg-divert --add --rename --package pkgbinarymangler --divert /usr/bin/pkgbinarymangler/dh_auto_configure /usr/bin/dh_auto_configure > /dev/null
> + dpkg-divert --add --rename --package pkgbinarymangler --divert /usr/bin/pkgbinarymangler/dh_auto_build /usr/bin/dh_auto_build > /dev/null
> + dpkg-divert --add --rename --package pkgbinarymangler --divert /usr/bin/pkgbinarymangler/dh_auto_test /usr/bin/dh_auto_test > /dev/null
> + dpkg-divert --add --rename --package pkgbinarymangler --divert /usr/bin/dpkg-gensymbols.pkgbinarymangler /usr/bin/dpkg-gensymbols > /dev/null
> ;;
> esac
>
>
> === added file 'dpkg-gensymbols'
> --- dpkg-gensymbols 1970-01-01 00:00:00 +0000
> +++ dpkg-gensymbols 2014-08-25 23:25:55 +0000
> @@ -0,0 +1,10 @@
> +#!/bin/bash
> +
> +set -e
> +
> +# gcov introduces mismatches; set to lowest check level
> +export DPKG_GENSYMBOLS_CHECK_LEVEL=0
Production binaries built for coverage support are a generally bad idea, and the upstream authors of all the *cov tools agree. These are testing and development workflow tools, not production build tools.
> +
> +# TODO filter options, eliminating -c
> +DPKG_GENSYMBOLS_OPTS=$@
> +exec dpkg-gensymbols.pkgbinarymangler $DPKG_GENSYMBOLS_OPTS
>
> === added directory 'src'
> === added file 'src/dh_auto_build'
> --- src/dh_auto_build 1970-01-01 00:00:00 +0000
> +++ src/dh_auto_build 2014-08-25 23:25:55 +0000
> @@ -0,0 +1,9 @@
> +#!/bin/bash
> +set -e
> +
> +/usr/bin/pkgbinarymangler/dh_auto_build $@
> +
> +echo "Verify that we produced .gcno artifacts."
> +
> +find -name "*.o"
> +find -name "*.gcno"
>
> === added file 'src/dh_auto_configure'
> --- src/dh_auto_configure 1970-01-01 00:00:00 +0000
> +++ src/dh_auto_configure 2014-08-25 23:25:55 +0000
> @@ -0,0 +1,41 @@
> +#!/bin/bash
> +
> +set -e
> +
> +echo "Diverted dh_auto_configure enabling coverage build."
> +
> +DH_AUTO_CONFIGURE_OPTS=$@
> +
> +enable_coverage_report() {
> + if $(echo $DH_AUTO_CONFIGURE_OPTS | grep '.*-- .*' > /dev/null); then
> + # slip our option in after the --
> + DH_AUTO_CONFIGURE_OPTS=$(echo "$DH_AUTO_CONFIGURE_OPTS" | sed 's/\(^.*-- \)\(.*\)/\1'"$1"' \2/')
> + else
> + DH_AUTO_CONFIGURE_OPTS="$DH_AUTO_CONFIGURE_OPTS -- $1"
> + fi
> +}
> +
> +if [ -f Makefile.am.coverage ]; then
> + # 2011-era alesage effort added Makefile.am.coverage macro for autotools projects
> + # http://qualityhour.wordpress.com/2012/01/29/test-coverage-tutorial-for-cc-autotools-projects/
> + echo "Enabling coverage reporting per Makefile.am.coverage."
> + enable_coverage_report "--enable-gcov"
> +elif [ -f coverage.pri ]; then
> + # An unknown genius (vrruiz?) introduced coverage.pri for qmake projects
> + echo "Enabling coverage reporting per coverage.pri."
> + enable_coverage_report "CONFIG+=coverage"
> +elif grep -ri "if.*cmake_build_type.*c.*o.*v.*e.*r.*a.*g.*e" > /dev/null; then
> + # CMake projects virally added cmake/EnableCoverageReport.cmake (filenames vary)
> + # Above grep could be more clever but not as clever as
> + # IF(CMAKE_BUILD_TYPE MATCHES [cC][oO][vV][eE][rR][aA][gG][eE])
> + # Recursive grep to find options hidden in src/CMakeLists.txt e.g.
> + echo "Enabling coverage reporting per CMakeLists.txt CMAKE_BUILD_TYPE instruction."
> + if $(echo "$DH_AUTO_CONFIGURE_OPTS" | grep "\-DCMAKE_BUILD_TYPE" > /dev/null); then
> + # correct CMAKE_BUILD_TYPE to coverage
> + DH_AUTO_CONFIGURE_OPTS=$(echo "$DH_AUTO_CONFIGURE_OPTS" | sed 's/^\(.*-DCMAKE_BUILD_TYPE.*=\)[^ $]*/\1coverage/')
> + else
> + enable_coverage_report "-DCMAKE_BUILD_TYPE=coverage"
> + fi
> +fi
> +
> +exec /usr/bin/pkgbinarymangler/dh_auto_configure $DH_AUTO_CONFIGURE_OPTS
>
> === added file 'src/dh_auto_test'
> --- src/dh_auto_test 1970-01-01 00:00:00 +0000
> +++ src/dh_auto_test 2014-08-25 23:25:55 +0000
> @@ -0,0 +1,17 @@
> +#!/bin/bash
> +set -e
> +
> +/usr/bin/pkgbinarymangler/dh_auto_test $@
> +
> +echo "dh_auto_test runs gcovr to produce coverage.xml."
> +
> +# TODO if no gcdas then exit in disgust
> +find -name "*.gcda"
> +
> +# NOTE that pkgbinarymangler depends on gcovr (in debian/control)
> +gcovr --xml -r $(pwd) -o coverage.xml --exclude='.*test.*' --exclude='.*gmock.*' --exclude='/usr/.*'
> +
> +# on wgrant's recommendation we dump coverage.xml to the log
> +echo "===== BEGIN coverage.xml ====="
> +cat coverage.xml
> +echo "===== END coverage.xml ====="
>
> === modified file 'test/run'
> --- test/run 2014-01-15 09:21:27 +0000
> +++ test/run 2014-08-25 23:25:55 +0000
> @@ -38,6 +38,13 @@
> os.symlink('/usr/bin/dh_builddeb.pkgbinarymangler', os.path.join(self.srcdir, 'dh_builddeb.pkgbinarymangler'))
> else:
> os.symlink('/usr/bin/dh_builddeb', os.path.join(self.srcdir, 'dh_builddeb.pkgbinarymangler'))
> + # debhelper objects to '.pkgbinarymangler' suffix for dh_auto_configure; instead install to special dir
> + os.mkdir(os.path.join(self.srcdir, 'pkgbinarymangler'))
> + os.environ['PATH'] = os.path.join(self.srcdir, 'pkgbinarymangler') + os.pathsep + os.environ['PATH']
> + if os.path.exists('/usr/bin/pkgbinarymangler/dh_auto_configure'):
> + os.symlink('/usr/bin/pkgbinarymangler/dh_auto_configure', os.path.join(self.srcdir, 'pkgbinarymangler', 'dh_auto_configure'))
> + else:
> + os.symlink('/usr/bin/dh_auto_configure', os.path.join(self.srcdir, 'pkgbinarymangler', 'dh_auto_configure'))
>
> # copy our default configuration files, and enable them
> for conf in glob(os.path.join(self.srcdir, '*.conf')):
> @@ -59,6 +66,9 @@
> shutil.rmtree(self.workdir)
> os.unlink(os.path.join(self.srcdir, 'dpkg-deb.pkgbinarymangler'))
> os.unlink(os.path.join(self.srcdir, 'dh_builddeb.pkgbinarymangler'))
> + os.unlink(os.path.join(self.srcdir, 'pkgbinarymangler', 'dh_auto_configure'))
> + os.rmdir(os.path.join(self.srcdir, 'pkgbinarymangler'))
> + os.environ['PATH'] = os.environ['PATH'].replace(os.path.join(self.srcdir, 'pkgbinarymangler') + os.pathsep, '')
>
> def build(self, use_local_mangler=True, extra_env=None, srcname='icecream'):
> env = os.environ.copy()
>
--
https://code.launchpad.net/~allanlesage/pkgbinarymangler/coverage-mangler/+merge/232127
Your team Ubuntu branches is subscribed to branch lp:ubuntu/pkgbinarymangler.
More information about the Ubuntu-reviews
mailing list