use rpm lua to sanitize the upstream version string

Like in Fedora perftest-4.5.0.20-4.fc38.

Resolves: rhbz#2167405
Signed-off-by: Michal Schmidt <mschmidt@redhat.com>
This commit is contained in:
Michal Schmidt 2023-02-06 17:05:00 +01:00
parent 12fe95137c
commit d4589b396c
1 changed files with 11 additions and 4 deletions

View File

@ -1,11 +1,11 @@
Name: perftest
Summary: IB Performance Tests
# Upstream uses a dash in the version. Not valid in the Version field, so we use a dot instead.
# Issue "Please avoid dashes in version":
# https://github.com/linux-rdma/perftest/issues/18
%global upstream_ver 4.5-0.20
# The directory in the tarball has only the part before the dash.
%global tarball_ver 4.5
Version: 4.5.0.20
Release: 1%{?dist}
Version: %{lua: print((string.gsub(rpm.expand("%{upstream_ver}"),"-",".")))}
Release: 4%{?dist}
License: GPLv2 or BSD
Source: https://github.com/linux-rdma/perftest/releases/download/v4.5-0.20/perftest-4.5-0.20.gac7cca5.tar.gz
Url: https://github.com/linux-rdma/perftest
@ -26,6 +26,9 @@ connections. It does not work on normal TCP/IP networks, only on
RDMA networks.
%prep
# The directory in the tarball has only the part before the dash.
%global tarball_ver %{lua: _,_,v=string.find(rpm.expand("%{upstream_ver}"),"([^-]+)"); print(v)}
%setup -q -n %{name}-%{tarball_ver}
find src -type f -iname '*.[ch]' -exec chmod a-x '{}' ';'
@ -44,6 +47,10 @@ done
%_bindir/*
%changelog
* Tue Feb 07 2023 Michal Schmidt <mschmidt@redhat.com> - 4.5.0.20-4
- Use rpm lua code from Fedora perftest-4.5.0.20-4.fc38.
- Resolves: rhbz#2167405
* Mon Feb 06 2023 Kamal Heib <kheib@redhat.com> - 4.5.0.20-1
- Rebase to upstream release perftest-4.5-0.20
- Resolves: rhbz#2167405