make %nodejs_symlink_deps actually work

module packaging stuff is now complete (for pure-JS modules anyway)
and npm reviews will be filed shortly :-)
This commit is contained in:
T.C. Hollingsworth 2013-01-02 00:05:33 -07:00
parent 37ced2c50e
commit e69a9d539d
3 changed files with 16 additions and 4 deletions

View file

@ -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

View file

@ -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')

View file

@ -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@gmail.com> - 0.9.5-3
- make nodejs-symlink-deps actually work
* Tue Jan 01 2013 T.C. Hollingsworth <tchollingsworth@gmail.com> - 0.9.5-2
- provide nodejs-devel so modules can BuildRequire it (and be consistent
with other interpreted languages in the distro)