simplify the lua code
Use parentheses around the string.gsub call to get the first result from the returned tuple. Use string.find with a capture to get the part we're interested in. Signed-off-by: Michal Schmidt <mschmidt@redhat.com>
This commit is contained in:
parent
56bffeff41
commit
2673b45773
@ -4,7 +4,7 @@ Summary: IB Performance Tests
|
|||||||
# Issue "Please avoid dashes in version":
|
# Issue "Please avoid dashes in version":
|
||||||
# https://github.com/linux-rdma/perftest/issues/18
|
# https://github.com/linux-rdma/perftest/issues/18
|
||||||
%global upstream_ver 4.5-0.20
|
%global upstream_ver 4.5-0.20
|
||||||
Version: %{lua: v=string.gsub(rpm.expand("%{upstream_ver}"),"-","."); print(v)}
|
Version: %{lua: print((string.gsub(rpm.expand("%{upstream_ver}"),"-",".")))}
|
||||||
Release: %autorelease
|
Release: %autorelease
|
||||||
License: GPLv2 or BSD
|
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
|
Source: https://github.com/linux-rdma/perftest/releases/download/v4.5-0.20/perftest-4.5-0.20.gac7cca5.tar.gz
|
||||||
@ -27,7 +27,7 @@ RDMA networks.
|
|||||||
|
|
||||||
%prep
|
%prep
|
||||||
# The directory in the tarball has only the part before the dash.
|
# The directory in the tarball has only the part before the dash.
|
||||||
%global tarball_ver %{lua: uv=rpm.expand("%{upstream_ver}"); d=string.find(uv,"-"); print(string.sub(uv,1,d-1))}
|
%global tarball_ver %{lua: _,_,v=string.find(rpm.expand("%{upstream_ver}"),"([^-]+)"); print(v)}
|
||||||
|
|
||||||
%setup -q -n %{name}-%{tarball_ver}
|
%setup -q -n %{name}-%{tarball_ver}
|
||||||
find src -type f -iname '*.[ch]' -exec chmod a-x '{}' ';'
|
find src -type f -iname '*.[ch]' -exec chmod a-x '{}' ';'
|
||||||
|
Loading…
Reference in New Issue
Block a user