mirror of
git://git.openembedded.org/meta-openembedded
synced 2026-01-01 13:58:06 +00:00
nodejs: fix no-registry option
* https://github.com/npm/npm/issues/3691 * https://github.com/npm/npm/issues/5509 Signed-off-by: Martin Jansa <martin.jansa@lge.com>
This commit is contained in:
parent
e836f8f936
commit
c6eef3a0c1
59
meta-oe/recipes-devtools/nodejs/nodejs/no-registry.patch
Normal file
59
meta-oe/recipes-devtools/nodejs/nodejs/no-registry.patch
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
Bugfix for --no-registry in nodejs-v0.12.2
|
||||
|
||||
diff -u -r node-v0.12.2_def/deps/npm/lib/cache/caching-client.js node-v0.12.2/deps/npm/lib/cache/caching-client.js
|
||||
--- node-v0.12.2_def/deps/npm/lib/cache/caching-client.js 2015-04-01 01:13:01.000000000 +0300
|
||||
+++ node-v0.12.2/deps/npm/lib/cache/caching-client.js 2015-05-18 00:47:10.738599686 +0300
|
||||
@@ -67,6 +67,22 @@
|
||||
var cacheBase = cacheFile(npm.config.get("cache"))(uri)
|
||||
var cachePath = path.join(cacheBase, ".cache.json")
|
||||
|
||||
+ if (parsed.host === "noregistry") (function() {
|
||||
+ var stat = null
|
||||
+ var file = npm.config.get("cache") + parsed.pathname + "/.cache.json"
|
||||
+ try {
|
||||
+ stat = fs.statSync(cachePath)
|
||||
+ } catch (ex) {}
|
||||
+ if (!stat) try {
|
||||
+ stat = fs.statSync(file)
|
||||
+ cachePath = file
|
||||
+ } catch (ex) {
|
||||
+ stat = "Registry not defined and registry files not found: \"" +
|
||||
+ cachePath + "\", \"" + file + "\"."
|
||||
+ throw new Error(stat)
|
||||
+ }
|
||||
+ })()
|
||||
+
|
||||
// If the GET is part of a write operation (PUT or DELETE), then
|
||||
// skip past the cache entirely, but still save the results.
|
||||
if (uri.match(/\?write=true$/)) {
|
||||
@@ -83,12 +99,17 @@
|
||||
}
|
||||
catch (ex) {
|
||||
data = null
|
||||
+ if (parsed.host === "noregistry")
|
||||
+ throw new Error("File \"" + cachePath+"\"" + " corrupted.")
|
||||
}
|
||||
|
||||
params.stat = stat
|
||||
params.data = data
|
||||
|
||||
- get_.call(client, uri, cachePath, params, cb)
|
||||
+ if (parsed.host === "noregistry")
|
||||
+ cb(null, data, JSON.stringify(data), { statusCode : 304 })
|
||||
+ else
|
||||
+ get_.call(client, uri, cachePath, params, cb)
|
||||
})
|
||||
}
|
||||
else {
|
||||
diff -u -r node-v0.12.2_def/deps/npm/lib/utils/map-to-registry.js node-v0.12.2/deps/npm/lib/utils/map-to-registry.js
|
||||
--- node-v0.12.2_def/deps/npm/lib/utils/map-to-registry.js 2015-04-01 01:13:01.000000000 +0300
|
||||
+++ node-v0.12.2/deps/npm/lib/utils/map-to-registry.js 2015-05-18 01:15:10.030569613 +0300
|
||||
@@ -45,6 +45,8 @@
|
||||
|
||||
log.silly("mapToRegistry", "registry", registry)
|
||||
|
||||
+ if (!registry) return cb(null, "http://noregistry/" + name, {})
|
||||
+
|
||||
var auth = config.getCredentialsByURI(registry)
|
||||
|
||||
// normalize registry URL so resolution doesn't drop a piece of registry URL
|
||||
|
|
@ -7,6 +7,7 @@ DEPENDS = "openssl"
|
|||
|
||||
SRC_URI = "http://nodejs.org/dist/v${PV}/node-v${PV}.tar.gz \
|
||||
file://enable-armv5e-build.patch \
|
||||
file://no-registry.patch \
|
||||
"
|
||||
SRC_URI[md5sum] = "c2b4deea212c0b7c2f86368c65fab312"
|
||||
SRC_URI[sha256sum] = "3298d0997613a04ac64343e8316da134d04588132554ae402eb344e3369ec912"
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user