Blob Blame 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. t/166_cancel_import.t trigger it reliably.
%bcond_with gscan2pdf_enables_test

Name:           gscan2pdf
Version:        1.8.8
Release:        2%{?dist}
Summary:        GUI for producing a multipage PDF from a scan
# 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
# Use specific font for ImageMagick, bug #1494563
Patch0:         gscan2pdf-1.8.7-Use-specific-font-by-ImageMagick.patch
# Fix t/166_cancel_import.t test, upstream bug
# <https://sourceforge.net/p/gscan2pdf/bugs/286/>
Patch1:         gscan2pdf-1.8.8-Set-gettext-domain-in-t-166_cancel_import.t.patch
BuildArch:      noarch
BuildRequires:  coreutils
BuildRequires:  desktop-file-utils
BuildRequires:  gettext
BuildRequires:  make
BuildRequires:  perl-interpreter
BuildRequires:  perl-generators
BuildRequires:  perl(ExtUtils::MakeMaker)
%if %{with gscan2pdf_enables_test}
# Run-time:
# libtiff-tools or poppler-utils for PostScript support
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(Date::Calc)
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) >= 1.220
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(Image::Sane)
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(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:  file
# We need to pass a specific font name to ImageMagick, bug #1494563
BuildRequires:  font(dejavusans)
BuildRequires:  ImageMagick
BuildRequires:  ImageMagick-djvu
BuildRequires:  perl(File::stat)
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
# libappstream-glib for appstream-util
BuildRequires:  libappstream-glib
Suggests:       cuneiform
Requires:       GConf2
# Prefer libtiff-tools over poppler-utils for PostScript support
# Prefer gocr over cuneiform, ocropus, or tesseract
Recommends:     gocr
Recommends:     djvulibre
# Prefer libtiff-tools over poppler-utils for PostScript support
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:     ImageMagick-djvu
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
%patch1 -p1

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

%install
make install DESTDIR=$RPM_BUILD_ROOT
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 gscan2pdf_enables_test}
# Disable currently failing tests
# TODO: Fix them with upstream
# Bad plan
rm t/081_Frontend_CLI.t
# expand_metadata_pattern subtest fails on ARM koji
rm t/101_Document.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
# Produced test.pdf does not contain non-ASCII characters
rm t/1123_save_pdf_with_utf8.t
# Modification date stored in PDF depends on time zone
rm t/1151_save_pdf_with_metadata.t
rm t/1152_save_pdf_with_old_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
# SIGHUPs terminal
rm t/166_cancel_import.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
appstream-util validate-relax --nonet \
    %{buildroot}/%{_datadir}/metainfo/%{name}.appdata.xml

# Do not call gtk-update-icon-cache because it's needed only for updating icon
# themata in %%{_datadir}/icon/*. This package installes icon into
# %%{_datadir}/pixmaps/gscan2pdf.svg. Pixmaps seems not to be subject of icon
# themata.
%post
touch --no-create %{_datadir}/pixmaps || :

%postun
if [ $1 -eq 0 ] ; then
    touch --no-create %{_datadir}/pixmaps || :
fi

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

%changelog
* Mon Nov 06 2017 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 1.8.8-2
- Remove last hack for metainfo() provides

* Mon Nov 06 2017 Petr Pisar <ppisar@redhat.com> - 1.8.8-1
- 1.8.8 bump

* Mon Sep 25 2017 Petr Pisar <ppisar@redhat.com> - 1.8.7-1
- 1.8.7 bump

* Wed Aug 23 2017 Petr Pisar <ppisar@redhat.com> - 1.8.6-1
- 1.8.6 bump

* Mon Aug 21 2017 Petr Pisar <ppisar@redhat.com> - 1.8.5-1
- 1.8.5 bump

* Mon Jul 31 2017 Petr Pisar <ppisar@redhat.com> - 1.8.4-1
- 1.8.4 bump

* Wed Jul 26 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.8.3-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild

* Tue Jul 04 2017 Petr Pisar <ppisar@redhat.com> - 1.8.3-2
- Fix a race in t/0610_Dialog_Scan_Image_Sane.t test

* Mon Jul 03 2017 Petr Pisar <ppisar@redhat.com> - 1.8.3-1
- 1.8.3 bump

* Sun Jun 04 2017 Jitka Plesnikova <jplesnik@redhat.com> - 1.8.2-2
- Perl 5.26 rebuild

* Fri Jun 02 2017 Petr Pisar <ppisar@redhat.com> - 1.8.2-1
- 1.8.2 bump

* Mon May 29 2017 Petr Pisar <ppisar@redhat.com> - 1.8.1-1
- 1.8.1 bump

* Thu Apr 20 2017 Petr Pisar <ppisar@redhat.com> - 1.8.0-2
- Adapt 357_unpaper_rtl.t test to ImageMagick-6.9.3.0

* Thu Apr 13 2017 Petr Pisar <ppisar@redhat.com> - 1.8.0-1
- 1.8.0 bump

* Mon Apr 10 2017 Petr Pisar <ppisar@redhat.com> - 1.7.3-2
- Adapt to changes in tesseract-3.05.00 (bug #1440476)
- Make AppData XML file strictly conforming

* Mon Mar 13 2017 Petr Pisar <ppisar@redhat.com> - 1.7.3-1
- 1.7.3 bump

* Mon Feb 13 2017 Petr Pisar <ppisar@redhat.com> - 1.7.2-1
- 1.7.2 bump

* Fri Feb 10 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.7.1-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild

* Fri Jan 13 2017 Petr Pisar <ppisar@redhat.com> - 1.7.1-1
- 1.7.1 bump

* Thu Jan 05 2017 Petr Pisar <ppisar@redhat.com> - 1.7.0-1
- 1.7.0 bump

* Mon Dec 05 2016 Petr Pisar <ppisar@redhat.com> - 1.6.0-1
- 1.6.0 bump

* Tue Nov 01 2016 Petr Pisar <ppisar@redhat.com> - 1.5.5-2
- Fix saving to an image with shell meta characters in a file name
  (bug #1390105)

* Mon Oct 24 2016 Petr Pisar <ppisar@redhat.com> - 1.5.5-1
- 1.5.5 bump

* Mon Oct 17 2016 Petr Pisar <ppisar@redhat.com> - 1.5.4-1
- 1.5.4 bump

* Thu Oct 13 2016 Petr Pisar <ppisar@redhat.com> - 1.5.3-1
- 1.5.3 bump

* 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