testing/fprintd: new aport

This commit is contained in:
Jakub Jirutka 2021-09-12 02:44:19 +02:00
parent 94da6d12e3
commit beba7f10c7
6 changed files with 232 additions and 0 deletions

73
testing/fprintd/APKBUILD Normal file
View File

@ -0,0 +1,73 @@
# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
#
# TODO: Figure out how to ditch out Polkit (make it optional).
pkgname=fprintd
pkgver=1.94.0
pkgrel=0
pkgdesc="Daemon that provides fingerprint scanning functionality over D-Bus"
url="https://fprint.freedesktop.org/"
arch="all"
license="GPL-2.0-or-later"
depends="dbus"
makedepends="
bash
basu-dev
cmd:pod2man
gettext-dev
libfprint-dev>=$pkgver
linux-pam-dev
meson
polkit-dev
"
checkdepends="
dbus
py3-cairo
py3-dbus
py3-dbusmock
"
subpackages="$pkgname-doc $pkgname-lang $pkgname-pam"
source="https://gitlab.freedesktop.org/libfprint/fprintd/-/archive/v$pkgver/$pkgname-v$pkgver.tar.gz
add-test-feature-and-make-tests-optional.patch
add-configure-option-for-libsystemd-provider.patch
pam-include-time.patch
pam-use-basu-and-remove-sd-login.patch
fix-missing-libintl.patch
"
builddir="$srcdir/$pkgname-v$pkgver"
options="!check" # tests are broken, they expect fprintd installed in "/"
build() {
abuild-meson \
-Dman=true \
-Dgtk_doc=false \
-Dsystemd=false \
-Dlibsystemd=basu \
-Dpam=true \
-Dtest=disabled \
output
meson compile ${JOBS:+-j ${JOBS}} -C output
}
check() {
meson test -C output --no-rebuild --print-errorlogs --no-stdsplit
}
package() {
DESTDIR="$pkgdir" meson install -C output --no-rebuild
}
pam() {
pkgdesc="PAM module for fingerprint authentication"
amove lib/security
}
sha512sums="
4b85da1cdadd2d6e2e6648dc269e82e4b4e8761c5d03445a2a514c823c47984662e01df975416d81279f0ba682f78fd65fc35fb5e3902269e4e76b6be36d7b61 fprintd-v1.94.0.tar.gz
d1526a4870f38b7681a6cdfa57e380038a1203380e5c1012c162bf4ad9ff77dc62ce534b66491e12056e5b956cbd3e271934cee8268dd63890c69605f98fa905 add-test-feature-and-make-tests-optional.patch
0e4612f51b9ecaffefb407e877837633828ac4b2a40f371e11c32c0e375772a64ca2ce2a2da7de03fdbc15512a3d0b8ec9939107fc52dcd57312c153e08d8bc8 add-configure-option-for-libsystemd-provider.patch
08d489d3dce24f921777f5e90f716596aee99f8d1dfe794368bf92bd39313731225e0750375826454c22974316fd9d13b7e6405ae3f1f5b54dd418e61d512589 pam-include-time.patch
0fd20371cb710095db6ab0ca80db6308e876b44455be22f77297c756e7ed8a5292687706928f33015477ddc01b4f939ba7e111d56a90396ced863f5dc6948a84 pam-use-basu-and-remove-sd-login.patch
4e1aee3c3250924a48f45a28f2f624f15641fe9957987bdd61df8f4af1253e7d56d913570101fd05c37cd0e917be1391d44ae6ab7246119b462515e1159ad952 fix-missing-libintl.patch
"

View File

@ -0,0 +1,25 @@
Patch-Source: https://github.com/gentoo/gentoo/blob/ac511bd4faafe3534b81d5a6d7f685cb8391b1b0/sys-auth/fprintd/files/fprintd-1.90.8_0002-add-configure-option-for-libsystemd-provider.patch
--- a/meson.build 2020-12-13 08:08:13.886367478 +0100
+++ b/meson.build 2020-12-13 08:30:16.056756878 +0100
@@ -84,7 +84,7 @@
libfprint_dep = dependency('libfprint-2', version: '>=' + libfprint_min_version)
polkit_gobject_dep = dependency('polkit-gobject-1', version: '>= 0.91')
dbus_dep = dependency('dbus-1', required: false)
-libsystemd_dep = dependency('libsystemd', required: get_option('pam'))
+libsystemd_dep = dependency(get_option('libsystemd'), required: get_option('pam'))
pam_dep = cc.find_library('pam',
required: get_option('pam'),
has_headers: 'security/pam_modules.h',
--- a/meson_options.txt 2020-12-13 08:08:13.886367478 +0100
+++ b/meson_options.txt 2020-12-13 08:26:57.111919403 +0100
@@ -10,6 +10,10 @@
description: 'Install system service files',
type: 'boolean',
value: true)
+option('libsystemd',
+ description: 'Libsystemd provider (libsystemd or libelogind)',
+ type: 'string',
+ value: 'libsystemd')
option('systemd_system_unit_dir',
description: 'Directory for systemd service files',
type: 'string')

View File

@ -0,0 +1,71 @@
From: Martin Gysel <me@bearsh.org>
Date: Thu, 19 Nov 2020 07:04:10 +0100
Subject: [PATCH 1/2] add test feature and make tests optional
---
meson.build | 14 ++++++++++----
meson_options.txt | 4 ++++
2 files changed, 14 insertions(+), 4 deletions(-)
Patch-Source: https://github.com/gentoo/gentoo/blob/3b3bd2d66b15d3ec1c8b2a41043cfc2e6aa0f738/sys-auth/fprintd/files/fprintd-1.90.7_0001-add-test-feature-and-make-tests-optional.patch
diff --git a/meson.build b/meson.build
--- a/meson.build
+++ b/meson.build
@@ -137,7 +137,7 @@
polkit_policy_directory = polkit_gobject_dep.get_pkgconfig_variable('policydir')
# Tests dependencies
-pam_wrapper_dep = dependency('pam_wrapper', required: get_option('pam'))
+pam_wrapper_dep = dependency('pam_wrapper', required: get_option('pam') and get_option('test').enabled() )
xmllint = find_program('xmllint', required: false)
python3 = find_program('python3') # No meson without it!
@@ -151,11 +151,13 @@
}
python3_available_modules = []
+if get_option('test').enabled()
foreach module, required : python3_test_modules
if required and run_command(python3, '-c', 'import @0@'.format(module)).returncode() != 0
error('Python3 module \'' + module + '\' required by test suite not found')
endif
endforeach
+endif
cdata = configuration_data()
cdata.set_quoted('GETTEXT_PACKAGE', meson.project_name())
@@ -179,7 +181,9 @@
if get_option('gtk_doc')
subdir('doc')
endif
-subdir('tests')
+if get_option('test').enabled()
+ subdir('tests')
+endif
subdir('po')
output = []
@@ -201,7 +205,9 @@
output += ' Manuals: ' + get_option('man').to_string()
output += ' GTK Doc: ' + get_option('gtk_doc').to_string()
output += ' XML Linter ' + xmllint.found().to_string()
-output += '\nTest setup:\n'
-output += ' With address sanitizer: ' + address_sanitizer.to_string()
+if get_option('test').enabled()
+ output += '\nTest setup:\n'
+ output += ' With address sanitizer: ' + address_sanitizer.to_string()
+endif
message('\n'+'\n'.join(output)+'\n')
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('test',
+ type: 'feature',
+ value: 'disabled',
+ description: 'Enable tests')

View File

@ -0,0 +1,23 @@
--- a/meson.build
+++ b/meson.build
@@ -97,6 +97,10 @@
required: get_option('pam'),
has_headers: 'security/pam_modules.h',
)
+intl_dep = cc.find_library('intl',
+ required: get_option('pam'),
+ has_headers: 'libintl.h',
+)
pod2man = find_program('pod2man', required: get_option('man'))
xsltproc = find_program('xsltproc', required: get_option('gtk_doc'))
--- a/pam/meson.build
+++ b/pam/meson.build
@@ -16,6 +16,7 @@
dependencies: [
libsystemd_dep,
pam_dep,
+ intl_dep,
],
c_args: [
'-DLOCALEDIR="@0@"'.format(localedir),

View File

@ -0,0 +1,16 @@
Fix missing import:
../pam/pam_fprintd.c: In function 'now':
../pam/pam_fprintd.c:76:3: error: implicit declaration of function 'clock_gettime' [-Werror=implicit-function-declaration]
76 | clock_gettime (CLOCK_MONOTONIC, &ts);
--- a/pam/pam_fprintd.c
+++ b/pam/pam_fprintd.c
@@ -36,6 +36,7 @@
#include <signal.h>
#include <sys/signalfd.h>
#include <poll.h>
+#include <time.h>
#define PAM_SM_AUTH
#include <security/pam_modules.h>

View File

@ -0,0 +1,24 @@
--- a/pam/pam_fprintd.c
+++ b/pam/pam_fprintd.c
@@ -31,8 +31,7 @@
#include <errno.h>
#include <libintl.h>
-#include <systemd/sd-bus.h>
-#include <systemd/sd-login.h>
+#include <basu/sd-bus.h>
#include <signal.h>
#include <sys/signalfd.h>
#include <poll.h>
@@ -775,8 +774,9 @@
strcmp (rhost, "localhost") != 0)
return true;
- if (sd_session_is_remote (NULL) > 0)
- return true;
+// XXX-Patched: Remove dependency on elogind.
+//if (sd_session_is_remote (NULL) > 0)
+// return true;
return false;
}