copy mutiple versioned packages implementation from nodejs-packaging

This commit is contained in:
T.C. Hollingsworth 2013-06-18 20:08:09 -07:00
parent 689af2fd68
commit b751ee7a54
3 changed files with 25 additions and 8 deletions

2
multiver_modules Normal file
View File

@ -0,0 +1,2 @@
uglify-js
inherits

View File

@ -30,6 +30,9 @@ import sys
#the %nodejs_symlink_deps macro passes %nodejs_sitelib as the first argument
sitelib = sys.argv[1]
#read in the list of mutiple-versioned packages
mvpkgs = open('/usr/share/node/multiver_modules').read().split('\n')
if '--check' in sys.argv:
check = True
modules = [os.getcwd()]
@ -52,15 +55,23 @@ for path in modules:
os.chdir('node_modules')
if 'dependencies' in md:
for dep in md['dependencies'].iterkeys():
target = os.path.join(sitelib, dep)
for dep, ver in md['dependencies'].iteritems():
if dep in mvpkgs:
depver = ver.lstrip('~').split('.')[0]
target = os.path.join(sitelib, '{0}@{1}'.format(dep, depver))
else:
target = os.path.join(sitelib, dep)
if not check or os.path.exists(target):
os.symlink(target, dep)
if check and '--no-devdeps' not in sys.argv and 'devDependencies' in md:
for dep in md['devDependencies']:
target = os.path.join(sitelib, dep)
for dep, ver in md['devDependencies'].iteritems():
if dep in mvpkgs:
depver = ver.lstrip('~').split('.')[0]
target = os.path.join(sitelib, '{0}@{1}'.format(dep, depver))
else:
target = os.path.join(sitelib, dep)
if os.path.exists(target):
os.symlink(target, dep)

View File

@ -22,6 +22,7 @@ Source4: nodejs.req
Source5: nodejs-symlink-deps
Source6: nodejs-fixdep
Source7: nodejs_native.attr
Source8: multiver_modules
# Disable running gyp on bundled deps we don't use
Patch1: nodejs-disable-gyp-deps.patch
@ -142,7 +143,7 @@ install -pm0755 %{SOURCE4} %{buildroot}%{_rpmconfigdir}/nodejs.req
install -pm0755 %{SOURCE5} %{buildroot}%{_rpmconfigdir}/nodejs-symlink-deps
install -pm0755 %{SOURCE6} %{buildroot}%{_rpmconfigdir}/nodejs-fixdep
install -Dpm0644 %{SOURCE7} %{buildroot}%{_rpmconfigdir}/fileattrs/nodejs_native.attr
install -Dpm0644 %{SOURCE8} %{buildroot}%{_datadir}/node/multiver_modules
# ensure Requires are added to every native module that match the Provides from
# the nodejs build in the buildroot
@ -174,11 +175,12 @@ cp -p common.gypi %{buildroot}%{_datadir}/node
%{_bindir}/node
%{_mandir}/man1/node.*
%dir %{_prefix}/lib/node_modules
%dir %{_datadir}/node
%files devel
%{_bindir}/node_g
%{_includedir}/node
%{_datadir}/node
%{_datadir}/node/common.gypi
%files docs
%{_defaultdocdir}/%{name}-docs-%{version}
@ -187,6 +189,7 @@ cp -p common.gypi %{buildroot}%{_datadir}/node
%{_sysconfdir}/rpm/macros.nodejs
%{_rpmconfigdir}/fileattrs/nodejs*.attr
%{_rpmconfigdir}/nodejs*
%{_datadir}/node/multiver_modules
%changelog
* Wed Jun 19 2013 T.C. Hollingsworth <tchollingsworth@gmail.com> - 0.10.12-1
@ -194,6 +197,7 @@ cp -p common.gypi %{buildroot}%{_datadir}/node
http://blog.nodejs.org/2013/06/18/node-v0-10-12-stable/
- split off a -packaging subpackage with RPM macros, etc.
- build -docs as noarch
- copy mutiple version logic from nodejs-packaging SRPM for now
* Fri May 31 2013 T.C. Hollingsworth <tchollingsworth@gmail.com> - 0.10.9-1
- new upstream release 0.10.9