Compare commits

...

27 Commits
f25 ... rawhide

Author SHA1 Message Date
Neal Gompa fd67f13a77 Rebuild for ffmpeg 6.0 2023-03-12 15:38:10 -04:00
Petr Písař cd0cb68ef9 Convert license tags to an SPDX format 2023-02-08 12:27:46 +01:00
Fedora Release Engineering 10ff7477c0 Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2023-01-21 05:51:37 +00:00
Petr Písař 422f187bde Escape all percents in a comment 2022-10-10 14:47:13 +02:00
Petr Písař 54f9913222 Set an update option to supress a warning with ffmpeg-5.1 2022-10-10 14:41:02 +02:00
Petr Písař 52fb09cf39 Correct an URL in RPM metadata 2022-08-31 09:57:30 +02:00
Neal Gompa 094ed21243 Rebuild for ffmpeg 5.1 (#2121070) 2022-08-29 19:16:35 -04:00
Fedora Release Engineering 0ef0a7fee6 Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2022-07-23 11:26:16 +00:00
Petr Písař 5d33082409 Enable TMT tests and gating 2022-05-31 14:39:00 +02:00
Petr Písař a140636d43 Package the tests 2022-05-31 14:37:02 +02:00
Petr Písař 9f25b954f2 7.0.0 bump 2022-05-31 13:48:43 +02:00
Neal Gompa 46c9a1b3fd Rebuild for ffmpeg 5.0 ABI fix (#2061392) 2022-03-08 10:36:12 -05:00
Petr Písař 382a7325f7 Bump to a post-6.1 git snapshot e515408 2022-02-25 16:58:38 +01:00
Petr Písař c733c7eb9d 6.1 bump from Flameeyes fork
The fork was merged back to the origin.
The 6.1 code does not build with current libav 5.0.

Fix in upstream <https://github.com/unpaper/unpaper/pull/104> requires
too many changes. I will add a rabase on top.
2022-02-25 14:43:51 +01:00
Fedora Release Engineering 6ad23905a8 - Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2022-01-22 03:33:48 +00:00
Fedora Release Engineering 1b5210ed39 - Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2021-07-23 20:04:44 +00:00
Fedora Release Engineering 61d346145c - Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2021-01-27 22:42:32 +00:00
Fedora Release Engineering 7746811c7b - Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2020-07-29 13:20:15 +00:00
Fedora Release Engineering 33bc465fd2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2020-01-31 02:39:30 +00:00
Fedora Release Engineering 8300353a5c - Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2019-07-27 02:33:13 +00:00
Fedora Release Engineering 599434d319 - Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2019-02-03 10:51:51 +00:00
Igor Gnatenko 37656e24a0 Remove obsolete Group tag
References: https://fedoraproject.org/wiki/Changes/Remove_Group_Tag
2019-01-28 20:24:53 +01:00
Fedora Release Engineering d8d977b0a4 - Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2018-07-14 08:16:28 +00:00
Fedora Release Engineering 648402ef5b - Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2018-02-09 20:05:01 +00:00
Fedora Release Engineering a72b285176 - Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild 2017-08-03 09:49:31 +00:00
Fedora Release Engineering 8c5fdde2c5 - Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild 2017-07-27 21:01:51 +00:00
Fedora Release Engineering c3197d32c1 - Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild 2017-02-11 16:46:20 +00:00
13 changed files with 299 additions and 82 deletions

1
.fmf/version Normal file
View File

@ -0,0 +1 @@
1

4
.gitignore vendored
View File

@ -1 +1,5 @@
unpaper-0.3.tar.gz
/unpaper-6.1.tar.xz
/unpaper-6.1.tar.xz.sig
/unpaper-6.1^20220117.gite515408.tar.xz
/unpaper-7.0.0.tar.xz

View File

@ -1,2 +0,0 @@
from Config import *
addFilter("spelling-error .* deskewing");

7
gating.yaml Normal file
View File

@ -0,0 +1,7 @@
--- !Policy
product_versions:
- fedora-*
decision_context: bodhi_update_push_stable
subject_type: koji_build
rules:
- !PassingTestCaseRule {test_case_name: fedora-ci.koji-build.tier0.functional}

Binary file not shown.

5
plans/sanity.fmf Normal file
View File

@ -0,0 +1,5 @@
summary: Sanity tests
discover:
how: fmf
execute:
how: tmt

View File

@ -1 +1 @@
be41eaf8556e7df39ab53939c99c4f7b unpaper-0.3.tar.gz
SHA512 (unpaper-7.0.0.tar.xz) = 58da969e773bf16ffee98b96f903ac5347f66d9a93c63bdb9131f5d45f4d7973c09f364ac2f27f8cb61f75de0421c6b01aa248fa9619fbdbde30fcebc76aa484

5
tests/upstream-tests.fmf Normal file
View File

@ -0,0 +1,5 @@
summary: Upstream tests
component: unpaper
require: unpaper-tests
test: /usr/libexec/unpaper/test
duration: 12m

View File

@ -1,55 +0,0 @@
diff --git a/src/unpaper.c b/src/unpaper.c
index f967d92..53f55b0 100644
--- a/src/unpaper.c
+++ b/src/unpaper.c
@@ -1,9 +1,9 @@
/* ---------------------------------------------------------------------------
unpaper - written by Jens Gulden 2005-2007 */
-const char* VERSION = "0.3";
+const char VERSION[] = "0.3";
-const char* README =
+const char README[] =
"unpaper is a post-processing tool for scanned sheets of paper, especially for\n"
"book pages that have been scanned from previously created photocopies.\n"
"The main purpose is to make scanned book pages better readable on screen\n"
@@ -29,7 +29,7 @@ const char* README =
"Conversion to PDF can e.g. be achieved with the Linux tools pgm2tiff, tiffcp\n"
"and tiff2pdf.";
-const char* COMPILE =
+const char COMPILE[] =
"gcc -D TIMESTAMP=\"<yyyy-MM-dd HH:mm:ss>\" -lm -O3 -funroll-all-loops -fomit-frame-pointer -ftree-vectorize -o unpaper unpaper.c\n";
/* ------------------------------------------------------------------------ */
@@ -46,17 +46,17 @@ const char* BUILD = TIMESTAMP;
const char* BUILD = NULL;
#endif
-const char* WELCOME =
+const char WELCOME[] =
"unpaper %s - written by Jens Gulden 2005-2007.\n"
"Licensed under the GNU General Public License, this comes with no warranty.\n";
-const char* USAGE =
+const char USAGE[] =
"Usage: unpaper [options] <input-file(s)> <output-file(s)>\n\n"
"Filenames may contain a formatting placeholder starting with '%%' to insert a\n"
"page counter for multi-page processing. E.g.: 'scan%%03d.pbm' to process files\n"
"scan001.pbm, scan002.pbm, scan003.pbm etc.\n";
-const char* OPTIONS =
+const char OPTIONS[] =
"-l --layout single Set default layout options for a sheet:\n"
" |double 'single': One page per sheet.\n"
" |none 'double': Two pages per sheet, landscape\n"
@@ -558,7 +558,7 @@ const char* OPTIONS =
//--help-compile Undocumented.
-const char* HELP =
+const char HELP[] =
"Run 'unpaper --help' for usage information.\n";

View File

@ -0,0 +1,44 @@
From a2a88fe837fd6770ac94f08b2eb841f0dc9d2430 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Diego=20Elio=20Petten=C3=B2?= <flameeyes@flameeyes.com>
Date: Sat, 8 Oct 2022 10:14:46 +0100
Subject: [PATCH] Set the `update` option to suppress the ffmpeg 5.1 warning.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
This addresses Issue #113, the spurious warning coming from ffmpeg 5.1+
about the filename not being an image sequence (we do our own sequencing
so we do not want it to be seen by ffmpeg at all!)
Signed-off-by: Petr Písař <ppisar@redhat.com>
---
file.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/file.c b/file.c
index fc24a4c..53ef727 100644
--- a/file.c
+++ b/file.c
@@ -13,6 +13,7 @@
#include <libavcodec/avcodec.h>
#include <libavformat/avformat.h>
#include <libavutil/avutil.h>
+#include <libavutil/opt.h>
#include "tools.h"
#include "unpaper.h"
@@ -142,6 +143,11 @@ void saveImage(char *filename, AVFrame *input, int outputPixFmt) {
errOutput("unable to allocate output context.");
}
+ if ((ret = av_opt_set(out_ctx->priv_data, "update", "true", 0)) < 0) {
+ av_strerror(ret, errbuff, sizeof(errbuff));
+ errOutput("unable to configure update option: %s", errbuff);
+ }
+
switch (outputPixFmt) {
case AV_PIX_FMT_RGB24:
output_codec = AV_CODEC_ID_PPM;
--
2.37.3

View File

@ -0,0 +1,55 @@
From d29fd2cf84ea386c67ecb0302adebc0700088d94 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Diego=20Elio=20Petten=C3=B2?= <flameeyes@flameeyes.com>
Date: Sat, 8 Oct 2022 00:16:20 +0100
Subject: [PATCH] Use avformat_alloc_output_context2() to create the out
context.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
This simplifies the API usage quite a bit, while maintaining the same
logic as previously.
Signed-off-by: Petr Písař <ppisar@redhat.com>
---
file.c | 14 ++------------
1 file changed, 2 insertions(+), 12 deletions(-)
diff --git a/file.c b/file.c
index d9c239e..fc24a4c 100644
--- a/file.c
+++ b/file.c
@@ -127,7 +127,6 @@ void loadImage(const char *filename, AVFrame **image) {
* @return true on success, false on failure
*/
void saveImage(char *filename, AVFrame *input, int outputPixFmt) {
- const AVOutputFormat *fmt = NULL;
enum AVCodecID output_codec = -1;
const AVCodec *codec;
AVFormatContext *out_ctx;
@@ -138,20 +137,11 @@ void saveImage(char *filename, AVFrame *input, int outputPixFmt) {
int ret;
char errbuff[1024];
- fmt = av_guess_format("image2", NULL, NULL);
-
- if (!fmt) {
- errOutput("could not find suitable output fmt.");
- }
-
- out_ctx = avformat_alloc_context();
- if (!out_ctx) {
+ if (avformat_alloc_output_context2(&out_ctx, NULL, "image2", filename) < 0 ||
+ out_ctx == NULL) {
errOutput("unable to allocate output context.");
}
- out_ctx->oformat = fmt;
- out_ctx->url = av_strdup(filename);
-
switch (outputPixFmt) {
case AV_PIX_FMT_RGB24:
output_codec = AV_CODEC_ID_PPM;
--
2.37.3

2
unpaper.rpmlintrc Normal file
View File

@ -0,0 +1,2 @@
addFilter('spelling-error .* deskewing')
addFilter('-tests\.noarch: W: no-documentation')

View File

@ -1,16 +1,66 @@
Name: unpaper
Version: 0.3
Release: 15%{?dist}
Version: 7.0.0
Release: 7%{?dist}
Summary: Post-processing of scanned and photocopied book pages
Group: Applications/Publishing
# Licensed under any GPL version since none is specified
License: GPL+
URL: http://unpaper.berlios.de/
Source0: http://download.berlios.de/%{name}/%{name}-%{version}.tar.gz
Patch0: unpaper-0.3-format-security.patch
BuildRequires: coreutils
# AUTHORS: GPL-2.0-only
# constants.h: GPL-2.0-only
# doc/basic-concepts.md: GPL-2.0-only
# doc/file-formats.md: GPL-2.0-only
# doc/image-processing.md: GPL-2.0-only
# doc/img/*.png.license: GPL-2.0-only
# doc/unpaper.1.rst: GPL-2.0-only
# file.c: GPL-2.0-only
# imageprocess.c: GPL-2.0-only
# imageprocess.h: GPL-2.0-only
# LICENSES/0BSD.txt: 0BSD text
# LICENSES/GPL-2.0-only.txt: GPL-2.0 text
# other files: GPL-2.0-only
# README.md: GPL-2.0-only
# version.h.in: 0BSD
## In tests subpackage
# LICENSES/MIT.txt: MIT text
# tests/golden_images/*.license GPL-2.0-only
# tests/source_images/*.license GPL-2.0-only
# tests/unpaper_tests.py: GPL-2.0-only AND MIT
## Not in any binary package
# doc/conf.py: MIT
# LICENSES/Apache-2.0.txt: Apache-2.0 text
# meson.build: MIT
# .dir-locals.el: MIT
# .editorconfig: 0BSD
# .github/workflows/meson-build-and-test.yml: Apache-2.0
# .github/workflows/pre-commit.yml: MIT
# .gitignore: MIT
# .mailmap: MIT
# .mergify.yml: MIT
# .pre-commit-config.yaml: MIT
License: GPL-2.0-only AND 0BSD
URL: https://www.flameeyes.eu/projects/%{name}
Source0: https://www.flameeyes.eu/files/%{name}-%{version}.tar.xz
# Missing a signature, requested by e-mail
# <https://flameeyes.blog/2022/05/10/unpaper-7-0-0-release/>.
#Source1: https://www.flameeyes.eu/files/%%{name}-%%{version}.tar.xz.sig
## A key exported from keyserver <hkp://pgp.surfnet.nl> on 2022-02-25.
#Source2: gpgkey-BDAEF3008A1CC62079C2A16847664B94E36B629F.gpg
# 1/2Set an update option to supress a warning with ffmpeg-5.1,
# in upstream after 7.0.0,
# <https://github.com/unpaper/unpaper/issues/113>
Patch0: unpaper-7.0.0-Use-avformat_alloc_output_context2-to-create-the-out.patch
# 2/2 Set an update option to supress a warning with ffmpeg-5.1,
# in upstream after 7.0.0,
# <https://github.com/unpaper/unpaper/issues/113>
Patch1: unpaper-7.0.0-Set-the-update-option-to-suppress-the-ffmpeg-5.1-war.patch
BuildRequires: gcc
BuildRequires: sed
#BuildRequires: gnupg2
BuildRequires: meson >= 0.57
BuildRequires: pkgconfig(libavcodec)
BuildRequires: pkgconfig(libavformat)
BuildRequires: pkgconfig(libavutil)
BuildRequires: python3-sphinx >= 3.4
# Tests:
BuildRequires: python3dist(pytest)
# python3-pillow for PIL Python module
BuildRequires: python3-pillow
%description
unpaper is a post-processing tool for scanned sheets of paper, especially for
@ -18,33 +68,134 @@ book pages that have been scanned from previously created photocopies. The
main purpose is to make scanned book pages better readable on screen after
conversion to PDF. Additionally, unpaper might be useful to enhance the
quality of scanned pages before performing optical character recognition (OCR).
unpaper tries to clean scanned images by removing dark edges that appeared
through scanning or copying on areas outside the actual page content (e.g. dark
areas between the left-hand-side and the right-hand-side of a double- sided
book-page scan). The program also tries to detect misaligned centering and
rotation of pages and will automatically straighten each page by rotating it to
the correct angle. This process is called "deskewing".
areas between the left-hand-side and the right-hand-side of a double-sided
book-page scan).
The program also tries to detect misaligned centering and rotation of pages
and will automatically straighten each page by rotating it to the correct
angle. This process is called "deskewing".
%package tests
Summary: Tests for %{name}
License: GPL-2.0-only AND MIT
BuildArch: noarch
Requires: %{name} = %{?epoch:%{epoch}:}%{version}-%{release}
# python3-pillow for PIL Python module
Requires: python3-pillow
Requires: python3-pytest
# Parallelize tests
Requires: python3-pytest-xdist
%description tests
Tests from %{name}. Execute them
with "%{_libexecdir}/%{name}/test".
%prep
%setup -q
%patch0 -p1
# fix eol encoding in LICENSE
sed -i -e 's/\r//' LICENSE
#%%{gpgverify} --keyring='%%{SOURCE2}' --signature='%%{SOURCE1}' --data='%%{SOURCE0}'
%autosetup -p1
%build
cd src
gcc $RPM_OPT_FLAGS $RPM_LD_FLAGS -o unpaper unpaper.c -lm
%meson
%meson_build
%check
%meson_test
%install
install -d $RPM_BUILD_ROOT/%{_bindir}
install -p -m 0755 src/unpaper $RPM_BUILD_ROOT/%{_bindir}
%meson_install
# Install tests
mkdir -p %{buildroot}%{_libexecdir}/%{name}
cp -a tests %{buildroot}%{_libexecdir}/%{name}
cat > %{buildroot}%{_libexecdir}/%{name}/test << 'EOF'
#!/bin/sh
export TEST_IMGSRC_DIR=tests/source_images
export TEST_GOLDEN_DIR=tests/golden_images
export TEST_UNPAPER_BINARY=%{_bindir}/unpaper
cd %{_libexecdir}/%{name} && exec pytest -v -n "$(getconf _NPROCESSORS_ONLN)" tests/unpaper_tests.py
EOF
chmod +x %{buildroot}%{_libexecdir}/%{name}/test
%{_fixperms} %{buildroot}/*
%files
%license LICENSE
%license LICENSES/0BSD.txt LICENSES/GPL-2.0-only.txt
%{_bindir}/*
%doc doc CHANGELOG README
%{_mandir}/man1/*
%doc AUTHORS doc/*.md doc/img NEWS README.md
%files tests
%license LICENSES/MIT.txt
%{_libexecdir}/%{name}
%changelog
* Sun Mar 12 2023 Neal Gompa <ngompa@fedoraproject.org> - 7.0.0-7
- Rebuild for ffmpeg 6.0
* Wed Feb 08 2023 Petr Pisar <ppisar@redhat.com> - 7.0.0-6
- Convert license tags to an SPDX format
* Sat Jan 21 2023 Fedora Release Engineering <releng@fedoraproject.org> - 7.0.0-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild
* Mon Oct 10 2022 Petr Pisar <ppisar@redhat.com> - 7.0.0-4
- Set an update option to supress a warning with ffmpeg-5.1 (upstream #113)
* Mon Aug 29 2022 Neal Gompa <ngompa@fedoraproject.org> - 7.0.0-3
- Rebuild for ffmpeg 5.1 (#2121070)
* Sat Jul 23 2022 Fedora Release Engineering <releng@fedoraproject.org> - 7.0.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild
* Tue May 31 2022 Petr Pisar <ppisar@redhat.com> - 7.0.0-1
- 7.0.0 bump
- License changed from (GPLv2) to (GPLv2 and 0BSD and MIT)
- Package the tests
* Tue Mar 08 2022 Neal Gompa <ngompa@fedoraproject.org> - 6.1^20220117.gite515408-2
- Rebuild for ffmpeg 5.0 ABI fix (#2061392)
* Fri Feb 25 2022 Petr Pisar <ppisar@redhat.com> - 6.1^20220117.gite515408-1
- 6.1 bump from upstream git tree
- License changed to GPLv2
* Sat Jan 22 2022 Fedora Release Engineering <releng@fedoraproject.org> - 0.3-27
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
* Fri Jul 23 2021 Fedora Release Engineering <releng@fedoraproject.org> - 0.3-26
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
* Wed Jan 27 2021 Fedora Release Engineering <releng@fedoraproject.org> - 0.3-25
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
* Wed Jul 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 0.3-24
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
* Fri Jan 31 2020 Fedora Release Engineering <releng@fedoraproject.org> - 0.3-23
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
* Sat Jul 27 2019 Fedora Release Engineering <releng@fedoraproject.org> - 0.3-22
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
* Sun Feb 03 2019 Fedora Release Engineering <releng@fedoraproject.org> - 0.3-21
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
* Sat Jul 14 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0.3-20
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
* Fri Feb 09 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0.3-19
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
* Thu Aug 03 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.3-18
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild
* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.3-17
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.3-16
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
* Thu Jul 07 2016 Petr Pisar <ppisar@redhat.com> - 0.3-15
- Modernize spec file