From 4bc53e20ef3de08e489d1baf93bf4ddb78737a11 Mon Sep 17 00:00:00 2001
From: fossdd <fossdd@pwned.life>
Date: Sat, 22 Feb 2025 18:28:42 +0100
Subject: [PATCH] community/fprintd: upgrade to 1.94.5

https://gitlab.freedesktop.org/libfprint/fprintd/-/releases/v1.94.5
---
 community/fprintd/APKBUILD                    |  10 +-
 ...test-feature-and-make-tests-optional.patch |  62 ----------
 community/fprintd/tests-option.patch          | 111 ++++++++++++++++++
 3 files changed, 116 insertions(+), 67 deletions(-)
 delete mode 100644 community/fprintd/add-test-feature-and-make-tests-optional.patch
 create mode 100644 community/fprintd/tests-option.patch

diff --git a/community/fprintd/APKBUILD b/community/fprintd/APKBUILD
index dbe30b627f11..75e9e61377ab 100644
--- a/community/fprintd/APKBUILD
+++ b/community/fprintd/APKBUILD
@@ -3,7 +3,7 @@
 #
 # TODO: Figure out how to ditch out Polkit (make it optional).
 pkgname=fprintd
-pkgver=1.94.4
+pkgver=1.94.5
 pkgrel=0
 pkgdesc="Daemon that provides fingerprint scanning functionality over D-Bus"
 url="https://fprint.freedesktop.org/"
@@ -28,7 +28,7 @@ checkdepends="
 	"
 subpackages="$pkgname-doc $pkgname-lang $pkgname-pam"
 source="https://gitlab.freedesktop.org/libfprint/fprintd/-/archive/v$pkgver/fprintd-v$pkgver.tar.gz
-	add-test-feature-and-make-tests-optional.patch
+	tests-option.patch
 	fix-missing-libintl.patch
 	"
 builddir="$srcdir/$pkgname-v$pkgver"
@@ -41,7 +41,7 @@ build() {
 		-Dsystemd=false \
 		-Dlibsystemd=basu \
 		-Dpam=true \
-		-Dtests=false \
+		-Dtests="$(want_check && echo true || echo false)" \
 		output
 	meson compile -C output
 }
@@ -62,7 +62,7 @@ pam() {
 }
 
 sha512sums="
-f8d0859d901da2ed419cb57a21dd51bab1b08057e60c555bac129e1f37777d946fc46752b27fc99a52040ef95529728f2936b65de7751ace0bba5c1c5787908d  fprintd-v1.94.4.tar.gz
-25abf87dddc4f9b5e2bb7141b5468b10478bc37a3075cd8fbd4cc125e08a1487ff46d5d433366f5627c0bed3bca8e4d8845403ce6d01b59c1e4da11b4125f9c7  add-test-feature-and-make-tests-optional.patch
+ee71d1d8cfea99fb6711bd4039011702a1f31c59a23d13423fca8be17b43b29bf7a7434e0baf598f2d4bfefd42c08f2f7e3c6ebdf371d53aa9d6b7963d4732dc  fprintd-v1.94.5.tar.gz
+8f4344f32638e8398fdec20c548b70d0580ccd09c0677d3a7865ce9063a2c48a6afc91b447f522733ce812b2cc990e5f4179dda30e602dd3845fd3abf83c0272  tests-option.patch
 dabfeacd5677e5553bec559cdbc837dc298ac3729ca5d62f5dbe7c9fdc68ef8cd95c4b0d4b6c706553b9cffe5de59c7e4399e5d43d1b5fc142ac3a91673ef516  fix-missing-libintl.patch
 "
diff --git a/community/fprintd/add-test-feature-and-make-tests-optional.patch b/community/fprintd/add-test-feature-and-make-tests-optional.patch
deleted file mode 100644
index be252ed21977..000000000000
--- a/community/fprintd/add-test-feature-and-make-tests-optional.patch
+++ /dev/null
@@ -1,62 +0,0 @@
-Ref https://gitlab.freedesktop.org/libfprint/fprintd/-/merge_requests/199
-
-diff --git a/meson.build b/meson.build
---- a/meson.build
-+++ b/meson.build
-@@ -183,11 +183,13 @@ python3_test_modules = {
- }
- python3_available_modules = []
- 
-+if get_option('tests')
- foreach module, required : python3_test_modules
-     if required and run_command(python3, '-c', 'import @0@'.format(module)).returncode() != 0
-         warning('Python3 module \'' + module + '\' required by test suite not found')
-     endif
- endforeach
-+endif
- 
- cdata = configuration_data()
- cdata.set_quoted('GETTEXT_PACKAGE', meson.project_name())
-@@ -202,6 +204,8 @@ config_h = configure_file(
-   configuration: cdata
- )
- 
-+address_sanitizer = get_option('b_sanitize') == 'address'
-+
- subdir('src')
- subdir('data')
- subdir('utils')
-@@ -211,7 +215,9 @@ endif
- if get_option('gtk_doc')
-     subdir('doc')
- endif
--subdir('tests')
-+if get_option('tests')
-+    subdir('tests')
-+endif
- subdir('po')
- 
- output = []
-diff --git a/tests/meson.build b/tests/meson.build
---- a/tests/meson.build
-+++ b/tests/meson.build
-@@ -16,8 +16,6 @@ python_tests = [
-     # }
- ]
- 
--address_sanitizer = get_option('b_sanitize') == 'address'
--
- tests = [
-     'fprintd',
-     'test_fprintd_utils',
-diff --git a/meson_options.txt b/meson_options.txt
---- a/meson_options.txt
-+++ b/meson_options.txt
-@@ -23,3 +23,7 @@
-     type: 'boolean',
-     value: false,
-     description: 'Use gtk-doc to build documentation')
-+option('tests',
-+    type: 'boolean',
-+    value: true,
-+    description: 'Enable tests')
diff --git a/community/fprintd/tests-option.patch b/community/fprintd/tests-option.patch
new file mode 100644
index 000000000000..992e1887fb04
--- /dev/null
+++ b/community/fprintd/tests-option.patch
@@ -0,0 +1,111 @@
+Patch-Source: https://gitlab.freedesktop.org/libfprint/fprintd/-/merge_requests/222
+---
+From 3c17eda191bf0227499278d93642bfed039b979d Mon Sep 17 00:00:00 2001
+From: fossdd <fossdd@pwned.life>
+Date: Sat, 22 Feb 2025 18:40:40 +0100
+Subject: [PATCH] build: Add tests meson option
+
+---
+ meson.build       | 49 +++++++++++++++++++++++++++--------------------
+ meson_options.txt |  4 ++++
+ tests/meson.build |  2 --
+ 3 files changed, 32 insertions(+), 23 deletions(-)
+
+diff --git a/meson.build b/meson.build
+index eebea25c..5692ad30 100644
+--- a/meson.build
++++ b/meson.build
+@@ -165,29 +165,34 @@ endif
+ 
+ polkit_policy_directory = polkit_gobject_dep.get_variable('policydir')
+ 
+-# Tests dependencies
+-pam_wrapper_dep = dependency('pam_wrapper', required: false)
+-if get_option('pam') and not pam_wrapper_dep.found()
+-    warning('Dependency "pam_wrapper" required by test suite not found')
+-endif
+-
+ xmllint = find_program('xmllint', required: false)
+ python3 = find_program('python3') # No meson without it!
+-python3_test_modules = {
+-    'cairo': true,
+-    'dbus': true,
+-    'dbusmock': true,
+-    'gi': true,
+-    'gi.repository.FPrint': true,
+-    'pypamtest': get_option('pam'),
+-}
+-python3_available_modules = []
+-
+-foreach module, required : python3_test_modules
+-    if required and run_command(python3, '-c', 'import @0@'.format(module), check: false).returncode() != 0
+-        warning('Python3 module \'' + module + '\' required by test suite not found')
++
++# Tests dependencies
++if get_option('tests')
++    pam_wrapper_dep = dependency('pam_wrapper', required: false)
++    if get_option('pam') and not pam_wrapper_dep.found()
++        warning('Dependency "pam_wrapper" required by test suite not found')
+     endif
+-endforeach
++
++    python3_test_modules = {
++        'cairo': true,
++        'dbus': true,
++        'dbusmock': true,
++        'gi': true,
++        'gi.repository.FPrint': true,
++        'pypamtest': get_option('pam'),
++    }
++    python3_available_modules = []
++
++    foreach module, required : python3_test_modules
++        if required and run_command(python3, '-c', 'import @0@'.format(module), check: false).returncode() != 0
++            warning('Python3 module \'' + module + '\' required by test suite not found')
++        endif
++    endforeach
++endif
++
++address_sanitizer = get_option('b_sanitize') == 'address'
+ 
+ cdata = configuration_data()
+ cdata.set_quoted('GETTEXT_PACKAGE', meson.project_name())
+@@ -211,7 +216,9 @@ endif
+ if get_option('gtk_doc')
+     subdir('doc')
+ endif
+-subdir('tests')
++if get_option('tests')
++    subdir('tests')
++endif
+ subdir('po')
+ 
+ output = []
+diff --git a/meson_options.txt b/meson_options.txt
+index 286889ee..73b28f2c 100644
+--- a/meson_options.txt
++++ b/meson_options.txt
+@@ -28,3 +28,7 @@ option('gtk_doc',
+     type: 'boolean',
+     value: false,
+     description: 'Use gtk-doc to build documentation')
++option('tests',
++    type: 'boolean',
++    value: true,
++    description: 'Run tests')
+diff --git a/tests/meson.build b/tests/meson.build
+index 0e5ea3c2..9c96e10b 100644
+--- a/tests/meson.build
++++ b/tests/meson.build
+@@ -16,8 +16,6 @@ python_tests = [
+     # }
+ ]
+ 
+-address_sanitizer = get_option('b_sanitize') == 'address'
+-
+ tests = [
+     'fprintd',
+     'test_fprintd_utils',
+-- 
+GitLab
+
-- 
GitLab