[Pkg-javascript-devel] Bug#705236: npm doesn't work with node v0.10.1

Guido Günther agx at sigxcpu.org
Thu Apr 25 19:37:05 UTC 2013


Hi jérémy,
On Wed, Apr 24, 2013 at 11:13:57AM +0200, Jérémy Lal wrote:
> (resending using another smtp, your mta rejected mine the first try)
> 
> On 24/04/2013 06:23, Guido Günther wrote:
> > Package: npm
> > Followup-For: Bug #705236
> > 
> > I wonder if it would make sense to ship npm from nodejs itself? This
> > would make sure these are in sync. cc: the nodejs maintainers for that.
> > 
> > If not I'd be happy to NMU a new npm version.
> > Cheers,
> 
> I think it doesn't make sense packaging npm within nodejs,
> - they are very different software
> - npm depends on many other modules, nodejs doesn't
> - the packaging work is very different

That's fine. I was just suggesting this since it might save some effort.
Having it packaged separately is preferable of course.

> There is still work to do on npm dependencies. Some of them
> should better be left bundled in npm (because they are so bound
> to npm and better alternatives exist, or because nobody would
> use them anyway).
> 
> I'll have some time to finish this job next month. If you can
> help before, we can talk on #debian-js.

I've attached my current diff here (excluding the upstream import of
1.2.18) that gave me a working (but far from lintian clean) version.
I'll update it should I find some time to make some more progress.
Cheers,
 -- Guido
-------------- next part --------------
diff --git a/debian/install b/debian/install
index 2972590..25a1372 100644
--- a/debian/install
+++ b/debian/install
@@ -1,9 +1,8 @@
 lib/*.js usr/share/npm/lib
 lib/utils/*.js usr/share/npm/lib/utils
 lib/utils/completion usr/share/npm/lib/utils
-lib/utils/npm-registry-client usr/share/npm/lib/utils
 bin/*.js usr/share/npm/bin
 package.json usr/share/npm
 node_modules usr/share/npm
 debian/npmrc usr/share/npm
-doc usr/share/npm
\ No newline at end of file
+doc usr/share/npm
diff --git a/debian/patches/1001_sort_index_build.patch b/debian/patches/1001_sort_index_build.patch
deleted file mode 100644
index 03b0101..0000000
--- a/debian/patches/1001_sort_index_build.patch
+++ /dev/null
@@ -1,15 +0,0 @@
-Description: Sort globbed files when building index of documentation.
-Origin: upstream,https://github.com/isaacs/npm/commit/af6444fe
-Forwarded: not-needed
-Author: Jérémy Lal <kapouer at melix.org>
-Last-Update: 2012-04-07
---- a/scripts/index-build.js
-+++ b/scripts/index-build.js
-@@ -12,6 +12,7 @@
- 
- function done (which) { return function (er, docs) {
-   if (er) throw er
-+  docs.sort();
-   if (which === "api") apidocs = docs
-   else clidocs = docs
- 
diff --git a/debian/patches/1002_only_use_numeric_UIDs_and_GIDs_in_spawn.patch b/debian/patches/1002_only_use_numeric_UIDs_and_GIDs_in_spawn.patch
deleted file mode 100644
index 4b1640b..0000000
--- a/debian/patches/1002_only_use_numeric_UIDs_and_GIDs_in_spawn.patch
+++ /dev/null
@@ -1,45 +0,0 @@
-Description: Only use numeric UIDs and GIDs in spawn.
-Origin: upstream,https://github.com/isaacs/npm/commit/76c7d93e
-Forwarded: not-needed
-Last-Update: 2012-09-09
----
- lib/utils/exec.js |   19 +++++++++++++++++--
- 1 file changed, 17 insertions(+), 2 deletions(-)
-
---- a/lib/utils/exec.js
-+++ b/lib/utils/exec.js
-@@ -11,6 +11,7 @@
-   , myGID = process.getgid ? process.getgid() : null
-   , isRoot = process.getuid && myUID === 0
-   , constants = require("constants")
-+  , uidNumber = require("./uid-number.js")
- 
- function exec (cmd, args, env, takeOver, cwd, uid, gid, cb) {
-   if (typeof cb !== "function") cb = gid, gid = null
-@@ -34,6 +35,15 @@
-     log.verbose(uid, "Setting uid from "+myUID)
-     log.verbose(new Error().stack, "stack at uid setting")
-   }
-+
-+  if (isNaN(uid) || isNaN(gid)) {
-+    // get the numeric values
-+    return uidNumber(uid, gid, function (er, uid, gid) {
-+      if (er) return cb(er)
-+      exec(cmd, args, env, takeOver, cwd, uid, gid, cb)
-+    })
-+  }
-+
-   log.silly(cmd+" "+args.map(JSON.stringify).join(" "), "exec")
-   var stdout = ""
-     , stderr = ""
-@@ -94,8 +104,8 @@
-              , env : env || process.env
-              , cwd : cwd || null }
-     , cp
--  if (uid != null) opts.uid = uid
--  if (gid != null) opts.gid = gid
-+  if (!isNaN(uid)) opts.uid = uid
-+  if (!isNaN(gid)) opts.gid = gid
-   if (!isNaN(opts.uid)) opts.uid = +opts.uid
-   if (!isNaN(opts.gid)) opts.gid = +opts.gid
-   var name = c +" "+ a.map(JSON.stringify).join(" ")
diff --git a/debian/patches/2001_no-false-attribs.patch b/debian/patches/2001_no-false-attribs.patch
index 1afb202..f722f74 100644
--- a/debian/patches/2001_no-false-attribs.patch
+++ b/debian/patches/2001_no-false-attribs.patch
@@ -6,19 +6,30 @@ Description: Comply with Expat+no-false-attribs license
  package to displays its own bug tracker instead.
 Forwarded: not-needed
 Author: Jérémy Lal <kapouer at melix.org>
-Last-Update: 2012-03-13
+Last-Update: 2013-04-24
+
+---
+ lib/utils/error-handler.js |   10 +++++-----
+ 1 file changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/lib/utils/error-handler.js b/lib/utils/error-handler.js
+index 88ce742..0d1bc94 100644
 --- a/lib/utils/error-handler.js
 +++ b/lib/utils/error-handler.js
-@@ -169,9 +169,9 @@
+@@ -229,11 +229,11 @@ function errorHandler (er) {
+ 
    default:
-     log.error(er)
-     log.error(["You may report this log at:"
--              ,"    <http://github.com/isaacs/npm/issues>"
--              ,"or email it to:"
--              ,"    <npm- at googlegroups.com>"
+     log.error("", er.stack || er.message || er)
+-    log.error("", ["If you need help, you may report this log at:"
+-                  ,"    <http://github.com/isaacs/npm/issues>"
+-                  ,"or email it to:"
+-                  ,"    <npm- at googlegroups.com>"
+-                  ].join("\n"))
++    log.error(["You may report this log at:"
 +              ,"    <http://bugs.debian.org/npm>"
 +              ,"or use"
 +              ,"    reportbug --attach "+path.resolve("npm-debug.log")+" npm"
-               ].join("\n"))
++                ].join("\n"))
+     printStack = false
      break
    }
diff --git a/debian/patches/2002_use_ruby_ronn.patch b/debian/patches/2002_use_ruby_ronn.patch
index 2e0c266..135a0c8 100644
--- a/debian/patches/2002_use_ruby_ronn.patch
+++ b/debian/patches/2002_use_ruby_ronn.patch
@@ -3,6 +3,13 @@ Description: Use ruby-ronn to generate documentation
 Forwarded: not-needed
 Author: Jérémy Lal <kapouer at melix.org>
 Last-Update: 2012-04-07
+
+---
+ scripts/doc-build.sh |   42 ++++++------------------------------------
+ 1 file changed, 6 insertions(+), 36 deletions(-)
+
+diff --git a/scripts/doc-build.sh b/scripts/doc-build.sh
+index 9a66d4d..09033a0 100755
 --- a/scripts/doc-build.sh
 +++ b/scripts/doc-build.sh
 @@ -1,37 +1,5 @@
@@ -43,7 +50,7 @@ Last-Update: 2012-04-07
  src=$1
  dest=$2
  name=$(basename ${src%.*})
-@@ -42,7 +10,7 @@
+@@ -42,7 +10,7 @@ mkdir -p $(dirname $dest)
  
  case $dest in
    *.[13])
@@ -52,7 +59,7 @@ Last-Update: 2012-04-07
      | sed "s|@VERSION@|$version|g" \
      | perl -pi -e 's/npm\\-([^\(]*)\(1\)/npm help \1/g' \
      | perl -pi -e 's/npm\\-([^\(]*)\(3\)/npm apihelp \1/g' \
-@@ -53,7 +21,7 @@
+@@ -53,7 +21,7 @@ case $dest in
      ;;
    *.html)
      (cat html/dochead.html && \
@@ -61,7 +68,7 @@ Last-Update: 2012-04-07
       cat html/docfoot.html )\
      | sed "s|@NAME@|$name|g" \
      | sed "s|@DATE@|$date|g" \
-@@ -62,8 +30,10 @@
+@@ -62,8 +30,10 @@ case $dest in
      | perl -pi -e 's/npm-npm/npm/g' \
      | perl -pi -e 's/([^"-])(npm-)?README(\(1\))?/\1<a href="..\/doc\/README.html">README<\/a>/g' \
      | perl -pi -e 's/<title><a href="..\/doc\/README.html">README<\/a><\/title>/<title>README<\/title>/g' \
diff --git a/debian/patches/2003_fix_doc.patch b/debian/patches/2003_fix_doc.patch
index f35b5f9..b6f00b0 100644
--- a/debian/patches/2003_fix_doc.patch
+++ b/debian/patches/2003_fix_doc.patch
@@ -2,9 +2,16 @@ Description: ruby-ronn does not handle h4
 Forwarded: not-needed
 Author: Jérémy Lal <kapouer at melix.org>
 Last-Update: 2012-04-07
+
+---
+ doc/cli/folders.md |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/doc/cli/folders.md b/doc/cli/folders.md
+index 2035861..416f3ce 100644
 --- a/doc/cli/folders.md
 +++ b/doc/cli/folders.md
-@@ -135,7 +135,7 @@
+@@ -135,7 +135,7 @@ prevented.
  Another optimization can be made by installing dependencies at the
  highest level possible, below the localized "target" folder.
  
diff --git a/debian/patches/2004_remove_shebang.patch b/debian/patches/2004_remove_shebang.patch
index 8a75435..c74c8c7 100644
--- a/debian/patches/2004_remove_shebang.patch
+++ b/debian/patches/2004_remove_shebang.patch
@@ -2,6 +2,13 @@ Description: remove shebang from completion script
 Forwarded: not-needed
 Author: Jérémy Lal <kapouer at melix.org>
 Last-Update: 2012-04-07
+
+---
+ lib/utils/completion.sh |    1 -
+ 1 file changed, 1 deletion(-)
+
+diff --git a/lib/utils/completion.sh b/lib/utils/completion.sh
+index d027590..da9818d 100755
 --- a/lib/utils/completion.sh
 +++ b/lib/utils/completion.sh
 @@ -1,4 +1,3 @@
diff --git a/debian/patches/2005_index_build_dont_run_npm.patch b/debian/patches/2005_index_build_dont_run_npm.patch
index 5a94193..f3dd181 100644
--- a/debian/patches/2005_index_build_dont_run_npm.patch
+++ b/debian/patches/2005_index_build_dont_run_npm.patch
@@ -3,9 +3,16 @@ Description: Do not run cli.js as it depends on many packages.
 Forwarded: not-needed
 Author: Jérémy Lal <kapouer at melix.org>
 Last-Update: 2012-04-07
+
+---
+ scripts/doc-build.sh |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/scripts/doc-build.sh b/scripts/doc-build.sh
+index 09033a0..b44b3a8 100755
 --- a/scripts/doc-build.sh
 +++ b/scripts/doc-build.sh
-@@ -4,7 +4,7 @@
+@@ -4,7 +4,7 @@ src=$1
  dest=$2
  name=$(basename ${src%.*})
  date=$(date -u +'%Y-%M-%d %H:%m:%S')
diff --git a/debian/patches/2006_rename_node_to_nodejs.patch b/debian/patches/2006_rename_node_to_nodejs.patch
index a8bcedf..6cdc3d6 100644
--- a/debian/patches/2006_rename_node_to_nodejs.patch
+++ b/debian/patches/2006_rename_node_to_nodejs.patch
@@ -6,47 +6,18 @@ Forwarded: not-needed
 Author: Jérémy Lal <kapouer at melix.org>
 Last-Update: 2012-09-21
 
---- a/test/packages/npm-test-shrinkwrap/test.sh
-+++ b/test/packages/npm-test-shrinkwrap/test.sh
-@@ -3,7 +3,7 @@
- # ensure that we get the npm being tested, not some global thing.
- npmbin=$npm_config_prefix/bin/npm
- npm () {
--  node $npmbin "$@"
-+  nodejs $npmbin "$@"
- }
- 
- # work around the weird env we're in, as part of npm's test
---- a/scripts/index-build.js
-+++ b/scripts/index-build.js
-@@ -1,4 +1,4 @@
--#!/usr/bin/env node
-+#!/usr/bin/nodejs
- var fs = require("fs")
-   , path = require("path")
-   , cli = path.resolve(__dirname, "..", "doc", "cli")
---- a/scripts/clean-old.sh
-+++ b/scripts/clean-old.sh
-@@ -26,7 +26,7 @@
- else
-   node="$NODE"
-   if [ "x$node" = "x" ]; then
--    node=`which node`
-+    node=`which nodejs`
-   fi
-   if [ "x$node" = "x" ]; then
-     echo "Can't find node to determine prefix. Aborting."
---- a/scripts/install.sh
-+++ b/scripts/install.sh
-@@ -42,7 +42,7 @@
- export npm_config_loglevel
- 
- # make sure that node exists
--node=`which node 2>&1`
-+node=`which nodejs 2>&1`
- ret=$?
- if [ $ret -eq 0 ] && [ -x "$node" ]; then
-   (exit 0)
+---
+ Makefile               |   17 +++++++++--------
+ bin/npm-cli.js         |    2 +-
+ cli.js                 |    2 +-
+ lib/utils/lifecycle.js |    5 ++++-
+ scripts/clean-old.sh   |    2 +-
+ scripts/index-build.js |    2 +-
+ scripts/install.sh     |    2 +-
+ 7 files changed, 18 insertions(+), 14 deletions(-)
+
+diff --git a/Makefile b/Makefile
+index 82fa8b6..c014baa 100644
 --- a/Makefile
 +++ b/Makefile
 @@ -1,4 +1,5 @@
@@ -55,7 +26,7 @@ Last-Update: 2012-09-21
  
  markdowns = $(shell find doc -name '*.md' | grep -v 'index') README.md
  
-@@ -33,23 +34,23 @@
+@@ -33,23 +34,23 @@ latest:
  	@echo "Installing latest published npm"
  	@echo "Use 'make install' or 'make link' to install the code"
  	@echo "in this folder that you're looking at right now."
@@ -84,7 +55,7 @@ Last-Update: 2012-09-21
  
  doc: $(mandocs) $(htmldocs)
  
-@@ -89,17 +90,17 @@
+@@ -89,17 +90,17 @@ html/api/%.html: doc/api/%.md html/dochead.html html/docfoot.html scripts/doc-bu
  	scripts/doc-build.sh $< $@
  
  doc/cli/index.md: $(markdowns) scripts/index-build.js scripts/doc-build.sh package.json
@@ -92,8 +63,8 @@ Last-Update: 2012-09-21
 +	$(node) scripts/index-build.js > $@
  
  node_modules/.bin/ronn:
--	node cli.js install https://github.com/isaacs/ronnjs/tarball/master
-+	$(node) cli.js install https://github.com/isaacs/ronnjs/tarball/master
+-	node cli.js install ronn
++	$(node) cli.js install ronn
  
  doc: man
  
@@ -103,14 +74,10 @@ Last-Update: 2012-09-21
 -	node cli.js test
 +	$(node) cli.js test
  
- version: link
- 	git add package.json &&\
---- a/cli.js
-+++ b/cli.js
-@@ -1,2 +1,2 @@
--#!/usr/bin/env node
-+#!/usr/bin/nodejs
- require("./bin/npm-cli.js")
+ publish: link doc
+ 	@git push origin :v$(shell npm -v) || true
+diff --git a/bin/npm-cli.js b/bin/npm-cli.js
+index ef88735..8b2195d 100755
 --- a/bin/npm-cli.js
 +++ b/bin/npm-cli.js
 @@ -1,4 +1,4 @@
@@ -119,17 +86,63 @@ Last-Update: 2012-09-21
  ;(function () { // wrapper in case we're in module_context mode
  
  // windows: running "npm blah" in this folder will invoke WSH, not node.
+diff --git a/cli.js b/cli.js
+index 0df931e..f5a3f87 100755
+--- a/cli.js
++++ b/cli.js
+@@ -1,2 +1,2 @@
+-#!/usr/bin/env node
++#!/usr/bin/nodejs
+ require("./bin/npm-cli.js")
+diff --git a/lib/utils/lifecycle.js b/lib/utils/lifecycle.js
+index 3f0042f..2642068 100644
 --- a/lib/utils/lifecycle.js
 +++ b/lib/utils/lifecycle.js
-@@ -153,7 +153,10 @@
-         er.stage = stage
-         er.script = env.npm_lifecycle_script
-         er.pkgname = pkg.name
--        return cb(er)
-+        cb(er)
-+        log.warn('', 'This failure might be due to the use of legacy binary "node"')
-+        log.warn("For further explanations, please read\n/usr/share/doc/nodejs/README.Debian\n")
-+        return
-       } else if (er) {
-         log.error(er, pkg._id+"."+stage)
-         log.error("failed, but continuing anyway", pkg._id+"."+stage)
+@@ -164,7 +164,10 @@ function runPackageLifecycle (pkg, env, wd, unsafe, cb) {
+       er.stage = stage
+       er.script = env.npm_lifecycle_script
+       er.pkgname = pkg.name
+-      return cb(er)
++      var ret = cb(er)
++      log.warn('', 'This failure might be due to the use of legacy binary "node"')
++      log.warn("For further explanations, please read\n/usr/share/doc/nodejs/README.Debian\n")
++      return ret
+     } else if (er) {
+       log.error(pkg._id+"."+stage, er)
+       log.error(pkg._id+"."+stage, "continuing anyway")
+diff --git a/scripts/clean-old.sh b/scripts/clean-old.sh
+index cda80f2..d1b4110 100755
+--- a/scripts/clean-old.sh
++++ b/scripts/clean-old.sh
+@@ -26,7 +26,7 @@ if [ "x$npm_config_prefix" != "x" ]; then
+ else
+   node="$NODE"
+   if [ "x$node" = "x" ]; then
+-    node=`which node`
++    node=`which nodejs`
+   fi
+   if [ "x$node" = "x" ]; then
+     echo "Can't find node to determine prefix. Aborting."
+diff --git a/scripts/index-build.js b/scripts/index-build.js
+index 551bb1d..4bd288e 100755
+--- a/scripts/index-build.js
++++ b/scripts/index-build.js
+@@ -1,4 +1,4 @@
+-#!/usr/bin/env node
++#!/usr/bin/nodejs
+ var fs = require("fs")
+   , path = require("path")
+   , cli = path.resolve(__dirname, "..", "doc", "cli")
+diff --git a/scripts/install.sh b/scripts/install.sh
+index a8e588d..0abf69a 100755
+--- a/scripts/install.sh
++++ b/scripts/install.sh
+@@ -42,7 +42,7 @@ fi
+ export npm_config_loglevel
+ 
+ # make sure that node exists
+-node=`which node 2>&1`
++node=`which nodejs 2>&1`
+ ret=$?
+ if [ $ret -eq 0 ] && [ -x "$node" ]; then
+   (exit 0)
diff --git a/debian/patches/series b/debian/patches/series
index f324ddb..1be41eb 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,5 +1,3 @@
-1001_sort_index_build.patch
-1002_only_use_numeric_UIDs_and_GIDs_in_spawn.patch
 2001_no-false-attribs.patch
 2002_use_ruby_ronn.patch
 2003_fix_doc.patch


More information about the Pkg-javascript-devel mailing list