Blob Blame History Raw
# Gscan2pdf::Document->cancel sends SIGHUP to its process subtree via
# Proc::Killfam::killfam(). But it leaks randomly to parent and it kills mock
# (koji error "mock was killed by signal 1"). Disabling tests until resolving
# it.
%bcond_with test

Name:           gscan2pdf
Version:        1.5.2
Release:        2%{?dist}
Summary:        GUI for producing a multipage PDF from a scan
Group:          Applications/Publishing
# icons/scanner.svg:    GPLv2
# icons/pdf.svg:        LGPLv2+ (copy of
#           Nuvola/icons/scalable/mimetypes/gnome-mime-application-pdf.svg
#           from gnome-themes-extras-0.9.0)
# other files:          GPLv3
License:        GPLv3 and GPLv2 and LGPLv2+
URL:            http://gscan2pdf.sourceforge.net/
Source0:        http://downloads.sourceforge.net/%{name}/%{name}-%{version}.tar.xz
# Preserve image depth on PDF export, bug #1369984, proposed to upstream
# <https://sourceforge.net/p/gscan2pdf/bugs/231/>
Patch0:         gscan2pdf-1.5.2-Reset-image-depth-on-export-to-PDF.patch
BuildArch:      noarch
BuildRequires:  coreutils
BuildRequires:  desktop-file-utils
BuildRequires:  findutils
BuildRequires:  gettext
BuildRequires:  make
BuildRequires:  perl
BuildRequires:  perl-generators
BuildRequires:  perl(ExtUtils::MakeMaker)
%if %{with test}
# Run-time:
BuildRequires:  libtiff-tools
BuildRequires:  perl(Archive::Tar)
BuildRequires:  perl(base)
BuildRequires:  perl(Carp)
BuildRequires:  perl(Config::General) >= 2.40
BuildRequires:  perl(Cwd)
BuildRequires:  perl(Data::Dumper)
BuildRequires:  perl(Data::UUID)
BuildRequires:  perl(Encode)
BuildRequires:  perl(English)
BuildRequires:  perl(Exporter)
BuildRequires:  perl(Fcntl)
BuildRequires:  perl(feature)
BuildRequires:  perl(File::Basename)
BuildRequires:  perl(File::Copy)
BuildRequires:  perl(File::Path)
BuildRequires:  perl(File::Spec)
BuildRequires:  perl(File::Temp)
BuildRequires:  perl(FileHandle)
BuildRequires:  perl(Filesys::Df)
BuildRequires:  perl(Getopt::Long)
BuildRequires:  perl(Glib)
BuildRequires:  perl(Glib::Object::Subclass)
BuildRequires:  perl(Goo::Canvas)
BuildRequires:  perl(Gtk2) >= 1.09
BuildRequires:  perl(Gtk2::Entry)
BuildRequires:  perl(Gtk2::Ex::Simple::List)
BuildRequires:  perl(Gtk2::Gdk::Keysyms)
BuildRequires:  perl(Gtk2::ImageView)
BuildRequires:  perl(HTML::Entities)
BuildRequires:  perl(HTML::TokeParser)
BuildRequires:  perl(if)
BuildRequires:  perl(Image::Magick)
BuildRequires:  perl(IO::Handle)
BuildRequires:  perl(IPC::Open3)
BuildRequires:  perl(JSON::PP)
BuildRequires:  perl(List::MoreUtils)
BuildRequires:  perl(Locale::gettext) >= 1.05
BuildRequires:  perl(Log::Log4perl)
BuildRequires:  perl(PDF::API2)
BuildRequires:  perl(POSIX)
BuildRequires:  perl(Proc::Killfam)
BuildRequires:  perl(Readonly)
BuildRequires:  perl(Sane) >= 0.05
BuildRequires:  perl(Set::IntSpan) >= 1.10
BuildRequires:  perl(Socket)
BuildRequires:  perl(Storable)
BuildRequires:  perl(strict)
BuildRequires:  perl(Symbol)
BuildRequires:  perl(Text::Balanced)
BuildRequires:  perl(Text::ParseWords)
BuildRequires:  perl(Thread::Queue)
BuildRequires:  perl(threads)
BuildRequires:  perl(threads::shared)
BuildRequires:  perl(Try::Tiny)
BuildRequires:  perl(utf8)
BuildRequires:  perl(version)
BuildRequires:  perl(warnings)
# Optional run-time:
BuildRequires:  djvulibre
# Gtk2::Ex::PodViewer not used at tests
BuildRequires:  poppler-utils
BuildRequires:  unpaper
# Tests:
BuildRequires:  font(:lang=en)
BuildRequires:  ImageMagick
BuildRequires:  perl(Scalar::Util)
BuildRequires:  perl(Sub::Override)
BuildRequires:  perl(Test::More)
BuildRequires:  sane-backends-drivers-scanners
BuildRequires:  xorg-x11-server-Xvfb
# Optional tests:
# pdftk not packaged
# sane-frontends for scanadf
BuildRequires:  sane-frontends
# Test::Perl::Critic not used
%endif
Suggests:       cuneiform
Requires:       GConf2
# Prefer gocr over cuneiform, ocropus, or tesseract
Recommends:     gocr
Recommends:     djvulibre
Requires:       libtiff-tools
# ocropus not packaged
Requires:       perl(:MODULE_COMPAT_%(eval "`perl -V:version`"; echo $version))
Requires:       perl(forks)
Requires:       perl(Gtk2) >= 1.09
Recommends:     perl(Gtk2::Ex::PodViewer)
Requires:       perl(if)
Recommends:     perl(Image::Magick)
Recommends:     ImageMagick
Recommends:     poppler-utils
Requires:       sane-backends >= 1.0.17
Requires:       sane-frontends
Suggests:       tesseract
Recommends:     unpaper
# xdg-utils for xdg-email command
Recommends:     xdg-utils

# Remove under-specified dependencies
%global __requires_exclude %{?__requires_exclude:%{__requires_exclude}|}^perl\\(Glib\\) >= 1\.210$
%global __requires_exclude %{?__requires_exclude:%{__requires_exclude}|}^perl\\(Gtk2\\)$

%description
A GUI to ease the process of producing a multipage PDF from a scan.

%prep
%setup -q
%patch0 -p1

%build
perl Makefile.PL INSTALLDIRS=vendor SHAREDIR=%{_datadir}
make %{?_smp_mflags}

%install
make install DESTDIR=$RPM_BUILD_ROOT
find $RPM_BUILD_ROOT -type f -name .packlist -delete
rm -f $RPM_BUILD_ROOT/%{perl_archlib}/perllocal.pod
%{_fixperms} $RPM_BUILD_ROOT

desktop-file-install --delete-original \
  --dir=$RPM_BUILD_ROOT/%{_datadir}/applications         \
  $RPM_BUILD_ROOT/%{_datadir}/applications/%{name}.desktop

%find_lang %{name}

%check
%if %{with test}
# Disable currently failing tests
# TODO: Fix them with upstream
# expand_metadata_pattern subtest fails on ARM koji
rm t/10_Document.t
# Bad plan
rm t/081_Frontend_CLI.t
# file(1) reports grayscale PNM diffently
rm t/0823_Frontend_Sane.t
# Does not halt
rm t/113_save_pdf_with_downsample.t
# Mock terminates with SIGHUP on ARM koji
rm t/114_cancel_save_pdf.t
# ???
rm t/1111_save_pdf.t
# Modification date stored in PDF depends on time zone
rm t/115_save_pdf_with_metadata.t
# Mock terminates with SIGHUP on i686 koji
rm t/124_cancel_save_djvu.t
# Does not halt
rm t/131_save_tiff.t
# "started callback has message" subtest fails in mock
rm t/1601_import_DjVu.t
# Bad plan without pdftk
rm t/1623_import_multipage_PDF2.t
# Storable::retrieve() refuses deserialize on ARM koji
rm t/175_open_session2.t
# Bad plan without unpaper
# t/351_unpaper.t
# t/352_unpaper.t
# t/354_unpaper_with_error.t
# t/355_unpaper2.t
xvfb-run -a make test
%endif

# The installed icon file is %%{_datadir}/pixmaps/gscan2pdf.svg. The scriptlets
# are wrong probably.
%post
touch --no-create %{_datadir}/icons/hicolor || :
if [ -x %{_bindir}/gtk-update-icon-cache ]; then
  %{_bindir}/gtk-update-icon-cache --quiet %{_datadir}/icons/hicolor || :
fi

%postun
touch --no-create %{_datadir}/icons/hicolor || :
if [ -x %{_bindir}/gtk-update-icon-cache ]; then
  %{_bindir}/gtk-update-icon-cache --quiet %{_datadir}/icons/hicolor || :
fi

%files -f %{name}.lang
%license LICENCE
%doc COPYING History
%{_bindir}/*
%{perl_vendorlib}/*
%{_datadir}/%{name}
%{_datadir}/applications/*%{name}.desktop
%{_datadir}/appdata/%{name}.appdata.xml
%{_datadir}/pixmaps/%{name}.svg
%{_mandir}/man1/*.1*

%changelog
* Fri Sep 30 2016 Petr Pisar <ppisar@redhat.com> - 1.5.2-2
- Preserve image depth on PDF export (bug #1369984)

* Thu Sep 01 2016 Petr Pisar <ppisar@redhat.com> - 1.5.2-1
- 1.5.2 bump

* Wed Jul 27 2016 Petr Pisar <ppisar@redhat.com> - 1.5.1-1
- 1.5.1 bump

* Fri Jul 08 2016 Petr Pisar <ppisar@redhat.com> - 1.5.0-1
- 1.5.0 bump

* Thu Jul 07 2016 Petr Pisar <ppisar@redhat.com> - 1.3.9-3
- Modernize spec file
- License corrected to (GPLv3 and GPLv2 and LGPLv2+)

* Sat May 14 2016 Jitka Plesnikova <jplesnik@redhat.com> - 1.3.9-2
- Perl 5.24 rebuild

* Thu Mar 10 2016 Sven Lankes <sven@lank.es>  -1.3.9-1
- new upstream release

* Mon Feb 22 2016 Sven Lankes <sven@lank.es>  -1.3.8-1
- new upstream release

* Wed Feb 03 2016 Fedora Release Engineering <releng@fedoraproject.org> - 1.3.0-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild

* Wed Jun 17 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.3.0-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild

* Wed Jun 03 2015 Jitka Plesnikova <jplesnik@redhat.com> - 1.3.0-2
- Perl 5.22 rebuild

* Wed Feb 25 2015 Bernard Johnson <bjohnson@symetirx.com> - 1.3.0-1
- v 1.3.0 (bz #1082579)

* Wed Aug 27 2014 Jitka Plesnikova <jplesnik@redhat.com> - 1.2.5-3
- Perl 5.20 rebuild

* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.2.5-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild

* Mon Jun 02 2014 Richard Hughes <richard@hughsie.com> - 1.2.5-1
- v 1.2.5

* Tue Mar 11 2014 Bernard Johnson <bjohnson@symetirx.com> - 1.2.3-1
- v 1.2.3 (bz #1034069)
- substitute a sed command to change gconftool-2 change

* Sat Aug 03 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.1.3-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild

* Thu Jul 18 2013 Petr Pisar <ppisar@redhat.com> - 1.1.3-3
- Perl 5.18 rebuild

* Tue Apr 23 2013 Jon Ciesla <limburgher@gmail.com>  -1.1.3-2
- Drop desktop vendor tag.

* Tue Mar 05 2013 Sven Lankes <sven@lank.es>  -1.1.3-1
- new upstream release

* Sat Feb 16 2013 Sven Lankes <sven@lank.es>  -1.1.2-1
- new upstream release

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

* Sun Dec 16 2012 Sven Lankes <sven@lank.es>  -1.1.0-1
- new upstream release

* Fri Aug 24 2012 Sven Lankse <sven@lank.es> - 1.0.6-1
- new upstream release (bz #840442)

* Thu Jul 19 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.0.4-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild

* Mon Jun 11 2012 Petr Pisar <ppisar@redhat.com> - 1.0.4-2
- Perl 5.16 rebuild

* Fri May 25 2012 Bernard Johnson <bjohnson@symetirx.com> - 1.0.4-1
- v 1.0.4 (bz #810826)

* Wed Mar 28 2012 Bernard Johnson <bjohnson@symetrix.com> - 1.0.2-1
- v 1.0.2 (bz #787361, bz #807604)

* Fri Jan 13 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.0.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild

* Tue Sep 27 2011 Bernard Johnson <bjohnson@symetrix.com> - 1.0.0-1
- v 1.0.0 (bz #740997)
- disable tests for now due to dependencies