rubygem-nokogiri/rubygem-nokogiri.spec

157 lines
4.6 KiB
RPMSpec
Raw Normal View History

2020-08-28 12:06:27 +08:00
%global mainver 1.10.5
%global mainrel 1
2020-08-29 16:56:45 +08:00
%global prerpmver %(echo "%{?prever}" | sed -e 's|\\.||g')
2020-08-28 12:06:27 +08:00
%global gem_name nokogiri
2020-08-29 16:56:45 +08:00
%undefine __brp_mangle_shebangs
2020-08-28 12:06:27 +08:00
%undefine _changelog_trimtime
Summary: An HTML, XML, SAX, and Reader parser
Name: rubygem-%{gem_name}
Version: %{mainver}
2021-03-17 10:08:42 +08:00
Release: 2
2020-08-28 12:06:27 +08:00
License: MIT
URL: https://nokogiri.org
Source0: https://rubygems.org/gems/%{gem_name}-%{mainver}%{?prever}.gem
Source1: https://github.com/sparklemotion/%{gem_name}/archive/v%{mainver}.tar.gz
# Shut down libxml2 version unmatching warning
2020-08-29 16:56:45 +08:00
Patch0: %{name}-1.6.6.4-shutdown-libxml2-warning.patch
2021-03-17 10:08:42 +08:00
Patch1: CVE-2020-26247-pre.patch
Patch2: CVE-2020-26247.patch
2020-08-29 16:56:45 +08:00
BuildRequires: ruby(release) ruby(rubygems) rubygem(minitest) rubygems-devel
Obsoletes: ruby-%{gem_name} <= 1.5.2-2
BuildRequires: gcc rubygem(pkg-config) libxml2-devel libxslt-devel ruby-devel
2020-08-28 12:06:27 +08:00
%description
Nokogiri parses and searches XML/HTML very quickly, and also has
correctly implemented CSS3 selector support as well as XPath support.
Nokogiri also features an Hpricot compatibility layer to help ease the change
to using correct CSS and XPath.
%if 0
%package jruby
Summary: JRuby support for %{name}
2020-08-29 16:56:45 +08:00
Requires: %{name} = %{version}-%{release}
2020-08-28 12:06:27 +08:00
%description jruby
This package contains JRuby support for %{name}.
%endif
%package doc
Summary: Documentation for %{name}
2020-08-29 16:56:45 +08:00
Requires: %{name} = %{version}-%{release}
2020-08-28 12:06:27 +08:00
%description doc
This package contains documentation for %{name}.
%package -n ruby-%{gem_name}
Summary: Non-Gem support package for %{gem_name}
2020-08-29 16:56:45 +08:00
Requires: %{name} = %{version}-%{release}
2020-08-28 12:06:27 +08:00
Provides: ruby(%{gem_name}) = %{version}-%{release}
%description -n ruby-%{gem_name}
This package provides non-Gem support for %{gem_name}.
%global version %{mainver}%{?prever}
%prep
%setup -q -T -c -a 1
TOPDIR=$(pwd)
mkdir tmpunpackdir
pushd tmpunpackdir
gem unpack %{SOURCE0}
cd %{gem_name}-%{version}
%patch0 -p1
2021-03-17 10:08:42 +08:00
%patch1 -p1
%patch2 -p1
2020-08-28 12:06:27 +08:00
gem specification -l --ruby %{SOURCE0} > %{gem_name}.gemspec
sed -i \
-e 's|, "ports/archives/[^"][^"]*"||g' \
-e 's|, "ports/patches/[^"][^"]*"||g' \
%{gem_name}.gemspec
sed -i -e '\@mini_portile@d' %{gem_name}.gemspec
LANG=C.UTF-8 gem build %{gem_name}.gemspec
mv %{gem_name}-%{version}.gem $TOPDIR
popd
rm -rf tmpunpackdir
%build
mkdir -p ./%{gem_dir}
export NOKOGIRI_USE_SYSTEM_LIBRARIES=yes
%gem_install
chmod 0644 .%{gem_dir}/cache/%{gem_name}-%{mainver}%{?prever}.gem
rm -f .%{gem_instdir}/lib/*.jar
rm -rf .%{gem_instdir}/ext/java
%install
mkdir -p %{buildroot}%{gem_dir}
cp -a ./%{gem_dir}/* %{buildroot}%{gem_dir}
find %{buildroot} -name \*.orig_\* | xargs rm -vf
mkdir -p %{buildroot}%{gem_extdir_mri}
cp -a ./%{gem_extdir_mri}/* %{buildroot}%{gem_extdir_mri}/
pushd %{buildroot}
rm -f .%{gem_extdir_mri}/{gem_make.out,mkmf.log}
popd
mkdir -p %{buildroot}%{_bindir}
cp -pa .%{_bindir}/* \
%{buildroot}%{_bindir}/
for f in $(find %{buildroot}%{gem_instdir} -name \*.rb)
do
sed -i -e '/^#!/d' $f
chmod 0644 $f
done
cp -p %{gem_name}-%{version}/[A-Z]* %{buildroot}%{gem_instdir}/
rm -rf %{buildroot}%{gem_instdir}/ext/%{gem_name}/
rm -rf %{buildroot}%{gem_instdir}/tmp/
rm -f %{buildroot}%{gem_instdir}/{.autotest,.require_paths,.gemtest,.travis.yml}
rm -f %{buildroot}%{gem_instdir}/appveyor.yml
rm -f %{buildroot}%{gem_instdir}/.cross_rubies
rm -f %{buildroot}%{gem_instdir}/{build_all,dependencies.yml,test_all}
rm -f %{buildroot}%{gem_instdir}/.editorconfig
rm -rf %{buildroot}%{gem_instdir}/suppressions/
rm -rf %{buildroot}%{gem_instdir}/patches/
rm -f %{buildroot}%{gem_instdir}/{Rakefile,Gemfile*}
rm -f %{buildroot}%{gem_instdir}/Manifest.txt
%check
export TZ="Asia/Tokyo"
LANG=C.UTF-8
cp -a %{gem_name}-%{version}/test/ ./%{gem_instdir}
pushd ./%{gem_instdir}
sed -i test/helper.rb \
-e '\@require.*simplecov@,\@^end$@d'
ruby \
-I.:lib:test:ext \
-e \
"require 'test/helper' ; Dir.glob('test/**/test_*.rb'){|f| require f}" || \
exit 1
echo "Please investigate this"
for f in $SKIPTEST
do
mv $f.skip $f
done
popd
%files
%defattr(-,root, root,-)
%{_bindir}/%{gem_name}
%{gem_extdir_mri}/
%dir %{gem_instdir}/
%doc %{gem_instdir}/[A-Z]*
%{gem_instdir}/bin/
%{gem_instdir}/lib/
%exclude %{gem_dir}/cache/%{gem_name}-%{mainver}%{?prever}.gem
%{gem_dir}/specifications/%{gem_name}-%{mainver}%{?prever}.gemspec
%if 0
%files jruby
%defattr(-,root,root,-)
%{gem_instdir}/ext/java/
%endif
%files doc
%defattr(-,root,root,-)
%exclude %{gem_instdir}/tasks/
%exclude %{gem_instdir}/test/
%{gem_dir}/doc/%{gem_name}-%{mainver}%{?prever}/
%changelog
2021-03-17 10:08:42 +08:00
* Wed Mar 17 2021 zhanghua <zhanghua40@huawei.com> - 1.10.5-2
- fix CVE-2020-26247
2020-08-28 16:58:05 +08:00
* Wed Aug 19 2020 luoshengwei <luoshengwei@huawei.com> - 1.10.5-1
2020-08-28 12:06:27 +08:00
- package init