예제 #1
0
def test_post_add(tmpdir, toolchain_db):
    boost = tmpdir.mkdir("boost")
    script = boost.join("post-add.sh")
    script.write(
        '#!/bin/sh\n'
        'echo $@ > foobar\n'
    )
    os.chmod(script.strpath, 0755)

    boost_package = tmpdir.join("boost-1.58.zip")
    qisys.archive.compress(boost.strpath, output=boost_package.strpath)

    feed = tmpdir.join("feed.xml")
    feed.write("""
<toolchain>
  <package name="boost" version="1.58" url="{url}" post-add="post-add.sh hello world" />
</toolchain>
""".format(url="file://" + boost_package.strpath))

    print boost.strpath
    print script.strpath
    print boost_package.strpath
    print feed.strpath

    toolchain_db.update(feed.strpath)

    boost_in_db = toolchain_db.get_package("boost")
    with open(os.path.join(boost_in_db.path, 'foobar')) as f:
        txt = f.read()

    assert "hello world" in txt
예제 #2
0
def test_post_add(tmpdir, toolchain_db):
    """ Test Post Add """
    boost = tmpdir.mkdir("boost")
    script = boost.join("post-add.sh")
    script.write(
        '#!/bin/sh\n'
        'echo $@ > foobar\n'
    )
    os.chmod(script.strpath, 0o755)
    boost_package = tmpdir.join("boost-1.58.zip")
    qisys.archive.compress(boost.strpath, output=boost_package.strpath)
    feed = tmpdir.join("feed.xml")
    feed.write("""
<toolchain>
<package name="boost" version="1.58" url="{url}" post-add="post-add.sh hello world" />
</toolchain>\n""".format(url="file://" + boost_package.strpath))
    print(boost.strpath)
    print(script.strpath)
    print(boost_package.strpath)
    print(feed.strpath)
    toolchain_db.update(feed.strpath)
    boost_in_db = toolchain_db.get_package("boost")
    with open(os.path.join(boost_in_db.path, 'foobar')) as f:
        txt = f.read()
    assert "hello world" in txt
예제 #3
0
def test_package_with_flags(tmpdir, toolchain_db):
    """ Test Package With Flags """
    feed = tmpdir.join("feed.xml")
    x_tools = tmpdir.join("x-tools")
    x_tools.ensure("sysroot", dir=True)
    x_tools.join("toolchain.cmake").ensure(file=True)
    x_tools.join("package.xml").write(
        """\n<package name="x_tools" version="0.1" toolchain_file="toolchain.cmake" />\n"""
    )
    x_tools_package = tmpdir.join("x-tools-0.1.zip")
    qisys.archive.compress(x_tools.strpath,
                           output=x_tools_package.strpath,
                           flat=True)
    feed.write(
        """\n<toolchain>\n  <package name="x-tools" version="0.1" url="{url}" />\n</toolchain>\n"""
        .format(url="file://" + x_tools_package.strpath))
    toolchain_db.update(feed.strpath)
    x_tools_in_db = toolchain_db.get_package("x-tools")
    assert x_tools_in_db.toolchain_file
예제 #4
0
def test_package_with_flags(tmpdir, toolchain_db):
    feed = tmpdir.join("feed.xml")
    x_tools = tmpdir.join("x-tools")
    x_tools.ensure("sysroot", dir=True)
    x_tools.join("toolchain.cmake").ensure(file=True)
    x_tools.join("package.xml").write("""
<package name="x_tools" version="0.1" toolchain_file="toolchain.cmake" />
""")
    x_tools_package = tmpdir.join("x-tools-0.1.zip")
    qisys.archive.compress(x_tools.strpath, output=x_tools_package.strpath, flat=True)
    feed.write("""
<toolchain>
  <package name="x-tools" version="0.1" url="{url}" />
</toolchain>
""".format(url="file://" + x_tools_package.strpath))
    toolchain_db.update(feed.strpath)

    x_tools_in_db = toolchain_db.get_package("x-tools")
    assert x_tools_in_db.toolchain_file