def signBuild(executablePath): if sys.platform != 'win32': print('Skipping signing because platform is not win32') return RELEASE_TYPE = os.getenv("RELEASE_TYPE", "") if RELEASE_TYPE != "PRODUCTION": print('Skipping signing because RELEASE_TYPE "{}" != "PRODUCTION"'. format(RELEASE_TYPE)) return HF_PFX_FILE = os.getenv("HF_PFX_FILE", "") if HF_PFX_FILE == "": print('Skipping signing because HF_PFX_FILE is empty') return HF_PFX_PASSPHRASE = os.getenv("HF_PFX_PASSPHRASE", "") if HF_PFX_PASSPHRASE == "": print('Skipping signing because HF_PFX_PASSPHRASE is empty') return # FIXME use logic similar to the SetPackagingParameteres.cmake to locate the executable SIGN_TOOL = "C:/Program Files (x86)/Windows Kits/10/bin/10.0.17763.0/x64/signtool.exe" # sign the launcher executable print("Signing {}".format(executablePath)) hifi_utils.executeSubprocess([ SIGN_TOOL, 'sign', '/fd', 'sha256', '/f', HF_PFX_FILE, '/p', HF_PFX_PASSPHRASE, '/tr', 'http://sha256timestamp.ws.symantec.com/sha256/timestamp', '/td', 'SHA256', executablePath ])
def run(self, commands): actualCommands = [self.exe, '--vcpkg-root', self.path] actualCommands.extend(commands) print("Running command") print(actualCommands) hifi_utils.executeSubprocess(actualCommands, folder=self.path, env=self.buildEnv)
def run(self, commands): # TODO: causes Error: Invalid vcpkg root directory /interface/build/TIVOLI_VCPKG/5317b356-release/interface/build/TIVOLI_VCPKG/5317b356-release: No such file or directory # actualCommands = [self.exe, '--vcpkg-root', self.path] actualCommands = [self.exe] actualCommands.extend(commands) print("Running command") print(actualCommands) hifi_utils.executeSubprocess(actualCommands, folder=self.path, env=self.buildEnv)
def bootstrap(self): if self.upToDate(): self.copyEnv() return if self.prebuiltArchive is not None: return self.clean() downloadVcpkg = False if self.args.force_bootstrap: print("Forcing bootstrap") downloadVcpkg = True if not downloadVcpkg and not os.path.isfile(self.exe): print("Missing executable, boot-strapping") downloadVcpkg = True # Make sure we have a vcpkg executable testFile = os.path.join(self.path, '.vcpkg-root') if not downloadVcpkg and not os.path.isfile(testFile): print("Missing {}, bootstrapping".format(testFile)) downloadVcpkg = True if downloadVcpkg: if "HIFI_VCPKG_BOOTSTRAP" in os.environ: print("Cloning vcpkg from github to {}".format(self.path)) hifi_utils.executeSubprocess([ 'git', 'clone', 'https://github.com/microsoft/vcpkg', self.path ]) print("Bootstrapping vcpkg") hifi_utils.executeSubprocess(self.bootstrapCmds, folder=self.path, env=self.bootstrapEnv) else: print("Fetching vcpkg from {} to {}".format( self.vcpkgUrl, self.path)) hifi_utils.downloadAndExtract(self.vcpkgUrl, self.path, self.vcpkgSha512) print("Replacing port files") portsPath = os.path.join(self.path, 'ports') if (os.path.islink(portsPath)): os.unlink(portsPath) if (os.path.isdir(portsPath)): shutil.rmtree(portsPath, ignore_errors=True) shutil.copytree(self.sourcePortsPath, portsPath) self.copyEnv()
def zipDarwinLauncher(): launcherSourcePath = os.path.join(SOURCE_PATH, 'launchers', 'qt') launcherBuildPath = os.path.join(BUILD_PATH, 'launcher') archiveName = computeArchiveName('HQ Launcher') cpackCommand = [ 'cpack', '-G', 'ZIP', '-D', "CPACK_PACKAGE_FILE_NAME={}".format(archiveName), '-D', "CPACK_INCLUDE_TOPLEVEL_DIRECTORY=OFF" ] print("Create ZIP version of installer archive") print(cpackCommand) hifi_utils.executeSubprocess(cpackCommand, folder=launcherBuildPath) launcherZipDestFile = os.path.join(BUILD_PATH, "{}.zip".format(archiveName)) launcherZipSourceFile = os.path.join(launcherBuildPath, "{}.zip".format(archiveName)) print("Moving {} to {}".format(launcherZipSourceFile, launcherZipDestFile)) shutil.move(launcherZipSourceFile, launcherZipDestFile)
def buildLightLauncher(): launcherSourcePath = os.path.join(SOURCE_PATH, 'launchers', 'qt') launcherBuildPath = os.path.join(BUILD_PATH, 'launcher') if not os.path.exists(launcherBuildPath): os.makedirs(launcherBuildPath) # configure launcher build cmakeArgs = ['cmake', '-S', launcherSourcePath] if sys.platform == 'darwin': cmakeArgs.append('-G') cmakeArgs.append('Xcode') elif sys.platform == 'win32': cmakeArgs.append('-A') cmakeArgs.append('x64') hifi_utils.executeSubprocess(cmakeArgs, folder=launcherBuildPath) buildTarget = 'package' if sys.platform == 'win32': buildTarget = 'ALL_BUILD' hifi_utils.executeSubprocess([ 'cmake', '--build', launcherBuildPath, '--config', 'Release', '--target', buildTarget ], folder=launcherBuildPath) if sys.platform == 'darwin': zipDarwinLauncher() launcherDestFile = os.path.join( BUILD_PATH, "{}.dmg".format(computeArchiveName('Launcher'))) launcherSourceFile = os.path.join(launcherBuildPath, "HQ Launcher.dmg") elif sys.platform == 'win32': launcherDestFile = os.path.join( BUILD_PATH, "{}.exe".format(computeArchiveName('Launcher'))) launcherSourceFile = os.path.join(launcherBuildPath, "Release", "HQLauncher.exe") print("Moving {} to {}".format(launcherSourceFile, launcherDestFile)) shutil.move(launcherSourceFile, launcherDestFile) signBuild(launcherDestFile)
def run(self, commands): actualCommands = [self.exe, '--vcpkg-root', self.path] actualCommands.extend(commands) print("Running command") print(actualCommands) hifi_utils.executeSubprocess(actualCommands, folder=self.path)
"HQLauncher.exe") print("Moving {} to {}".format(launcherSourceFile, launcherDestFile)) shutil.move(launcherSourceFile, launcherDestFile) signBuild(launcherDestFile) # Main for wipePath in WIPE_PATHS: wipeClientBuildPath(wipePath) # Need the archive name for ad-hoc zip file manipulation archiveName = computeArchiveName('HighFidelity-Beta-Interface') cpackCommand = [ 'cpack', '-G', 'ZIP', '-D', "CPACK_PACKAGE_FILE_NAME={}".format(archiveName), '-D', "CPACK_INCLUDE_TOPLEVEL_DIRECTORY=OFF" ] print("Create ZIP version of installer archive") print(cpackCommand) hifi_utils.executeSubprocess(cpackCommand, folder=BUILD_PATH) if sys.platform == "win32": fixupWinZip(archiveName) elif sys.platform == "darwin": fixupMacZip(archiveName) buildLightLauncher()
# if we made it here, include the file in the output buffer = inzip.read(entry.filename) outzip.writestr(entry, buffer) outzip.close() print("Replacing {} with fixed {}".format(fullPath, outFullPath)) shutil.move(outFullPath, fullPath) for wipePath in WIPE_PATHS: wipeClientBuildPath(wipePath) # Need the archive name for ad-hoc zip file manipulation archiveName = computeArchiveName() cpackCommand = [ 'cpack', '-G', 'ZIP', '-D', "CPACK_PACKAGE_FILE_NAME={}".format(archiveName), '-D', "CPACK_INCLUDE_TOPLEVEL_DIRECTORY=OFF" ] print("Create ZIP version of installer archive") print(cpackCommand) hifi_utils.executeSubprocess(cpackCommand, folder=BUILD_PATH) if sys.platform == "win32": fixupWinZip(archiveName) elif sys.platform == "darwin": fixupMacZip(archiveName)
def bootstrap(self): if self.upToDate(): return if self.prebuiltArchive is not None: return self.clean() downloadVcpkg = False if self.args.force_bootstrap: print("Forcing bootstrap") downloadVcpkg = True if not downloadVcpkg and not os.path.isfile(self.exe): print("Missing executable, boot-strapping") downloadVcpkg = True # Make sure we have a vcpkg executable testFile = os.path.join(self.path, '.vcpkg-root') if not downloadVcpkg and not os.path.isfile(testFile): print("Missing {}, bootstrapping".format(testFile)) downloadVcpkg = True if downloadVcpkg: # print("Cloning vcpkg from github to {}".format(self.path)) # hifi_utils.executeSubprocess(['git', 'clone', 'https://github.com/microsoft/vcpkg.git', self.path]) print("Download vcpkg from GitHub to {}".format(self.path)) hifi_utils.downloadAndExtract( "https://codeload.github.com/microsoft/vcpkg/zip/" + self.vcpkgVersion, self.path, isZip=True) vcpkg_extract_dir = os.path.join(self.path, "vcpkg-" + self.vcpkgVersion) for filename in os.listdir(vcpkg_extract_dir): shutil.move(os.path.join(vcpkg_extract_dir, filename), os.path.join(self.path, filename)) os.rmdir(vcpkg_extract_dir) if platform.system() != "Windows": hifi_utils.executeSubprocess([ "chmod", "+x", os.path.join(self.path, "bootstrap-vcpkg.sh") ]) print("Bootstrapping vcpkg") hifi_utils.executeSubprocess(self.bootstrapCmds, folder=self.path, env=self.bootstrapEnv) print("Replacing port files") portsPath = os.path.join(self.path, 'ports') if (os.path.islink(portsPath)): os.unlink(portsPath) if (os.path.isdir(portsPath)): shutil.rmtree(portsPath, ignore_errors=True) shutil.copytree(self.sourcePortsPath, portsPath)