Compare commits

..

No commits in common. "rawhide" and "unpaper-0_3-3_fc11" have entirely different histories.

13 changed files with 51 additions and 335 deletions

1
.cvsignore Normal file
View File

@ -0,0 +1 @@
unpaper-0.3.tar.gz

View File

@ -1 +0,0 @@
1

5
.gitignore vendored
View File

@ -1,5 +0,0 @@
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

21
Makefile Normal file
View File

@ -0,0 +1,21 @@
# Makefile for source rpm: unpaper
# $Id$
NAME := unpaper
SPECFILE = $(firstword $(wildcard *.spec))
define find-makefile-common
for d in common ../common ../../common ; do if [ -f $$d/Makefile.common ] ; then if [ -f $$d/CVS/Root -a -w $$/Makefile.common ] ; then cd $$d ; cvs -Q update ; fi ; echo "$$d/Makefile.common" ; break ; fi ; done
endef
MAKEFILE_COMMON := $(shell $(find-makefile-common))
ifeq ($(MAKEFILE_COMMON),)
# attept a checkout
define checkout-makefile-common
test -f CVS/Root && { cvs -Q -d $$(cat CVS/Root) checkout common && echo "common/Makefile.common" ; } || { echo "ERROR: I can't figure out how to checkout the 'common' module." ; exit -1 ; } >&2
endef
MAKEFILE_COMMON := $(shell $(checkout-makefile-common))
endif
include $(MAKEFILE_COMMON)

View File

@ -1,7 +0,0 @@
--- !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}

View File

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

View File

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

View File

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

View File

@ -1,44 +0,0 @@
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

@ -1,55 +0,0 @@
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

View File

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

View File

@ -1,66 +1,15 @@
Name: unpaper
Version: 7.0.0
Release: 7%{?dist}
Version: 0.3
Release: 3%{?dist}
Summary: Post-processing of scanned and photocopied book pages
# 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: 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
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
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
%description
unpaper is a post-processing tool for scanned sheets of paper, especially for
@ -68,170 +17,39 @@ 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).
areas between the left-hand-side and the right-hand-side of a double- sided
book-page scan). The program also tries to detect disaligned centering and
rotation of pages and will automatically straighten each page by rotating it to
the correct angle. This process is called "deskewing".
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
#%%{gpgverify} --keyring='%%{SOURCE2}' --signature='%%{SOURCE1}' --data='%%{SOURCE0}'
%autosetup -p1
%setup -q
%build
%meson
%meson_build
(cd src && gcc $RPM_OPT_FLAGS -o unpaper unpaper.c -lm)
%check
%meson_test
# fix eol encoding in LICENSE
sed -i 's/\r//' LICENSE
%install
%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}/*
rm -rf $RPM_BUILD_ROOT
install -d $RPM_BUILD_ROOT/%{_bindir}
install -p -m 0755 src/unpaper $RPM_BUILD_ROOT/%{_bindir}
%clean
rm -rf $RPM_BUILD_ROOT
%files
%license LICENSES/0BSD.txt LICENSES/GPL-2.0-only.txt
%defattr(-,root,root,-)
%{_bindir}/*
%{_mandir}/man1/*
%doc AUTHORS doc/*.md doc/img NEWS README.md
%files tests
%license LICENSES/MIT.txt
%{_libexecdir}/%{name}
%doc doc CHANGELOG LICENSE README
%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
* Fri Feb 05 2016 Fedora Release Engineering <releng@fedoraproject.org> - 0.3-14
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
* Fri Jun 19 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.3-13
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
* Mon Aug 18 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.3-12
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild
* Mon Jun 16 2014 Yaakov Selkowitz <yselkowi@redhat.com> - 0.3-11
- Fix FTBFS with -Werror=format-security (#1037369, #1107039)
* Sun Jun 08 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.3-10
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
* Sun Aug 04 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.3-9
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
* Fri Feb 15 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.3-8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild
* Sun Jul 22 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.3-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
* Sat Jan 14 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.3-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild
* Mon Feb 07 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.3-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
* Sun Jul 26 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.3-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild
* Wed Feb 25 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.3-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild