|
|
2e83041 |
%define ruby_sitelib %(ruby -rrbconfig -e "puts Config::CONFIG['sitelibdir']")
|
|
|
2e83041 |
%define ruby_sitearch %(ruby -rrbconfig -e "puts Config::CONFIG['sitearchdir']")
|
|
|
2e83041 |
%define rubyabi 1.8
|
|
|
2e83041 |
|
|
|
2e83041 |
%define gemdir %(ruby -rubygems -e 'puts Gem::dir' 2>/dev/null)
|
|
|
2e83041 |
%define gemname nokogiri
|
|
|
2e83041 |
%define geminstdir %{gemdir}/gems/%{gemname}-%{version}
|
|
|
2e83041 |
|
|
|
2e83041 |
Summary: An HTML, XML, SAX, and Reader parser
|
|
|
2e83041 |
Name: rubygem-%{gemname}
|
|
|
84fc73f |
Version: 1.2.3
|
|
|
2e83041 |
Release: 1%{?dist}
|
|
|
2e83041 |
Group: Development/Languages
|
|
|
2e83041 |
License: MIT
|
|
|
2e83041 |
URL: http://nokogiri.rubyforge.org/nokogiri/
|
|
|
2e83041 |
Source0: http://gems.rubyforge.org/gems/%{gemname}-%{version}.gem
|
|
|
2e83041 |
|
|
|
2e83041 |
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
|
|
2e83041 |
BuildRequires: ruby(abi) = %{rubyabi}
|
|
|
2e83041 |
BuildRequires: ruby(rubygems)
|
|
|
38cdf38 |
BuildRequires: rubygem(hoe)
|
|
|
2e83041 |
BuildRequires: rubygem(rake)
|
|
|
2e83041 |
BuildRequires: libxml2-devel
|
|
|
2e83041 |
BuildRequires: libxslt-devel
|
|
|
2e83041 |
BuildRequires: ruby-devel
|
|
|
2e83041 |
Requires: ruby(abi) = %{rubyabi}
|
|
|
2e83041 |
Requires: ruby(rubygems)
|
|
|
2e83041 |
Provides: rubygem(%{gemname}) = %{version}-%{release}
|
|
|
2e83041 |
|
|
|
2e83041 |
%description
|
|
|
2e83041 |
Nokogiri parses and searches XML/HTML very quickly, and also has
|
|
|
2e83041 |
correctly implemented CSS3 selector support as well as XPath support.
|
|
|
2e83041 |
|
|
|
2e83041 |
Nokogiri also features an Hpricot compatibility layer to help ease the change
|
|
|
2e83041 |
to using correct CSS and XPath.
|
|
|
2e83041 |
|
|
|
2e83041 |
%package doc
|
|
|
2e83041 |
Summary: Documentation for %{name}
|
|
|
2e83041 |
Group: Documentation
|
|
|
2e83041 |
# Directory ownership issue
|
|
|
2e83041 |
Requires: %{name} = %{version}-%{release}
|
|
|
2e83041 |
Requires: ruby(rubygems)
|
|
|
2e83041 |
|
|
|
2e83041 |
%description doc
|
|
|
2e83041 |
This package contains documentation for %{name}.
|
|
|
2e83041 |
|
|
|
2e83041 |
%package -n ruby-%{gemname}
|
|
|
2e83041 |
Summary: Non-Gem support package for %{gemname}
|
|
|
2e83041 |
Group: Development/Languages
|
|
|
2e83041 |
Requires: %{name} = %{version}-%{release}
|
|
|
2e83041 |
Provides: ruby(%{gemname}) = %{version}-%{release}
|
|
|
2e83041 |
|
|
|
2e83041 |
%description -n ruby-%{gemname}
|
|
|
2e83041 |
This package provides non-Gem support for %{gemname}.
|
|
|
2e83041 |
|
|
|
2e83041 |
%prep
|
|
|
2e83041 |
%setup -q -T -c
|
|
|
2e83041 |
|
|
|
2e83041 |
%build
|
|
|
2e83041 |
mkdir -p ./%{gemdir}
|
|
|
2e83041 |
export CONFIGURE_ARGS="--with-cflags='%{optflags}'"
|
|
|
2e83041 |
gem install \
|
|
|
2e83041 |
--local \
|
|
|
2e83041 |
--install-dir ./%{gemdir} \
|
|
|
2e83041 |
-V --force \
|
|
|
2e83041 |
%{SOURCE0}
|
|
|
2e83041 |
|
|
|
2e83041 |
# cflags wrong (-O3 passed), recompiling
|
|
|
2e83041 |
pushd ./%{geminstdir}
|
|
|
2e83041 |
sed -i.flags -e 's|-O3||' ext/nokogiri/extconf.rb
|
|
|
bcb3dd9 |
# F-10/9 hoe is old and readme_file or so are not defined
|
|
|
bcb3dd9 |
%if 0%{?fedora} < 11
|
|
|
bcb3dd9 |
sed -i.readme \
|
|
|
bcb3dd9 |
-e '/p\.readme_file/d' \
|
|
|
bcb3dd9 |
-e '/p\.history_file/d' \
|
|
|
bcb3dd9 |
-e '/p\.extra_rdoc_files/d' \
|
|
|
bcb3dd9 |
Rakefile
|
|
|
bcb3dd9 |
%endif
|
|
|
2e83041 |
find . -name \*.so -or -name \*.o -exec rm -f {} \;
|
|
|
bcb3dd9 |
rake -v ext/nokogiri/native.so --trace
|
|
|
2e83041 |
|
|
|
2e83041 |
%install
|
|
|
2e83041 |
rm -rf %{buildroot}
|
|
|
2e83041 |
mkdir -p %{buildroot}%{gemdir}
|
|
|
2e83041 |
cp -a ./%{gemdir}/* %{buildroot}%{gemdir}
|
|
|
2e83041 |
|
|
|
2e83041 |
# move arch dependent files to %%ruby_sitearch
|
|
|
2e83041 |
mkdir -p %{buildroot}%{ruby_sitearch}/%{gemname}
|
|
|
2e83041 |
mv %{buildroot}%{geminstdir}/lib/%{gemname}/*.so \
|
|
|
2e83041 |
%{buildroot}%{ruby_sitearch}/%{gemname}/
|
|
|
2e83041 |
|
|
|
2e83041 |
# remove all shebang
|
|
|
2e83041 |
for f in $(find %{buildroot}%{geminstdir} -name \*.rb)
|
|
|
2e83041 |
do
|
|
|
2e83041 |
sed -i -e '/^#!/d' $f
|
|
|
2e83041 |
chmod 0644 $f
|
|
|
2e83041 |
done
|
|
|
2e83041 |
|
|
|
2e83041 |
# cleanups
|
|
|
2e83041 |
rm -rf %{buildroot}%{geminstdir}/ext
|
|
|
38cdf38 |
rm -f %{buildroot}%{geminstdir}/{.autotest,.require_paths,Rakefile}
|
|
|
2e83041 |
|
|
|
38cdf38 |
# vendor/hoe.rb is no longer installed
|
|
|
38cdf38 |
: rm -f %{buildroot}/%{geminstdir}/vendor/hoe.rb
|
|
|
38cdf38 |
: rmdir %{buildroot}/%{geminstdir}/vendor/
|
|
|
2e83041 |
|
|
|
2e83041 |
# The following method is completely copied from rubygem-gettext
|
|
|
2e83041 |
# spec file
|
|
|
2e83041 |
#
|
|
|
2e83041 |
# Create symlinks
|
|
|
2e83041 |
##
|
|
|
2e83041 |
## Note that before switching to gem %%{ruby_sitelib}/%%{gemname}
|
|
|
2e83041 |
## already existed as a directory, so this cannot be replaced
|
|
|
2e83041 |
## by symlink (cpio fails)
|
|
|
2e83041 |
## Similarly, all directories under %%{ruby_sitelib} cannot be
|
|
|
2e83041 |
## replaced by symlink
|
|
|
2e83041 |
#
|
|
|
2e83041 |
|
|
|
2e83041 |
create_symlink_rec(){
|
|
|
2e83041 |
|
|
|
2e83041 |
ORIGBASEDIR=$1
|
|
|
2e83041 |
TARGETBASEDIR=$2
|
|
|
2e83041 |
|
|
|
2e83041 |
## First calculate relative path of ORIGBASEDIR
|
|
|
2e83041 |
## from TARGETBASEDIR
|
|
|
2e83041 |
TMPDIR=$TARGETBASEDIR
|
|
|
2e83041 |
BACKDIR=
|
|
|
2e83041 |
DOWNDIR=
|
|
|
2e83041 |
num=0
|
|
|
2e83041 |
nnum=0
|
|
|
2e83041 |
while true
|
|
|
2e83041 |
do
|
|
|
2e83041 |
num=$((num+1))
|
|
|
2e83041 |
TMPDIR=$(echo $TMPDIR | sed -e 's|/[^/][^/]*$||')
|
|
|
2e83041 |
DOWNDIR=$(echo $ORIGBASEDIR | sed -e "s|^$TMPDIR||")
|
|
|
2e83041 |
if [ x$DOWNDIR != x$ORIGBASEDIR ]
|
|
|
2e83041 |
then
|
|
|
2e83041 |
nnum=0
|
|
|
2e83041 |
while [ $nnum -lt $num ]
|
|
|
2e83041 |
do
|
|
|
2e83041 |
BACKDIR="../$BACKDIR"
|
|
|
2e83041 |
nnum=$((nnum+1))
|
|
|
2e83041 |
done
|
|
|
2e83041 |
break
|
|
|
2e83041 |
fi
|
|
|
2e83041 |
done
|
|
|
2e83041 |
|
|
|
2e83041 |
RELBASEDIR=$( echo $BACKDIR/$DOWNDIR | sed -e 's|//*|/|g' )
|
|
|
2e83041 |
|
|
|
2e83041 |
## Next actually create symlink
|
|
|
2e83041 |
pushd %{buildroot}/$ORIGBASEDIR
|
|
|
2e83041 |
find . -type f | while read f
|
|
|
2e83041 |
do
|
|
|
2e83041 |
DIRNAME=$(dirname $f)
|
|
|
2e83041 |
BACK2DIR=$(echo $DIRNAME | sed -e 's|/[^/][^/]*|/..|g')
|
|
|
2e83041 |
mkdir -p %{buildroot}${TARGETBASEDIR}/$DIRNAME
|
|
|
2e83041 |
LNNAME=$(echo $BACK2DIR/$RELBASEDIR/$f | \
|
|
|
2e83041 |
sed -e 's|^\./||' | sed -e 's|//|/|g' | \
|
|
|
2e83041 |
sed -e 's|/\./|/|' )
|
|
|
2e83041 |
ln -s -f $LNNAME %{buildroot}${TARGETBASEDIR}/$f
|
|
|
2e83041 |
done
|
|
|
2e83041 |
popd
|
|
|
2e83041 |
|
|
|
2e83041 |
}
|
|
|
2e83041 |
|
|
|
2e83041 |
create_symlink_rec %{geminstdir}/lib %{ruby_sitelib}
|
|
|
2e83041 |
|
|
|
2e83041 |
|
|
|
2e83041 |
%clean
|
|
|
2e83041 |
rm -rf %{buildroot}
|
|
|
2e83041 |
|
|
|
fcf0ef0 |
%check
|
|
|
fcf0ef0 |
pushd ./%{geminstdir}
|
|
|
38cdf38 |
rake test || :
|
|
|
fcf0ef0 |
popd
|
|
|
fcf0ef0 |
|
|
|
2e83041 |
%files
|
|
|
2e83041 |
%defattr(-,root, root,-)
|
|
|
2e83041 |
%{ruby_sitearch}/%{gemname}/
|
|
|
2e83041 |
%dir %{geminstdir}/
|
|
|
2e83041 |
%doc %{geminstdir}/[A-Z]*
|
|
|
2e83041 |
%{geminstdir}/[a-l]*/
|
|
|
2e83041 |
%{gemdir}/cache/%{gemname}-%{version}.gem
|
|
|
2e83041 |
%{gemdir}/specifications/%{gemname}-%{version}.gemspec
|
|
|
2e83041 |
|
|
|
2e83041 |
%files doc
|
|
|
2e83041 |
%defattr(-,root,root,-)
|
|
|
fcf0ef0 |
%{geminstdir}/tasks/
|
|
|
2e83041 |
%{geminstdir}/test/
|
|
|
2e83041 |
%{gemdir}/doc/%{gemname}-%{version}/
|
|
|
2e83041 |
|
|
|
2e83041 |
%files -n ruby-%{gemname}
|
|
|
2e83041 |
%defattr(-,root,root,-)
|
|
|
2e83041 |
%{ruby_sitelib}/*%{gemname}.rb
|
|
|
2e83041 |
%{ruby_sitelib}/%{gemname}/
|
|
|
38cdf38 |
%{ruby_sitelib}/xsd/
|
|
|
2e83041 |
|
|
|
2e83041 |
%changelog
|
|
|
84fc73f |
* Thu Mar 26 2009 Mamoru Tasaka <mtasaka@ioa.s.u-tokyo.ac.jp> - 1.2.3-1
|
|
|
84fc73f |
- 1.2.3
|
|
|
84fc73f |
|
|
|
38cdf38 |
* Thu Mar 19 2009 Mamoru Tasaka <mtasaka@ioa.s.u-tokyo.ac.jp> - 1.2.2-1
|
|
|
38cdf38 |
- 1.2.2
|
|
|
38cdf38 |
|
|
|
fcf0ef0 |
* Thu Mar 12 2009 Mamoru Tasaka <mtasaka@ioa.s.u-tokyo.ac.jp> - 1.2.1-1
|
|
|
fcf0ef0 |
- 1.2.1
|
|
|
fcf0ef0 |
|
|
|
fcf0ef0 |
* Tue Feb 24 2009 Mamoru Tasaka <mtasaka@ioa.s.u-tokyo.ac.jp> - 1.1.1-2
|
|
|
fcf0ef0 |
- F-11: Mass rebuild
|
|
|
fcf0ef0 |
|
|
|
2e83041 |
* Thu Jan 15 2009 Mamoru Tasaka <mtasaka@ioa.s.u-tokyo.ac.jp> - 1.1.1-1
|
|
|
2e83041 |
- 1.1.1
|
|
|
2e83041 |
|
|
|
2e83041 |
* Thu Dec 25 2008 Mamoru Tasaka <mtasaka@ioa.s.u-tokyo.ac.jp> - 1.1.0-1
|
|
|
2e83041 |
- Initial packaging
|
|
|
2e83041 |
|