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_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 test_svn_package_conflict(toolchain_db, feed, svn_server): """ Test SVN Package Conflict """ boost_package = qitoolchain.qipackage.QiPackage("boost", version="1.44") feed.add_package(boost_package) toolchain = qitoolchain.toolchain.Toolchain("foo") toolchain.update(feed.url) boost_url = svn_server.create_repo("boost") svn_server.commit_file("boost", "version.hpp", '#define BOOST_VERSION "1_55"\n') svn_package = qitoolchain.svn_package.SvnPackage("boost") svn_package.url = boost_url feed.add_svn_package(svn_package) toolchain.update(feed.url)
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 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)