From 0444b44330ef2e7870d38aea5042e53ac49e0e82 Mon Sep 17 00:00:00 2001 From: Mark Lee Date: Sun, 9 Dec 2018 18:41:46 -0800 Subject: [PATCH 1/3] Update gconf dependency --- src/dependencies.js | 11 +++++++++-- test/dependencies.js | 11 +++++++++++ 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/src/dependencies.js b/src/dependencies.js index f32a429..0c95f8a 100644 --- a/src/dependencies.js +++ b/src/dependencies.js @@ -11,6 +11,13 @@ function getGTKDepends (version) { return semver.gte(version, '2.0.0-beta.1') ? 'libgtk-3-0' : 'libgtk2.0-0' } +/** + * Determine whether GConf is a necessary dependency, given the Electron version. + */ +function getGConfDepends (version) { + return semver.lt(version, '3.0.0-beta.1') ? ['libgconf2-4'] : [] +} + /** * Determine the dependencies for the `shell.moveItemToTrash` API, based on the * Electron version in use. @@ -32,6 +39,7 @@ module.exports = { // The content of the version file post-4.0 is just the version .then(tag => tag.toString().trim()) }, + getGConfDepends: getGConfDepends, getGTKDepends: getGTKDepends, getTrashDepends: getTrashDepends, @@ -41,12 +49,11 @@ module.exports = { getDepends: function getDepends (version) { return [ getTrashDepends(version), - 'libgconf2-4', getGTKDepends(version), 'libnotify4', 'libnss3', 'libxtst6', 'xdg-utils' - ] + ].concat(getGConfDepends(version)) } } diff --git a/test/dependencies.js b/test/dependencies.js index 9ca5c34..c4aa072 100644 --- a/test/dependencies.js +++ b/test/dependencies.js @@ -14,6 +14,17 @@ describe('dependencies', () => { }) }) + describe('getGConfDepends', () => { + it('returns gconf pre-3.0', () => { + chai.expect(dependencies.getGConfDepends('v2.0.0')).to.deep.equal(['libgconf2-4']) + }) + + it('returns nothing as of 3.0', () => { + // eslint-disable-next-line no-unused-expressions + chai.expect(dependencies.getGConfDepends('4.0.0')).to.be.an('array').that.is.empty + }) + }) + describe('getTrashDepends', () => { it('only depends on gvfs-bin before 1.4.1', () => { const trashDepends = dependencies.getTrashDepends('v1.3.0') From ca0dda8dfc91b4aab949968c0d519aa37697b6ec Mon Sep 17 00:00:00 2001 From: Mark Lee Date: Sun, 9 Dec 2018 19:00:14 -0800 Subject: [PATCH 2/3] Add uuid dependency --- src/dependencies.js | 21 +++++++++++++++------ test/dependencies.js | 11 +++++++++++ 2 files changed, 26 insertions(+), 6 deletions(-) diff --git a/src/dependencies.js b/src/dependencies.js index 0c95f8a..0940368 100644 --- a/src/dependencies.js +++ b/src/dependencies.js @@ -5,17 +5,17 @@ const path = require('path') const semver = require('semver') /** - * Determine the GTK dependency based on the Electron version in use. + * Determine whether GConf is a necessary dependency, given the Electron version. */ -function getGTKDepends (version) { - return semver.gte(version, '2.0.0-beta.1') ? 'libgtk-3-0' : 'libgtk2.0-0' +function getGConfDepends (version) { + return semver.lt(version, '3.0.0-beta.1') ? ['libgconf2-4'] : [] } /** - * Determine whether GConf is a necessary dependency, given the Electron version. + * Determine the GTK dependency based on the Electron version in use. */ -function getGConfDepends (version) { - return semver.lt(version, '3.0.0-beta.1') ? ['libgconf2-4'] : [] +function getGTKDepends (version) { + return semver.gte(version, '2.0.0-beta.1') ? 'libgtk-3-0' : 'libgtk2.0-0' } /** @@ -32,6 +32,13 @@ function getTrashDepends (version) { } } +/** + * Determine whether libuuid1 is necessary, given the Electron version. + */ +function getUUIDDepends (version) { + return semver.gte(version, '4.0.0-beta.1') ? ['libuuid1'] : [] +} + module.exports = { getElectronVersion: function getElectronVersion (options) { return fs.readFile(path.resolve(options.src, 'version')) @@ -42,6 +49,7 @@ module.exports = { getGConfDepends: getGConfDepends, getGTKDepends: getGTKDepends, getTrashDepends: getTrashDepends, + getUUIDDepends: getUUIDDepends, /** * Determine the default dependencies for an Electron application. @@ -55,5 +63,6 @@ module.exports = { 'libxtst6', 'xdg-utils' ].concat(getGConfDepends(version)) + .concat(getUUIDDepends(version)) } } diff --git a/test/dependencies.js b/test/dependencies.js index c4aa072..f50d604 100644 --- a/test/dependencies.js +++ b/test/dependencies.js @@ -47,4 +47,15 @@ describe('dependencies', () => { chai.expect(trashDepends).to.match(/libglib2\.0-bin/) }) }) + + describe('getUUIDDepends', () => { + it('returns nothing pre-4.0', () => { + // eslint-disable-next-line no-unused-expressions + chai.expect(dependencies.getUUIDDepends('v3.0.0')).to.be.an('array').that.is.empty + }) + + it('returns uuid as of 4.0', () => { + chai.expect(dependencies.getUUIDDepends('4.0.0')).to.deep.equal(['libuuid1']) + }) + }) }) From 243c2acb572109711072d40039cf939f2e141d95 Mon Sep 17 00:00:00 2001 From: Mark Lee Date: Mon, 10 Dec 2018 13:24:38 -0800 Subject: [PATCH 3/3] Add libxss1 --- src/dependencies.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/dependencies.js b/src/dependencies.js index 0940368..d3b88c6 100644 --- a/src/dependencies.js +++ b/src/dependencies.js @@ -60,6 +60,7 @@ module.exports = { getGTKDepends(version), 'libnotify4', 'libnss3', + 'libxss1', 'libxtst6', 'xdg-utils' ].concat(getGConfDepends(version))