Commit d47f4462 authored by Levin Zimmermann's avatar Levin Zimmermann Committed by Kirill Smelkov

Allow more than one version of the same software

In SlapOS we do in fact support/allow different versions for different
dependencies, so there isn't a reason why this should be disallowed.

----

kirr: added TODO regarding general multiversion support.

See merge-request for more context and discussion.

/reviewed-on nexedi/nxd-bom!3
/reviewed-by @jerome, @luke, @kirr
parent a537da80
...@@ -83,7 +83,7 @@ def bom_software(installed_software_path): # -> {} (name,kind) -> PkgInfo ...@@ -83,7 +83,7 @@ def bom_software(installed_software_path): # -> {} (name,kind) -> PkgInfo
info = PkgInfo(name, ver, kind, url) info = PkgInfo(name, ver, kind, url)
bkey = (name, kind) bkey = (name, kind, ver)
if bkey in bom: if bkey in bom:
assert bom[bkey] == info, (bom[bkey], info) assert bom[bkey] == info, (bom[bkey], info)
else: else:
...@@ -371,6 +371,7 @@ def namever(url, failonerr=True): # -> (name, ver) | None if !failonerr ...@@ -371,6 +371,7 @@ def namever(url, failonerr=True): # -> (name, ver) | None if !failonerr
# XXX hack: ERP5 SR uses both readline8 and readline-5 # XXX hack: ERP5 SR uses both readline8 and readline-5
# XXX Cloudooo SR ----//---- libpng16 and libpng12 # XXX Cloudooo SR ----//---- libpng16 and libpng12
# XXX Cloudooo SR ----//---- python2 and python3 # XXX Cloudooo SR ----//---- python2 and python3
# TODO -> general multiversion support
if name == 'readline' and ver.startswith('5'): name += '5' if name == 'readline' and ver.startswith('5'): name += '5'
if name == 'libpng' and ver.startswith('1.2'): name += '12' if name == 'libpng' and ver.startswith('1.2'): name += '12'
if name == 'Python' and ver.startswith('3'): name += '3' if name == 'Python' and ver.startswith('3'): name += '3'
......
...@@ -456,6 +456,20 @@ url = http://snowball.tartarus.org/dist/libstemmer_c.tgz ...@@ -456,6 +456,20 @@ url = http://snowball.tartarus.org/dist/libstemmer_c.tgz
libstemmer_c http://snowball.tartarus.org/dist/libstemmer_c.tgz libstemmer_c http://snowball.tartarus.org/dist/libstemmer_c.tgz
""") """)
# two different versions of the same software are ok
case1("""\
[scons-0]
recipe = slapos.recipe.build:download-unpacked
url = https://prdownloads.sourceforge.net/scons/scons-local-2.3.0.tar.gz
[scons-1]
recipe = slapos.recipe.build:download-unpacked
url = https://prdownloads.sourceforge.net/scons/scons-local-2.3.1.tar.gz
""", """\
scons-local 2.3.0 https://prdownloads.sourceforge.net/scons/scons-local-2.3.0.tar.gz
scons-local 2.3.1 https://prdownloads.sourceforge.net/scons/scons-local-2.3.1.tar.gz
""")
@pytest.mark.parametrize('build,bomok', testv) @pytest.mark.parametrize('build,bomok', testv)
def test_bom_software(tmpdir, build, bomok): 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