Blob Blame Raw
%global         usegit      1
%global         mainrel     0.16

%global         githash     78310e76371950cda6f77eb165521b19f7028c4a
%global         shorthash   %(TMP=%githash ; echo ${TMP:0:10})
%global         gitdate     Wed, 27 Jul 2016 08:17:23 +0100
%global         gitdate_num 20160727

%if 0%{?usegit} >= 1
%global         fedorarel   %{mainrel}.D%{gitdate_num}git%{shorthash}
%else
%global         fedorarel   %{?prever:0.}%{mainrel}%{?prever:.%{prerpmver}}
%endif

%global	description_common \
This is a Python script to convert the output from prof, gprof, oprofile,\
Shark, AQtime, and python profilers into a dot graph.  It has the following\
features:\
\
* can correctly parse C++ template function names\
* allows to prune nodes and edges below a certain threshold\
* uses an heuristic to propagate time inside mutually recursive functions\
* uses color efficiently to draw attention to hot-spots\
%{nil}


Name:           gprof2dot
Version:        1.0
Release:        %{fedorarel}%{?dist}.8
Summary:        Generate dot graphs from the output of several profilers

License:        LGPLv3+
URL:            https://github.com/jrfonseca/gprof2dot
Source0:        https://github.com/jrfonseca/gprof2dot/archive/%{githash}/%{name}-%{version}-D%{gitdate_num}git%{githash}.tar.gz
BuildArch: noarch

BuildRequires:  python2
BuildRequires:  python3
BuildRequires:  graphviz

%global _description\
%description_common

%description %_description

%package -n python2-gprof2dot
Summary: %summary
Requires:       python2
%{?python_provide:%python_provide python2-gprof2dot}
# Remove before F30
Provides: gprof2dot%{?_isa} = %{version}-%{release}
Obsoletes: gprof2dot < %{version}-%{release}

%description -n python2-gprof2dot %_description

%package        python3
Summary:        Generate dot graphs from the output of several profilers
Requires:       python3

%description    python3
%description_common

This package uses python3.

%prep
%setup -q -n %{name}-%{githash}

%build

%install
mkdir -p %{buildroot}%{_bindir}

install -p -m 0755 gprof2dot.py %{buildroot}%{_bindir}/gprof2dot
ln -sf gprof2dot %{buildroot}%{_bindir}/gprof2dot-py2
install -p -m 0755 gprof2dot.py %{buildroot}%{_bindir}/gprof2dot-py3

sed -i %{buildroot}%{_bindir}/gprof2dot \
	-e 's|/usr/bin/env[ \t][ \t]*python$|%{_bindir}/python2|'
sed -i %{buildroot}%{_bindir}/gprof2dot-py3 \
	-e 's|/usr/bin/env[ \t][ \t]*python$|%{_bindir}/python3|'

chmod 0644 hotshotmain.py

%check
python2 ./tests/test.py
python3 ./tests/test.py

%files -n python2-gprof2dot
%license LICENSE.txt
%doc README.markdown
%doc hotshotmain.py 
%doc sample.png

%{_bindir}/gprof2dot
%{_bindir}/gprof2dot-py2

%files python3
%license LICENSE.txt
%doc README.markdown
%doc hotshotmain.py 
%doc sample.png

%{_bindir}/gprof2dot-py3

%changelog
* Thu Jul 25 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1.0-0.16.D20160727git78310e7637.8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild

* Fri Feb 01 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1.0-0.16.D20160727git78310e7637.7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild

* Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.0-0.16.D20160727git78310e7637.6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild

* Wed Feb 07 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.0-0.16.D20160727git78310e7637.5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild

* Sat Aug 19 2017 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 1.0-0.16.D20160727git78310e7637.4
- Python 2 binary package renamed to python2-gprof2dot
  See https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3

* Wed Jul 26 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.0-0.16.D20160727git78310e7637.3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild

* Fri Feb 10 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.0-0.16.D20160727git78310e7637.2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild

* Mon Dec 19 2016 Miro Hrončok <mhroncok@redhat.com> - 1.0-0.16.D20160727git78310e7637.1
- Rebuild for Python 3.6

* Thu Aug 18 2016 Mamoru TASAKA <mtasaka@fedoraproject.org> - 1.0-0.16.D20160727git78310e7637
- New upstream snapshot
- Create python3 subpackage

* Wed Feb 03 2016 Fedora Release Engineering <releng@fedoraproject.org> - 1.0-0.15.20150131gitc1354af
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild

* Wed Jun 17 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.0-0.14.20150131gitc1354af
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild

* Wed Mar  4 2015 Mamoru TASAKA <mtasaka@fedoraproject.org> - 1.0-0.13.20150131gitc1354af
- New upstream snapshot (actually same as pypi 2015.02.03)

* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.0-0.12.20130226git1ef99
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild

* Sat Aug 03 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.0-0.11.20130226git1ef99
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild

* Tue Feb 26 2013 Toshio Kuratomi <toshio@fedoraproject.org> - 1.0-0.9.20130226git1ef99
- New upstream snapshot

* Thu Feb 14 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.0-0.9.20120720git56961
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild

* Fri Jul 20 2012 Toshio Kuratomi <toshio@fedoraproject.org> - 1.0-0.8.20120720git56961
- Update to solve https://bugzilla.redhat.com/show_bug.cgi?id=821864 (support perf)
- Upstream has switched to a git repo

* Thu Jul 19 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.0-0.7.20100708hg89
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild

* Fri Jan 13 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.0-0.6.20100708hg89
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild

* Tue Feb 08 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.0-0.5.20100708hg89
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild

* Thu Jul 08 2010 Toshio Kuratomi <toshio@fedoraproject.org> - 1.0-0.4.20100708hg89
- Update to new upstream

* Tue Apr 13 2010 Toshio Kuratomi <toshio@fedoraproject.org> - 1.0-0.3.20100413hg88
- Update to new upstream

* Mon Sep 14 2009 Toshio Kuratomi <toshio@fedoraproject.org> - 1.0-0.2.20090901svn
- Use svn export instead of svn checkout to generate the tarball
- Replace use of env with direct call to the python interpreter

* Tue Sep 1 2009 Toshio Kuratomi <toshio@fedoraproject.org> - 1.0-0.1.20090901svn
- Initial Fedora build