Subject: libnfc-bin: Add Appstream metainfo announcing HW support

From: Petter Reinholdtsen <[email-masked]>
Date: Mon, 02 Sep 2024 10:29:46 +0200

Package: libnfc-bin
Version: 1.8.0-2
Tags: patch
User: [email-masked]
Usertags: appstream-modalias

Here is a draft patch to add Appstream metainfo XML announcing the
hardware handled by this package.  The USB IDs were fetched from ones
listed in ./contrib/udev/93-pn53x.rules.  This is related to the lintian
warning appstream-metadata-missing-modalias-provide.  If you agree that
it make more sense to propose libnfc-bin over libnfc6, the lintian issue
should probably be overrided.

Including this information in the package will ensure programs mapping
hardware to packages using Appstream information, like the isenkram
package, will know that this package is useful on machines where the
hardware is discovered.

The appstream metadata file can be checked using this command after
package build:

  appstreamcli validate-tree  --no-net --explain debian/libnfc-bin

diff --git a/debian/libnfc-bin.install b/debian/libnfc-bin.install
index 84f5396..d0ebaf4 100644
--- a/debian/libnfc-bin.install
+++ b/debian/libnfc-bin.install
@@ -7,3 +7,4 @@ usr/bin/nfc-mfultralight
 usr/bin/nfc-read-forum-tag3
 usr/bin/nfc-relay-picc
 usr/bin/nfc-scan-device
+usr/share/metainfo/org.nfc_tools.libnfc_bin.metainfo.xml
diff --git a/debian/patches/1000-appstream-metainfo.patch b/debian/patches/1000-appstream-metainfo.patch
new file mode 100644
index 0000000..2c4c670
--- /dev/null
+++ b/debian/patches/1000-appstream-metainfo.patch
@@ -0,0 +1,58 @@
+Description: Added AppStream metainfo XML with hardware provide info.
+ This allow isenkram to propose this package when the relevant hardware is
+ present.
+Author: Petter Reinholdtsen
+Forwarded: no
+Last-Update: 2024-09-02
+---
+Index: libnfc-1.8.0/org.nfc_tools.libnfc_bin.metainfo.xml
+===================================================================
+--- /dev/null  1970-01-01 00:00:00.000000000 +0000
++++ libnfc-1.8.0/org.nfc_tools.libnfc_bin.metainfo.xml 2024-09-02 10:13:11.573555592 +0200
+@@ -0,0 +1,29 @@
++<?xml version="1.0" encoding="UTF-8"?>
++<component>
++  <id>org.nfc_tools.libnfc_bin</id>
++  <metadata_license>MIT</metadata_license>
++  <name>libnfc-bin</name>
++  <summary>Near Field Communication (NFC) binaries</summary>
++  <description>
++    <p>libnfc is a library for Near Field Communication. It abstracts
++    the low-level details of communicating with the devices away
++    behind an easy-to-use high-level API.  It supports most hardware
++    based on the NXP PN531, PN532 or PN533 controller chips.</p>
++
++    <p>This package contains some utils that come along with libnfc,
++    for development or debugging purposes (including nfc-list,
++    nfc-mfclassic, nfc-mfultralight, etc).</p>
++  </description>
++  <url type="homepage">http://www.nfc-tools.org/</url>
++  <provides>
++    <modalias>usb:v04CCp0531d*</modalias>
++    <modalias>usb:v04CCp2533d*</modalias>
++    <modalias>usb:v04E6p5591d*</modalias>
++    <modalias>usb:v04E6p5594d*</modalias>
++    <modalias>usb:v054Cp0193d*</modalias>
++    <modalias>usb:v054Cp02E1d*</modalias>
++    <modalias>usb:v072Fp2200d*</modalias>
++    <modalias>usb:v072Fp90CCd*</modalias>
++    <modalias>usb:v1FD3p0608d*</modalias>
++  </provides>
++</component>
+Index: libnfc-1.8.0/Makefile.am
+===================================================================
+--- libnfc-1.8.0.orig/Makefile.am      2024-09-02 10:04:00.000000000 +0200
++++ libnfc-1.8.0/Makefile.am   2024-09-02 10:14:03.330179459 +0200
+@@ -15,7 +15,11 @@
+       README.md \
+       README-Windows.md \
+       libnfc.conf.sample \
+-      mingw-cross-compile.sh
++      mingw-cross-compile.sh \
++      org.nfc_tools.libnfc_bin.metainfo.xml
++ 
++dist_metainfo_DATA = org.nfc_tools.libnfc_bin.metainfo.xml
++metainfodir = $(datarootdir)/metainfo
+ 
+ CLEANFILES = Doxygen.log coverage.info libnfc.pc
+ 
diff --git a/debian/patches/series b/debian/patches/series
index 70bb863..edfabd4 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1 +1,2 @@
 fix_timeout_message_with_ACR122U.patch
+1000-appstream-metainfo.patch

-- 
Happy hacking
Petter Reinholdtsen