Blob Blame History Raw
# Supported rpmbuild options:
#
# --with live-test/--without live-test
#   include/exclude LIVE_TEST testsuite
#   Default: --without (Requires networking, doesn't work in mock)
%bcond_with     live_test

Name:           perl-Web-Scraper
Version:        0.37
Release:        2%{?dist}
Summary:        Web Scraping Toolkit using HTML and CSS Selectors or XPath expressions
License:        GPL+ or Artistic
Group:          Development/Libraries
URL:            http://search.cpan.org/dist/Web-Scraper/
Source0:        http://www.cpan.org/authors/id/M/MI/MIYAGAWA/Web-Scraper-%{version}.tar.gz
# Misc. hacks to make the testsuite working
Patch0:         Web-Scraper-0.36-testsuite-hacks.patch
BuildArch:      noarch

BuildRequires:  perl(base)
BuildRequires:  perl(Carp)
BuildRequires:  perl(ExtUtils::MakeMaker)
BuildRequires:  perl(HTML::Entities)
BuildRequires:  perl(HTML::Selector::XPath) >= 0.03
BuildRequires:  perl(HTML::Tagset)
BuildRequires:  perl(HTML::TreeBuilder) >= 3.23
BuildRequires:  perl(HTML::TreeBuilder::XPath) >= 0.08
BuildRequires:  perl(HTML::TreeBuilder::LibXML) >= 0.13
BuildRequires:  perl(List::Util)
BuildRequires:  perl(LWP) >= 5.827
BuildRequires:  perl(LWP::UserAgent)
BuildRequires:  perl(Scalar::Util)
BuildRequires:  perl(Test::Base)
BuildRequires:  perl(Test::More)
BuildRequires:  perl(Test::Requires)
BuildRequires:  perl(UNIVERSAL::require)
BuildRequires:  perl(URI)
BuildRequires:  perl(warnings)
BuildRequires:  perl(XML::XPathEngine) >= 0.08
BuildRequires:  perl(YAML)
BuildRequires:  perl(strict)

# Required by the testsuite
BuildRequires:  /bin/ps

Requires:       perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version))

# rpm's deptracker misses these:
Requires:  perl(LWP::UserAgent)

%{?perl_default_filter}

%description
Web::Scraper is a web scraper toolkit, inspired by Ruby's equivalent
Scrapi. It provides a DSL-ish interface for traversing HTML documents and
returning a neatly arranged Perl data structure.

%prep
%setup -q -n Web-Scraper-%{version}
%patch0 -p1 

%build
# --skipdeps causes ExtUtils::AutoInstall not to try auto-installing
#  missing modules
%{__perl} Makefile.PL INSTALLDIRS=vendor --skipdeps
make %{?_smp_mflags}

%install
make pure_install PERL_INSTALL_ROOT=$RPM_BUILD_ROOT

find $RPM_BUILD_ROOT -type f -name .packlist -exec rm -f {} \;
find $RPM_BUILD_ROOT -depth -type d -exec rmdir {} 2>/dev/null \;

%{_fixperms} $RPM_BUILD_ROOT/*

%check
make test LEAK_TEST=1 %{?with_live_test:LIVE_TEST=1}

%files
%defattr(-,root,root,-)
%doc Changes README
%{_bindir}/scraper
%{perl_vendorlib}/*
%{_mandir}/man3/*

%changelog
* Thu Feb 14 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.37-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild

* Tue Oct 30 2012 Ralf Corsépius <corsepiu@fedoraproject.org> 0.37-1
- Upstream update.

* Tue Aug 07 2012 Ralf Corsépius <corsepiu@fedoraproject.org> 0.36-2
- R: perl(LWP::UserAgent).
- Make live tests working (Add Web-Scraper-0.36-testsuite-hacks.patch).
- BR: /bin/ps.

* Tue Jul 10 2012 Ralf Corsépius <corsepiu@fedoraproject.org> 0.36-1.20120710.0
- Merge in Xavier's spec.

* Fri Jan 21 2012 Ralf Corsépius <corsepiu@fedoraproject.org> 0.36-1.20120121.0
- More deps.
- Add %%{?perl_default_filter}.

* Mon Dec 19 2011 Ralf Corsépius <corsepiu@fedoraproject.org> 0.36-1
- Upstream update.
- Add --with/without live-test (disabled by default).

* Wed Mar 30 2011 Ralf Corsépius <corsepiu@fedoraproject.org> 0.34-1
- Upstream update.
- Spec cleanup.

* Tue Dec 21 2010 Ralf Corsépius <corsepiu@fedoraproject.org> 0.32-1
- Initial Fedora package.