Skip to content

Commit 1ef6c44

Browse files
authored
Merge pull request #175 from atom-ide-community/adjust-compression
2 parents b72c904 + f2f8a1e commit 1ef6c44

File tree

2 files changed

+27
-4
lines changed

2 files changed

+27
-4
lines changed

script/lib/create-debian-package.js

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -200,9 +200,32 @@ module.exports = function(packagedAppPath) {
200200
);
201201

202202
console.log(`Generating .deb file from ${debianPackageDirPath}`);
203-
spawnSync('fakeroot', ['dpkg-deb', '-b', debianPackageDirPath], {
204-
stdio: 'inherit'
205-
});
203+
204+
// don't compress by default to speed up build
205+
let compressionLevel = 0;
206+
let compressionType = 'none';
207+
if (process.env.IS_RELEASE_BRANCH || process.env.IS_SIGNED_ZIP_BRANCH) {
208+
compressionLevel = 6;
209+
compressionType = 'xz';
210+
}
211+
// use sudo if available to speed up build
212+
let sudoCommand = 'fakeroot';
213+
if (process.env.CI === true || (process.getuid && process.getuid() === 0)) {
214+
sudoCommand = 'sudo';
215+
}
216+
spawnSync(
217+
sudoCommand,
218+
[
219+
'dpkg-deb',
220+
`-Z${compressionType}`,
221+
`-z${compressionLevel}`,
222+
'-b',
223+
debianPackageDirPath
224+
],
225+
{
226+
stdio: 'inherit'
227+
}
228+
);
206229

207230
console.log(
208231
`Copying generated package into "${outputDebianPackageFilePath}"`

script/vsts/platforms/templates/preparation.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ steps:
44
- script: |
55
sudo apt-get update
66
sudo apt-get install -y wget software-properties-common
7-
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
7+
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
88
# clang 9 is included in the image
99
sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-9 10
1010
sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-9 10

0 commit comments

Comments
 (0)