summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorElvis Pranskevichus <elvis@magic.io>2016-05-25 11:11:17 -0400
committerPatrice Clement <monsieurp@gentoo.org>2016-05-27 13:47:37 +0000
commitdd47bfc852882b48eb465dcde3ba90b4857a0964 (patch)
tree627108c3e651b486da3d1cced98d83ace19e6033
parentdev-python/cffi-1.5.2-r0: add alpha keyword (diff)
downloadgentoo-dd47bfc852882b48eb465dcde3ba90b4857a0964.tar.gz
gentoo-dd47bfc852882b48eb465dcde3ba90b4857a0964.tar.bz2
gentoo-dd47bfc852882b48eb465dcde3ba90b4857a0964.zip
app-editors/atom: Fix apm under Node 5+.
apm monkey-patches Node's module system to add support for module loading from "asar" archives. Add a case to make this work under Node 5+. Gentoo-Bug: https://bugs.gentoo.org/584000 Package-Manager: portage-2.2.28 Closes: https://github.com/gentoo/gentoo/pull/1539 Signed-off-by: Patrice Clement <monsieurp@gentoo.org>
-rw-r--r--app-editors/atom/atom-1.7.4-r1.ebuild (renamed from app-editors/atom/atom-1.7.4.ebuild)1
-rw-r--r--app-editors/atom/files/asar-require.patch45
2 files changed, 46 insertions, 0 deletions
diff --git a/app-editors/atom/atom-1.7.4.ebuild b/app-editors/atom/atom-1.7.4-r1.ebuild
index c408132e3032..c45728cce2a3 100644
--- a/app-editors/atom/atom-1.7.4.ebuild
+++ b/app-editors/atom/atom-1.7.4-r1.ebuild
@@ -279,6 +279,7 @@ src_prepare() {
cd "${S}" || die
epatch "${FILESDIR}/atom-apm-path.patch"
+ epatch "${FILESDIR}/asar-require.patch"
sed -i -e "s|{{ATOM_SUFFIX}}|${suffix}|g" \
"${S}/build/app.asar/src/config-schema.js" || die
diff --git a/app-editors/atom/files/asar-require.patch b/app-editors/atom/files/asar-require.patch
new file mode 100644
index 000000000000..a00169b0b778
--- /dev/null
+++ b/app-editors/atom/files/asar-require.patch
@@ -0,0 +1,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
+index 47cb1bb..67895d5 100644
+--- 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
+@@ -1,5 +1,7 @@
+ (function() {
+- var asar, asarStatsToFsStats, fakeTime, fs, gid, nextInode, path, readFileSync, realpathSync, splitPath, statSync, uid;
++ var asar, asarStatsToFsStats, fakeTime, fs, gid, nextInode, path, readFileSync, realpathSync, splitPath, statSync, uid;
++
++ var module, module_findPath, _e;
+
+ asar = require('asar');
+
+@@ -7,6 +9,12 @@
+
+ path = require('path');
+
++ try {
++ module = require('module');
++ } catch (_e) {
++ module = null;
++ }
++
+ splitPath = function(p) {
+ var index;
+ if (typeof p !== 'string') {
+@@ -124,5 +132,18 @@
+ }
+ return path.join(realpathSync(asarPath), filePath);
+ };
++
++ if (module && module._findPath) {
++ module_findPath = module._findPath;
++
++ module._findPath = function(request, paths, isMain) {
++ var asarPath, filePath, isAsar, _ref;
++ _ref = splitPath(request), isAsar = _ref[0], asarPath = _ref[1], filePath = _ref[2];
++ if (isAsar) {
++ return request;
++ }
++ return module_findPath.apply(this, arguments);
++ }
++ }
+
+ }).call(this);