diff --git a/dnsperf-python3.patch b/dnsperf-python3.patch new file mode 100644 index 0000000..b328c23 --- /dev/null +++ b/dnsperf-python3.patch @@ -0,0 +1,26 @@ +diff --git a/contrib/queryparse/queryparse b/contrib/queryparse/queryparse +index 516d933..6aab725 100755 +--- a/contrib/queryparse/queryparse ++++ b/contrib/queryparse/queryparse +@@ -102,16 +102,16 @@ def main(argv): + if outfile is not sys.stdout: + outfile.close() + sum = 0 +- print "Statistics:" +- qtypes = qtypecount.keys() ++ print("Statistics:") ++ qtypes = list(qtypecount.keys()) + qtypes.sort() + for qtype in qtypes: + qtype_str = dns.rdatatype.to_text(qtype) + count = qtypecount[qtype] +- print " %10s:\t%d" % (qtype_str, count) ++ print(" %10s:\t%d" % (qtype_str, count)) + sum += count +- print "-------------------------" +- print " TOTAL:\t%d" % sum ++ print("-------------------------") ++ print(" TOTAL:\t%d" % sum) + + if __name__ == '__main__': + main(sys.argv[1:]) diff --git a/dnsperf.spec b/dnsperf.spec index 0886c74..994f39f 100644 --- a/dnsperf.spec +++ b/dnsperf.spec @@ -1,3 +1,13 @@ +%if 0%{fedora} >= 29 +%bcond_without python3 +%bcond_with python2 +%global python %{__python3} +%else +%bcond_with python3 +%bcond_without python2 +%global python %{__python2} +%endif + Summary: Benchmarking authorative and recursing DNS servers Name: dnsperf Version: 2.1.0.0 @@ -34,6 +44,8 @@ Patch5: dnsperf-stdbool.patch Patch6: dnsperf-ends-client-subnet.patch # Fix deconst warning Patch7: dnsperf-constinit.patch +# Created by 2to3 +Patch8: dnsperf-python3.patch BuildRequires: bind-devel >= 9.10.0, gcc, make # Following are (incomplete dependencies of bind-devel) @@ -41,7 +53,17 @@ BuildRequires: bind-devel >= 9.10.0, gcc, make BuildRequires: libcap-devel, gzip, openssl-devel BuildRequires: krb5-devel, libxml2-devel, GeoIP-devel -Requires: gnuplot pcapy python2-dns +BuildRequires: /usr/bin/pathfix.py + +Requires: gnuplot +%if %{with python3} +BuildRequires: python3-devel +Requires: python3-pcapy python3-dns +%endif +%if %{with python2} +BuildRequires: python2-devel +Requires: pcapy python2-dns +%endif %description This is dnsperf, a collection of DNS server performance testing tools. @@ -56,11 +78,19 @@ For more information, see the dnsperf(1) and resperf(1) man pages. %patch5 -p1 -b .stdbool %patch6 -p1 -b .ends-subnet %patch7 -p1 -b .constinit +%patch8 -p1 -b .python3 %build %configure %make_build +%if %{with python2} +%{_bindir}/pathfix.py -i %{__python2} -p -n contrib/queryparse/queryparse +%endif +%if %{with python3} +%{_bindir}/pathfix.py -i %{__python3} -p -n contrib/queryparse/queryparse +%endif + %install %make_install install contrib/queryparse/queryparse %{buildroot}/%{_bindir}