From 8f8ca7f979d29bc776450003aeeda849febae98a Mon Sep 17 00:00:00 2001 From: webbuilder_pel7x64builder0 Date: Wed, 6 Nov 2019 08:01:44 +0100 Subject: [PATCH] nodejs-yarn package creation Signed-off-by: webbuilder_pel7x64builder0 --- SOURCES/README.Fedora.md | 16 +++++ SOURCES/yarn-tarball.sh | 7 +++ SPECS/nodejs-yarn.spec | 122 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 145 insertions(+) create mode 100644 SOURCES/README.Fedora.md create mode 100644 SOURCES/yarn-tarball.sh create mode 100644 SPECS/nodejs-yarn.spec diff --git a/SOURCES/README.Fedora.md b/SOURCES/README.Fedora.md new file mode 100644 index 0000000..bc3ecc1 --- /dev/null +++ b/SOURCES/README.Fedora.md @@ -0,0 +1,16 @@ +Usage +===== + +To use yarn in Fedora, you need to use +`nodejs-yarn` and `yarnpkg` commands. + + $ nodejs-yarn help + $ yarnpkg help + +This is because of conflicts with other +packages providing yarn. + +If you wish to use yarn command, +you can use an alias in your .bashrc. + + alias yarn='nodejs-yarn' diff --git a/SOURCES/yarn-tarball.sh b/SOURCES/yarn-tarball.sh new file mode 100644 index 0000000..92dd1f5 --- /dev/null +++ b/SOURCES/yarn-tarball.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +version=$(rpm -q --specfile --qf='%{version}\n' nodejs-yarn.spec | head -n1) +wget https://github.com/yarnpkg/yarn/archive/v$version.tar.gz +tar -zxf v$version.tar.gz +cd yarn-$version +npm install && cd .. && tar -zcf yarn-v$version-bundled.tar.gz yarn-$version diff --git a/SPECS/nodejs-yarn.spec b/SPECS/nodejs-yarn.spec new file mode 100644 index 0000000..f0e1c5a --- /dev/null +++ b/SPECS/nodejs-yarn.spec @@ -0,0 +1,122 @@ +%global npm_name yarn +# name yarn would probably confict with cmdtest and hadoop-yarn +# https://bugzilla.redhat.com/show_bug.cgi?id=1507312 +%global fc_name nodejs-yarn + +%{?nodejs_find_provides_and_requires} + +%global enable_tests 1 + +# don't require bundled modules +%global __requires_exclude_from ^%{_prefix}/lib/node_modules/yarn/.*$ + +Name: nodejs-yarn +Version: 1.13.0 +Release: 3%{?dist} +Summary: Fast, reliable, and secure dependency management. +Url: https://github.com/yarnpkg/yarn +# we need tarball with node_modules +Source0: %{npm_name}-v%{version}-bundled.tar.gz +Source1: yarn-tarball.sh +# Clarify the usage of renamed binaries +Source10: README.Fedora.md +License: BSD + +BuildArch: noarch +ExclusiveArch: %{nodejs_arches} noarch + +BuildRequires: nodejs-packaging +BuildRequires: npm +Requires: nodejs + +%description +Fast, reliable, and secure dependency management. + +%prep +%setup -q -n %{npm_name}-%{version} + +cp %{SOURCE10} . + +%build +# use build script +npm run build + +# remove build dependencies from node_modules +npm prune --production + +%install +mkdir -p %{buildroot}%{nodejs_sitelib}/%{npm_name} + +cp -pr package.json lib bin node_modules \ + %{buildroot}%{nodejs_sitelib}/%{npm_name} + +mkdir -p %{buildroot}%{_bindir} +ln -sf ../lib/node_modules/yarn/bin/yarn.js %{buildroot}%{_bindir}/nodejs-yarn +ln -sf ../lib/node_modules/yarn/bin/yarn.js %{buildroot}%{_bindir}/yarnpkg + +# Remove executable bits from bundled dependency tests +find %{buildroot}%{nodejs_sitelib}/%{npm_name}/node_modules \ + -ipath '*/test/*' -type f -executable \ + -exec chmod -x '{}' + + +#%{nodejs_symlink_deps} + +%if 0%{?enable_tests} +%check +%nodejs_symlink_deps --check +if [[ $(%{buildroot}/%{_bindir}/nodejs-yarn --version) == %{version} ]] ; then echo PASS; else echo FAIL; fi +if [[ $(%{buildroot}/%{_bindir}/yarnpkg --version) == %{version} ]] ; then echo PASS; else echo FAIL; fi +%endif + + +%files +%{nodejs_sitelib}/yarn +%{_bindir}/nodejs-yarn +%{_bindir}/yarnpkg +%doc README.md README.Fedora.md +%license LICENSE + +%changelog +* Thu Jul 25 2019 Fedora Release Engineering - 1.13.0-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild + +* Wed Feb 13 2019 Jan Staněk - 1.13.0-2 +- Remove executable bits from bundled tests +- Related: rhbz#1674073 + +* Thu Feb 07 2019 Zuzana Svetlikova - 1.13.0-1 +- Update + +* Fri Feb 01 2019 Fedora Release Engineering - 1.9.2-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild + +* Mon Jul 30 2018 Zuzana Svetlikova - 1.9.2-1 +- Update to 1.9.2 + +* Fri Jul 13 2018 Fedora Release Engineering - 1.7.0-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild + +* Thu May 24 2018 Zuzana Svetlikova - 1.7.0-1 +- Update to 1.7.0 + +* Wed May 09 2018 Zuzana Svetlikova - 1.6.0-1 +- Rebase, rebuild with new packaging + +* Wed Mar 21 2018 Zuzana Svetlikova - 1.5.1-2 +- Add requires_exclude_from macro +- rename nodejs-yarnpkg to yarn + +* Wed Mar 21 2018 Zuzana Svetlikova - 1.5.1-1 +- Rebase + +* Tue Jan 30 2018 Zuzana Svetlikova - 1.4.1-1 +- rebase +- package from GH, build with npm + +* Tue Dec 05 2017 Zuzana Svetlikova - 1.3.2-2 +- Add fedora readme so users are able to find renamed commands +- change source url +- rename license according to guidelines + +* Mon Nov 27 2017 Zuzana Svetlikova - 1.3.2-1 +- Initial build