[nodejs] make %nodejs_symlink_deps actually work

T.C. Hollingsworth patches at fedoraproject.org
Wed Jan 2 07:07:15 UTC 2013


commit e69a9d539d189e1280f05b4c0d4aaa8bfea52eaf
Author: T.C. Hollingsworth <tchollingsworth at gmail.com>
Date:   Wed Jan 2 00:05:33 2013 -0700

    make %nodejs_symlink_deps actually work
    
    module packaging stuff is now complete (for pure-JS modules anyway)
    and npm reviews will be filed shortly :-)

 macros.nodejs       |    1 +
 nodejs-symlink-deps |   14 +++++++++++---
 nodejs.spec         |    5 ++++-
 3 files changed, 16 insertions(+), 4 deletions(-)
---
diff --git a/macros.nodejs b/macros.nodejs
index a7d431f..da625a2 100644
--- a/macros.nodejs
+++ b/macros.nodejs
@@ -9,6 +9,7 @@
 
 # symlink dependencies so `npm link` works
 # this should be run in every module's %%install section
+# pass the module name if the npm metadata is incorrect (e.g. multiple versions)
 %nodejs_symlink_deps %{_rpmconfigdir}/nodejs-symlink-deps %{nodejs_sitelib}
 
 # patch package.json to fix a dependency
diff --git a/nodejs-symlink-deps b/nodejs-symlink-deps
index f33375e..5571af4 100755
--- a/nodejs-symlink-deps
+++ b/nodejs-symlink-deps
@@ -30,12 +30,20 @@ import sys
 #the %nodejs_symlink_deps macro passes %nodejs_sitelib as the first argument
 sitelib = sys.argv[1]
 
+metadata = json.load(open('package.json'))
+
+if len(sys.argv) > 2:
+    name = sys.argv[2]
+else:
+    name = metadata['name']
+
+os.chdir(os.path.join(os.environ['RPM_BUILD_ROOT'], sitelib.lstrip('/'), name))
+
 try:
     os.mkdir('node_modules')
 except OSError:
-    pass
-
-metadata = json.load(open('package.json'))
+    sys.stderr.write('WARNING: node_modules already exists. Make sure you have' +
+                        'no bundled dependencies.\n')
 
 os.chdir('node_modules')
 
diff --git a/nodejs.spec b/nodejs.spec
index 1717aac..95ef14c 100644
--- a/nodejs.spec
+++ b/nodejs.spec
@@ -1,6 +1,6 @@
 Name: nodejs
 Version: 0.9.5
-Release: 2%{?dist}
+Release: 3%{?dist}
 Summary: JavaScript runtime
 License: MIT and ASL 2.0 and ISC and BSD
 Group: Development/Languages
@@ -138,6 +138,9 @@ rm -f %{_defaultdocdir}/%{name}-docs-%{version}/html/nodejs.1
 %doc LICENSE
 
 %changelog
+* Wed Jan 02 2013 T.C. Hollingsworth <tchollingsworth at gmail.com> - 0.9.5-3
+- make nodejs-symlink-deps actually work
+
 * Tue Jan 01 2013 T.C. Hollingsworth <tchollingsworth at gmail.com> - 0.9.5-2
 - provide nodejs-devel so modules can BuildRequire it (and be consistent
   with other interpreted languages in the distro)


More information about the scm-commits mailing list