Skip to content

Instantly share code, notes, and snippets.

@kazuhisya
Created July 29, 2011 08:43
Show Gist options
  • Save kazuhisya/1113454 to your computer and use it in GitHub Desktop.
Save kazuhisya/1113454 to your computer and use it in GitHub Desktop.
npm rpm spec
Name: npm
Version: 1.0.93
Release: 1%{?dist}
Summary: A package manager for Node.js
Packager: Kazuhisa Hara <[email protected]>
Group: Development/Libraries
License: MIT License
URL: http://npmjs.org/
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
Source0: npm-%{version}.tgz
BuildRequires: nodejs
Requires: nodejs
BuildArch: noarch
%description
NPM is a package manager for Node.js.
You can use it to install and publish your node programs.
It manages dependencies and does other cool stuff.
%prep
%setup -q -c
install_module() {
tar --transform "s|^package|node_modules/$1|g" --show-transformed -zxf $2
}
%build
%install
cd package
rm -rf $RPM_BUILD_ROOT
npm_config_prefix=$RPM_BUILD_ROOT/usr \
npm_config_root=$RPM_BUILD_ROOT/usr/lib/node \
npm_config_binroot=$RPM_BUILD_ROOT%{_bindir} \
npm_config_manroot=$RPM_BUILD_ROOT%{_mandir} \
node ./cli.js install -g
# workaround for automatically compresses manfile
custom_mandir_1=$RPM_BUILD_ROOT%{_mandir}/man1
rm -rf $RPM_BUILD_ROOT%{_mandir}
mkdir -p $RPM_BUILD_ROOT%{_mandir}
cp -rf $RPM_BUILD_ROOT/usr/lib/node_modules/npm/man/man1 $RPM_BUILD_ROOT%{_mandir}
cd ${custom_mandir_1}
for manfile in *; do mv -i $manfile `echo $manfile | sed 's/^/npm_/'`; done
mv npm_npm.1 npm.1
custom_mandir_3=$RPM_BUILD_ROOT%{_mandir}/man3
cp -rf $RPM_BUILD_ROOT/usr/lib/node_modules/npm/man/man3 $RPM_BUILD_ROOT%{_mandir}
cd ${custom_mandir_3}
for manfile in *; do mv -i $manfile `echo $manfile | sed 's/^/npm_/'`; done
%files
%defattr(-,root,root,-)
%{_prefix}/lib/node_modules/npm
%{_bindir}/npm*
%{_mandir}/man1/*
%{_mandir}/man3/*
%clean
rm -rf $RPM_BUILD_ROOT
%post
# This section is the workaround does not work properly npm install.
/usr/bin/npm config set registry http://registry.npmjs.org/
%changelog
* Tue Oct 4 2011 Kazuhisa Hara <[email protected]>
- Updated to mpn version 1.0.93
* Tue Oct 4 2011 Kazuhisa Hara <[email protected]>
- Updated to mpn version 1.0.92
* Tue Oct 4 2011 Kazuhisa Hara <[email protected]>
- Updated to mpn version 1.0.91
* Mon Oct 3 2011 Kazuhisa Hara <[email protected]>
- Updated to mpn version 1.0.90
* Sun Sep 18 2011 Kazuhisa Hara <[email protected]>
- Updated to mpn version 1.0.30
* Thu Sep 1 2011 Kazuhisa Hara <[email protected]>
- Fixed manfile
* Fri Aug 26 2011 Kazuhisa Hara <[email protected]>
- Updated to mpn version 1.0.27
* Thu Aug 18 2011 Kazuhisa Hara <[email protected]>
- Updated to mpn version 1.0.26
* Wed Aug 17 2011 Kazuhisa Hara <[email protected]>
- Updated to mpn version 1.0.25
* Mon Aug 15 2011 Kazuhisa Hara <[email protected]>
- Updated to mpn version 1.0.24
- Added workaround does not work properly npm install
* Mon Aug 8 2011 Kazuhisa Hara <[email protected]>
- Updated to mpn version 1.0.23
* Fri Jul 29 2011 Kazuhisa Hara <[email protected]>
- Initial version
@mlazarov
Copy link

From where to get npm-1.0.25.tgz file?

@kazuhisya
Copy link
Author

@mlazarov You can find it from the following URL: http://search.npmjs.org/#/npm

@mlazarov
Copy link

It seems that with this spec file symlinks made for man1 pages doesn't work.

@kazuhisya
Copy link
Author

Hi @mlazarov
Thank you for your feedback!
Problem is that they automatically compresses manfile, therefore I added a workaround for that time.
but this workaround is not cool... have any ideas?

@kazuhisya
Copy link
Author

This is initial npm rpm spec codes. Current codes are moved to https://github.com/kazuhisya/npm-rpm .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment