public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] repo/gentoo:master commit in: media-gfx/gscan2pdf/, media-gfx/gscan2pdf/files/
@ 2024-01-03 20:20 Florian Schmaus
  0 siblings, 0 replies; only message in thread
From: Florian Schmaus @ 2024-01-03 20:20 UTC (permalink / raw
  To: gentoo-commits

commit:     9847317ef712a30e26b54761e611612239b13543
Author:     Chris Mayo <aklhfex <AT> gmail <DOT> com>
AuthorDate: Tue Jan  2 19:23:46 2024 +0000
Commit:     Florian Schmaus <flow <AT> gentoo <DOT> org>
CommitDate: Wed Jan  3 20:14:18 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9847317e

media-gfx/gscan2pdf: tiff2ps no longer installed by media-libs/tiff

Signed-off-by: Chris Mayo <aklhfex <AT> gmail.com>
Closes: https://github.com/gentoo/gentoo/pull/34596
Signed-off-by: Florian Schmaus <flow <AT> gentoo.org>

 .../gscan2pdf/files/gscan2pdf-2.13.2-min_max.patch |  20 ++++
 .../gscan2pdf/files/gscan2pdf-2.13.2-t1161.patch   |  13 +++
 .../gscan2pdf/files/gscan2pdf-2.13.2-t131.patch    |  17 +++
 .../gscan2pdf/files/gscan2pdf-2.13.2-tiff2ps.patch |  39 +++++++
 media-gfx/gscan2pdf/gscan2pdf-2.13.2-r1.ebuild     | 117 +++++++++++++++++++++
 5 files changed, 206 insertions(+)

diff --git a/media-gfx/gscan2pdf/files/gscan2pdf-2.13.2-min_max.patch b/media-gfx/gscan2pdf/files/gscan2pdf-2.13.2-min_max.patch
new file mode 100644
index 000000000000..5724bc16a188
--- /dev/null
+++ b/media-gfx/gscan2pdf/files/gscan2pdf-2.13.2-min_max.patch
@@ -0,0 +1,20 @@
+--- a/lib/Gscan2pdf/Dialog/Scan/Image_Sane.pm
++++ b/lib/Gscan2pdf/Dialog/Scan/Image_Sane.pm
+@@ -295,6 +295,17 @@ sub _initialise_options {    ## no critic (ProhibitExcessComplexity)
+                 if ( $opt->{constraint}{quant} ) {
+                     $step = $opt->{constraint}{quant};
+                 }
++                if ( $opt->{constraint}{min} > $opt->{constraint}{max} ) {
++                    $logger->error(
++                        sprintf __(
++"Ignoring scan option '%s', minimum range (%s) > maximum (%s)"
++                        ),
++                        $opt->{name},
++                        $opt->{constraint}{min},
++                        $opt->{constraint}{max}
++                    );
++                    next;
++                }
+                 $widget =
+                   Gtk3::SpinButton->new_with_range( $opt->{constraint}{min},
+                     $opt->{constraint}{max}, $step );

diff --git a/media-gfx/gscan2pdf/files/gscan2pdf-2.13.2-t1161.patch b/media-gfx/gscan2pdf/files/gscan2pdf-2.13.2-t1161.patch
new file mode 100644
index 000000000000..707d109cf148
--- /dev/null
+++ b/media-gfx/gscan2pdf/files/gscan2pdf-2.13.2-t1161.patch
@@ -0,0 +1,13 @@
+diff --git a/t/1161_save_multipage_pdf_with_utf8.t b/t/1161_save_multipage_pdf_with_utf8.t
+index 23ed652e..6b9537a0 100644
+--- a/t/1161_save_multipage_pdf_with_utf8.t
++++ b/t/1161_save_multipage_pdf_with_utf8.t
+@@ -26,7 +26,7 @@ system(qw(convert rose: 1.pnm));
+ my $n = 3;
+ 
+ my %options;
+-$options{font} = capture('fc-list : file | grep ttf 2> /dev/null | head -n 1');
++$options{font} = capture('fc-list :lang=ru file | grep ttf 2> /dev/null | head -n 1');
+ chomp $options{font};
+ $options{font} =~ s/: $//;
+ 

diff --git a/media-gfx/gscan2pdf/files/gscan2pdf-2.13.2-t131.patch b/media-gfx/gscan2pdf/files/gscan2pdf-2.13.2-t131.patch
new file mode 100644
index 000000000000..ecbf48b5f59a
--- /dev/null
+++ b/media-gfx/gscan2pdf/files/gscan2pdf-2.13.2-t131.patch
@@ -0,0 +1,17 @@
+--- a/t/131_save_tiff.t
++++ b/t/131_save_tiff.t
+@@ -43,12 +43,12 @@ Gtk3->main;
+ 
+ like(
+     capture(qw(identify test.tif)),
+-    qr/test.tif TIFF 70x46 70x46\+0\+0 8-bit sRGB [7|9][.\d]+K?B/,
++    qr/test.tif TIFF 70x46 70x46\+0\+0 8-bit sRGB/,
+     'valid TIFF created'
+ );
+ like(
+     capture(qw(identify test2.png)),
+-    qr/test2.png PNG 70x46 70x46\+0\+0 8-bit sRGB 7[.\d]+K?B.*/,
++    qr/test2.png PNG 70x46 70x46\+0\+0 8-bit sRGB/,
+     'ran post-save hook'
+ );
+ 

diff --git a/media-gfx/gscan2pdf/files/gscan2pdf-2.13.2-tiff2ps.patch b/media-gfx/gscan2pdf/files/gscan2pdf-2.13.2-tiff2ps.patch
new file mode 100644
index 000000000000..f5c96a196098
--- /dev/null
+++ b/media-gfx/gscan2pdf/files/gscan2pdf-2.13.2-tiff2ps.patch
@@ -0,0 +1,39 @@
+--- a/lib/Gscan2pdf/Dialog/Save.pm
++++ b/lib/Gscan2pdf/Dialog/Save.pm
+@@ -570,10 +570,6 @@ sub add_image_type {
+     $label = Gtk3::Label->new( __('Postscript backend') );
+     $hboxps->pack_start( $label, FALSE, FALSE, 0 );
+     my @backends = (
+-        [
+-            'libtiff', __('LibTIFF'),
+-            __('Use LibTIFF (tiff2ps) to create Postscript files from TIFF.')
+-        ],
+         [
+             'pdf2ps',
+             __('Ghostscript'),
+--- a/lib/Gscan2pdf/Document.pm
++++ b/lib/Gscan2pdf/Document.pm
+@@ -4471,22 +4471,7 @@ sub _thread_save_tiff {
+             'Save file', sprintf __('Error compressing image: %s'), $error );
+         return;
+     }
+-    if ( defined $options{options}{ps} ) {
+-        $self->{message} = __('Converting to PS');
+-        @cmd = ( 'tiff2ps', '-3', $options{path}, '-O', $options{options}{ps} );
+-        ( $status, undef, $error ) = exec_command( \@cmd, $options{pidfile} );
+-        if ( $status or $error ) {
+-            $logger->info($error);
+-            _thread_throw_error( $self, $options{uuid}, $options{page}{uuid},
+-                'Save file',
+-                sprintf __('Error converting TIFF to PS: %s'), $error );
+-            return;
+-        }
+-        _post_save_hook( $options{options}{ps}, %{ $options{options} } );
+-    }
+-    else {
+-        _post_save_hook( $options{path}, %{ $options{options} } );
+-    }
++    _post_save_hook( $options{path}, %{ $options{options} } );
+ 
+     $self->{return}->enqueue(
+         {

diff --git a/media-gfx/gscan2pdf/gscan2pdf-2.13.2-r1.ebuild b/media-gfx/gscan2pdf/gscan2pdf-2.13.2-r1.ebuild
new file mode 100644
index 000000000000..0ad4b4925aba
--- /dev/null
+++ b/media-gfx/gscan2pdf/gscan2pdf-2.13.2-r1.ebuild
@@ -0,0 +1,117 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+DIST_TEST="do"
+
+inherit optfeature perl-module virtualx xdg-utils
+
+DESCRIPTION="Scan documents, perform OCR, produce PDFs and DjVus"
+HOMEPAGE="http://gscan2pdf.sourceforge.net/"
+SRC_URI="mirror://sourceforge/${PN}/${P}.tar.xz"
+
+LICENSE="GPL-3"
+SLOT="0"
+KEYWORDS="~amd64 ~arm64 ~x86"
+IUSE="test"
+RESTRICT="!test? ( test )"
+
+RDEPEND="
+	dev-perl/Config-General
+	dev-perl/Data-UUID
+	dev-perl/Date-Calc
+	dev-perl/Filesys-Df
+	dev-perl/glib-perl
+	dev-perl/GooCanvas2
+	dev-perl/Gtk3
+	>=dev-perl/Gtk3-ImageView-10.0.0
+	dev-perl/Gtk3-SimpleList
+	dev-perl/HTML-Parser
+	dev-perl/Image-Sane
+	dev-perl/List-MoreUtils
+	dev-perl/Locale-Codes
+	dev-perl/Locale-gettext
+	dev-perl/Log-Log4perl
+	>=dev-perl/PDF-Builder-3.23.0
+	dev-perl/Proc-ProcessTable
+	dev-perl/Readonly
+	dev-perl/Set-IntSpan
+	dev-perl/Try-Tiny
+	virtual/perl-Archive-Tar
+	virtual/perl-Carp
+	virtual/perl-Data-Dumper
+	virtual/perl-File-Temp
+	virtual/perl-Getopt-Long
+	virtual/perl-threads
+	virtual/perl-threads-shared
+	media-gfx/imagemagick[png,tiff,perl]
+	media-gfx/sane-backends
+	media-libs/tiff"
+
+BDEPEND="
+	test? (
+		${RDEPEND}
+		dev-perl/IPC-System-Simple
+		dev-perl/Sub-Override
+		media-libs/fontconfig
+
+		app-text/djvu[jpeg,tiff]
+		app-text/poppler[utils]
+		app-text/tesseract[-opencl,osd(+),png,tiff]
+		app-text/unpaper
+		media-gfx/imagemagick[djvu,jpeg,png,tiff,perl,postscript,truetype]
+		media-gfx/sane-backends[sane_backends_test]
+		media-gfx/sane-frontends
+	)"
+
+PATCHES=(
+	"${FILESDIR}/${P}-min_max.patch"
+	"${FILESDIR}/${P}-tiff2ps.patch"
+	"${FILESDIR}/${P}-t131.patch"
+	"${FILESDIR}/${P}-t1161.patch"
+)
+
+PERL_RM_FILES=( t/{90_MANIFEST,91_critic,99_pod,135_save_tiff_as_ps_with_space,169_import_scan,0601_Dialog_Scan,1171_prepend_pdf,1172_append_pdf,1173_prepend_pdf_with_space,1174_prepend_pdf_with_inverted_comma,1175_append_with_timestamp,1621_import_pdf,1622_import_multipage_PDF,1623_import_multipage_PDF2,1624_import_multipage_PDF3,1625_import_pdf_bw,1626_import_PDF_with_error,1627_import_encrypted_pdf,1628_import_pdf_metadata}.t )
+
+mydoc="History"
+
+src_test() {
+	einfo "Using:"
+	einfo "  $(best_version app-text/djvu)"
+	einfo "  $(best_version app-text/poppler)"
+	einfo "  $(best_version app-text/tesseract)"
+	einfo "  $(best_version dev-perl/Gtk3-ImageView)"
+	einfo "  $(best_version dev-perl/Image-Sane)"
+	einfo "  $(best_version dev-perl/PDF-Builder)"
+	einfo "  $(best_version media-gfx/imagemagick)"
+	einfo "  $(best_version media-gfx/sane-backends)"
+	einfo "  $(best_version media-libs/tiff)"
+
+	local confdir="${HOME}/.config/ImageMagick"
+	mkdir -p "${confdir}" || die
+	cat > "${confdir}/policy.xml" <<-EOT || die
+		<policymap>
+			<policy domain="coder" rights="read|write" pattern="PDF" />
+			<policy domain="coder" rights="read" pattern="PS" />
+		</policymap>
+	EOT
+	NO_AT_BRIDGE=1 virtx perl-module_src_test
+}
+
+pkg_postinst() {
+	xdg_desktop_database_update
+
+	optfeature "DjVu file support" "app-text/djvu[tiff] media-gfx/imagemagick[djvu]"
+	optfeature "encrypting PDFs" app-text/pdftk
+	optfeature "creating PostScript files from PDFs" app-text/poppler[utils]
+	optfeature "adding to an existing PDF" app-text/poppler[utils]
+	optfeature "Optical Character Recognition" app-text/tesseract[tiff]
+	optfeature "scan post-processing" app-text/unpaper
+	optfeature "automatic document feeder support" media-gfx/sane-frontends
+	optfeature "sending PDFs as email attachments" x11-misc/xdg-utils
+}
+
+pkg_postrm() {
+	xdg_desktop_database_update
+}


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2024-01-03 20:20 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-03 20:20 [gentoo-commits] repo/gentoo:master commit in: media-gfx/gscan2pdf/, media-gfx/gscan2pdf/files/ Florian Schmaus

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox