Exemplo n.º 1
0
def build(context, config, execute):
    version = config.get("options.version") or \
        helpers.generate_datetime_version()
    build_command = config.get("command", "make install")
    replacements = {
        "build_name": config["project_name"],
        "build_requires": ",".join(config.get("project_requires", [])),
        "build_version": version
    }

    checkinstall_command = \
        "checkinstall -y --requires={build_requires} " \
        "--pkgname={build_name} --provides={build_name} --nodoc " \
        "--deldoc=yes --deldesc=yes --delspec=yes --backup=no " \
        "--pkgversion={build_version} " + build_command

    stdout = execute(checkinstall_command, **replacements)
    path = None
    check_row = False
    for row in stdout.splitlines():
        if "Done. The new package has been installed and saved to" in row:
            check_row = True
            continue

        if not check_row:
            continue

        if "{}_{}".format(config["project_name"], version) in row:
            path = row.strip()
            context["checkinstall_deb_path"] = path
            break

    LOGGER.debug("Finished running checkinstall.")
Exemplo n.º 2
0
 def test_generate_datetime_version(self):
     start = datetime.utcnow().strftime("%Y%m%d.%H%M%S")
     version = generate_datetime_version()
     end = datetime.utcnow().strftime("%Y%m%d.%H%M%S")
     self.assertTrue(float(start) <= float(version) <= float(end))