def test_persistent_storage(feed): boost_package = qitoolchain.qipackage.QiPackage("boost", "1.42") feed.add_package(boost_package, with_url=True) toolchain = qitoolchain.toolchain.Toolchain("bar") toolchain.update(feed.url) toolchain2 = qitoolchain.get_toolchain("bar") assert toolchain2.packages == toolchain.packages
def test_add_local_ctc(tmpdir): ctc = tmpdir.mkdir("ctc") toolchain_xml = ctc.join("toolchain.xml") toolchain_xml.write(""" <toolchain> <package name="ctc" directory="." /> <package name="boost" directory="boost" /> </toolchain> """) toolchain = qitoolchain.toolchain.Toolchain("bar") package_xml = ctc.join("package.xml") package_xml.write(""" <package name="ctc" cross_gdb="cross/bin/i686-linux-gnu-gdb" sysroot="sysroot" toolchain_file="cross-config.cmake" /> """) toolchain.update(toolchain_xml.strpath) tc_contents = get_tc_file_contents(toolchain) ctc_path = toolchain.db.get_package_path("ctc") config_cmake = os.path.join(ctc_path, "cross-config.cmake") assert ('include("%s")' % config_cmake) in tc_contents toolchain2 = qitoolchain.toolchain.Toolchain("bar") tc_contents = get_tc_file_contents(toolchain2) assert ('include("%s")' % config_cmake) in tc_contents
def test_simple(qitoolchain_action, svn_server, feed, record_messages): toolchain = qitoolchain.toolchain.Toolchain("foo") boost_url = svn_server.create_repo("boost") svn_server.commit_file("boost", "version.hpp", "") qt_url = svn_server.create_repo("qt") boost_package = qitoolchain.svn_package.SvnPackage("boost") boost_package.url = boost_url qt_package = qitoolchain.svn_package.SvnPackage("qt") qt_package.url = qt_url feed.add_svn_package(boost_package) feed.add_svn_package(qt_package) toolchain.update(feed.url) record_messages.reset() rc = qitoolchain_action("svn-status", "foo", retcode=True) assert rc == 0 assert not record_messages.find("qt") assert not record_messages.find("boost") assert record_messages.find("All OK") # Now create a problem in the svn repo: boost_path = toolchain.get_package("boost").path version_hpp = os.path.join(boost_path, "version.hpp") os.remove(version_hpp) record_messages.reset() rc = qitoolchain_action("svn-status", "foo", retcode=True) assert rc != 0 assert record_messages.find("boost") assert record_messages.find("version.hpp")
def fake_ctc(): toolchain = qitoolchain.toolchain.Toolchain("fake-ctc") this_dir = os.path.dirname(__file__) toolchain.update( feed_url=os.path.join(this_dir, "fakectc", "toolchain.xml")) qibuild.config.add_build_config("fake-ctc", toolchain="fake-ctc") return toolchain
def test_simple(qitoolchain_action, svn_server, feed, record_messages): """ Test Simple """ toolchain = qitoolchain.toolchain.Toolchain("foo") boost_url = svn_server.create_repo("boost") svn_server.commit_file("boost", "version.hpp", "") qt_url = svn_server.create_repo("qt") boost_package = qitoolchain.svn_package.SvnPackage("boost") boost_package.url = boost_url qt_package = qitoolchain.svn_package.SvnPackage("qt") qt_package.url = qt_url feed.add_svn_package(boost_package) feed.add_svn_package(qt_package) toolchain.update(feed.url) record_messages.reset() rc = qitoolchain_action("svn-status", "foo", retcode=True) assert rc == 0 assert not record_messages.find("qt") assert not record_messages.find("boost") assert record_messages.find("All OK") # Now create a problem in the svn repo: boost_path = toolchain.get_package("boost").path version_hpp = os.path.join(boost_path, "version.hpp") os.remove(version_hpp) record_messages.reset() rc = qitoolchain_action("svn-status", "foo", retcode=True) assert rc != 0 assert record_messages.find("boost") assert record_messages.find("version.hpp")
def test_removing(feed): boost_package = qitoolchain.qipackage.QiPackage("boost", "1.42") feed.add_package(boost_package, with_url=True) toolchain = qitoolchain.toolchain.Toolchain("bar") toolchain.update(feed.url) toolchain.remove() toolchain2 = qitoolchain.toolchain.Toolchain("bar") assert not toolchain2.packages
def test_toolchain_file(feed): boost_package = qitoolchain.qipackage.QiPackage("boost", "1.42") feed.add_package(boost_package, with_url=True) toolchain = qitoolchain.toolchain.Toolchain("bar") toolchain.update(feed.url) boost_path = toolchain.db.get_package_path("boost") tc_contents = get_tc_file_contents(toolchain) assert ('list(INSERT CMAKE_PREFIX_PATH 0 "%s")' % boost_path) in tc_contents
def test_svn_update(svn_server, feed, toolchains): # pylint: disable=unused-argument boost_url = svn_server.create_repo("boost") svn_server.commit_file("boost", "version.hpp", '#define BOOST_VERSION "1_55"\n') boost_package = qitoolchain.svn_package.SvnPackage("boost") boost_package.url = boost_url feed.add_svn_package(boost_package) toolchain = qitoolchain.toolchain.Toolchain("foo") toolchain.update(feed.url) boost_path = toolchain.get_package("boost").path version_hpp = os.path.join(boost_path, "version.hpp") with open(version_hpp, "r") as fp: assert fp.read() == '#define BOOST_VERSION "1_55"\n' svn_server.commit_file("boost", "version.hpp", '#define BOOST_VERSION "1_56"\n') toolchain.update(feed.url) with open(version_hpp, "r") as fp: assert fp.read() == '#define BOOST_VERSION "1_56"\n'
def test_svn_update(svn_server, feed, toolchains): boost_url = svn_server.create_repo("boost") svn_server.commit_file("boost", "version.hpp", '#define BOOST_VERSION "1_55"\n') boost_package = qitoolchain.svn_package.SvnPackage("boost") boost_package.url = boost_url feed.add_svn_package(boost_package) toolchain = qitoolchain.toolchain.Toolchain("foo") toolchain.update(feed.url) boost_path = toolchain.get_package("boost").path version_hpp = os.path.join(boost_path, "version.hpp") with open(version_hpp, "r") as fp: assert fp.read() == '#define BOOST_VERSION "1_55"\n' svn_server.commit_file("boost", "version.hpp", '#define BOOST_VERSION "1_56"\n') toolchain.update(feed.url) with open(version_hpp, "r") as fp: assert fp.read() == '#define BOOST_VERSION "1_56"\n'
def test_update_svn_package(tmpdir, svn_server): """ Test Update SVN Package """ boost_url = svn_server.create_repo("boost") svn_server.commit_file("boost", "libboost-1.55.so", "") feed_xml = """\n<toolchain>\n <svn_package name="boost" url="{url}" />\n</toolchain>\n""" feed_xml = feed_xml.format(url=boost_url) feed_path = tmpdir.join("feed.xml") feed_path.write(feed_xml) toolchain = qitoolchain.toolchain.Toolchain("bar") toolchain.update(feed_path.strpath) boost_package = toolchain.get_package("boost") boost_lib = os.path.join(boost_package.path, "libboost-1.55.so") assert os.path.exists(boost_lib) svn_server.commit_file("boost", "libboost-1.56.so", "") toolchain.update() boost_lib = os.path.join(boost_package.path, "libboost-1.56.so") assert os.path.exists(boost_lib)
def recreate_toolchains(): """ Recreate Toolchain """ old_toolchains = get_old_toolchains() old_names = old_toolchains.keys() old_names.sort() errors = list() for i, name in enumerate(old_names): ui.info(ui.bold, "[ %d on %d ]" % (i+1, len(old_names)), name) feed_url = old_toolchains[name] if feed_url: toolchain = qitoolchain.toolchain.Toolchain(name) try: toolchain.update(feed_url=feed_url) except Exception as exp: errors.append((name, exp)) if errors: ui.error("Could not update some toolchains") for name, error in errors: ui.error(" * ", name, error)
def recreate_toolchains(): old_toolchains = get_old_toolchains() old_names = old_toolchains.keys() old_names.sort() errors = list() for i, name in enumerate(old_names): n = len(old_names) ui.info(ui.bold, "[ %d on %d ]" % (i + 1, n), name) feed_url = old_toolchains[name] if feed_url: toolchain = qitoolchain.toolchain.Toolchain(name) try: toolchain.update(feed_url=feed_url) except Exception as e: errors.append((name, e)) if errors: ui.error("Could not update some toolchains") for name, error in errors: ui.error(" * ", name, error)
def test_update_svn_package(tmpdir, svn_server): boost_url = svn_server.create_repo("boost") svn_server.commit_file("boost", "libboost-1.55.so", "") feed_xml = """ <toolchain> <svn_package name="boost" url="{url}" /> </toolchain> """ feed_xml = feed_xml.format(url=boost_url) feed_path = tmpdir.join("feed.xml") feed_path.write(feed_xml) toolchain = qitoolchain.toolchain.Toolchain("bar") toolchain.update(feed_path.strpath) boost_package = toolchain.get_package("boost") boost_lib = os.path.join(boost_package.path, "libboost-1.55.so") assert os.path.exists(boost_lib) svn_server.commit_file("boost", "libboost-1.56.so", "") toolchain.update() boost_lib = os.path.join(boost_package.path, "libboost-1.56.so") assert os.path.exists(boost_lib)
def test_stores_feed_after_updating(feed): toolchain = qitoolchain.toolchain.Toolchain("bar") toolchain.update(feed.url) toolchain2 = qitoolchain.toolchain.Toolchain("bar") assert toolchain2.feed_location == feed.url
def test_stores_feed_after_updating(feed): """ Test Stores Feed After Updating """ toolchain = qitoolchain.toolchain.Toolchain("bar") toolchain.update(feed.url) toolchain2 = qitoolchain.toolchain.Toolchain("bar") assert toolchain2.feed_url == feed.url
def fake_ctc(): toolchain = qitoolchain.toolchain.Toolchain("fake-ctc") this_dir = os.path.dirname(__file__) toolchain.update(feed_url=os.path.join(this_dir, "fakectc", "toolchain.xml")) qibuild.config.add_build_config("fake-ctc", toolchain="fake-ctc") return toolchain
def test_stores_feed_after_updating(feed): toolchain = qitoolchain.toolchain.Toolchain("bar") toolchain.update(feed.url) toolchain2 = qitoolchain.toolchain.Toolchain("bar") assert toolchain2.feed_url == feed.url