From d9c91eb958bfa156945215a29624f0ff1b9eb017 Mon Sep 17 00:00:00 2001 From: Yureka Date: Sat, 2 Dec 2023 15:37:25 +0100 Subject: [PATCH] electron_27: remove versions patch https://github.com/electron/electron/pull/39974 has been backported to 27.x Also now the patch used for versions older than 27 has been renamed to just "version.patch" --- pkgs/development/tools/electron/common.nix | 6 +-- .../tools/electron/version-old.patch | 42 ------------------- pkgs/development/tools/electron/version.patch | 4 +- 3 files changed, 5 insertions(+), 47 deletions(-) delete mode 100644 pkgs/development/tools/electron/version-old.patch diff --git a/pkgs/development/tools/electron/common.nix b/pkgs/development/tools/electron/common.nix index 19725cc8f148..9bdceebfa7d4 100644 --- a/pkgs/development/tools/electron/common.nix +++ b/pkgs/development/tools/electron/common.nix @@ -42,10 +42,10 @@ in (chromium.override { upstream-info = info.chromium; }).mkDerivation (base: { src = null; - patches = base.patches ++ lib.optional (lib.versionOlder info.version "28") + patches = base.patches ++ lib.optional (lib.versionOlder info.version "27") (substituteAll { name = "version.patch"; - src = if lib.versionAtLeast info.version "27" then ./version.patch else ./version-old.patch; + src = ./version.patch; inherit (info) version; }) ; @@ -167,7 +167,7 @@ in (chromium.override { upstream-info = info.chromium; }).mkDerivation (base: { enable_check_raw_ptr_fields = false; } // lib.optionalAttrs (lib.versionOlder info.version "26") { use_gnome_keyring = false; - } // lib.optionalAttrs (lib.versionAtLeast info.version "28") { + } // lib.optionalAttrs (lib.versionAtLeast info.version "27") { override_electron_version = info.version; }; diff --git a/pkgs/development/tools/electron/version-old.patch b/pkgs/development/tools/electron/version-old.patch deleted file mode 100644 index 00562225d767..000000000000 --- a/pkgs/development/tools/electron/version-old.patch +++ /dev/null @@ -1,42 +0,0 @@ -diff --git a/electron/BUILD.gn b/electron/BUILD.gn -index c905891eb8..f2cf11fe88 100644 ---- a/electron/BUILD.gn -+++ b/electron/BUILD.gn -@@ -111,8 +111,6 @@ electron_version = exec_script("script/print-version.py", - [], - "trim string", - [ -- ".git/packed-refs", -- ".git/HEAD", - "script/lib/get-version.js", - ]) - -diff --git a/electron/script/lib/get-version.js b/electron/script/lib/get-version.js -index 45a120482b..ddaf8ab60e 100644 ---- a/electron/script/lib/get-version.js -+++ b/electron/script/lib/get-version.js -@@ -1,22 +1 @@ --const { spawnSync } = require('child_process'); --const path = require('path'); -- --module.exports.getElectronVersion = () => { -- // Find the nearest tag to the current HEAD -- // This is equivilant to our old logic of "use a value in package.json" for the following reasons -- // -- // 1. Whenever we updated the package.json we ALSO pushed a tag with the same version -- // 2. Whenever we _reverted_ a bump all we actually did was push a commit that deleted the tag and changed the version number back -- // -- // The only difference in the "git describe" technique is that technically a commit can "change" it's version -- // number if a tag is created / removed retroactively. i.e. the first time a commit is pushed it will be 1.2.3 -- // and after the tag is made rebuilding the same commit will result in it being 1.2.4 -- const output = spawnSync('git', ['describe', '--tags', '--abbrev=0'], { -- cwd: path.resolve(__dirname, '..', '..') -- }); -- if (output.status !== 0) { -- console.error(output.stderr); -- throw new Error('Failed to get current electron version'); -- } -- return output.stdout.toString().trim().replace(/^v/g, ''); --}; -+module.exports.getElectronVersion = () => "@version@"; - diff --git a/pkgs/development/tools/electron/version.patch b/pkgs/development/tools/electron/version.patch index 6edb64a23eaf..00562225d767 100644 --- a/pkgs/development/tools/electron/version.patch +++ b/pkgs/development/tools/electron/version.patch @@ -16,8 +16,8 @@ index 45a120482b..ddaf8ab60e 100644 --- a/electron/script/lib/get-version.js +++ b/electron/script/lib/get-version.js @@ -1,22 +1 @@ --const { spawnSync } = require('node:child_process'); --const path = require('node:path'); +-const { spawnSync } = require('child_process'); +-const path = require('path'); - -module.exports.getElectronVersion = () => { - // Find the nearest tag to the current HEAD