[83821] trunk/dports/devel/npm

ciserlohn at macports.org ciserlohn at macports.org
Sun Sep 11 06:33:18 PDT 2011


Revision: 83821
          http://trac.macports.org/changeset/83821
Author:   ciserlohn at macports.org
Date:     2011-09-11 06:33:15 -0700 (Sun, 11 Sep 2011)
Log Message:
-----------
npm: suppress that npm can update itself (see #31161)

Modified Paths:
--------------
    trunk/dports/devel/npm/Portfile

Added Paths:
-----------
    trunk/dports/devel/npm/files/
    trunk/dports/devel/npm/files/patch-lib-update.js

Modified: trunk/dports/devel/npm/Portfile
===================================================================
--- trunk/dports/devel/npm/Portfile	2011-09-11 13:24:41 UTC (rev 83820)
+++ trunk/dports/devel/npm/Portfile	2011-09-11 13:33:15 UTC (rev 83821)
@@ -5,6 +5,7 @@
 
 name                npm
 version             1.0.27
+revision            1
 categories          devel
 platforms           darwin
 license             MIT
@@ -27,10 +28,17 @@
 
 use_configure       no
 
+patchfiles          patch-lib-update.js
+
 post-fetch {
     system "cd ${worksrcpath} && git submodule update --init --recursive"
 }
 
+post-patch {
+    regsub -all {/} "^${prefix}/(bin/npm\\|lib/node_modules/npm)+" {\\\/} npm_path_jsregex
+    reinplace "s|@@NPM_PATH_JSREGEX@@|${npm_path_jsregex}|g" ${worksrcpath}/lib/update.js
+}
+
 build {}
 
 destroot {

Added: trunk/dports/devel/npm/files/patch-lib-update.js
===================================================================
--- trunk/dports/devel/npm/files/patch-lib-update.js	                        (rev 0)
+++ trunk/dports/devel/npm/files/patch-lib-update.js	2011-09-11 13:33:15 UTC (rev 83821)
@@ -0,0 +1,17 @@
+--- lib/update.js.orig	2011-09-11 13:03:12.000000000 +0200
++++ lib/update.js	2011-09-11 13:09:44.000000000 +0200
+@@ -27,6 +27,14 @@
+         , dep = ww[1]
+         , want = ww[3]
+         , what = dep + "@" + want
++	
++	if (where.match(/@@NPM_PATH_JSREGEX@@/)) {
++           log.error("Trying to update '" + what + "' in '" + where + "'")
++           log.error("which is part of the MacPorts npm base installation.")
++	    log.error("To update npm please run:")
++           log.error("sudo port selfupdate && sudo port upgrade npm\n")
++	    return cb()
++	}
+ 
+       npm.commands.install(where, what, cb)
+     }, cb)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20110911/37d6ac61/attachment.html>


More information about the macports-changes mailing list