From b751ee7a547b5de8b54768510dfd45b6616c43cc Mon Sep 17 00:00:00 2001 From: "T.C. Hollingsworth" Date: Tue, 18 Jun 2013 20:08:09 -0700 Subject: [PATCH] copy mutiple versioned packages implementation from nodejs-packaging --- multiver_modules | 2 ++ nodejs-symlink-deps | 23 +++++++++++++++++------ nodejs.spec | 8 ++++++-- 3 files changed, 25 insertions(+), 8 deletions(-) create mode 100644 multiver_modules diff --git a/multiver_modules b/multiver_modules new file mode 100644 index 0000000..29857b1 --- /dev/null +++ b/multiver_modules @@ -0,0 +1,2 @@ +uglify-js +inherits \ No newline at end of file diff --git a/nodejs-symlink-deps b/nodejs-symlink-deps index f7a872e..5bcb885 100755 --- a/nodejs-symlink-deps +++ b/nodejs-symlink-deps @@ -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) diff --git a/nodejs.spec b/nodejs.spec index cbb1a6b..48833d0 100644 --- a/nodejs.spec +++ b/nodejs.spec @@ -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 - 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 - 0.10.9-1 - new upstream release 0.10.9