 +    for i in `ls -aR $WORKPATH | awk '/:$/&&f{s=$0;f=0} /:$/&&!f{sub(/:$/,"");s=$0;f=1;next} NF&&f{ print s"/"$0 }'`
 +    do
 +        if [[ $i == *".gcno" ]]; then
-+            newfile=$(echo "$i" | sed -s "s/gcno/gcda/g")
++            newfile=$(echo "$i" | sed -s "s/\.gcno/\.gcda/g")
 +            touch $newfile
 +            chmod a+w $newfile
 +        fi

 		$(PIE_LDFLAGS) \
diff --git a/tools/virtcov.in b/tools/virtcov.in
new file mode 100644
index 0000000..38abe3f
--- /dev/null
+++ b/tools/virtcov.in
@@ -0,0 +1,208 @@

 %{_bindir}/virt-pki-validate
 %{_bindir}/virt-host-validate
 %{_libdir}/lib*.so.*
@@ -1438,6 +1451,7 @@ rm -f $RPM_BUILD_ROOT%{_sysconfdir}/sysctl.d/libvirtd
 
 %doc docs/*.html docs/html docs/*.gif
 %doc docs/libvirt-api.xml
+%doc docs/gcno
 %doc examples/hellolibvirt
 %doc examples/domain-events/events-c
 %doc examples/dominfo
