]> git.pld-linux.org Git - packages/npm.git/blob - npm.spec
70f605b8ca3377b35b6f1d014ebf5bd2fc85d76d
[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 # build package without bundled node-gyp module
7 %bcond_without  bundled_gyp
8
9 Summary:        A package manager for node.js
10 Name:           npm
11 Version:        6.9.0
12 Release:        1
13 License:        Artistic-2.0
14 Group:          Development/Libraries
15 Source0:        http://registry.npmjs.org/npm/-/%{name}-%{version}.tgz
16 # Source0-md5:  37d19666ae627bc5f8acdab48a8a0eed
17 Patch0:         link-globalPaths.patch
18 Patch1:         cmd-shim-optional.patch
19 URL:            http://npmjs.org/
20 BuildRequires:  bash
21 BuildRequires:  nodejs >= 0.9
22 BuildRequires:  rpmbuild(macros) >= 1.634
23 BuildRequires:  sed >= 4.0
24 Requires:       nodejs
25 %if %{without bundled_gyp}
26 Suggests:       nodejs-gyp
27 Conflicts:      nodejs-gyp < 3.5.0
28 Conflicts:      nodejs-gyp >= 3.4.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 %package -n bash-completion-%{name}
39 Summary:        bash-completion for %{name}
40 Summary(pl.UTF-8):      bashowe uzupełnianie nazw dla %{name}
41 Group:          Applications/Shells
42 Requires:       %{name}
43 Requires:       bash-completion
44
45 %description -n bash-completion-%{name}
46 bash-completion for %{name}.
47
48 %description -n bash-completion-%{name} -l pl.UTF-8
49 bashowe uzupełnianie nazw dla %{name}.
50
51 %prep
52 %setup -qc
53 mv package/* .
54 %patch0 -p1
55 %patch1 -p1
56
57 # fix shebangs
58 %{__sed} -i -e '1s,^#!.*node,#!/usr/bin/node,' \
59         bin/npm-cli.js \
60         bin/npx-cli.js
61
62 # startup helpers we don't need
63 rm bin/npm bin/npm.cmd
64
65 # clean up node_modules/
66 for i in README.markdown LICENSE \
67         .npmignore .travis.yml test examples example samples; do
68         find node_modules -name $i -print0 | sort -rz | xargs -0r rm -rv
69 done
70 find node_modules -name \*.md -print0 -exec rm -v {} \;
71 rm lib/fetch-package-metadata.md
72
73 %build
74 # forces npm to keep config files in /etc instead of /usr/etc
75 ./configure \
76         --globalconfig=%{_sysconfdir}/npmrc \
77         --globalignorefile=%{_sysconfdir}/npmignore
78
79 cat npmrc
80
81 %install
82 rm -rf $RPM_BUILD_ROOT
83 install -d $RPM_BUILD_ROOT{%{_bindir},%{nodejs_libdir}/npm/bin,/etc/bash_completion.d}
84 install -d $RPM_BUILD_ROOT%{nodejs_libdir}/npm/bin
85
86 cp -a lib npmrc package.json $RPM_BUILD_ROOT%{nodejs_libdir}/npm
87 cp -p bin/*.js $RPM_BUILD_ROOT%{nodejs_libdir}/npm/bin
88 ln -s %{nodejs_libdir}/npm/bin/npm-cli.js $RPM_BUILD_ROOT%{_bindir}/npm
89 ln -s %{nodejs_libdir}/npm/bin/npx-cli.js $RPM_BUILD_ROOT%{_bindir}/npx
90
91 %if %{without bundled_gyp}
92 rm -r node_modules/node-gyp
93 %endif
94 cp -r node_modules $RPM_BUILD_ROOT%{nodejs_libdir}/npm/
95
96 # for npm help
97 install -d $RPM_BUILD_ROOT%{nodejs_libdir}/npm/doc
98 cp -a doc/* $RPM_BUILD_ROOT%{nodejs_libdir}/npm/doc
99
100 # ghosted global config files
101 # TODO: package as files to have file permissions set
102 install -d $RPM_BUILD_ROOT%{_sysconfdir}
103 cp -p npmrc $RPM_BUILD_ROOT%{_sysconfdir}/npmrc
104 touch $RPM_BUILD_ROOT%{_sysconfdir}/npmignore
105
106 # install to mandir
107 install -d $RPM_BUILD_ROOT%{_mandir}
108 cp -pr man/* $RPM_BUILD_ROOT%{_mandir}
109
110 # FIXME: "npm help" requires this
111 ln -s %{_mandir} $RPM_BUILD_ROOT%{nodejs_libdir}/npm/man
112
113 mv $RPM_BUILD_ROOT%{nodejs_libdir}/npm/lib/utils/completion.sh \
114         $RPM_BUILD_ROOT/etc/bash_completion.d/%{name}.sh
115
116 %clean
117 rm -rf $RPM_BUILD_ROOT
118
119 %files
120 %defattr(644,root,root,755)
121 %doc AUTHORS LICENSE README.md
122 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/npmrc
123 %ghost %{_sysconfdir}/npmignore
124 %attr(755,root,root) %{_bindir}/npm
125 %attr(755,root,root) %{_bindir}/npx
126 %dir %{nodejs_libdir}/npm
127 %{nodejs_libdir}/npm/package.json
128 %{nodejs_libdir}/npm/npmrc
129
130 %dir %{nodejs_libdir}/npm/bin
131 %attr(755,root,root) %{nodejs_libdir}/npm/bin/npm-cli.js
132 %attr(755,root,root) %{nodejs_libdir}/npm/bin/npx-cli.js
133 %dir %{nodejs_libdir}/npm/lib
134 %{nodejs_libdir}/npm/lib/*.js
135 %{nodejs_libdir}/npm/lib/auth
136 %{nodejs_libdir}/npm/lib/config
137 %{nodejs_libdir}/npm/lib/doctor
138 %{nodejs_libdir}/npm/lib/install
139 %{nodejs_libdir}/npm/lib/search
140 %{nodejs_libdir}/npm/lib/utils
141 %{nodejs_libdir}/npm/node_modules
142
143 # man symlink
144 %{nodejs_libdir}/npm/man
145
146 %dir %{nodejs_libdir}/npm/doc
147 %{nodejs_libdir}/npm/doc/cli
148 %{nodejs_libdir}/npm/doc/files
149 %{nodejs_libdir}/npm/doc/misc
150 %{nodejs_libdir}/npm/doc/spec
151
152 %{_mandir}/man1/npm*
153 %{_mandir}/man1/npx*
154 %{_mandir}/man5/npm*
155 %{_mandir}/man5/package.json.5*
156 %{_mandir}/man5/package-lock.json.5*
157 %{_mandir}/man7/npm*
158 %{_mandir}/man7/removing-npm.7*
159 %{_mandir}/man7/semver.7*
160
161 %files -n bash-completion-%{name}
162 %defattr(644,root,root,755)
163 /etc/bash_completion.d/npm.sh
This page took 0.083426 seconds and 2 git commands to generate.