diff --git a/config/build.conf.js b/config/build.conf.js index 3eec657d29..40a9fd5b48 100644 --- a/config/build.conf.js +++ b/config/build.conf.js @@ -63,6 +63,11 @@ const REVISION = process.env.IS_PATCH ? `pr-${process.env.GITHUB_PR_NUMBER}-${process.env.REVISION_ORDER_ID}` : process.env.REVISION; +/** + * The copyright notice for debian packages and .exe files + */ +const COPYRIGHT = `${new Date().getYear() + 1900} MongoDB, Inc.`; + /** * Export the configuration for the build. */ @@ -119,7 +124,7 @@ module.exports = { license: { sourceFilePath: path.resolve(__dirname, '..', 'packaging', 'LICENSE-mongocryptd'), packagedFilePath: 'LICENSE-mongocryptd', - debCopyright: `${new Date().getYear() + 1900} MongoDB, Inc.`, + debCopyright: COPYRIGHT, debIdentifier: 'Proprietary', rpmIdentifier: 'Proprietary' } @@ -142,7 +147,9 @@ module.exports = { description: CLI_REPL_PACKAGE_JSON.description, homepage: CLI_REPL_PACKAGE_JSON.homepage, maintainer: CLI_REPL_PACKAGE_JSON.author, - manufacturer: CLI_REPL_PACKAGE_JSON.manufacturer + manufacturer: CLI_REPL_PACKAGE_JSON.manufacturer, + copyright: COPYRIGHT, + icon: path.resolve(__dirname, '..', 'packaging', 'mongo.ico') }, debTemplateDir: path.resolve(__dirname, '..', 'packaging', 'deb-template'), rpmTemplateDir: path.resolve(__dirname, '..', 'packaging', 'rpm-template'), diff --git a/package-lock.json b/package-lock.json index 1689e17f54..d4d70d44c4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5167,7 +5167,8 @@ "base64-js": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.3.1.tgz", - "integrity": "sha512-mLQ4i2QO1ytvGWFWmcngKO//JXAQueZvwEKtjgQFM4jIK0kU+ytMfplL8j+n5mspOfjHwoAg+9yhb7BwAHm36g==" + "integrity": "sha512-mLQ4i2QO1ytvGWFWmcngKO//JXAQueZvwEKtjgQFM4jIK0kU+ytMfplL8j+n5mspOfjHwoAg+9yhb7BwAHm36g==", + "dev": true }, "base64id": { "version": "1.0.0", @@ -5283,9 +5284,9 @@ "dev": true }, "boxednode": { - "version": "1.9.0", - "resolved": "https://registry.npmjs.org/boxednode/-/boxednode-1.9.0.tgz", - "integrity": "sha512-tXFwEJASyqFPLuFqPxYS387coe7VU1+ruwcFQgx3zLfTpPy6ySov485oSeuUmM0KmGVoMI50y0D9po5uywFhGQ==", + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/boxednode/-/boxednode-1.10.0.tgz", + "integrity": "sha512-qo9Px313msVTVZ3c8xkFFwMMaryz/m+poJ85tG7r/qLoQzVRnnTJV19zIKUq62oW9xo1iMwCHMS3kt60P1QPgQ==", "dev": true, "requires": { "@pkgjs/nv": "^0.1.0", @@ -5490,9 +5491,9 @@ } }, "tar": { - "version": "6.0.5", - "resolved": "https://registry.npmjs.org/tar/-/tar-6.0.5.tgz", - "integrity": "sha512-0b4HOimQHj9nXNEAA7zWwMM91Zhhba3pspja6sQbgTpynOJf+bkjBnfybNYzbpLbnwXnbyB4LOREvlyXLkCHSg==", + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/tar/-/tar-6.1.0.tgz", + "integrity": "sha512-DUCttfhsnLCjwoDoFcI+B2iJgYa93vBnDUATYEeRx6sntCTdN01VnqsIuTlALXla/LWooNg0yEGeB+Y8WdFxGA==", "dev": true, "requires": { "chownr": "^2.0.0", @@ -5542,9 +5543,9 @@ } }, "yargs-parser": { - "version": "20.2.4", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.4.tgz", - "integrity": "sha512-WOkpgNhPTlE73h4VFAFsOnomJVaovO8VqLDzy5saChRBFQFBoMYirowyW+Q9HB4HFF4Z7VZTiG3iSzJJA29yRA==", + "version": "20.2.6", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.6.tgz", + "integrity": "sha512-AP1+fQIWSM/sMiET8fyayjx/J+JmTPt2Mr0FkrgqB4todtfa53sOsrSAcIrJRD5XS20bKUwaDIuMkWKCEiQLKA==", "dev": true } } @@ -5772,6 +5773,7 @@ "version": "4.2.3", "resolved": "https://registry.npmjs.org/bson/-/bson-4.2.3.tgz", "integrity": "sha512-3ztgjpKp0itFxGqzrLMHWqyZH5oMOIRWsjeY61yNVzrDGB/KxtgD6djFlz9n3vx7lLr2r6bkHagBCgyk1ZjETA==", + "dev": true, "requires": { "buffer": "^5.6.0" }, @@ -5780,6 +5782,7 @@ "version": "5.7.1", "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz", "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==", + "dev": true, "requires": { "base64-js": "^1.3.1", "ieee754": "^1.1.13" @@ -6276,9 +6279,9 @@ } }, "cli-progress": { - "version": "3.8.2", - "resolved": "https://registry.npmjs.org/cli-progress/-/cli-progress-3.8.2.tgz", - "integrity": "sha512-qRwBxLldMSfxB+YGFgNRaj5vyyHe1yMpVeDL79c+7puGujdKJHQHydgqXDcrkvQgJ5U/d3lpf6vffSoVVUftVQ==", + "version": "3.9.0", + "resolved": "https://registry.npmjs.org/cli-progress/-/cli-progress-3.9.0.tgz", + "integrity": "sha512-g7rLWfhAo/7pF+a/STFH/xPyosaL1zgADhI0OM83hl3c7S43iGvJWEAV2QuDOnQ8i6EMBj/u4+NTd0d5L+4JfA==", "dev": true, "requires": { "colors": "^1.1.2", @@ -8034,9 +8037,9 @@ } }, "defer-to-connect": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/defer-to-connect/-/defer-to-connect-2.0.0.tgz", - "integrity": "sha512-bYL2d05vOSf1JEZNx5vSAtPuBMkX8K9EUutg7zlKvTqKXHt7RhWJFbmd7qakVuf13i+IkGmp6FwSsONOf6VYIg==", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/defer-to-connect/-/defer-to-connect-2.0.1.tgz", + "integrity": "sha512-4tvttepXG1VaYGrRibk5EwJd1t4udunSOVMdLSAL6mId1ix438oPwPZMALY41FCijukO1L0twNcGsdzS7dHgDg==", "dev": true }, "define-properties": { @@ -11670,7 +11673,8 @@ "ieee754": { "version": "1.1.13", "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.1.13.tgz", - "integrity": "sha512-4vf7I2LYV/HaWerSo3XmlMkp5eZ83i+/CDluXi/IGTs/O1sejBNhTtnxzmRZfvOUqj7lZjqHkeTvpgSFDlWZTg==" + "integrity": "sha512-4vf7I2LYV/HaWerSo3XmlMkp5eZ83i+/CDluXi/IGTs/O1sejBNhTtnxzmRZfvOUqj7lZjqHkeTvpgSFDlWZTg==", + "dev": true }, "iferr": { "version": "0.1.5", diff --git a/package.json b/package.json index 44681958c1..a3c3ba5ca9 100644 --- a/package.json +++ b/package.json @@ -100,7 +100,7 @@ "@typescript-eslint/parser": "^4.6.0", "aws-sdk": "^2.674.0", "axios": "^0.19.2", - "boxednode": "^1.9.0", + "boxednode": "^1.10.0", "browserify": "^16.5.0", "chai": "^4.2.0", "command-exists": "^1.2.9", diff --git a/packages/build/src/compile/run-compile.ts b/packages/build/src/compile/run-compile.ts index 558b89c332..d66be786dd 100644 --- a/packages/build/src/compile/run-compile.ts +++ b/packages/build/src/compile/run-compile.ts @@ -1,3 +1,4 @@ +import type { PackageInformation } from '../tarball'; import { generateBundle } from './generate-bundle'; import { SignableCompiler } from './signable-compiler'; @@ -11,7 +12,8 @@ export async function runCompile( executablePath: string, execNodeVersion: string, analyticsConfigFilePath: string, - segmentKey: string + segmentKey: string, + executableMetadata: PackageInformation['metadata'] ): Promise { // We use Parcel to bundle up everything into a single JS under // cli-repl/dist/mongosh.js that the executable generator can use as input. @@ -20,9 +22,8 @@ export async function runCompile( console.info('mongosh: creating binary:', executablePath); - const { compileJSFileAsBinary } = require('boxednode'); - await new SignableCompiler(execInput, executablePath, execNodeVersion) - .compile(compileJSFileAsBinary); + await new SignableCompiler(execInput, executablePath, execNodeVersion, executableMetadata) + .compile(); return executablePath; } diff --git a/packages/build/src/compile/signable-compiler.ts b/packages/build/src/compile/signable-compiler.ts index ec5837b3f2..cd4d2df280 100644 --- a/packages/build/src/compile/signable-compiler.ts +++ b/packages/build/src/compile/signable-compiler.ts @@ -6,6 +6,8 @@ import path from 'path'; import childProcess from 'child_process'; import { once } from 'events'; import { Platform } from '../config'; +import type { PackageInformation } from '../tarball'; +import { compileJSFileAsBinary } from 'boxednode'; async function preCompileHook(nodeSourceTree: string) { const fleAddonVersion = require(path.join( @@ -40,11 +42,17 @@ export class SignableCompiler { sourceFile: string; targetFile: string; nodeVersionRange: string; + executableMetadata: PackageInformation['metadata']; - constructor(sourceFile: string, targetFile: string, nodeVersionRange: string) { + constructor( + sourceFile: string, + targetFile: string, + nodeVersionRange: string, + executableMetadata: PackageInformation['metadata']) { this.sourceFile = sourceFile; this.targetFile = targetFile; this.nodeVersionRange = nodeVersionRange; + this.executableMetadata = executableMetadata; } /** @@ -52,7 +60,7 @@ export class SignableCompiler { * * @param {Function} exec - The boxednode compile function. */ - async compile(exec: (opts: any) => void): Promise { + async compile(): Promise { const fleAddon = { path: await findModulePath('mongodb-client-encryption'), requireRegexp: /\bmongocrypt\.node$/ @@ -61,7 +69,7 @@ export class SignableCompiler { // This compiles the executable along with Node from source. // Evergreen and XCode don't have up to date libraries to compile // open ssl with asm so we revert back to the slower version. - await exec({ + await compileJSFileAsBinary({ configureArgs: os.platform() === Platform.Windows ? ['openssl-no-asm'] : os.platform() === Platform.MacOs ? ['--openssl-no-asm'] : [], @@ -78,7 +86,8 @@ export class SignableCompiler { addons: [ fleAddon ], - preCompileHook + preCompileHook, + executableMetadata: this.executableMetadata }); } } diff --git a/packages/build/src/release.ts b/packages/build/src/release.ts index 7fadc06e4e..556b86bac2 100644 --- a/packages/build/src/release.ts +++ b/packages/build/src/release.ts @@ -14,6 +14,7 @@ import { runPackage } from './package'; import { runDraft } from './run-draft'; import { runPublish } from './run-publish'; import { runUpload } from './run-upload'; +import type { PackageInformation } from './tarball'; export type ReleaseCommand = 'bump' | 'compile' | 'package' | 'upload' | 'draft' | 'publish'; @@ -56,7 +57,8 @@ export async function release( config.executablePath, config.execNodeVersion, config.analyticsConfigFilePath ?? '', - config.segmentKey ?? '' + config.segmentKey ?? '', + (config.packageInformation?.metadata ?? {}) as PackageInformation['metadata'] ); } else if (command === 'package') { const tarballFile = await runPackage( diff --git a/packages/build/src/tarball/package-information.ts b/packages/build/src/tarball/package-information.ts index 48f6bb0315..c4fb2091c0 100644 --- a/packages/build/src/tarball/package-information.ts +++ b/packages/build/src/tarball/package-information.ts @@ -1,4 +1,3 @@ - interface DocumentationFile { sourceFilePath: string; packagedFilePath: string; @@ -26,6 +25,8 @@ export interface PackageInformation { maintainer: string; manufacturer: string; fullName: string; + copyright: string; + icon: string; }; debTemplateDir: string; rpmTemplateDir: string; diff --git a/packaging/mongo.ico b/packaging/mongo.ico new file mode 100644 index 0000000000..5258b6e044 Binary files /dev/null and b/packaging/mongo.ico differ