Ejemplo n.º 1
0
def main():
    print("Obtaining version information from git")
    cmd = "git describe --long --match='[^(jenkins)]*'"
    try:
        process = subprocess.Popen(cmdsplit(cmd), stdout=subprocess.PIPE, stderr=subprocess.STDOUT, bufsize=-1)
        vers, _ = process.communicate()
    except OSError:
        print("Git not found")
        vers = "v1.0-0-deadbeef"
    (major, minor, rev, githash) = re.match("v(\d+).(\d+)-(\d+)-(.*)", vers).groups()

    (mcpversion, mcclientversion, mcserverversion) = re.match(
        "[.\w]+ \(data: ([.\w]+), client: ([.\w.]+), server: ([.\w.]+)\)", Commands.fullversion()
    ).groups()

    with open("fmlversion.properties", "w") as f:
        f.write("%s=%s\n" % ("fmlbuild.major.number", major))
        f.write("%s=%s\n" % ("fmlbuild.minor.number", minor))
        f.write("%s=%s\n" % ("fmlbuild.revision.number", rev))
        f.write("%s=%s\n" % ("fmlbuild.githash", githash))
        f.write("%s=%s\n" % ("fmlbuild.mcpversion", mcpversion))
        f.write("%s=%s\n" % ("fmlbuild.mcclientversion", mcclientversion))
        f.write("%s=%s\n" % ("fmlbuild.mcserverversion", mcserverversion))

    print(
        "Version information: FML %s.%s.%s using MCP %s for c:%s, s:%s"
        % (major, minor, rev, mcpversion, mcclientversion, mcserverversion)
    )
Ejemplo n.º 2
0
def main():
    print("Obtaining version information from git")
    cmd = "git describe --long --match='[^(jenkins)]*'"
    try:
        process = subprocess.Popen(cmdsplit(cmd),
                                   stdout=subprocess.PIPE,
                                   stderr=subprocess.STDOUT,
                                   bufsize=-1)
        vers, _ = process.communicate()
    except OSError:
        print("Git not found")
        vers = "v1.0-0-deadbeef"
    (major, minor, rev, githash) = re.match("v(\d+).(\d+)-(\d+)-(.*)",
                                            vers).groups()

    (mcpversion, mcversion, mcserverversion) = re.match(
        "[.\w]+ \(data: ([.\w]+), client: ([.\w.]+), server: ([.\w.]+)\)",
        Commands.fullversion()).groups()

    with open("version.properties", "w") as f:
        f.write("%s=%s\n" % ("CompactSolars.build.major.number", major))
        f.write("%s=%s\n" % ("CompactSolars.build.minor.number", minor))
        f.write("%s=%s\n" % ("CompactSolars.build.revision.number", rev))
        f.write("%s=%s\n" % ("CompactSolars.build.githash", githash))
        f.write("%s=%s\n" % ("CompactSolars.build.mcpversion", mcpversion))
        f.write("%s=%s\n" % ("CompactSolars.build.mcversion", mcversion))

    print("Version information: CompactSolars %s.%s.%s using MCP %s for %s" %
          (major, minor, rev, mcpversion, mcversion))
Ejemplo n.º 3
0
def main():

    print("Obtaining version information from git")

    # get mod version
    try:
        process = subprocess.Popen(cmd_describe, bufsize= -1, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
        git_tagstring, _ = process.communicate()
    except OSError as e:
        print("Git not found.")
        print("  type: " + str(type(e)))
        print("  " + str(e).decode("cp932").encode(encoding='utf-8'))
        print("----------")
        git_tagstring = dummy_version_string
    print("tag    : " + git_tagstring)
    print("pattern: " + pattern_gittag)
    (major, minor, build, githash) = re.match(pattern_gittag, git_tagstring).groups()

    # get mcp/minecraft version
    fullversion = Commands.fullversion()
    print("fullver: " + fullversion)
    print("pattern: " + pattern_mcp_commands_fullversion)
    (mcpversion, mcversion, mcserverversion) = re.match(pattern_mcp_commands_fullversion, fullversion).groups()

    # output
    with open(version_properties_filename, "w") as f:
        f.write("###################################################\n#\n")
        f.write("# version.properties\n")
        f.write("#\n")
        f.write("# create: " + str(datetime.datetime.now()) + "\n")
        f.write("#\n")
        f.write("###################################################\n")
        f.write("%s=%s\n" % (mod_id + ".version", "%s.%s.%s.%s" % (major, minor, build, mod_rev_number)))
        f.write("%s=%s\n" % (mod_id + ".version.major", major))
        f.write("%s=%s\n" % (mod_id + ".version.minor", minor))
        f.write("%s=%s\n" % (mod_id + ".version.build", build))
        f.write("%s=%s\n" % (mod_id + ".version.revision", mod_rev_number))
        f.write("%s=%s\n" % (mod_id + ".version.githash", githash))
        f.write("\n")
        f.write("%s=%s\n" % ("mod.version", "%s.%s.%s.%s" % (major, minor, build, mod_rev_number)))
        f.write("%s=%s\n" % ("mcmod.info.version", "%s.%s.%s #%s" % (major, minor, build, mod_rev_number)))
        f.write("%s=%s\n" % ("minecraft.version", mcversion))
        f.write("%s=%s\n" % ("mcp.version", mcpversion))
        f.write("%s=%s\n" % ("fml.build.number", fml_build_number))

        f.write("#[EOF]")

    print(" \n")
    print("Version information: " + mod_id + " %s.%s.%s #%s using MCP %s for Minecraft %s" % (major, minor, build, mod_rev_number, mcpversion, mcversion))
Ejemplo n.º 4
0
def main():
    print("Obtaining version information from git")
    cmd = "git describe --long --match='[^(jenkins)]*'"
    try:
        process = subprocess.Popen(cmdsplit(cmd),
                                   stdout=subprocess.PIPE,
                                   stderr=subprocess.STDOUT,
                                   bufsize=-1)
        vers, _ = process.communicate()
    except OSError:
        print("Git not found")
        vers = "v1.0-0-deadbeef"
    (major, minor, rev, githash) = re.match("v(\d+).(\d+)-(\d+)-(.*)",
                                            vers).groups()

    (mcpversion, mcclientversion, mcserverversion) = re.match(
        "[.\w]+ \(data: ([.\w]+), client: ([.\w.]+), server: ([.\w.]+)\)",
        Commands.fullversion()).groups()

    if os.getenv("GIT_BRANCH") is None:
        cmd = "git rev-parse --abbrev-ref HEAD"
        try:
            process = subprocess.Popen(cmdsplit(cmd),
                                       stdout=subprocess.PIPE,
                                       stderr=subprocess.STDOUT,
                                       bufsize=-1)
            branch, _ = process.communicate()
            branch = branch.strip()
        except OSError:
            print("Git not found")
            branch = "master"
    else:
        branch = os.getenv("GIT_BRANCH").rpartition('/')[2]
        if branch == 'HEAD':
            branch = "master"

    with open("fmlversion.properties", "w") as f:
        f.write("%s=%s\n" % ("fmlbuild.major.number", major))
        f.write("%s=%s\n" % ("fmlbuild.minor.number", minor))
        f.write("%s=%s\n" % ("fmlbuild.revision.number", rev))
        f.write("%s=%s\n" % ("fmlbuild.githash", githash))
        f.write("%s=%s\n" % ("fmlbuild.mcpversion", mcpversion))
        f.write("%s=%s\n" % ("fmlbuild.mcversion", mcclientversion))
        f.write("%s=%s\n" % ("fmlbuild.branch", branch))

    print(
        "Version information: FML %s.%s.%s (%s) using MCP %s for minecraft %s"
        % (major, minor, rev, branch, mcpversion, mcclientversion))
Ejemplo n.º 5
0
def main():
    print("Obtaining version information from git")
    cmd = "git describe --long --match='[^(jenkins)]*'"
    try:
        process = subprocess.Popen(cmdsplit(cmd), stdout=subprocess.PIPE, stderr=subprocess.STDOUT, bufsize=-1)
        vers, _ = process.communicate()
    except OSError:
        print("Git not found")
        vers = "v1.0-0-deadbeef"
    (major, minor, rev, githash) = re.match("v(\d+).(\d+)-(\d+)-(.*)", vers).groups()

    (mcpversion, mcclientversion, mcserverversion) = re.match(
        "[.\w]+ \(data: ([.\w]+), client: ([.\w.]+), server: ([.\w.]+)\)", Commands.fullversion()
    ).groups()

    if os.getenv("GIT_BRANCH") is None:
        cmd = "git rev-parse --abbrev-ref HEAD"
        try:
            process = subprocess.Popen(cmdsplit(cmd), stdout=subprocess.PIPE, stderr=subprocess.STDOUT, bufsize=-1)
            branch, _ = process.communicate()
            branch = branch.strip()
        except OSError:
            print("Git not found")
            branch = "master"
    else:
        branch = os.getenv("GIT_BRANCH").rpartition("/")[2]
        if branch == "HEAD":
            branch = "master"

    with open("fmlversion.properties", "w") as f:
        f.write("%s=%s\n" % ("fmlbuild.major.number", major))
        f.write("%s=%s\n" % ("fmlbuild.minor.number", minor))
        f.write("%s=%s\n" % ("fmlbuild.revision.number", rev))
        f.write("%s=%s\n" % ("fmlbuild.githash", githash))
        f.write("%s=%s\n" % ("fmlbuild.mcpversion", mcpversion))
        f.write("%s=%s\n" % ("fmlbuild.mcversion", mcclientversion))
        f.write("%s=%s\n" % ("fmlbuild.branch", branch))

    print(
        "Version information: FML %s.%s.%s (%s) using MCP %s for minecraft %s"
        % (major, minor, rev, branch, mcpversion, mcclientversion)
    )
Ejemplo n.º 6
0
def getVersion():
    from runtime.commands import Commands
    Commands._version_config = os.path.join(mcp_dir, Commands._version_config)

    print("Obtaining version information from git")
    execCmd("git checkout master")  # Get tags from the master branch

    try:
        vers = execCmd("git describe --long --match='[^(jenkins)]*'")
    except OSError:
        print("Git not found")
        vers = "v1.0-0-deadbeef"
    execCmd("git checkout %s" % branch)

    (major, minor, info, rev,
     githash) = re.match("v(\d+).(\d+)(-.*)?-(\d+)-(.*)", vers).groups()
    if not info: info = ""

    (mcpversion, mcversion, mcserverversion) = re.match(
        "[.\w]+ \(data: ([.\w]+), client: ([.\w.]+), server: ([.\w.]+)\)",
        Commands.fullversion()).groups()

    global verData
    verData = {
        "build.major.number": major,
        "build.minor.number": minor,
        "build.info": info,
        "build.revision.number": rev,
        "build.number": os.getenv('BUILD_NUMBER', 1),
        "githash": githash,
        "mcpversion": mcpversion,
        "mcversion": mcversion,
    }

    print("Version information: Boxes %s.%s.%s%s using MCP %s for %s" %
          (major, minor, rev, info, mcpversion, mcversion))
Ejemplo n.º 7
0
def main():
	print("Obtaining version information from git")
	cmd = "git describe --long --match='[^(jenkins)]*'"
	try:
		process = subprocess.Popen(cmdsplit(cmd), stdout=subprocess.PIPE, stderr=subprocess.STDOUT, bufsize=-1)
		vers, _ = process.communicate()
	except OSError:
		print("Git not found")
		vers="v1.0-0-deadbeef"
	(major,minor,info,rev,githash)=re.match("v(\d+).(\d+)(-.*)?-(\d+)-(.*)",vers).groups()
	if not info: info=""

	(mcpversion,mcversion,mcserverversion) = re.match("[.\w]+ \(data: ([.\w]+), client: ([.\w.]+), server: ([.\w.]+)\)",Commands.fullversion()).groups()

	with open("version.properties","w") as f:
		f.write("%s=%s\n" %("Boxes.build.major.number",major))
		f.write("%s=%s\n" %("Boxes.build.minor.number",minor))
		f.write("%s=%s\n" %("Boxes.build.info",info))
		f.write("%s=%s\n" %("Boxes.build.revision.number",rev))
		f.write("%s=%s\n" %("Boxes.build.githash",githash))
		f.write("%s=%s\n" %("Boxes.build.mcpversion",mcpversion))
		f.write("%s=%s\n" %("Boxes.build.mcversion",mcversion))
		
		for dirname, dirnames, filenames in os.walk('libs'):
			for fn in filenames:
				m = re.match(r'^(.*)-.*-(\d*\.\d*\.\d*\.\d*)-.*\.jar', fn)
				if m is not None:
					f.write("%s.version=%s\n" %(m.group(1), m.group(2)))

	print("Version information: Boxes %s.%s.%s%s using MCP %s for %s" % (major, minor, rev, info, mcpversion, mcversion))
Ejemplo n.º 8
0
def getVersion():
	from runtime.commands import Commands
	Commands._version_config = os.path.join(mcp_dir,Commands._version_config)
	
	print("Obtaining version information from git")
	execCmd("git checkout master") # Get tags from the master branch

	try:
		vers = execCmd("git describe --long --match='[^(jenkins)]*'")
	except OSError:
		print("Git not found")
		vers="v1.0-0-deadbeef"
	execCmd("git checkout %s" % branch)
	
	(major,minor,info,rev,githash)=re.match("v(\d+).(\d+)(-.*)?-(\d+)-(.*)",vers).groups()
	if not info: info=""

	(mcpversion,mcversion,mcserverversion) = re.match("[.\w]+ \(data: ([.\w]+), client: ([.\w.]+), server: ([.\w.]+)\)",Commands.fullversion()).groups()

	global verData
	verData = {
		"build.major.number": major,
		"build.minor.number": minor,
		"build.info": info,
		"build.revision.number": rev,
		"build.number": os.getenv('BUILD_NUMBER', 1),
		
		"githash": githash,
		"mcpversion": mcpversion,
		"mcversion": mcversion,
	}

	print("Version information: Boxes %s.%s.%s%s using MCP %s for %s" % (major, minor, rev, info, mcpversion, mcversion))