Blame SPECS/nodejs-inherits.spec

60b07d
%{?scl:%scl_package nodejs-inherits}
60b07d
%{!?scl:%global pkg_name %{name}}
60b07d
%{?nodejs_find_provides_and_requires}
60b07d
60b07d
Name:       %{?scl_prefix}nodejs-inherits
60b07d
Version:    2.0.0
3e4103
Release:    16%{?dist}
60b07d
Summary:    A tiny simple way to do classic inheritance in js
60b07d
License:    WTFPL
60b07d
Group:      Development/Libraries
60b07d
URL:        https://github.com/isaacs/inherits
60b07d
Source0:    http://registry.npmjs.org/inherits/-/inherits-%{version}.tgz
60b07d
Source1:    https://raw.github.com/isaacs/inherits/112807f2670160b6e3bafdf39e395c10ae7d0fac/LICENSE
60b07d
BuildRoot:  %{_tmppath}/%{pkg_name}-%{version}-%{release}-root-%(%{__id_u} -n)
60b07d
BuildArch:  noarch
60b07d
ExclusiveArch: %{nodejs_arches} noarch
60b07d
60b07d
BuildRequires:  %{?scl_prefix}nodejs-devel
60b07d
60b07d
%description
60b07d
%{summary}.
60b07d
60b07d
%prep
60b07d
%setup -q -n package
60b07d
60b07d
#copy the license into %%{_builddir} so it works with %%doc
60b07d
cp -p %{SOURCE1} LICENSE
60b07d
60b07d
%build
60b07d
#nothing to do
60b07d
60b07d
%install
60b07d
rm -rf %{buildroot}
60b07d
60b07d
mkdir -p %{buildroot}%{nodejs_sitelib}/inherits
60b07d
cp -pr inherits.js package.json %{buildroot}%{nodejs_sitelib}/inherits
60b07d
60b07d
%nodejs_symlink_deps
60b07d
60b07d
ln -sf inherits %{buildroot}%{nodejs_sitelib}/inherits@2
60b07d
60b07d
%clean
60b07d
rm -rf %{buildroot}
60b07d
60b07d
# there have been reports that the symlinks are messed up when upgrading
60b07d
# from older versions, so let's make sure everything's copacetic
60b07d
%triggerun -- nodejs-inherits < 2.0.0-4
60b07d
ln -sf inherits@2 %{nodejs_sitelib}/inherits
60b07d
%{__python} <
60b07d
import json, os, sys
60b07d
60b07d
for moddir in os.listdir('%{nodejs_sitelib}'):
60b07d
    if os.path.isdir(moddir):
60b07d
        md = json.load(open(os.path.join(moddir, 'package.json')))
60b07d
        
60b07d
        if 'dependencies' in md and 'inherits' in md['dependencies']:
60b07d
            if isinstance(md['dependencies'], dict) and '1' in md['dependencies']['inherits']:
60b07d
                src = os.path.join('%{nodejs_sitelib}', 'inherits@1')
60b07d
            else:
60b07d
                src = os.path.join('%{nodejs_sitelib}', 'inherits@2')
60b07d
               
60b07d
            dest = os.path.join('%{nodejs_sitelib}', moddir, 'inherits')
60b07d
            
60b07d
            if not os.path.realpath(dest) == src:
60b07d
                try:
60b07d
                    os.unlink(dest)
60b07d
                except OSError:
60b07d
                    pass
60b07d
                    
60b07d
                try:
60b07d
                    os.symlink(src, dest)
60b07d
                except OSError, e:
60b07d
                    sys.stderr.write(e + '\n')
60b07d
EOF
60b07d
60b07d
# rpm blows up if you try to replace a dir with a symlink or vice-versa
60b07d
#%%pretrans -p <lua>
60b07d
#if posix.stat("%{nodejs_sitelib}/inherits", "type") == "directory" then
60b07d
#    os.rename('%{nodejs_sitelib}/inherits', '%{nodejs_sitelib}/inherits@2')
60b07d
#end
60b07d
60b07d
%files
60b07d
%defattr(-,root,root,-)
60b07d
%{nodejs_sitelib}/inherits@2
60b07d
%{nodejs_sitelib}/inherits
60b07d
%doc README.md LICENSE
60b07d
60b07d
%changelog
3e4103
* Mon May 28 2018 Zuzana Svetlikova <zsvetlik@redhat.com> - 2.0.0-16
3e4103
- Resolves: RHBZ#1543198, rebuild for multiarch
3e4103
60b07d
* Sun Feb 14 2016 Zuzana Svetlikova <zsvetlik@redhat.com> - 2.0.0-15
60b07d
- rebuilt
60b07d
60b07d
* Sat Feb 13 2016 Zuzana Svetlikova <zsvetlik@redhat.com> - 2.0.0-14
60b07d
- rebuilt
60b07d
60b07d
* Tue Feb 09 2016 Tomas Hrcka <thrcka@redhat.com> - 2.0.0-13
60b07d
- Fix simlink issues
60b07d
60b07d
* Fri Oct 23 2015 Zuzana Svetlikova <zsvetlik@redhat.com> - 2.0.0-10
60b07d
- Rebuilt
60b07d
60b07d
* Thu Oct 15 2015 Zuzana Svetlikova <zsvetlik@redhat.com> - 2.0.0-9
60b07d
- Fix bad indentation in python script
60b07d
60b07d
* Wed Oct 14 2015 Zuzana Svetlikova <zsvetlik@redhat.com> - 2.0.0-8
60b07d
- Rebuild
60b07d
60b07d
* Fri Oct 09 2015 Zuzana Svetlikova <zsvetlik@redhat.com> - 2.0.0-7
60b07d
- Enable multiversioning (BZ#1268882)
60b07d
60b07d
* Wed Mar 05 2014 Tomas Hrcka <thrcka@redhat.com> - 2.0.0-6
60b07d
- Disable multiversion inherits
60b07d
60b07d
* Thu Oct 17 2013 Tomas Hrcka <thrcka@redhat.com> - 2.0.0-5
60b07d
- replace provides and requires with macro
60b07d
60b07d
* Fri Aug 16 2013 T.C. Hollingsworth <tchollingsworth@gmail.com> - 2.0.0-4
60b07d
- add some post-install hackery to work around potential RPM bug resulting in
60b07d
  symlinks still pointing to their old locations on upgrade (RHBZ#997978)
60b07d
60b07d
* Sat Aug 03 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.0.0-4
60b07d
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
60b07d
60b07d
* Sat Jul 06 2013 T.C. Hollingsworth <tchollingsworth@gmail.com> - 2.0.0-3
60b07d
- only run the hack when we really need to
60b07d
60b07d
* Sat Jul 06 2013 T.C. Hollingsworth <tchollingsworth@gmail.com> - 2.0.0-2
60b07d
- use lua for pretrans
60b07d
60b07d
* Sun Jun 23 2013 T.C. Hollingsworth <tchollingsworth@gmail.com> - 2.0.0-1
60b07d
- new upstream release 2.0.0
60b07d
- include license file
60b07d
- follow the mutiple version spec
60b07d
60b07d
* Sun Jun 23 2013 T.C. Hollingsworth <tchollingsworth@gmail.com> - 1.0.0-9
60b07d
- restrict to compatible arches
60b07d
60b07d
* Mon Apr 15 2013 T.C. Hollingsworth <tchollingsworth@gmail.com> - 1.0.0-8
60b07d
- add macro for EPEL6 dependency generation
60b07d
60b07d
* Thu Apr 11 2013 Stanislav Ochotnicky <sochotnicky@redhat.com> - 1.0.0-8
60b07d
- Add support for software collections
60b07d
60b07d
* Thu Feb 14 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.0.0-7
60b07d
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild
60b07d
60b07d
* Tue Jan 08 2013 T.C. Hollingsworth <tchollingsworth@gmail.com> - 1.0.0-6
60b07d
- add missing build section
60b07d
60b07d
* Thu Jan 03 2013 T.C. Hollingsworth <tchollingsworth@gmail.com> - 1.0.0-5
60b07d
- correct license tag (thanks to Robin Lee)
60b07d
60b07d
* Mon Dec 31 2012 T.C. Hollingsworth <tchollingsworth@gmail.com> - 1.0.0-4
60b07d
- clean up for submission
60b07d
60b07d
* Fri Apr 27 2012 T.C. Hollingsworth <tchollingsworth@gmail.com> - 1.0.0-3
60b07d
- guard Requires for F17 automatic depedency generation
60b07d
60b07d
* Sat Feb 11 2012 T.C. Hollingsworth <tchollingsworth@gmail.com> - 1.0.0-2
60b07d
- switch to automatically generated provides/requires
60b07d
60b07d
* Sat Jan 21 2012 T.C. Hollingsworth <tchollingsworth@gmail.com> - 1.0.0-1
60b07d
- initial package