diff --git a/gscan2pdf-2.12.4-Fix-parsing-scanimage-version.patch b/gscan2pdf-2.12.4-Fix-parsing-scanimage-version.patch new file mode 100644 index 0000000..87f8632 --- /dev/null +++ b/gscan2pdf-2.12.4-Fix-parsing-scanimage-version.patch @@ -0,0 +1,64 @@ +From de6ac3dec8c2fcdd131c6b789d847f9c0b6ae41e Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= +Date: Tue, 8 Feb 2022 13:24:22 +0100 +Subject: [PATCH] Fix parsing scanimage version +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +The code needs to know a scanimage version to supply --format=pnm +option requires since 1.0.27. The code used to compare only the last +number (27) and that stopped working with sane-backends-1.1.1 +(1 < 27). It broke t/081_Frontend_CLI.t: + + ok 43 - scanimage starts + not ok 44 - error callback called: Unknown message: Output format is not set, using pnm as a default. + # Failed test 'error callback called: Unknown message: Output format is not set, using pnm as a default.' + # at t/081_Frontend_CLI.t line 384. + ok 45 - scanimage scans + ok 46 - scanimage finishes + +This patch fixes it by using version module to parse the complete +version string. + +Signed-off-by: Petr Písař +--- + lib/Gscan2pdf/Frontend/CLI.pm | 7 ++++--- + 1 file changed, 4 insertions(+), 3 deletions(-) + +diff --git a/lib/Gscan2pdf/Frontend/CLI.pm b/lib/Gscan2pdf/Frontend/CLI.pm +index 0a1ee5cb..a66b8569 100644 +--- a/lib/Gscan2pdf/Frontend/CLI.pm ++++ b/lib/Gscan2pdf/Frontend/CLI.pm +@@ -20,6 +20,7 @@ use Image::Sane ':all'; # To get SANE_NAME_PAGE_WIDTH & SANE_NAME_PAGE_HEIGHT + use Cwd; + use File::Spec; + use Readonly; ++use version; + Readonly my $_POLL_INTERVAL => 100; # ms + Readonly my $_100 => 100; + Readonly my $_1KB => 1024; +@@ -45,9 +46,9 @@ sub setup { + finished_callback => sub { + my ( $output, $error ) = @_; + if ( $output =~ +- /scanimage\s[(]sane-backends[)]\s\d+[.]\d+[.](\d+)/xsm ) ++ /scanimage\s[(]sane-backends[)]\s(\d+[.]\d+[.]\d+)/xsm ) + { +- $_self->{version} = $1; ++ $_self->{version} = version->parse($1); + } + } + ); +@@ -334,7 +335,7 @@ sub _create_scanimage_cmd { + } + } + if ( not $help ) { +- if ( defined $_self->{version} and $_self->{version} gt '27' ) { ++ if ( defined $_self->{version} and $_self->{version} > v1.0.27 ) { + push @options, '--format=pnm'; + } + push @options, '--batch'; +-- +2.34.1 + diff --git a/gscan2pdf.spec b/gscan2pdf.spec index 327cb99..39054a1 100644 --- a/gscan2pdf.spec +++ b/gscan2pdf.spec @@ -4,7 +4,7 @@ Name: gscan2pdf Version: 2.12.4 -Release: 2%{?dist} +Release: 3%{?dist} Summary: GUI for producing a multipage PDF from a scan # icons/180_degree.svg: GPLv3 # icons/scanner.svg: GPLv2 @@ -23,6 +23,9 @@ Source2: gpgkey-463293E4AE33871846F30227B321F203110FCAF3.gpg Patch0: gscan2pdf-2.9.0-Do-not-warn-about-missing-pdftk.patch # Replace copies of gscan2pdf.svg with links, not upstreamable Patch1: gscan2pdf-2.12.2-Symlink-gscan2pdf.svg-files.patch +# Fix parsing scanimage version, proposed to the upstream, +# +Patch2: gscan2pdf-2.12.4-Fix-parsing-scanimage-version.patch BuildArch: noarch BuildRequires: coreutils BuildRequires: desktop-file-utils @@ -323,6 +326,9 @@ fi %{_libexecdir}/%{name} %changelog +* Tue Feb 08 2022 Petr Pisar - 2.12.4-3 +- Fix parsing scanimage version (upstream bug #399) + * Thu Jan 20 2022 Fedora Release Engineering - 2.12.4-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild