Control: tags -1 + patch

On Wed, 01 Mar 2023 at 10:52:44 +0000, Simon McVittie wrote:
> I'll send the obvious patch when I have a bug number.

Attached, or available from
https://salsa.debian.org/efi-team/libgusb/-/merge_requests/6

    smcv
>From 0b82db8fc0333e9d16e3e0eb9c7fa77b6d47f34c Mon Sep 17 00:00:00 2001
From: Simon McVittie <s...@debian.org>
Date: Wed, 1 Mar 2023 10:25:00 +0000
Subject: [PATCH 1/2] Add a superficial autopkgtest for libgusb-dev

This checks whether the -dev package has all the required dependencies
to link a simple program with libgusb.

Reproduces: #1032183
Signed-off-by: Simon McVittie <s...@debian.org>
---
 debian/tests/control     |  5 +++++
 debian/tests/libgusb-dev | 46 ++++++++++++++++++++++++++++++++++++++++
 2 files changed, 51 insertions(+)
 create mode 100644 debian/tests/control
 create mode 100755 debian/tests/libgusb-dev

diff --git a/debian/tests/control b/debian/tests/control
new file mode 100644
index 0000000..2a91858
--- /dev/null
+++ b/debian/tests/control
@@ -0,0 +1,5 @@
+Tests: libgusb-dev
+Restrictions: allow-stderr, superficial
+Depends:
+ build-essential,
+ libgusb-dev,
diff --git a/debian/tests/libgusb-dev b/debian/tests/libgusb-dev
new file mode 100755
index 0000000..22bec3f
--- /dev/null
+++ b/debian/tests/libgusb-dev
@@ -0,0 +1,46 @@
+#!/bin/sh
+# Copyright 2023 Simon McVittie
+# SPDX-License-Identifier: LGPL-2.1-or-later
+
+set -eux
+
+if [ -n "${AUTOPKGTEST_ARTIFACTS-}" ]; then
+    WORKDIR="$AUTOPKGTEST_ARTIFACTS"
+else
+    WORKDIR="$(mktemp -d)"
+    trap 'cd /; rm -fr "$WORKDIR"' 0 INT QUIT ABRT PIPE TERM
+fi
+
+if [ -n "${DEB_HOST_GNU_TYPE:-}" ]; then
+    CROSS_COMPILE="$DEB_HOST_GNU_TYPE-"
+else
+    CROSS_COMPILE=
+fi
+
+cat >> "$WORKDIR"/trivial.c <<EOF
+#include <gusb.h>
+
+#include <glib.h>
+#include <glib-object.h>
+
+int main (int argc, char *argv[])
+{
+  GError *error = NULL;
+  GUsbContext *context = NULL;
+
+  context = g_usb_context_new (&error);
+
+  if (context == NULL)
+    g_error ("%s", error->message);
+
+  g_object_unref (context);
+  return 0;
+}
+EOF
+
+cd "$WORKDIR"
+
+# Deliberately word-splitting pkg-config's output:
+# shellcheck disable=SC2046
+"${CROSS_COMPILE}gcc" -otrivial trivial.c $("${CROSS_COMPILE}pkg-config" --cflags --libs gusb gobject-2.0 glib-2.0)
+./trivial
-- 
2.39.2

>From d234a8ca7dde5c8d2b0b031270156ea4933e7724 Mon Sep 17 00:00:00 2001
From: Simon McVittie <s...@debian.org>
Date: Wed, 1 Mar 2023 10:39:55 +0000
Subject: [PATCH 2/2] d/control: Add missing dependency libgusb-dev ->
 libjson-glib-dev

Closes: #1032183
Signed-off-by: Simon McVittie <s...@debian.org>
---
 debian/control | 1 +
 1 file changed, 1 insertion(+)

diff --git a/debian/control b/debian/control
index 3a1fa8d..98a8f1c 100644
--- a/debian/control
+++ b/debian/control
@@ -26,6 +26,7 @@ Depends: libgusb2 (= ${binary:Version}),
          ${misc:Depends},
          gir1.2-gusb-1.0 (= ${binary:Version}),
          libglib2.0-dev (>= 2.44.0),
+         libjson-glib-dev,
          libusb-1.0-0-dev
 Description: GLib wrapper around libusb1 - development files
  GUsb is a GObject wrapper for libusb1 that makes it easy to do
-- 
2.39.2

Reply via email to