Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Leap:42.3:Update
nodejs-packaging
nodejs-packaging-compat-opensuse-pre1320.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File nodejs-packaging-compat-opensuse-pre1320.patch of Package nodejs-packaging
diff -urN nodejs-packaging-fedora-7/macros.nodejs nodejs-packaging/macros.nodejs --- nodejs-packaging-fedora-7/macros.nodejs 2014-05-25 14:08:21.000000000 +0800 +++ nodejs-packaging/macros.nodejs 2015-07-05 00:16:26.188133579 +0800 @@ -8,6 +8,16 @@ #for future-proofing only; we don't do multilib %nodejs_sitearch %{nodejs_sitelib} +#compat +%nodejs_modulesdir %{nodejs_sitelib} + +%nodejs_requires \ +Requires: nodejs + +%nodejs_install \ +mkdir -p %{buildroot}%{nodejs_modulesdir} \ +npm_config_prefix=%{buildroot}%{_prefix} npm install -g %{S:0} + # currently installed nodejs version %nodejs_version %(%{__nodejs} -v | sed s/v//) @@ -15,19 +25,24 @@ # this should be run in every module's %%install section # pass --check to work in the current directory instead of the buildroot # pass --no-devdeps to ignore devDependencies when --check is used -%nodejs_symlink_deps %{_rpmconfigdir}/nodejs-symlink-deps %{nodejs_sitelib} +%nodejs_symlink_deps %{_prefix}/lib/rpm/nodejs-symlink-deps %{nodejs_sitelib} # patch package.json to fix a dependency # see `man npm-json` for details on writing dependencies for package.json files # e.g. `%%nodejs_fixdep frobber` makes any version of frobber do # `%%nodejs_fixdep frobber '>1.0'` requires frobber > 1.0 # `%%nodejs_fixdep -r frobber removes the frobber dep -%nodejs_fixdep %{_rpmconfigdir}/nodejs-fixdep +%nodejs_fixdep %{_prefix}/lib/rpm/nodejs-fixdep # macro to filter unwanted provides from Node.js binary native modules -%nodejs_default_filter %{expand: \ -%global __provides_exclude_from ^%{nodejs_sitearch}/.*\\.node$ -} +%nodejs_default_filter %{?filter_setup: %{expand: \ +%filter_provides_in %{nodejs_sitearch}/.*\\.node$ \ +%filter_setup \ +}} -# no-op macro to allow spec compatibility with EPEL -%nodejs_find_provides_and_requires %{nil} +# macro to invoke the Node.js provides and requires generators +%nodejs_find_provides_and_requires %{expand: \ +%global _use_internal_dependency_generator 0 +%global __find_provides %{_prefix}/lib/rpm/nodejs.prov +%global __find_requires %{_prefix}/lib/rpm/nodejs.req +} diff -urN nodejs-packaging-fedora-7/nodejs.attr nodejs-packaging/nodejs.attr --- nodejs-packaging-fedora-7/nodejs.attr 2014-05-25 14:08:21.000000000 +0800 +++ nodejs-packaging/nodejs.attr 1970-01-01 08:00:00.000000000 +0800 @@ -1,3 +0,0 @@ -%__nodejs_provides %{_rpmconfigdir}/nodejs.prov -%__nodejs_requires %{_rpmconfigdir}/nodejs.req -%__nodejs_path ^/usr/lib.*/node_modules/.*/package\\.json$ diff -urN nodejs-packaging-fedora-7/nodejs.prov nodejs-packaging/nodejs.prov --- nodejs-packaging-fedora-7/nodejs.prov 2014-05-25 14:08:21.000000000 +0800 +++ nodejs-packaging/nodejs.prov 2014-05-24 11:05:36.000000000 +0800 @@ -26,6 +26,7 @@ # IN THE SOFTWARE. import json +import subprocess import sys paths = [path.rstrip() for path in sys.stdin.readlines()] @@ -43,3 +44,7 @@ print '= ' + metadata['version'] else: print + +# invoke the regular RPM provides generator +p = subprocess.Popen(['/usr/lib/rpm/find-provides'], stdout=subprocess.PIPE, stdin=subprocess.PIPE) +print p.communicate(input='\n'.join(paths))[0] diff -urN nodejs-packaging-fedora-7/nodejs.req nodejs-packaging/nodejs.req --- nodejs-packaging-fedora-7/nodejs.req 2014-05-25 14:08:21.000000000 +0800 +++ nodejs-packaging/nodejs.req 2014-05-24 11:05:36.000000000 +0800 @@ -28,7 +28,9 @@ from __future__ import unicode_literals import json +import os import re +import subprocess import sys RE_VERSION = re.compile(r'\s*v?([<>=~^]{0,2})\s*([0-9][0-9\.\-]*)\s*') @@ -45,6 +47,11 @@ for path in paths: if not path.endswith('package.json'): continue + + # we only want the package.json in the toplevel module directory + pathparts = path.split(os.sep) + if not pathparts[-5:-2] == ['usr', 'lib', 'node_modules']: + continue fh = open(path) metadata = json.load(fh) @@ -75,6 +82,10 @@ raise TypeError('invalid package.json: dependencies not a valid type') print '\n'.join(deps) + + # invoke the regular RPM requires generator + p = subprocess.Popen(['/usr/lib/rpm/find-requires'], stdout=subprocess.PIPE, stdin=subprocess.PIPE) + print p.communicate(input='\n'.join(paths))[0] def process_dep(req, version): """Converts an individual npm dependency into RPM dependencies""" diff -urN nodejs-packaging-fedora-7/nodejs-symlink-deps nodejs-packaging/nodejs-symlink-deps --- nodejs-packaging-fedora-7/nodejs-symlink-deps 2014-05-25 14:08:21.000000000 +0800 +++ nodejs-packaging/nodejs-symlink-deps 2014-05-24 11:05:36.000000000 +0800 @@ -73,9 +73,6 @@ def symlink_deps(deps, check): if isinstance(deps, dict): - #read in the list of mutiple-versioned packages - mvpkgs = open('/usr/share/node/multiver_modules').read().split('\n') - for dep, ver in deps.iteritems(): if dep in mvpkgs and ver != '' and ver != '*': depver = ver.lstrip('~').split('.')[0] @@ -104,6 +101,9 @@ #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 or '--build' in sys.argv: check = True modules = [os.getcwd()]
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor