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4B,MAA5B;AAAT,GAAnB,CAAzB;AACA,QAAM,2BAAW,UAAX,EAAuB,MAAvB,CAAN;AACA,SAAO,UAAP;AACD,C","sourcesContent":["import { path7za } from \"7zip-bin\"\nimport { Arch, executeAppBuilder, log, TmpDir, toLinuxArchString, use } from \"builder-util\"\nimport { unlinkIfExists } from \"builder-util/out/fs\"\nimport { ensureDir, outputFile, readFile } from \"fs-extra\"\nimport * as path from \"path\"\nimport { DebOptions, LinuxTargetSpecificOptions } from \"..\"\nimport { smarten } from \"../appInfo\"\nimport { Target } from \"../core\"\nimport * as errorMessages from \"../errorMessages\"\nimport { LinuxPackager } from \"../linuxPackager\"\nimport { objectToArgs } from \"../util/appBuilder\"\nimport { computeEnv } from \"../util/bundledTool\"\nimport { isMacOsSierra } from \"../util/macosVersion\"\nimport { getTemplatePath } from \"../util/pathManager\"\nimport { installPrefix, LinuxTargetHelper } from \"./LinuxTargetHelper\"\nimport { getLinuxToolsPath } from \"./tools\"\n\ninterface FpmOptions {\n maintainer: string | undefined\n vendor: string\n url: string\n}\n\nexport default class FpmTarget extends Target {\n readonly options: LinuxTargetSpecificOptions = {...this.packager.platformSpecificBuildOptions, ...(this.packager.config as any)[this.name]}\n\n private readonly scriptFiles: Promise<Array<string>>\n\n constructor(name: string, private readonly packager: LinuxPackager, private readonly helper: LinuxTargetHelper, readonly outDir: string) {\n super(name, false)\n\n this.scriptFiles = this.createScripts()\n }\n\n private async createScripts(): Promise<Array<string>> {\n const defaultTemplatesDir = getTemplatePath(\"linux\")\n\n const packager = this.packager\n const templateOptions = {\n // old API compatibility\n executable: packager.executableName,\n productFilename: packager.appInfo.productFilename, ...packager.platformSpecificBuildOptions}\n\n function getResource(value: string | null | undefined, defaultFile: string) {\n if (value == null) {\n return path.join(defaultTemplatesDir, defaultFile)\n }\n return path.resolve(packager.projectDir, value)\n }\n\n return await Promise.all<string>([\n writeConfigFile(packager.info.tempDirManager, getResource(this.options.afterInstall, \"after-install.tpl\"), templateOptions),\n writeConfigFile(packager.info.tempDirManager, getResource(this.options.afterRemove, \"after-remove.tpl\"), templateOptions)\n ])\n }\n\n checkOptions(): Promise<any> {\n return this.computeFpmMetaInfoOptions()\n }\n\n private async computeFpmMetaInfoOptions(): Promise<FpmOptions> {\n const packager = this.packager\n const projectUrl = await packager.appInfo.computePackageUrl()\n const errors: Array<string> = []\n if (projectUrl == null) {\n errors.push(\"Please specify project homepage, see https://electron.build/configuration/configuration#Metadata-homepage\")\n }\n\n const options = this.options\n let author = options.maintainer\n if (author == null) {\n const a = packager.info.metadata.author\n if (a == null || a.email == null) {\n errors.push(errorMessages.authorEmailIsMissed)\n }\n else {\n author = `${a.name} <${a.email}>`\n }\n }\n\n if (errors.length > 0) {\n throw new Error(errors.join(\"\\n\\n\"))\n }\n\n return {\n maintainer: author!!,\n url: projectUrl!!,\n vendor: options.vendor || author!!,\n }\n }\n\n async build(appOutDir: string, arch: Arch): Promise<any> {\n const target = this.name\n\n // tslint:disable:no-invalid-template-strings\n let nameFormat = \"${name}-${version}-${arch}.${ext}\"\n let isUseArchIfX64 = false\n if (target === \"deb\") {\n nameFormat = \"${name}_${version}_${arch}.${ext}\"\n isUseArchIfX64 = true\n }\n else if (target === \"rpm\") {\n nameFormat = \"${name}-${version}.${arch}.${ext}\"\n isUseArchIfX64 = true\n }\n\n const packager = this.packager\n const artifactPath = path.join(this.outDir, packager.expandArtifactNamePattern(this.options, target, arch, nameFormat, !isUseArchIfX64))\n\n await packager.info.callArtifactBuildStarted({\n targetPresentableName: target,\n file: artifactPath,\n arch,\n })\n\n await unlinkIfExists(artifactPath)\n if (packager.packagerOptions.prepackaged != null) {\n await ensureDir(this.outDir)\n }\n\n const scripts = await this.scriptFiles\n const appInfo = packager.appInfo\n const options = this.options\n const synopsis = options.synopsis\n const args = [\n \"--architecture\", toLinuxArchString(arch, target),\n \"--name\", appInfo.linuxPackageName,\n \"--after-install\", scripts[0],\n \"--after-remove\", scripts[1],\n \"--description\", smarten(target === \"rpm\" ? this.helper.getDescription(options)! : `${synopsis || \"\"}\\n ${this.helper.getDescription(options)}`),\n \"--version\", appInfo.version,\n \"--package\", artifactPath,\n ]\n\n objectToArgs(args, await this.computeFpmMetaInfoOptions() as any)\n\n const packageCategory = options.packageCategory\n if (packageCategory != null) {\n args.push(\"--category\", packageCategory)\n }\n\n if (target === \"deb\") {\n use((options as DebOptions).priority, it => args.push(\"--deb-priority\", it!))\n }\n else if (target === \"rpm\") {\n if (synopsis != null) {\n args.push(\"--rpm-summary\", smarten(synopsis))\n }\n }\n\n const fpmConfiguration: FpmConfiguration = {\n args, target,\n }\n\n if (options.compression != null) {\n fpmConfiguration.compression = options.compression\n }\n\n // noinspection JSDeprecatedSymbols\n const depends = options.depends\n if (depends != null) {\n if (Array.isArray(depends)) {\n fpmConfiguration.customDepends = depends\n }\n else {\n // noinspection SuspiciousTypeOfGuard\n if (typeof depends === \"string\") {\n fpmConfiguration.customDepends = [depends as string]\n }\n else {\n throw new Error(`depends must be Array or String, but specified as: ${depends}`)\n }\n }\n }\n\n use(packager.info.metadata.license, it => args.push(\"--license\", it!))\n use(appInfo.buildNumber, it => args.push(\"--iteration\", it!))\n\n use(options.fpm, it => args.push(...it as any))\n\n args.push(`${appOutDir}/=${installPrefix}/${appInfo.productFilename}`)\n for (const icon of (await this.helper.icons)) {\n const extWithDot = path.extname(icon.file)\n const sizeName = extWithDot === \".svg\" ? \"scalable\" : `${icon.size}x${icon.size}`\n args.push(`${icon.file}=/usr/share/icons/hicolor/${sizeName}/apps/${packager.executableName}${extWithDot}`)\n }\n\n const mimeTypeFilePath = await this.helper.mimeTypeFiles\n if (mimeTypeFilePath != null) {\n args.push(`${mimeTypeFilePath}=/usr/share/mime/packages/${packager.executableName}.xml`)\n }\n\n const desktopFilePath = await this.helper.writeDesktopEntry(this.options)\n args.push(`${desktopFilePath}=/usr/share/applications/${packager.executableName}.desktop`)\n\n if (packager.packagerOptions.effectiveOptionComputed != null && await packager.packagerOptions.effectiveOptionComputed([args, desktopFilePath])) {\n return\n }\n\n const env = {\n ...process.env,\n SZA_PATH: path7za,\n SZA_COMPRESSION_LEVEL: packager.compression === \"store\" ? \"0\" : \"9\",\n }\n\n // rpmbuild wants directory rpm with some default config files. Even if we can use dylibbundler, path to such config files are not changed (we need to replace in the binary)\n // so, for now, brew install rpm is still required.\n if (target !== \"rpm\" && await isMacOsSierra()) {\n const linuxToolsPath = await getLinuxToolsPath()\n Object.assign(env, {\n PATH: computeEnv(process.env.PATH, [path.join(linuxToolsPath, \"bin\")]),\n DYLD_LIBRARY_PATH: computeEnv(process.env.DYLD_LIBRARY_PATH, [path.join(linuxToolsPath, \"lib\")]),\n })\n }\n await executeAppBuilder([\"fpm\", \"--configuration\", JSON.stringify(fpmConfiguration)], undefined, {env})\n\n await packager.dispatchArtifactCreated(artifactPath, this, arch)\n }\n}\n\ninterface FpmConfiguration {\n target: string\n args: Array<string>\n customDepends?: Array<string>\n compression?: string | null\n}\n\nasync function writeConfigFile(tmpDir: TmpDir, templatePath: string, options: any): Promise<string> {\n //noinspection JSUnusedLocalSymbols\n function replacer(match: string, p1: string) {\n if (p1 in options) {\n return options[p1]\n }\n else {\n throw new Error(`Macro ${p1} is not defined`)\n }\n }\n const config = (await readFile(templatePath, \"utf8\"))\n .replace(/\\${([a-zA-Z]+)}/g, replacer)\n .replace(/<%=([a-zA-Z]+)%>/g, (match, p1) => {\n log.warn(\"<%= varName %> is deprecated, please use ${varName} instead\")\n return replacer(match, p1.trim())\n })\n\n const outputPath = await tmpDir.getTempFile({suffix: path.basename(templatePath, \".tpl\")})\n await outputFile(outputPath, config)\n return outputPath\n}\n"],"sourceRoot":""}
|