]> git.pld-linux.org Git - packages/npm.git/blob - npm.spec
130ef4561d13d10d51fb0e23f29df670df161dd3
[packages/npm.git] / npm.spec
1 # TODO
2 # - put man3 to some -devel-doc package (man pages for npm programming)
3 # - it can't live without this path: Error: ENOENT, no such file or directory '/usr/lib/node_modules/npm/man/man1/'
4 # - npm-debug.log is created with 777 perms, should respect umask instead
5 #
6 # Conditional build:
7 %bcond_without  bundled_gyp     # package without bundled node-gyp module
8
9 Summary:        A package manager for node.js
10 Summary(pl.UTF-8):      Zarządca pakietów dla node.js
11 Name:           npm
12 Version:        6.14.15
13 Release:        1
14 License:        Artistic v2.0
15 Group:          Development/Tools
16 Source0:        https://registry.npmjs.org/npm/-/%{name}-%{version}.tgz
17 # Source0-md5:  51bb7ac69421253bdf08c7a09b7966bc
18 Patch0:         link-globalPaths.patch
19 Patch1:         cmd-shim-optional.patch
20 URL:            https://www.npmjs.com/
21 BuildRequires:  bash
22 BuildRequires:  nodejs >= 6
23 BuildRequires:  rpmbuild(macros) >= 1.634
24 BuildRequires:  sed >= 4.0
25 Requires:       nodejs >= 6
26 %if %{without bundled_gyp}
27 Suggests:       nodejs-gyp = 5.1.0
28 Conflicts:      nodejs-gyp < 5.1.0
29 %endif
30 BuildArch:      noarch
31 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
32
33 %description
34 NPM is a package manager for node.js. You can use it to install and
35 publish your node programs. It manages dependencies and does other
36 cool stuff.
37
38 %description -l pl.UTF-8
39 NPM to zarządca pakietów dla node.js. Można go używać do instalowania
40 i publikowania kodu w Node.
41
42 %package -n bash-completion-%{name}
43 Summary:        bash completion for NPM commands
44 Summary(pl.UTF-8):      bashowe uzupełnianie parametrów dla poleceń NPM
45 Group:          Applications/Shells
46 Requires:       %{name} = %{version}-%{release}
47 Requires:       bash-completion
48
49 %description -n bash-completion-%{name}
50 bash completion for NPM commands.
51
52 %description -n bash-completion-%{name} -l pl.UTF-8
53 bashowe uzupełnianie parametrów dla poleceń NPM.
54
55 %prep
56 %setup -qc
57 %{__mv} package/* .
58 %patch0 -p1
59 %patch1 -p1
60
61 grep -rl '#!.*env \(node\|python\|sh\|bash\)' . | xargs %{__sed} -i -e '1{
62         s,^#!.*bin/env bash,#!%{__bash},
63         s,^#!.*bin/env node,#!/usr/bin/node,
64         s,^#!.*bin/env python,#!%{__python},
65         s,^#!.*bin/env sh,#!%{__sh},
66 }'
67
68 # startup helpers we don't need
69 %{__rm} bin/npm bin/npm.cmd
70
71 # clean up node_modules/
72 for i in README.markdown LICENSE \
73         .npmignore .travis.yml test examples example samples; do
74         find node_modules -name $i -print0 | sort -rz | xargs -0r %{__rm} -rv
75 done
76 find node_modules -name \*.md -print0 -exec %{__rm} -v {} \;
77 %{__rm} lib/fetch-package-metadata.md
78
79 %build
80 # forces npm to keep config files in /etc instead of /usr/etc
81 ./configure \
82         --globalconfig=%{_sysconfdir}/npmrc \
83         --globalignorefile=%{_sysconfdir}/npmignore
84
85 cat npmrc
86
87 %install
88 rm -rf $RPM_BUILD_ROOT
89 install -d $RPM_BUILD_ROOT{%{_bindir},%{nodejs_libdir}/npm/bin,/etc/bash_completion.d}
90 install -d $RPM_BUILD_ROOT%{nodejs_libdir}/npm/bin
91
92 cp -a lib npmrc package.json $RPM_BUILD_ROOT%{nodejs_libdir}/npm
93 cp -p bin/*.js $RPM_BUILD_ROOT%{nodejs_libdir}/npm/bin
94 ln -s %{nodejs_libdir}/npm/bin/npm-cli.js $RPM_BUILD_ROOT%{_bindir}/npm
95 ln -s %{nodejs_libdir}/npm/bin/npx-cli.js $RPM_BUILD_ROOT%{_bindir}/npx
96
97 %if %{without bundled_gyp}
98 %{__rm} -r node_modules/node-gyp
99 %endif
100 cp -r node_modules $RPM_BUILD_ROOT%{nodejs_libdir}/npm/
101
102 # for npm help
103 install -d $RPM_BUILD_ROOT%{nodejs_libdir}/npm/doc
104 cp -a docs/content/* $RPM_BUILD_ROOT%{nodejs_libdir}/npm/doc
105
106 # ghosted global config files
107 # TODO: package as files to have file permissions set
108 install -d $RPM_BUILD_ROOT%{_sysconfdir}
109 cp -p npmrc $RPM_BUILD_ROOT%{_sysconfdir}/npmrc
110 touch $RPM_BUILD_ROOT%{_sysconfdir}/npmignore
111
112 # install to mandir
113 install -d $RPM_BUILD_ROOT%{_mandir}
114 cp -pr man/* $RPM_BUILD_ROOT%{_mandir}
115
116 # FIXME: "npm help" requires this
117 ln -s %{_mandir} $RPM_BUILD_ROOT%{nodejs_libdir}/npm/man
118
119 %{__mv} $RPM_BUILD_ROOT%{nodejs_libdir}/npm/lib/utils/completion.sh \
120         $RPM_BUILD_ROOT/etc/bash_completion.d/%{name}.sh
121
122 %clean
123 rm -rf $RPM_BUILD_ROOT
124
125 %files
126 %defattr(644,root,root,755)
127 %doc AUTHORS CHANGELOG.md LICENSE README.md
128 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/npmrc
129 %ghost %{_sysconfdir}/npmignore
130 %attr(755,root,root) %{_bindir}/npm
131 %attr(755,root,root) %{_bindir}/npx
132 %dir %{nodejs_libdir}/npm
133 %{nodejs_libdir}/npm/package.json
134 %{nodejs_libdir}/npm/npmrc
135
136 %dir %{nodejs_libdir}/npm/bin
137 %attr(755,root,root) %{nodejs_libdir}/npm/bin/npm-cli.js
138 %attr(755,root,root) %{nodejs_libdir}/npm/bin/npx-cli.js
139 %dir %{nodejs_libdir}/npm/lib
140 %{nodejs_libdir}/npm/lib/*.js
141 %{nodejs_libdir}/npm/lib/auth
142 %{nodejs_libdir}/npm/lib/config
143 %{nodejs_libdir}/npm/lib/doctor
144 %{nodejs_libdir}/npm/lib/install
145 %{nodejs_libdir}/npm/lib/search
146 %{nodejs_libdir}/npm/lib/utils
147 %{nodejs_libdir}/npm/node_modules
148
149 # man symlink
150 %{nodejs_libdir}/npm/man
151
152 %dir %{nodejs_libdir}/npm/doc
153 %{nodejs_libdir}/npm/doc/cli-commands
154 %{nodejs_libdir}/npm/doc/configuring-npm
155 %{nodejs_libdir}/npm/doc/using-npm
156
157 %{_mandir}/man1/npm.1*
158 %{_mandir}/man1/npm-*.1*
159 %{_mandir}/man1/npx.1*
160 %{_mandir}/man5/folders.5*
161 %{_mandir}/man5/install.5*
162 %{_mandir}/man5/npm*.5*
163 %{_mandir}/man5/package-json.5*
164 %{_mandir}/man5/package-lock-json.5*
165 %{_mandir}/man5/package-locks.5*
166 %{_mandir}/man5/shrinkwrap-json.5*
167 %{_mandir}/man7/config.7*
168 %{_mandir}/man7/developers.7*
169 %{_mandir}/man7/disputes.7*
170 %{_mandir}/man7/orgs.7*
171 %{_mandir}/man7/registry.7*
172 %{_mandir}/man7/removal.7*
173 %{_mandir}/man7/scope.7*
174 %{_mandir}/man7/scripts.7*
175 %{_mandir}/man7/semver.7*
176
177 %files -n bash-completion-%{name}
178 %defattr(644,root,root,755)
179 /etc/bash_completion.d/npm.sh
This page took 0.059985 seconds and 2 git commands to generate.