Add %version_no_operators macro and tests.
This commit is contained in:
parent
370b825e45
commit
9ec9c1fb5b
|
@ -221,3 +221,14 @@
|
|||
end
|
||||
end
|
||||
}}
|
||||
|
||||
%version_no_operators() %{lua:
|
||||
local ver = rpm.expand('%1')
|
||||
\
|
||||
if ver == '%1' then
|
||||
ver = rpm.expand('%version')
|
||||
end
|
||||
ver = ver:gsub('[~^]+', '')
|
||||
\
|
||||
print(ver)
|
||||
}
|
|
@ -73,6 +73,16 @@ def test_pydist_name(argument, result):
|
|||
assert rpm_eval(f'%py_dist_name {argument}') == [result]
|
||||
|
||||
|
||||
@pytest.mark.parametrize('argument, result', [
|
||||
('7.5.0~~dev1', '7.5.0dev1'),
|
||||
('7.5.0~b4', '7.5.0b4'),
|
||||
('7.5.0', '7.5.0'),
|
||||
('7.5.0^post1', '7.5.0post1'),
|
||||
])
|
||||
def test_version_no_operators(argument, result):
|
||||
assert rpm_eval(f'%version_no_operators {argument}') == [result]
|
||||
|
||||
|
||||
def test_py2_dist():
|
||||
assert rpm_eval(f'%py2_dist Aha[Boom] a') == ['python2dist(aha[boom]) python2dist(a)']
|
||||
|
||||
|
|
Loading…
Reference in New Issue