def zip_add(file, key=None): if key == None: key = os.path.basename(file) else: key = key.replace('/', os.sep) if not zip_base is None: key = os.path.join(zip_base, key) file = os.path.join(forge_dir, file.replace('/', os.sep)) if os.path.isdir(file): zip_folder(file, key, zip) else: if os.path.isfile(file): print key zip.write(file, key)
def sign_jar(forge_dir, command, files, dest_zip): from subprocess import Popen, PIPE, STDOUT global zip zip_file = os.path.join(forge_dir, 'tmp.jar') if os.path.isfile(zip_file): os.remove(zip_file) print '============== Creating tmp zip to sign =====================' zf = zipfile.ZipFile(zip_file, 'w', zipfile.ZIP_DEFLATED) zf.write(os.path.join(forge_dir, 'MANIFEST.MF'), 'META-INF/MANIFEST.MF') zip_folder_filter(files, '', zf, 'cpw/mods/'.replace('/', os.sep)) zip_folder_filter(files, '', zf, 'net/minecraftforge/'.replace('/', os.sep)) zf.close() print '================ End tmp zip to sign ========================' try: process = Popen([command, zip_file, "forge"], stdout=PIPE, stderr=STDOUT, bufsize=-1) out, _ = process.communicate() print out except OSError as e: print "Error creating signed tmp jar: %s" % e.strerror sys.exit(1) tmp_dir = os.path.join(forge_dir, 'tmp') if os.path.isdir(tmp_dir): shutil.rmtree(tmp_dir) zf = zipfile.ZipFile(zip_file) zf.extractall(tmp_dir) zf.close() os.remove(zip_file) zip_start(dest_zip) zip_folder(tmp_dir, '', zip) zip_folder(files, '', zip) if os.path.isdir(tmp_dir): shutil.rmtree(tmp_dir)
error_level = e.code extract_fml_obfed() version = load_version(build_num) version_str = '%d.%d.%d.%d' % (version['major'], version['minor'], version['revision'], version['build']) out_folder = os.path.join(forge_dir, 'forge-%s' % version_str) if os.path.isdir(out_folder): shutil.rmtree(out_folder) os.makedirs(out_folder) update_info('forge_common/mod_MinecraftForge.info', version_str) zip_start('minecraftforge-client-%s.zip' % version_str) zip_folder(client_dir, '', zip) zip_add('forge_common/mod_MinecraftForge.info', 'mod_MinecraftForge.info') zip_add('forge_client/src/forge_logo.png') zip_add('install/MinecraftForge-Credits.txt') zip_add('install/MinecraftForge-License.txt') zip_add('fml/CREDITS-fml.txt') zip_add('fml/LICENSE-fml.txt') zip_add('fml/README-fml.txt') zip_add('fml/src/minecraft/fmlversion.properties') zip_add('install/Paulscode IBXM Library License.txt') zip_add('install/Paulscode SoundSystem CodecIBXM License.txt') zip_end() zip_start('minecraftforge-server-%s.zip' % version_str) zip_folder(server_dir, '', zip) zip_add('forge_common/mod_MinecraftForge.info', 'mod_MinecraftForge.info')
version_file = 'forgeversion.properties' if os.path.exists(version_file): os.remove(version_file) with open(version_file, 'wb') as fh: fh.write('forge.major.number=%d\n' % version['major']) fh.write('forge.minor.number=%d\n' % version['minor']) fh.write('forge.revision.number=%d\n' % version['revision']) fh.write('forge.build.number=%d\n' % version['build']) if not options.sign_jar is None: sign_jar(forge_dir, options.sign_jar, client_dir, 'minecraftforge-universal-%s.jar' % version_str) else: zip_start('minecraftforge-universal-%s.jar' % version_str) zip_folder(client_dir, '', zip) zip_add('MANIFEST.MF','META-INF/MANIFEST.MF') zip_add('client/forge_logo.png') zip_add('install/MinecraftForge-Credits.txt') zip_add('install/MinecraftForge-License.txt') zip_add('install/Paulscode IBXM Library License.txt') zip_add('install/Paulscode SoundSystem CodecIBXM License.txt') zip_add('common/forge_at.cfg') zip_add(version_file) if not options.skip_changelog: zip_add(changelog_file, 'MinecraftForge-Changelog.txt') #Add dependancy and licenses from FML FML_FILES = [ 'CREDITS-fml.txt', 'LICENSE-fml.txt',
version_str) make_changelog("http://jenkins.minecraftforge.net/job/forge/", build_num, changelog_file, version_str) version_file = 'forgeversion.properties' if os.path.exists(version_file): os.remove(version_file) with open(version_file, 'wb') as fh: fh.write('forge.major.number=%d\n' % version['major']) fh.write('forge.minor.number=%d\n' % version['minor']) fh.write('forge.revision.number=%d\n' % version['revision']) fh.write('forge.build.number=%d\n' % version['build']) zip_start('minecraftforge-universal-%s.zip' % version_str) zip_folder(client_dir, '', zip) zip_add('client/forge_logo.png') zip_add('install/MinecraftForge-Credits.txt') zip_add('install/MinecraftForge-License.txt') zip_add('fml/CREDITS-fml.txt') zip_add('fml/LICENSE-fml.txt') zip_add('fml/README-fml.txt') zip_add('fml/common/fml_at.cfg') zip_add('fml/common/fml_marker.cfg') zip_add('fml/common/fmlversion.properties') zip_add('fml/common/mcpmod.info') zip_add('fml/client/mcp.png') zip_add('install/Paulscode IBXM Library License.txt') zip_add('install/Paulscode SoundSystem CodecIBXM License.txt') zip_add('common/forge_at.cfg') zip_add(version_file)
if not options.skip_changelog: changelog_file = "forge-%s/minecraftforge-changelog-%s.txt" % (version_str, version_str) make_changelog("http://jenkins.minecraftforge.net/job/minecraftforge/", build_num, changelog_file, version_str) version_file = "forgeversion.properties" if os.path.exists(version_file): os.remove(version_file) with open(version_file, "wb") as fh: fh.write("forge.major.number=%d\n" % version["major"]) fh.write("forge.minor.number=%d\n" % version["minor"]) fh.write("forge.revision.number=%d\n" % version["revision"]) fh.write("forge.build.number=%d\n" % version["build"]) zip_start("minecraftforge-universal-%s.zip" % version_str) zip_folder(client_dir, "", zip) zip_add("client/forge_logo.png") zip_add("install/MinecraftForge-Credits.txt") zip_add("install/MinecraftForge-License.txt") zip_add("fml/CREDITS-fml.txt") zip_add("fml/LICENSE-fml.txt") zip_add("fml/README-fml.txt") zip_add("fml/common/fml_at.cfg") zip_add("fml/common/fml_marker.cfg") zip_add("fml/common/fmlversion.properties") zip_add("fml/common/mcpmod.info") zip_add("fml/client/mcp.png") zip_add("install/Paulscode IBXM Library License.txt") zip_add("install/Paulscode SoundSystem CodecIBXM License.txt") zip_add("common/forge_at.cfg") zip_add(version_file)