diff options
author | Pavel Kopyl <p.kopyl@samsung.com> | 2018-01-30 00:22:53 +0300 |
---|---|---|
committer | Pavel Kopyl <p.kopyl@samsung.com> | 2018-01-31 15:46:45 +0300 |
commit | daf747e092b4a14c5c0f44fc5eaa34b1ce38c89e (patch) | |
tree | e4cfb271b032282d95717a53a59b16832e7d1b8e | |
parent | c6cd28984ab2ca8fc08c59ccac9d5aa7cab7c404 (diff) | |
download | rpm-sandbox/pavelkopyl/gcov.tar.gz rpm-sandbox/pavelkopyl/gcov.tar.bz2 rpm-sandbox/pavelkopyl/gcov.zip |
Generate gcovinfo package.sandbox/pavelkopyl/gcov
-rw-r--r-- | Makefile.am | 1 | ||||
-rw-r--r-- | macros.in | 15 | ||||
-rw-r--r-- | packaging/rpm-tizen_macros | 2 | ||||
-rw-r--r-- | packaging/rpm.spec | 1 | ||||
-rw-r--r-- | platform.in | 1 | ||||
-rw-r--r-- | scripts/Makefile.am | 2 | ||||
-rw-r--r-- | scripts/find-gcovinfo.sh | 58 |
7 files changed, 79 insertions, 1 deletions
diff --git a/Makefile.am b/Makefile.am index 3cb3365b4..250c8fd7c 100644 --- a/Makefile.am +++ b/Makefile.am @@ -158,6 +158,7 @@ rpm2cpio_LDFLAGS = $(LDFLAGS) -pie if LIBELF rpmconfig_SCRIPTS += scripts/find-debuginfo.sh +rpmconfig_SCRIPTS += scripts/find-gcovinfo.sh rpmlibexec_PROGRAMS += debugedit debugedit_SOURCES = tools/debugedit.c tools/hashtab.c tools/hashtab.h @@ -188,6 +188,9 @@ %{_rpmconfigdir}/find-debuginfo.sh %{?_missing_build_ids_terminate_build:--strict-build-id} %{?_find_debuginfo_opts} %{?_find_debuginfo_strip_opts} %{?_find_debuginfo_ko_strip_opts} "%{_builddir}/%{?buildsubdir}" %{?_install_debug_manifest} \ %{nil} +%__gcov_install_post \ + %{_rpmconfigdir}/find-gcovinfo.sh "%{_builddir}/%{?buildsubdir}" + # Template for debug information sub-package. %debug_package \ %global __debug_package 1\ @@ -204,6 +207,17 @@ package or when debugging this package.\ %manifest %{name}-debugsource.manifest \ %{nil} +%gcov_package \ +%package gcovinfo\ +Summary: Gcov files (*.gcno) for package %{name}\ +Group: Development/Debug\ +AutoReqProv: 0\ +%description gcovinfo\ +This package provides gcov files for package %{name}.\ +%files gcovinfo -f gcnofiles.list\ +%defattr(-,root,root)\ +%{nil} + %_defaultdocdir %{_datadir}/doc/packages %_defaultlicensedir %{_datadir}/licenses %_docdir_fmt %%{NAME} @@ -718,6 +732,7 @@ posix.setenv("RPMBUILD_SOURCEDIR",rpm.expand("%?_sourcedir")); %__spec_install_body %{___build_body} %__spec_install_post\ %{?__debug_package:%{__debug_install_post}}\ +%{__gcov_install_post}\ %{__arch_install_post}\ %{__os_install_post}\ %{nil} diff --git a/packaging/rpm-tizen_macros b/packaging/rpm-tizen_macros index fedf7289d..abfcbd6ba 100644 --- a/packaging/rpm-tizen_macros +++ b/packaging/rpm-tizen_macros @@ -41,6 +41,7 @@ %__spec_install_post\ %{?__debug_package:%{__debug_install_post}}\ + %{__gcov_install_post}\ %{__arch_install_post}\ %{__os_install_post}\ %{nil} @@ -224,6 +225,7 @@ LD_AS_NEEDED=1; export LD_AS_NEEDED ; \ %{nil} %install %{?_enable_debug_packages:%{?buildsubdir:%{debug_package}}}\ +%{gcov_package}\ %%install\ LANG=C\ export LANG\ diff --git a/packaging/rpm.spec b/packaging/rpm.spec index 4897db8a1..0fedf8a72 100644 --- a/packaging/rpm.spec +++ b/packaging/rpm.spec @@ -302,6 +302,7 @@ rm -f %{_dbpath}/Filemd5s \ %{rpmhome}/check-* %{rpmhome}/debugedit %{rpmhome}/find-debuginfo.sh +%{rpmhome}/find-gcovinfo.sh %{rpmhome}/find-lang.sh %{rpmhome}/find-provides.ksyms %{rpmhome}/*provides* diff --git a/platform.in b/platform.in index 20c564e2a..a2d231406 100644 --- a/platform.in +++ b/platform.in @@ -67,6 +67,7 @@ %__spec_install_post\ %{?__debug_package:%{__debug_install_post}}\ + %{__gcov_install_post}\ %{__arch_install_post}\ %{__os_install_post}\ %{nil} diff --git a/scripts/Makefile.am b/scripts/Makefile.am index 39bdb37a6..9808134e5 100644 --- a/scripts/Makefile.am +++ b/scripts/Makefile.am @@ -10,7 +10,7 @@ EXTRA_DIST = \ brp-strip-shared brp-strip-static-archive \ check-files check-prereqs \ check-buildroot check-rpaths check-rpaths-worker \ - find-debuginfo.sh find-lang.sh \ + find-debuginfo.sh find-gcovinfo.sh find-lang.sh \ perldeps.pl perl.prov perl.req pythondeps.sh osgideps.pl \ rpmdb_loadcvt rpm.daily rpm.log rpm.supp rpm2cpio.sh \ tcl.req tgpg vpkg-provides.sh \ diff --git a/scripts/find-gcovinfo.sh b/scripts/find-gcovinfo.sh new file mode 100644 index 000000000..6dc3e9227 --- /dev/null +++ b/scripts/find-gcovinfo.sh @@ -0,0 +1,58 @@ +#!/bin/bash +set -xe +#find-debuginfo.sh - automagically generate collects gcov info(*.gcno files) and file list +#for inclusion in an rpm spec file. +# +# Usage: find-debuginfo.sh [-o gcnofiles.list] [builddir] +# +BUILDDIR=. +out=gcnofiles.list +nout=0 +while [ $# -gt 0 ]; do + case "$1" in + -o) + out=$2 + shift + ;; + *) + BUILDDIR=$1 + shift + break + ;; + esac + shift +done + +LISTFILE="$BUILDDIR/$out" + +> "$LISTFILE" + +BUILDDIR=${BUILDDIR%/} + +get_gcovfn() +{ + dn=$(dirname "${1#$BUILDDIR}") + bn=$(basename "$1") + gcovdn=${RPM_BUILD_ROOT}${dn} + gcovfn=${gcovdn}/${bn} +} + +append_uniq() +{ + grep -F -f "$1" -x -v >> "$1" || true +} + +set -o pipefail + +find $BUILDDIR -name "*.gcno" | sort | +while read f; do + get_gcovfn $f + mkdir -p $gcovdn + cp $f $gcovfn + echo "$dn/$bn" >> "${LISTFILE}.tmp" + echo "%dir $dn" | append_uniq "${LISTFILE}" +done + +if [[ -f "${LISTFILE}.tmp" ]]; then + cat "${LISTFILE}.tmp" >> "${LISTFILE}" +fi |