Blame SPECS/nodejs-inherits.spec

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