From 9f91544ad7e079bca945426e9852497f8d69c651 Mon Sep 17 00:00:00 2001 From: Amin Yahyaabadi Date: Fri, 18 Sep 2020 03:54:36 -0500 Subject: [PATCH 1/3] linux deb: don't compress unless on release-branch --- script/lib/create-debian-package.js | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/script/lib/create-debian-package.js b/script/lib/create-debian-package.js index c354bf67c0f..af60cedc693 100644 --- a/script/lib/create-debian-package.js +++ b/script/lib/create-debian-package.js @@ -200,9 +200,27 @@ module.exports = function(packagedAppPath) { ); console.log(`Generating .deb file from ${debianPackageDirPath}`); - spawnSync('fakeroot', ['dpkg-deb', '-b', debianPackageDirPath], { - stdio: 'inherit' - }); + + // don't compress by default to speed up build + let compressionLevel = 0; + let compressionType = 'none'; + if (process.env.IS_RELEASE_BRANCH || process.env.IS_SIGNED_ZIP_BRANCH) { + compressionLevel = 6; + compressionType = 'xz'; + } + spawnSync( + 'fakeroot', + [ + 'dpkg-deb', + `-Z${compressionType}`, + `-z${compressionLevel}`, + '-b', + debianPackageDirPath + ], + { + stdio: 'inherit' + } + ); console.log( `Copying generated package into "${outputDebianPackageFilePath}"` From f40ac60e45f1a2d6632a7a83a14708248001b7c4 Mon Sep 17 00:00:00 2001 From: Amin Yahyaabadi Date: Fri, 18 Sep 2020 03:55:00 -0500 Subject: [PATCH 2/3] use sudo instead of fakeroot if available fakeroot is slower than sudo --- script/lib/create-debian-package.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/script/lib/create-debian-package.js b/script/lib/create-debian-package.js index af60cedc693..049997a4640 100644 --- a/script/lib/create-debian-package.js +++ b/script/lib/create-debian-package.js @@ -208,8 +208,13 @@ module.exports = function(packagedAppPath) { compressionLevel = 6; compressionType = 'xz'; } + // use sudo if available to speed up build + let sudoCommand = 'fakeroot'; + if (process.env.CI === true || (process.getuid && process.getuid() === 0)) { + sudoCommand = 'sudo'; + } spawnSync( - 'fakeroot', + sudoCommand, [ 'dpkg-deb', `-Z${compressionType}`, From f2f8a1e8cf70b1c1bf99d5aabea7d700f3ce852e Mon Sep 17 00:00:00 2001 From: Amin Yahyaabadi Date: Fri, 18 Sep 2020 03:53:28 -0500 Subject: [PATCH 3/3] install the latest dpkg --- script/vsts/platforms/templates/preparation.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script/vsts/platforms/templates/preparation.yml b/script/vsts/platforms/templates/preparation.yml index cc6103e52df..62c24bcf98a 100644 --- a/script/vsts/platforms/templates/preparation.yml +++ b/script/vsts/platforms/templates/preparation.yml @@ -4,7 +4,7 @@ steps: - script: | sudo apt-get update sudo apt-get install -y wget software-properties-common - sudo apt-get install -y build-essential ca-certificates xvfb fakeroot git libsecret-1-dev rpm libx11-dev libxkbfile-dev xz-utils xorriso zsync libxss1 libgconf2-4 libgtk-3-0 libasound2 libicu-dev + sudo apt-get install -y build-essential ca-certificates xvfb fakeroot git libsecret-1-dev rpm libx11-dev libxkbfile-dev xz-utils xorriso zsync libxss1 libgconf2-4 libgtk-3-0 libasound2 libicu-dev dpkg # clang 9 is included in the image sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-9 10 sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-9 10