Bug#1071028: viewnior: FTBFS with exiv2 0.28

2024-06-18 Thread Pino Toscano
Followup-For: Bug #1071028

Hi Dominik,

thanks for the upload of 1.8-4, which carries the changes I proposed.
Would you please upload that to unstable, so it can fix the problem
altogether? The version required (exiv2 0.27) is present already in the
current Debian stable.

Thanks,
-- 
Pino



Bug#1071028: viewnior: FTBFS with exiv2 0.28

2024-05-13 Thread Pino Toscano
Source: viewnior
Version: 1.8-3
Severity: important
Tags: patch ftbfs
Control: forwarded -1 https://github.com/hellosiyan/Viewnior/pull/134

Hi,

viewnior fails to build with the new stable series of the Exiv2 library,
i.e. 0.28.x; that version is available in experimental as of this
writing.

There are two upstream PRs to address this problem, i.e. PR 130 [1] and
PR 134, and sadly they have been sitting there for some months now
(viewnior does not seem an actively developed project). I chose PR 134,
as I find it as cleaner approach, I extracted the patch/commit from it,
and verified that it builds fine with both Exiv2 0.27 and Exiv2 0.28;
you can find it attached to this bug. Would you review this patch, and
upload it so that viewnior rebuilds cleanly once a newer Exiv2 is
uploaded to unstable?

In addition to the actual fix, I attached an update of the libexiv2-dev
build dependency, which is the result of the backported patch.

[1] https://github.com/hellosiyan/Viewnior/pull/130
[2] https://github.com/hellosiyan/Viewnior/pull/134

Thanks,
-- 
Pino
Author: Robert-André Mauchin 
Description: Fix build with >=exiv2-0.28.0, raise minimum to 0.27.0
 - enables use of EXIV2_TEST_VERSION macro
 - add compatibility for exiv2-0.28.0
Forwarded: https://github.com/hellosiyan/Viewnior/pull/134
Last-Update: 2023-11-11

diff --git a/meson.build b/meson.build
index 8f91fb5..9ef9f09 100644
--- a/meson.build
+++ b/meson.build
@@ -28,7 +28,7 @@ viewnior_deps = [
   dependency('gio-2.0', version: glib_ver),
   dependency('shared-mime-info', version: '>= 0.20'),
   dependency('gdk-pixbuf-2.0', version: '>= 0.21'),
-  dependency('exiv2', version: '>= 0.21'),
+  dependency('exiv2', version: '>= 0.27'),
 ]
 #
 
diff --git a/src/uni-exiv2.cpp b/src/uni-exiv2.cpp
index 0d14b9f..d03edd7 100644
--- a/src/uni-exiv2.cpp
+++ b/src/uni-exiv2.cpp
@@ -22,12 +22,21 @@
 
 #include 
 #include 
+#include 
 
 #include "uni-exiv2.hpp"
 
+#if EXIV2_TEST_VERSION(0,28,0)
+typedef Exiv2::Error Exiv2Error;
+typedef Exiv2::Image::UniquePtr ImagePtr;
+#else
+typedef Exiv2::AnyError Exiv2Error;
+typedef Exiv2::Image::AutoPtr ImagePtr;
+#endif
+
 #define ARRAY_SIZE(array) (sizeof array/sizeof(array[0]))
 
-static Exiv2::Image::AutoPtr cached_image;
+static ImagePtr cached_image;
 
 extern "C"
 void
@@ -35,7 +44,7 @@ uni_read_exiv2_map(const char *uri, void (*callback)(const 
char*, const char*, v
 {
 Exiv2::LogMsg::setLevel(Exiv2::LogMsg::mute);
 try {
-Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(uri);
+ImagePtr image = Exiv2::ImageFactory::open(uri);
 if ( image.get() == 0 ) {
 return;
 }
@@ -80,7 +89,7 @@ uni_read_exiv2_map(const char *uri, void (*callback)(const 
char*, const char*, v
 }
 }
 }
-} catch (Exiv2::AnyError& e) {
+} catch (Exiv2Error& e) {
 std::cerr << "Exiv2: '" << e << "'\n";
 }
 }
@@ -103,7 +112,7 @@ uni_read_exiv2_to_cache(const char *uri)
 }
 
 cached_image->readMetadata();
-} catch (Exiv2::AnyError& e) {
+} catch (Exiv2Error& e) {
 std::cerr << "Exiv2: '" << e << "'\n";
 }
 
@@ -121,7 +130,7 @@ uni_write_exiv2_from_cache(const char *uri)
 }
 
 try {
-Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(uri);
+ImagePtr image = Exiv2::ImageFactory::open(uri);
 if ( image.get() == 0 ) {
 return 2;
 }
@@ -133,7 +142,7 @@ uni_write_exiv2_from_cache(const char *uri)
 cached_image.reset(NULL);
 
 return 0;
-} catch (Exiv2::AnyError& e) {
+} catch (Exiv2Error& e) {
 std::cerr << "Exiv2: '" << e << "'\n";
 }
 
-- 
2.43.0

--- a/debian/control
+++ b/debian/control
@@ -6,7 +6,7 @@ Build-Depends:
  debhelper-compat (= 13),
  meson,
  intltool (>= 0.35.0),
- libexiv2-dev,
+ libexiv2-dev (>= 0.27.0),
  libgtk-3-dev
 Standards-Version: 4.6.2
 Homepage: https://siyanpanayotov.com/project/viewnior/