Gentoo Archives: gentoo-commits

From: Patrice Clement <monsieurp@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: app-editors/atom/, app-editors/atom/files/
Date: Fri, 27 May 2016 14:15:39
Message-Id: 1464356857.dd47bfc852882b48eb465dcde3ba90b4857a0964.monsieurp@gentoo
1 commit: dd47bfc852882b48eb465dcde3ba90b4857a0964
2 Author: Elvis Pranskevichus <elvis <AT> magic <DOT> io>
3 AuthorDate: Wed May 25 15:11:17 2016 +0000
4 Commit: Patrice Clement <monsieurp <AT> gentoo <DOT> org>
5 CommitDate: Fri May 27 13:47:37 2016 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=dd47bfc8
7
8 app-editors/atom: Fix apm under Node 5+.
9
10 apm monkey-patches Node's module system to add support for module loading
11 from "asar" archives. Add a case to make this work under Node 5+.
12
13 Gentoo-Bug: https://bugs.gentoo.org/584000
14 Package-Manager: portage-2.2.28
15 Closes: https://github.com/gentoo/gentoo/pull/1539
16
17 Signed-off-by: Patrice Clement <monsieurp <AT> gentoo.org>
18
19 .../{atom-1.7.4.ebuild => atom-1.7.4-r1.ebuild} | 1 +
20 app-editors/atom/files/asar-require.patch | 45 ++++++++++++++++++++++
21 2 files changed, 46 insertions(+)
22
23 diff --git a/app-editors/atom/atom-1.7.4.ebuild b/app-editors/atom/atom-1.7.4-r1.ebuild
24 similarity index 99%
25 rename from app-editors/atom/atom-1.7.4.ebuild
26 rename to app-editors/atom/atom-1.7.4-r1.ebuild
27 index c408132..c45728c 100644
28 --- a/app-editors/atom/atom-1.7.4.ebuild
29 +++ b/app-editors/atom/atom-1.7.4-r1.ebuild
30 @@ -279,6 +279,7 @@ src_prepare() {
31 cd "${S}" || die
32
33 epatch "${FILESDIR}/atom-apm-path.patch"
34 + epatch "${FILESDIR}/asar-require.patch"
35
36 sed -i -e "s|{{ATOM_SUFFIX}}|${suffix}|g" \
37 "${S}/build/app.asar/src/config-schema.js" || die
38
39 diff --git a/app-editors/atom/files/asar-require.patch b/app-editors/atom/files/asar-require.patch
40 new file mode 100644
41 index 0000000..a00169b
42 --- /dev/null
43 +++ b/app-editors/atom/files/asar-require.patch
44 @@ -0,0 +1,45 @@
45 +diff --git a/usr/share/atom/resources/app/apm/node_modules/asar-require/lib/require.js b/usr/share/atom/resources/app/apm/node_modules/asar-require/lib/require.js
46 +index 47cb1bb..67895d5 100644
47 +--- a/usr/share/atom/resources/app/apm/node_modules/asar-require/lib/require.js
48 ++++ b/usr/share/atom/resources/app/apm/node_modules/asar-require/lib/require.js
49 +@@ -1,5 +1,7 @@
50 + (function() {
51 +- var asar, asarStatsToFsStats, fakeTime, fs, gid, nextInode, path, readFileSync, realpathSync, splitPath, statSync, uid;
52 ++ var asar, asarStatsToFsStats, fakeTime, fs, gid, nextInode, path, readFileSync, realpathSync, splitPath, statSync, uid;
53 ++
54 ++ var module, module_findPath, _e;
55 +
56 + asar = require('asar');
57 +
58 +@@ -7,6 +9,12 @@
59 +
60 + path = require('path');
61 +
62 ++ try {
63 ++ module = require('module');
64 ++ } catch (_e) {
65 ++ module = null;
66 ++ }
67 ++
68 + splitPath = function(p) {
69 + var index;
70 + if (typeof p !== 'string') {
71 +@@ -124,5 +132,18 @@
72 + }
73 + return path.join(realpathSync(asarPath), filePath);
74 + };
75 ++
76 ++ if (module && module._findPath) {
77 ++ module_findPath = module._findPath;
78 ++
79 ++ module._findPath = function(request, paths, isMain) {
80 ++ var asarPath, filePath, isAsar, _ref;
81 ++ _ref = splitPath(request), isAsar = _ref[0], asarPath = _ref[1], filePath = _ref[2];
82 ++ if (isAsar) {
83 ++ return request;
84 ++ }
85 ++ return module_findPath.apply(this, arguments);
86 ++ }
87 ++ }
88 +
89 + }).call(this);