def setup_cms(): info("Creating database called %(DB_NAME)s accessible by %(DB_USER)s." % CONFIG) sh("sudo -u postgres createdb %(DB_NAME)s -O %(DB_USER)s" % CONFIG) info("Checking out code.") sh("git clone %(GIT_ORIGIN)s %(TEST_DIR)s" % CONFIG) os.chdir("%(TEST_DIR)s/cms" % CONFIG) sh("git checkout %(GIT_REVISION)s" % CONFIG) info("Configuring CMS.") configure_cms( { "database": '"postgresql+psycopg2://' "%(DB_USER)s:%(DB_PASSWORD)s@" '%(DB_HOST)s/%(DB_NAME)s"' % CONFIG, "keep_sandbox": "false", "contest_listen_address": '["127.0.0.1"]', "admin_listen_address": '"127.0.0.1"', "min_submission_interval": "0", } ) info("Setting environment.") os.environ["PYTHONPATH"] = "%(TEST_DIR)s/cms" % CONFIG info("Creating tables.") sh("python db/SQLAlchemyAll.py")
def setup_cms(): info("Creating database called %(DB_NAME)s accessible by %(DB_USER)s." % CONFIG) sh("sudo -u postgres createdb %(DB_NAME)s -O %(DB_USER)s" % CONFIG) info("Checking out code.") sh("git clone %(GIT_ORIGIN)s %(TEST_DIR)s" % CONFIG) os.chdir("%(TEST_DIR)s/cms" % CONFIG) sh("git checkout %(GIT_REVISION)s" % CONFIG) info("Configuring CMS.") configure_cms( { "database": '"postgresql+psycopg2://' \ '%(DB_USER)s:%(DB_PASSWORD)s@' \ '%(DB_HOST)s/%(DB_NAME)s"' % CONFIG, "keep_sandbox": "false", "contest_listen_address": '["127.0.0.1"]', "admin_listen_address": '"127.0.0.1"', "min_submission_interval": '0', }) info("Setting environment.") os.environ["PYTHONPATH"] = "%(TEST_DIR)s/cms" % CONFIG info("Creating tables.") sh("python db/SQLAlchemyAll.py")
def setup_cms(): info("Creating database called %(DB_NAME)s accessible by %(DB_USER)s." % CONFIG) sh("sudo -u postgres createdb %(DB_NAME)s -O %(DB_USER)s" % CONFIG) info("Checking out code.") sh([ "git", "clone", "--recursive", CONFIG["GIT_ORIGIN"], CONFIG["TEST_DIR"] ]) os.chdir("%(TEST_DIR)s" % CONFIG) sh(["git", "checkout", CONFIG["GIT_REVISION"]]) info("Configuring CMS.") configure_cms({ "database": '"postgresql+psycopg2://' '%(DB_USER)s:%(DB_PASSWORD)s@' '%(DB_HOST)s/%(DB_NAME)s"' % CONFIG, "keep_sandbox": "false", "contest_listen_address": '["127.0.0.1"]', "admin_listen_address": '"127.0.0.1"', "min_submission_interval": '0', }) info("Setting environment.") os.environ["PYTHONPATH"] = "%(TEST_DIR)s" % CONFIG info("Building cms.") sh("./setup.py build") # Add permission bits to isolate. sh("sudo chown root:root isolate/isolate") sh("sudo chmod 4755 isolate/isolate") # Ensure our logs get preserved. Point them into the checkout instead of # the tempdir that we blow away. sh(["mkdir", "-p", "%(GIT_ORIGIN)s/log" % CONFIG]) sh(["ln", "-s", "%(GIT_ORIGIN)s/log" % CONFIG, "log"]) info("Creating tables.") sh("python scripts/cmsInitDB")
def setup_cms(): info("Creating database called %(DB_NAME)s accessible by %(DB_USER)s." % CONFIG) sh("sudo -u postgres createdb %(DB_NAME)s -O %(DB_USER)s" % CONFIG) info("Checking out code.") sh(["git", "clone", "--recursive", CONFIG["GIT_ORIGIN"], CONFIG["TEST_DIR"]]) os.chdir("%(TEST_DIR)s" % CONFIG) sh(["git", "checkout", CONFIG["GIT_REVISION"]]) info("Configuring CMS.") configure_cms( {"database": '"postgresql+psycopg2://' '%(DB_USER)s:%(DB_PASSWORD)s@' '%(DB_HOST)s/%(DB_NAME)s"' % CONFIG, "keep_sandbox": "false", "contest_listen_address": '["127.0.0.1"]', "admin_listen_address": '"127.0.0.1"', "min_submission_interval": '0', }) info("Setting environment.") os.environ["PYTHONPATH"] = "%(TEST_DIR)s" % CONFIG info("Building cms.") sh("./setup.py build") # Add permission bits to isolate. sh("sudo chown root:root isolate/isolate") sh("sudo chmod 4755 isolate/isolate") # Ensure our logs get preserved. Point them into the checkout instead of # the tempdir that we blow away. sh(["mkdir", "-p", "%(GIT_ORIGIN)s/log" % CONFIG]) sh(["ln", "-s", "%(GIT_ORIGIN)s/log" % CONFIG, "log"]) info("Creating tables.") sh("python scripts/cmsInitDB")