T.C. Hollingsworth af2d4f8
%{?nodejs_find_provides_and_requires}
T.C. Hollingsworth 0ee84d0
2e8ec95
Name:           nodejs-inherits
f62ae33
Version:        2.0.3
3ec65e4
Release:        2%{?dist}
2e8ec95
Summary:        A tiny simple way to do classic inheritance in js
2e8ec95
License:        WTFPL
2e8ec95
Group:          Development/Libraries
2e8ec95
URL:            https://github.com/isaacs/inherits
2e8ec95
Source0:        https://registry.npmjs.org/inherits/-/inherits-%{version}.tgz
2e8ec95
Source1:        https://raw.github.com/isaacs/inherits/112807f2670160b6e3bafdf39e395c10ae7d0fac/LICENSE
2e8ec95
BuildArch:      noarch
2e8ec95
ExclusiveArch:  %{nodejs_arches} noarch
2e8ec95
2e8ec95
BuildRequires:  nodejs-packaging
T.C. Hollingsworth 9644e6f
T.C. Hollingsworth 9644e6f
%description
T.C. Hollingsworth 9644e6f
%{summary}.
T.C. Hollingsworth 9644e6f
2e8ec95
T.C. Hollingsworth 9644e6f
%prep
T.C. Hollingsworth 9644e6f
%setup -q -n package
T.C. Hollingsworth d612f77
cp -p %{SOURCE1} LICENSE
T.C. Hollingsworth d612f77
2e8ec95
T.C. Hollingsworth 9644e6f
%build
T.C. Hollingsworth 9644e6f
#nothing to do
T.C. Hollingsworth 9644e6f
T.C. Hollingsworth 9644e6f
2e8ec95
%install
T.C. Hollingsworth 04e5fc0
mkdir -p %{buildroot}%{nodejs_sitelib}/inherits@2
T.C. Hollingsworth 04e5fc0
cp -pr inherits.js package.json %{buildroot}%{nodejs_sitelib}/inherits@2
2e8ec95
ln -sf inherits@2 %{buildroot}%{nodejs_sitelib}/inherits
T.C. Hollingsworth 9644e6f
%nodejs_symlink_deps
T.C. Hollingsworth 9644e6f
T.C. Hollingsworth 04e5fc0
2e8ec95
%check
2e8ec95
%nodejs_symlink_deps --check
f62ae33
f62ae33
# Upstream no longer includes test.js with its tarballs
f62ae33
# %__nodejs test.js
2e8ec95
T.C. Hollingsworth 9644e6f
T.C. Hollingsworth 73cf684
# there have been reports that the symlinks are messed up when upgrading
T.C. Hollingsworth 73cf684
# from older versions, so let's make sure everything's copacetic
T.C. Hollingsworth 73cf684
%triggerun -- nodejs-inherits < 2.0.0-4
T.C. Hollingsworth 73cf684
ln -sf inherits@2 %{nodejs_sitelib}/inherits
T.C. Hollingsworth 73cf684
%{__python} <
T.C. Hollingsworth 0c2fbc0
import json, os, sys
T.C. Hollingsworth 73cf684
T.C. Hollingsworth 73cf684
for moddir in os.listdir('%{nodejs_sitelib}'):
T.C. Hollingsworth 73cf684
    if os.path.isdir(moddir):
T.C. Hollingsworth 73cf684
        md = json.load(open(os.path.join(moddir, 'package.json')))
T.C. Hollingsworth 73cf684
        
T.C. Hollingsworth 73cf684
        if 'dependencies' in md and 'inherits' in md['dependencies']:
T.C. Hollingsworth 73cf684
            if isinstance(md['dependencies'], dict) and '1' in md['dependencies']['inherits']:
T.C. Hollingsworth 73cf684
                src = os.path.join('%{nodejs_sitelib}', 'inherits@1')
T.C. Hollingsworth 73cf684
            else:
T.C. Hollingsworth 73cf684
                src = os.path.join('%{nodejs_sitelib}', 'inherits@2')
T.C. Hollingsworth 73cf684
                
T.C. Hollingsworth 73cf684
            dest = os.path.join('%{nodejs_sitelib}', moddir, 'node_modules/inherits')
T.C. Hollingsworth 73cf684
            
T.C. Hollingsworth 73cf684
            if not os.path.realpath(dest) == src:
T.C. Hollingsworth 73cf684
                try:
T.C. Hollingsworth 73cf684
                    os.unlink(dest)
T.C. Hollingsworth 73cf684
                except OSError:
T.C. Hollingsworth 73cf684
                    pass
T.C. Hollingsworth 73cf684
                    
T.C. Hollingsworth 73cf684
                try:
T.C. Hollingsworth 73cf684
                    os.symlink(src, dest)
T.C. Hollingsworth 73cf684
                except OSError, e:
T.C. Hollingsworth 73cf684
                    sys.stderr.write(e + '\n')
T.C. Hollingsworth 73cf684
EOF
T.C. Hollingsworth 73cf684
2e8ec95
T.C. Hollingsworth 04e5fc0
# rpm blows up if you try to replace a dir with a symlink or vice-versa
T.C. Hollingsworth 4060095
%pretrans -p <lua>
T.C. Hollingsworth fd3e30c
if posix.stat("%{nodejs_sitelib}/inherits", "type") == "directory" then
T.C. Hollingsworth fd3e30c
    os.rename('%{nodejs_sitelib}/inherits', '%{nodejs_sitelib}/inherits@2')
T.C. Hollingsworth fd3e30c
end
T.C. Hollingsworth 4060095
2e8ec95
T.C. Hollingsworth 9644e6f
%files
2e8ec95
%doc README.md
2e8ec95
%license LICENSE
T.C. Hollingsworth 04e5fc0
%{nodejs_sitelib}/inherits@2
T.C. Hollingsworth 9644e6f
%{nodejs_sitelib}/inherits
2e8ec95
T.C. Hollingsworth 9644e6f
T.C. Hollingsworth 9644e6f
%changelog
3ec65e4
* Wed Jul 26 2017 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.3-2
3ec65e4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
3ec65e4
f62ae33
* Tue May 30 2017 Stephen Gallagher <sgallagh@redhat.com> - 2.0.3-1
f62ae33
- Update to upstream 2.0.3 release
f62ae33
- Reduces package size and adds a safe import check
f62ae33
- Upstream tests are no longer shipped in the tarball, so they won't be run
f62ae33
e5401c8
* Fri Feb 10 2017 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.1-9
e5401c8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
e5401c8
238e0d0
* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.1-8
238e0d0
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
238e0d0
2e8ec95
* Tue Jan 26 2016 Tom Hughes <tom@compton.nu> - 2.0.1-7
2e8ec95
- Cleanup spec file, removing %%defattr and enabling tests
2e8ec95
5c30e86
* Wed Jun 17 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.0.1-6
5c30e86
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
5c30e86
d2d97a1
* Sun Oct 26 2014 Tom Hughes <tom@compton.nu> - 2.0.1-5
d2d97a1
- update to 2.0.1 upstream release
d2d97a1
78cf6df
* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.0.0-5
78cf6df
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
78cf6df
T.C. Hollingsworth 73cf684
* Fri Aug 16 2013 T.C. Hollingsworth <tchollingsworth@gmail.com> - 2.0.0-4
T.C. Hollingsworth 73cf684
- add some post-install hackery to work around potential RPM bug resulting in
T.C. Hollingsworth 73cf684
  symlinks still pointing to their old locations on upgrade (RHBZ#997978)
T.C. Hollingsworth 73cf684
286c595
* Sat Aug 03 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.0.0-4
286c595
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
286c595
T.C. Hollingsworth fd3e30c
* Sat Jul 06 2013 T.C. Hollingsworth <tchollingsworth@gmail.com> - 2.0.0-3
T.C. Hollingsworth fd3e30c
- only run the hack when we really need to
T.C. Hollingsworth fd3e30c
T.C. Hollingsworth 4060095
* Sat Jul 06 2013 T.C. Hollingsworth <tchollingsworth@gmail.com> - 2.0.0-2
T.C. Hollingsworth 4060095
- use lua for pretrans
T.C. Hollingsworth 4060095
T.C. Hollingsworth e888f21
* Sun Jun 23 2013 T.C. Hollingsworth <tchollingsworth@gmail.com> - 2.0.0-1
T.C. Hollingsworth e888f21
- new upstream release 2.0.0
T.C. Hollingsworth d612f77
- include license file
T.C. Hollingsworth 04e5fc0
- follow the mutiple version spec
T.C. Hollingsworth e888f21
T.C. Hollingsworth 2bac236
* Sun Jun 23 2013 T.C. Hollingsworth <tchollingsworth@gmail.com> - 1.0.0-9
T.C. Hollingsworth 2bac236
- restrict to compatible arches
T.C. Hollingsworth 2bac236
T.C. Hollingsworth 0ee84d0
* Mon Apr 15 2013 T.C. Hollingsworth <tchollingsworth@gmail.com> - 1.0.0-8
T.C. Hollingsworth 0ee84d0
- add macro for EPEL6 dependency generation
T.C. Hollingsworth 0ee84d0
958b4be
* Thu Feb 14 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.0.0-7
958b4be
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild
958b4be
T.C. Hollingsworth 9644e6f
* Tue Jan 08 2013 T.C. Hollingsworth <tchollingsworth@gmail.com> - 1.0.0-6
T.C. Hollingsworth 9644e6f
- add missing build section
T.C. Hollingsworth 9644e6f
T.C. Hollingsworth 9644e6f
* Thu Jan 03 2013 T.C. Hollingsworth <tchollingsworth@gmail.com> - 1.0.0-5
T.C. Hollingsworth 9644e6f
- correct license tag (thanks to Robin Lee)
T.C. Hollingsworth 9644e6f
T.C. Hollingsworth 9644e6f
* Mon Dec 31 2012 T.C. Hollingsworth <tchollingsworth@gmail.com> - 1.0.0-4
T.C. Hollingsworth 9644e6f
- clean up for submission
T.C. Hollingsworth 9644e6f
T.C. Hollingsworth 9644e6f
* Fri Apr 27 2012 T.C. Hollingsworth <tchollingsworth@gmail.com> - 1.0.0-3
T.C. Hollingsworth 9644e6f
- guard Requires for F17 automatic depedency generation
T.C. Hollingsworth 9644e6f
T.C. Hollingsworth 9644e6f
* Sat Feb 11 2012 T.C. Hollingsworth <tchollingsworth@gmail.com> - 1.0.0-2
T.C. Hollingsworth 9644e6f
- switch to automatically generated provides/requires
T.C. Hollingsworth 9644e6f
T.C. Hollingsworth 9644e6f
* Sat Jan 21 2012 T.C. Hollingsworth <tchollingsworth@gmail.com> - 1.0.0-1
T.C. Hollingsworth 9644e6f
- initial package