[npm/el6: 1/2] backport fix for traceback encountered when using "npm search" (RHBZ#1087065)

T.C. Hollingsworth patches at fedoraproject.org
Mon Apr 14 01:13:48 UTC 2014


commit 197544e078ac1ed5b9bcc6cb5c03020c69c6c180
Author: T.C. Hollingsworth <tchollingsworth at gmail.com>
Date:   Sun Apr 13 18:10:49 2014 -0700

    backport fix for traceback encountered when using "npm search" (RHBZ#1087065)

 npm-fix-search.patch |   25 +++++++++++++++++++++++++
 npm.spec             |   10 +++++++++-
 2 files changed, 34 insertions(+), 1 deletions(-)
---
diff --git a/npm-fix-search.patch b/npm-fix-search.patch
new file mode 100644
index 0000000..bf63188
--- /dev/null
+++ b/npm-fix-search.patch
@@ -0,0 +1,25 @@
+From b64998e73da90e34438b197aeaede58bc450d879 Mon Sep 17 00:00:00 2001
+From: Alan Shaw <alan at freestyle-developments.co.uk>
+Date: Tue, 30 Jul 2013 20:38:25 +0100
+Subject: [PATCH] Guard against falsey versions value.
+
+---
+ lib/search.js | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/lib/search.js b/lib/search.js
+index 700da2f..fdc1c8b 100644
+--- a/lib/search.js
++++ b/lib/search.js
+@@ -85,7 +85,7 @@ function stripData (data) {
+            })
+          , url: !Object.keys(data.versions || {}).length ? data.url : null
+          , keywords: data.keywords || []
+-         , version: Object.keys(data.versions)[0] || []
++         , version: Object.keys(data.versions || {})[0] || []
+          , time: data.time
+                  && data.time.modified
+                  && (new Date(data.time.modified).toISOString()
+-- 
+1.9.1
+
diff --git a/npm.spec b/npm.spec
index 3542697..fba2a6c 100644
--- a/npm.spec
+++ b/npm.spec
@@ -2,7 +2,7 @@
 
 Name:       npm
 Version:    1.3.6
-Release:    4%{?dist}
+Release:    5%{?dist}
 Summary:    Node.js Package Manager
 License:    Artistic 2.0
 Group:      Development/Tools
@@ -15,6 +15,10 @@ ExclusiveArch: %{nodejs_arches} noarch
 # use system paths for manual pages and docuementation
 Patch1:     %{name}-use-system-doc-paths.patch
 
+# backport upstream fix for 'npm search' traceback (RHBZ#1087065)
+# https://github.com/npm/npm/commit/b64998e73da90e34438b197aeaede58bc450d879
+Patch2:     %{name}-fix-search.patch
+
 BuildRequires: nodejs-devel
 
 %description
@@ -24,6 +28,7 @@ node programs. It manages dependencies and does other cool stuff.
 %prep
 %setup -q -n package
 %patch1 -p1
+%patch2 -p1
 
 %nodejs_fixdep ansi 0.2
 %nodejs_fixdep semver 2.1
@@ -83,6 +88,9 @@ rm -rf %{buildroot}
 %doc AUTHORS doc html README.md LICENSE
 
 %changelog
+* Mon Apr 14 2014 T.C. Hollingsworth <tchollingsworth at gmail.com> - 1.3.6-5
+- backport fix for traceback encountered when using "npm search" (RHBZ#1087065)
+
 * Thu Aug 08 2013 T.C. Hollingsworth <tchollingsworth at gmail.com> - 1.3.6-4
 - remove unnecessary symlink to mandir
   fixes upgrade path from certain older versions of npm


More information about the scm-commits mailing list