def run(self, repos, nightly): self.log("Dmg'ing it...") cd(self._basedir) version = get_version(repos, nightly) dmg_dir = os.path.join(self._basedir, "dmg") template_dir = os.path.join(self._basedir, "Bitmask") mkdir("-p", dmg_dir) cp("-R", os.path.join(template_dir, "Applications"), dmg_dir) cp("-R", os.path.join(template_dir, "relnotes.txt"), dmg_dir) cp("-R", os.path.join(template_dir, "Bitmask.app"), dmg_dir) cp(os.path.join(self._basedir, "leap_assets", "mac", "bitmask.icns"), os.path.join(dmg_dir, ".VolumeIcon.icns")) SetFile("-c", "icnC", os.path.join(dmg_dir, ".VolumeIcon.icns")) vol_name = "Bitmask" dmg_name = "Bitmask-OSX-{0}.dmg".format(version) raw_dmg_path = os.path.join(self._basedir, "raw-{0}".format(dmg_name)) dmg_path = os.path.join(self._basedir, dmg_name) hdiutil("create", "-srcfolder", dmg_dir, "-volname", vol_name, "-fsargs", "-c c=64,a=16,e=16", "-fs", "HFS+", "-format", "UDRW", "-ov", "-size", "500000k", raw_dmg_path) rm("-rf", dmg_dir) mkdir(dmg_dir) hdiutil("attach", raw_dmg_path, "-mountpoint", dmg_dir) SetFile("-a", "C", dmg_dir) hdiutil("detach", dmg_dir) rm("-rf", dmg_dir) hdiutil("convert", raw_dmg_path, "-format", "UDZO", "-imagekey", "zlib-level=9", "-o", dmg_path) rm("-f", raw_dmg_path) self.log("Done")
def run(self, sorted_repos, versions_file): self.log("`git checkout` repositories...") versions = None with open(versions_file, 'r') as f: versions = json.load(f) cd(self._basedir) for repo in sorted_repos: if repo not in versions: self.log("skipping {0}, no version specified.".format(repo)) continue where = versions[repo] # where to checkout self.log("Checkout {0} -> {1}".format(repo, where)) with push_pop(repo): git.fetch() git.checkout("--quiet", where) # just in case that we didn't just cloned but updated: git.reset("--hard", where) self.log("done checking out repos.")
def run(self, repos, nightly): self.log("Tarballing it...") cd(self._basedir) version = get_version(repos, nightly) import platform bits = platform.architecture()[0][:2] bundle_name = "Bitmask-linux%s-%s" % (bits, version) mv("Bitmask", bundle_name) tar("cjf", bundle_name + ".tar.bz2", bundle_name) self.log("Done")
def run(self, sorted_repos): self.log("cloning repositories...") cd(self._basedir) for repo in sorted_repos: self.log("cloning {0}".format(repo)) rm("-rf", repo) git.clone(self._repo_url(repo), repo) self.log("done cloning repos.")
def run(self, repos, nightly): self.log("Ziping it...") cd(self._basedir) version = get_version(repos, nightly) name = "Bitmask-win32-{0}".format(version) mv(_convert_path_for_win(os.path.join(self._basedir, "Bitmask")), _convert_path_for_win(os.path.join(self._basedir, name))) zf = zipfile.ZipFile("{0}.zip".format(name), "w", zipfile.ZIP_DEFLATED) self._zipdir(name, zf) zf.close() self.log("Done")
def run(self): self.log("Mt'ing all the files...") cd(os.path.join(self._basedir, "Bitmask")) subprocess.check_call([ "C:\\Program Files\\Windows Kits\\8.0\\bin\\x86\\mt.exe", "-nologo", "-manifest", "Microsoft.VC90.CRT.manifest", "-outputresource:bitmask.exe;#1" ]) cd(os.path.join("apps", "eip")) subprocess.check_call([ "C:\\Program Files\\Windows Kits\\8.0\\bin\\x86\\mt.exe", "-nologo", "-manifest", "openvpn_leap.exe.manifest", "-outputresource:openvpn_leap.exe;#1" ]) self.log("Done")
def gitrepo(root): tmpdir = sh.pwd().strip() sh.cd(root) gitlog = sh.git('--no-pager', 'log', '-1', pretty="format:%s" % FORMAT).split('\n', 5) branch = os.environ.get('CIRCLE_BRANCH') or os.environ.get('TRAVIS_BRANCH', sh.git('rev-parse', '--abbrev-ref', 'HEAD').strip()) remotes = [x.split() for x in filter(lambda x: x.endswith('(fetch)'), sh.git.remote('-v').strip().splitlines())] sh.cd(tmpdir) return { "head": { "id": gitlog[0], "author_name": gitlog[1], "author_email": gitlog[2], "committer_name": gitlog[3], "committer_email": gitlog[4], "message": gitlog[5].strip(), }, "branch": branch, "remotes": [{'name': remote[0], 'url': remote[1]} for remote in remotes] }
def run(self, sorted_repos, binaries_path): cd(self._basedir) for repo in sorted_repos: if repo in ["bitmask_launcher", "leap_assets"]: self.log("skipping repo: {0}...".format(repo)) continue self.log("setting up {0}".format(repo)) if repo == "soledad": for subrepo in ["common", "client"]: with push_pop(repo, subrepo): python("setup.py", "develop", "--always-unzip") sys.path.append( os.path.join(self._basedir, repo, subrepo, "src")) else: with push_pop(repo): if repo == "bitmask_client": self._build_client(repo, binaries_path) python("setup.py", "develop", "--always-unzip") sys.path.append(os.path.join(self._basedir, repo, "src"))
with open(GOOGLE_MANIFEST_PATH, 'w+') as fp: fp.write(google_manifest) with open(AMAZON_MANIFEST_PATH, 'w+') as fp: fp.write(amazon_manifest) with open('build.ver', 'w') as fp: fp.write(new_build_number) with open('release.properties', 'w') as fp: fp.write('project.version=%s' % (new_build_number)) ant('release', _fg=True) cd('%s/android-google' % (root_dir, )) ant('release', _fg=True) cd('%s/android-amazon' % (root_dir, )) ant('release', _fg=True) cd(root_dir) git.commit(a=True, m='Artifacts from release-%s' % (new_build_number, )) git.tag('release-%s' % (new_build_number, )) tower_consts = open(TOWER_CONSTS_JAVA).read() tower_consts = debug_flag_re.sub('boolean DEBUG = true;', tower_consts)
def push_pop(*directories): cd(os.path.join(*directories)) yield cd(os.path.join(*(("..", ) * len(directories))))
with open(GOOGLE_MANIFEST_PATH, 'w+') as fp: fp.write(google_manifest) with open(AMAZON_MANIFEST_PATH, 'w+') as fp: fp.write(amazon_manifest) with open('build.ver', 'w') as fp: fp.write(new_build_number) with open('release.properties', 'w') as fp: fp.write('project.version=%s' % (new_build_number)) ant('release', _fg=True) cd('%s/android-google' % (root_dir,)) ant('release', _fg=True) cd('%s/android-amazon' % (root_dir,)) ant('release', _fg=True) cd(root_dir) git.commit(a=True, m='Artifacts from release-%s' % (new_build_number,)) git.tag('release-%s' % (new_build_number,)) tower_consts = open(TOWER_CONSTS_JAVA).read() tower_consts = debug_flag_re.sub('boolean DEBUG = true;', tower_consts) tower_consts = server_url_re.sub('String HAPPYDROIDS_SERVER = "local.happydroids.com";', tower_consts)