diff --git a/dnsperf-data b/dnsperf-data new file mode 100755 index 0000000..f92ec99 --- /dev/null +++ b/dnsperf-data @@ -0,0 +1,126 @@ +#!/bin/sh +# +# dnsperf data downloader +# +# Replacement utility for original dnsperf-data package, provides easy way to install sample + +# Copyright 2021 Red Hat +# All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DATAURL="https://www.dns-oarc.net/files/dnsperf/data/queryfile-example-10million-201202.gz" +LOCAL=queryfile-example-10million-201202.gz +TARGET="/usr/share/dnsperf/$(basename -- "$LOCAL" .gz)" +CURL="$(type -p curl 2>/dev/null)" +WGET="$(type -p wget 2>/dev/null)" + +INSTALL_MODE=ask +DOWNLOAD_MODE=ask +FORCE_MODE=no + +do_check() +{ + test -s "$TARGET" +} + +do_install() +{ + local SUDO=sudo + [ "$(id -u)" -eq 0 ] && SUDO= + $SUDO install -d /usr/share/dnsperf + $SUDO install "$LOCAL" "$TARGET.gz" + $SUDO gunzip -v "$TARGET.gz" +} + +do_uninstall() +{ + local SUDO=sudo + [ "$(id -u)" -eq 0 ] && SUDO= + $SUDO rm -f "$TARGET" + $SUDO rmdir /usr/share/dnsperf +} + +do_download() +{ + if [ -x "$CURL" ]; then + $CURL -C - "$DATAURL" -o "$LOCAL" + elif [ -x "$WGET" ]; then + $WGET -c "$DATAURL" -O "$LOCAL" + else + echo "No curl or wget detected, cannot download!" + echo "Visit https://www.dns-oarc.net/tools/dnsperf for manual download." + fi +} + +do_help() +{ + cat < port domain" to capture your own read data and use queryparse from +dnsperf-queryparse package to convert it into queries list. + +It would download it into current directory, it would have size 238MB after unpacking. + +EOF + + read -p "Would you like to download $LOCAL? [y/N]" CONFIRM + [ "$CONFIRM" = y ] && do_download +else + do_download +fi + +if ! [ -s "$LOCAL" ]; then + echo "ERROR: Not downloaded, cannot install!" + exit 1 +fi + +if [ "$INSTALL_MODE" = ask ]; then + read -p "Would you like to install it to system [y/N]?" CONFIRM + if [ "$CONFIRM" = y ]; then + do_install + else + echo "Unpacking $LOCAL" + gunzip -v "$LOCAL" + fi +else + do_install +fi + +if [ "$UNINSTALL_MODE" = yes ]; then + do_uninstall +fi diff --git a/dnsperf.spec b/dnsperf.spec index a121e66..113b317 100644 --- a/dnsperf.spec +++ b/dnsperf.spec @@ -34,7 +34,7 @@ Url: https://www.dns-oarc.net/tools/dnsperf # Deactivate GitHub sources, make web server official. Should be the same, but GitHub does not match checksums. #Source: https://github.com/DNS-OARC/dnsperf/archive/v%%{version}/%%{name}-%%{version}.tar.gz Source0: https://www.dns-oarc.net/files/dnsperf/%{name}-%{version}.tar.gz -Source1: https://www.dns-oarc.net/files/dnsperf/data/queryfile-example-10million-%{dataversion}.gz +Source2: dnsperf-data Patch1: dnsperf-nolicense.patch @@ -64,6 +64,9 @@ BuildRequires: python3-devel BuildRequires: python2-devel %endif +Provides: %{name}-data = %{version}-%{release} +Obsoletes: %{name}-data < 2.5.1 + %description This is dnsperf, a collection of DNS server performance testing tools. For more information, see the dnsperf(1) and resperf(1) man pages. @@ -90,19 +93,6 @@ useable by dnsperf and resperf. %endif -%package data -Summary: Benchmarking authorative and recursing DNS servers data -BuildArch: noarch -Version: %{dataversion} -# Just for license file, any version containing the same license is ok -# Cannot use %%version-%%release, because %%version is local for data -Requires: %{name} >= 2.4.0 - -%description data -This is dnsperf, a collection of DNS server performance testing tools. - -This package provides example query file to use by dnsperf and resperf tools. - %prep %autosetup -p1 @@ -127,14 +117,16 @@ gzip %{buildroot}/%{_mandir}/man1/queryparse.1 %endif mkdir -p %{buildroot}%{_datadir}/%{name} -gunzip -c %{SOURCE1} > %{buildroot}%{_datadir}/%{name}/queryfile-example-current -chmod 644 %{buildroot}%{_datadir}/%{name}/queryfile-example-current +touch %{buildroot}%{_datadir}/%{name}/queryfile-example-current +install -m 755 -p %{SOURCE2} %{buildroot}%{_bindir}/dnsperf-data %files %doc README.md CHANGES %license LICENSE %{_bindir}/*perf* %{_mandir}/man*/*perf* +%dir %{_datadir}/dnsperf +%ghost %{_datadir}/dnsperf/queryfile-example-current %if %{with python2} || %{with python3} %files queryparse @@ -142,13 +134,10 @@ chmod 644 %{buildroot}%{_datadir}/%{name}/queryfile-example-current %{_mandir}/man1/queryparse.1* %endif -%files data -%dir %{_datadir}/dnsperf -%{_datadir}/dnsperf/queryfile-example-current - %changelog * Tue Mar 23 2021 Petr Menšík - 2.5.1-1 - Update to 2.5.1 +- Remove dnsperf-data package. Provide dnsperf-data command to download sample instead. * Tue Jan 26 2021 Fedora Release Engineering - 2.4.0-6 - Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild diff --git a/sources b/sources index a1dda66..a3100d0 100644 --- a/sources +++ b/sources @@ -1,2 +1 @@ SHA512 (dnsperf-2.5.1.tar.gz) = cd19973560ddb3fa5f9e503b7e904edbed229745ec13cdc32a94444b8e7ec62433128dfd1d212ba47f2c7e749f9ef7ab3af4f2744fb9a23641c8dfb74ce9b102 -SHA512 (queryfile-example-10million-201202.gz) = b679332a6e8d51d3dd4fc149d62f4362d513ad3430859debaa5d025b1d3cb122d07880b7785e0f33181cf4e68216b0dbeeeb47b4d588ba263b68540d22581ff8