#4 Clean up the spec file
Merged 4 years ago by jsmith. Opened 4 years ago by jstanek.
rpms/ jstanek/uglify-js private/pr/spec-cleanup  into  master

file modified
+17 -25
@@ -1,39 +1,26 @@ 

  %{?nodejs_find_provides_and_requires}

  

  #enable/disable tests in case the deps aren't there

- %global enable_tests 1

- 

- %if 0%{?fedora}

- %global installdir  %{_jsdir}

- %else

- %global installdir  %{_datadir}/javascript

- %endif

+ %bcond_without tests

  

  Name:           uglify-js

  Version:        2.8.22

- Release:        7%{?dist}

+ Release:        8%{?dist}

  Summary:        JavaScript parser, mangler/compressor and beautifier toolkit

  License:        BSD

  URL:            https://github.com/mishoo/UglifyJS2

  Source0:        https://github.com/mishoo/UglifyJS2/archive/v%{version}/uglify-js-%{version}.tar.gz

  Patch0:         uglify-js-esfuzz.patch

  

- BuildArch:  noarch

- %if 0%{?fedora} >= 19

+ BuildArch:      noarch

  ExclusiveArch:  %{nodejs_arches} noarch

- %else

- ExclusiveArch:  %{ix86} x86_64 %{arm} noarch

- %endif

  

  Provides:       nodejs-uglify-js = %{version}-%{release}

  

  BuildRequires:  nodejs-packaging

- 

- %if 0%{?fedora}

  BuildRequires:  web-assets-devel

- %endif

  

- %if 0%{?enable_tests}

+ %if %{with tests}

  BuildRequires:  npm(acorn)

  BuildRequires:  npm(async)

  BuildRequires:  npm(mocha)
@@ -79,9 +66,9 @@ 

  %install

  rm -rf %buildroot

  

- mkdir -p %{buildroot}%{installdir}/%{name}-2

- cp -pr lib/* %{buildroot}%{installdir}/%{name}-2

- ln -sf %{name}-2 %{buildroot}%{installdir}/%{name}

+ mkdir -p %{buildroot}%{_jsdir}/%{name}-2

+ cp -pr lib/* %{buildroot}%{_jsdir}/%{name}-2

+ ln -sf %{name}-2 %{buildroot}%{_jsdir}/%{name}

  

  #compat symlink

  mkdir -p %{buildroot}%{_datadir}
@@ -89,7 +76,7 @@ 

  

  mkdir -p %{buildroot}%{nodejs_sitelib}/uglify-js@2

  cp -pr bin tools package.json %{buildroot}%{nodejs_sitelib}/uglify-js@2

- ln -sf %{installdir}/%{name} %{buildroot}%{nodejs_sitelib}/uglify-js@2/lib

+ ln -sf %{_jsdir}/%{name} %{buildroot}%{nodejs_sitelib}/uglify-js@2/lib

  # Fix for rpmlint.

  sed -i -e 's|^#! */usr/bin/env node|#!/usr/bin/node|' \

    %{buildroot}%{nodejs_sitelib}/uglify-js@2/bin/*
@@ -105,12 +92,12 @@ 

  %check

  %nodejs_symlink_deps --check

  %{__nodejs} -e 'require("./")'

- %if 0%{?enable_tests}

+ %if %{with tests}

  # Prevent timeout error on an ARM builder which is slower than the x86 builder.

  sed -i '/timeout/ s/5000/10000/' test/mocha/cli.js

  sed -i '/timeout/ s/10000/20000/' test/mocha/let.js

  sed -i '/timeout/ s/20000/40000/' test/mocha/spidermonkey.js

- %__nodejs test/run-tests.js

+ NODE_DISABLE_COLORS=true %{__nodejs} test/run-tests.js

  %endif

  

  
@@ -135,14 +122,19 @@ 

  

  

  %files -n js-uglify

- %{installdir}/%{name}-2

- %{installdir}/%{name}

+ %{_jsdir}/%{name}-2

+ %{_jsdir}/%{name}

  %{_datadir}/%{name}

  %doc README.md

  %license LICENSE

  

  

  %changelog

+ * Wed Jan 22 2020 Jan Staněk <jstanek@redhat.com> - 2.8.22-8

+ - Remove unneeded legacy conditionals around %%{nodejs_arches} and %%{_jsdir}

+ - Disable colors in tests

+ - Use %%bcond_without for conditional compilation

+ 

  * Sat Jul 27 2019 Fedora Release Engineering <releng@fedoraproject.org> - 2.8.22-7

  - Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild

  

This is a polished version of PR#1, and a port of specfile changes from downstream (EL 8).

The main changes are:
1. Remove no longer needed conditionals around %{nodejs_arches} and %{_jsdir} macros (just assume they are defined).
2. Use %bcond_without for controlling the conditional compilation.

For better separation of concerns, the PR consists of several small commits, but I can squash them together if asked.

Pull-Request has been merged by jsmith

4 years ago