Commit 3218660b authored by Kirill Smelkov's avatar Kirill Smelkov

Fix for LibreOffice

Withthout this patch LibreOffice version was not detected and instead
was put into name.

Noticed while doing BOM(Cloudooo).
parent a0d7df61
......@@ -290,7 +290,7 @@ def namever(url, failonerr=True): # -> (name, ver) | None if !failonerr
def del_tgztail(s):
for tail in ('.tgz', '.tar.gz', '.tbz', '.tar.bz2', '.tar.xz', '.tar.lz', '.zip', '.egg'):
s = removesuffix(s, tail)
for tail in ('-linux-x86_64',): # FIXME x86/arm, non-linux ?
for tail in ('-linux-x86_64', '_Linux_x86-64_rpm'): # FIXME x86/arm, non-linux ?
s = removesuffix(s, tail)
for tail in ['-py2.7'] + ['-py3.%d' % _ for _ in range(20)]:
s = removesuffix(s, tail)
......
......@@ -40,6 +40,7 @@ from os.path import dirname, exists
('https://osdn.net/frs/redir.php?f=ipafonts%2F51868%2FIPAfont00303.zip', 'IPAfont', '00303'),
('https://osdn.net/frs/redir.php?f=tsukurimashou%2F56948%2Focr-0.2.zip', 'ocr', '0.2'),
('http://geolite.maxmind.com/download/geoip/database/GeoLite2-Country.tar.gz', 'GeoLite2-Country', None),
('http://downloadarchive.documentfoundation.org/libreoffice/old/5.2.4.2/rpm/x86_64/LibreOffice_5.2.4.2_Linux_x86-64_rpm.tar.gz', 'LibreOffice', '5.2.4.2'),
])
def test_namever(url, nameok, verok):
assert nxdbom.namever(url) == (nameok, verok)
......@@ -362,6 +363,15 @@ bbb 3.4 https://pypi.org/project/bbb/3.4/
ccc 5.6.7 https://pypi.org/project/ccc/5.6.7/
""")
# libreoffice
case1("""\
[libreoffice-bin]
recipe = slapos.recipe.build
url = http://downloadarchive.documentfoundation.org/libreoffice/old/5.2.4.2/rpm/x86_64/LibreOffice_5.2.4.2_Linux_x86-64_rpm.tar.gz
""", """\
LibreOffice 5.2.4.2 http://downloadarchive.documentfoundation.org/libreoffice/old/5.2.4.2/rpm/x86_64/LibreOffice_5.2.4.2_Linux_x86-64_rpm.tar.gz
""")
@pytest.mark.parametrize('build,bomok', testv)
def test_bom_software(tmpdir, build, bomok):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment