[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#1032183: libgusb-dev: missing dependency on libjson-glib-1.0-dev



Package: libgusb-dev
Version: 0.4.5-1
Severity: serious
Justification: Policy 7.2

To reproduce:

* Have a minimal Debian chroot or container
* apt install libgusb-dev
* pkg-config --cflags --libs gusb

Expected result: success, compiler flags are shown

Actual result:

> + pkg-config --cflags --libs gusb gobject-2.0 glib-2.0
> Package json-glib-1.0 was not found in the pkg-config search path.
> Perhaps you should add the directory containing `json-glib-1.0.pc'
> to the PKG_CONFIG_PATH environment variable
> Package 'json-glib-1.0', required by 'gusb', not found

I'll send the obvious patch when I have a bug number.

It's easy to reproduce this class of issues with an autopkgtest like
the one added by the attached patch, and running autopkgtest before upload
can detect and prevent these missing dependencies before they reach Debian.

    smcv

-- System Information:
Debian Release: bookworm/sid
  APT prefers unstable-debug
  APT policy: (500, 'unstable-debug'), (500, 'stable-security'), (500, 'oldstable-debug'), (500, 'oldoldstable'), (500, 'buildd-unstable'), (500, 'unstable'), (500, 'testing'), (500, 'stable'), (500, 'oldstable'), (1, 'experimental-debug'), (1, 'buildd-experimental'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 6.1.0-5-amd64 (SMP w/4 CPU threads; PREEMPT)
Locale: LANG=en_GB.utf8, LC_CTYPE=en_GB.utf8 (charmap=UTF-8), LANGUAGE=en_GB:en
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages libgusb-dev depends on:
ii  gir1.2-gusb-1.0     0.4.5-1
ii  libc6               2.36-8
ii  libglib2.0-0        2.74.5-1
ii  libglib2.0-dev      2.74.5-1
ii  libgusb2            0.4.5-1
ii  libjson-glib-1.0-0  1.6.6-1
ii  libusb-1.0-0-dev    2:1.0.26-1

libgusb-dev recommends no packages.

libgusb-dev suggests no packages.

-- no debconf information
>From e5c5697632a33b004cba3c687357f7408a591904 Mon Sep 17 00:00:00 2001
From: Simon McVittie <smcv@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.

Signed-off-by: Simon McVittie <smcv@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


Reply to: