[npm/el6: 6/8] use system paths for manual pages and documentation (RHBZ#953051)

T.C. Hollingsworth patches at fedoraproject.org
Tue Jun 25 22:08:08 UTC 2013


commit b827f79064d5d09ed7ae4205f308a11b90f5f1f4
Author: T.C. Hollingsworth <tchollingsworth at gmail.com>
Date:   Sat Jun 22 17:50:42 2013 -0700

    use system paths for manual pages and documentation (RHBZ#953051)
    
    (cherry picked from commit 48e13b589386c3fc5cd2fb12b54834f8c1a12305)

 npm-use-system-doc-paths.patch |   78 ++++++++++++++++++++++++++++++++++++++++
 npm.spec                       |   17 +++------
 2 files changed, 83 insertions(+), 12 deletions(-)
---
diff --git a/npm-use-system-doc-paths.patch b/npm-use-system-doc-paths.patch
new file mode 100644
index 0000000..7065ae9
--- /dev/null
+++ b/npm-use-system-doc-paths.patch
@@ -0,0 +1,78 @@
+From 3bd9c35573742bcefa524003b8915d451737f93b Mon Sep 17 00:00:00 2001
+From: "T.C. Hollingsworth" <tchollingsworth at gmail.com>
+Date: Sat, 22 Jun 2013 17:36:57 -0700
+Subject: [PATCH] use system man path
+
+---
+ lib/help-search.js |  5 +++--
+ lib/help.js        | 15 ++++++++-------
+ 2 files changed, 11 insertions(+), 9 deletions(-)
+
+diff --git a/lib/help-search.js b/lib/help-search.js
+index b0b15ba..541787f 100644
+--- a/lib/help-search.js
++++ b/lib/help-search.js
+@@ -4,10 +4,11 @@ module.exports = helpSearch
+ var fs = require("graceful-fs")
+   , path = require("path")
+   , asyncMap = require("slide").asyncMap
+-  , cliDocsPath = path.join(__dirname, "..", "doc", "cli")
+-  , apiDocsPath = path.join(__dirname, "..", "doc", "api")
+   , log = require("npmlog")
+   , npm = require("./npm.js")
++  , rootDocsPath = path.join("/usr/share/doc", "npm-" + npm.version)
++  , cliDocsPath = path.join(rootDocsPath, "cli")
++  , apiDocsPath = path.join(rootDocsPath, "api")
+ 
+ helpSearch.usage = "npm help-search <text>"
+ 
+diff --git a/lib/help.js b/lib/help.js
+index 8faef1c..b77707d 100644
+--- a/lib/help.js
++++ b/lib/help.js
+@@ -39,9 +39,10 @@ function help (args, cb) {
+       return cb()
+     }
+ 
+-    var sectionPath = path.join( __dirname, "..", "man", "man" + num
+-                               , section + "." + num)
+-      , htmlPath = path.resolve( __dirname, "..", "html"
++    var manSection = 0 == section.indexOf("npm") ? section : "npm-" + section
++      , sectionPath = path.join( "/usr/share/man", "man" + num
++                               , manSection + "." + num + ".gz")
++      , htmlPath = path.resolve( "/usr/share/doc", "npm-" + npm.version, "html"
+                                , num === 3 ? "api" : "doc"
+                                , section+".html" )
+     return fs.stat
+@@ -54,7 +55,6 @@ function help (args, cb) {
+           Object.keys(process.env).forEach(function (i) {
+             env[i] = process.env[i]
+           })
+-          env.MANPATH = manpath
+           var viewer = npm.config.get("viewer")
+ 
+           switch (viewer) {
+@@ -71,7 +71,7 @@ function help (args, cb) {
+ 
+             default:
+               var conf = { env: env, customFds: [ 0, 1, 2] }
+-              var man = spawn("man", [num, section], conf)
++              var man = spawn("man", [num, manSection], conf)
+               man.on("close", cb)
+           }
+         }
+@@ -142,8 +142,9 @@ function wrap (arr) {
+ function getSections (num, cb) {
+   if (typeof cb !== "function") cb = num, num = 1
+ 
+-  var mp = path.join(__dirname, "../man/man" + num + "/")
+-    , cleaner = new RegExp("\\." + num + "$")
++  var type = num === 3 ? "api" : "cli"
++    , mp = path.join("/usr/share/doc/", "npm-" + npm.version, type)
++    , cleaner = new RegExp("\\.md$")
+   fs.readdir(mp, function (er, files) {
+     if (er) return cb(er)
+     var sectionList = files.concat("help." + num)
+-- 
+1.8.2.1
+
diff --git a/npm.spec b/npm.spec
index 3500774..1e0fc1e 100644
--- a/npm.spec
+++ b/npm.spec
@@ -1,13 +1,8 @@
 %{?nodejs_find_provides_and_requires}
 
 Name:       npm
-<<<<<<< HEAD
 Version:    1.3.0
 Release:    1%{?dist}
-=======
-Version:    1.2.17
-Release:    4%{?dist}
->>>>>>> parent of 7e55371... Fix manpage names so that npm help finds them
 Summary:    Node.js Package Manager
 License:    MITNFA
 Group:      Development/Tools
@@ -17,6 +12,9 @@ BuildRoot:  %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 BuildArch:  noarch
 ExclusiveArch: %{ix86} x86_64 %{arm} noarch
 
+# use system paths for manual pages and docuementation
+Patch1:     %{name}-use-system-doc-paths.patch
+
 BuildRequires: nodejs-devel
 
 %description
@@ -25,6 +23,7 @@ node programs. It manages dependencies and does other cool stuff.
 
 %prep
 %setup -q -n package
+%patch1 -p1
 
 %nodejs_fixdep lru-cache 2.3.x
 %nodejs_fixdep init-package-json 0.0.x
@@ -77,10 +76,6 @@ touch %{buildroot}%{_sysconfdir}/npmignore
 mkdir -p %{buildroot}%{_mandir}
 cp -pr man/* %{buildroot}%{_mandir}/
 
-# some symlinks to make `npm help` work
-ln -sf %{_mandir} %{buildroot}%{nodejs_sitelib}/npm/man
-ln -sf %{_defaultdocdir}/%{name}-%{version} %{buildroot}%{nodejs_sitelib}/npm/doc
-
 %nodejs_symlink_deps
 
 # probably needs network, need to investigate further
@@ -102,9 +97,9 @@ rm -rf %{buildroot}
 %doc AUTHORS doc/* html README.md LICENSE
 
 %changelog
-<<<<<<< HEAD
 * Sun Jun 23 2013 T.C. Hollingsworth <tchollingsworth at gmail.com> - 1.3.0-1
 - new upstream release 1.3.0
+- use system paths for manual pages and documentation (RHBZ#953051)
 
 * Sat Jun 22 2013 T.C. Hollingsworth <tchollingsworth at gmail.com> - 1.2.17-6
 - restrict to compatible arches
@@ -112,8 +107,6 @@ rm -rf %{buildroot}
 * Wed Apr 17 2013 Stanislav Ochotnicky <sochotnicky at redhat.com> - 1.2.17-5
 - Fix manpage names so that npm help finds them
 
-=======
->>>>>>> parent of 7e55371... Fix manpage names so that npm help finds them
 * Mon Apr 15 2013 T.C. Hollingsworth <tchollingsworth at gmail.com> - 1.2.17-4
 - add EPEL dependency generation macro
 


More information about the scm-commits mailing list