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

Bug#975895: libxkbregistry-dev: missing dependency on libxml2-dev



Package: libxkbregistry-dev
Version: 1.0.3-1
Severity: important
Tags: patch

If you have libxkbregistry-dev installed, but not libxml2-dev:

    $ pkg-config --cflags --libs xkbregistry
    Package libxml-2.0 was not found in the pkg-config search path.
    Perhaps you should add the directory containing `libxml-2.0.pc'
    to the PKG_CONFIG_PATH environment variable
    Package 'libxml-2.0', required by 'xkbregistry', not found

See attached patch 0001 for a trivial solution.

This class of bug is easy to catch with an autopkgtest that links
a trivial executable to the library (and in fact that's how I found
it, by running that type of test on a library that recently gained a
libxkbregistry dependency). Please consider adding a test for each
library in xkbcommon, as in the attached patch 0002.

Thanks,
    smcv

-- System Information:
Debian Release: bullseye/sid
  APT prefers unstable-debug
  APT policy: (500, 'unstable-debug'), (500, 'stable-debug'), (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 5.9.0-3-amd64 (SMP w/8 CPU threads)
Locale: LANG=en_GB.utf8, LC_CTYPE=en_GB.utf8 (charmap=UTF-8), LANGUAGE=en_GB:en
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages libxkbregistry-dev depends on:
ii  libxkbcommon-dev  1.0.3-1
ii  libxkbregistry0   1.0.3-1

libxkbregistry-dev recommends no packages.

libxkbregistry-dev suggests no packages.

-- no debconf information
>From 7c3b7f1b4aa741af5145c991dc7f6b170e25a65b Mon Sep 17 00:00:00 2001
From: Simon McVittie <smcv@debian.org>
Date: Thu, 26 Nov 2020 10:53:46 +0000
Subject: [PATCH 1/2] libxkbregistry-dev: Depend on libxml2-dev

Otherwise, using pkg-config to check for the library or a library that
depends on it can fail:

$ pkg-config --cflags --libs xkbregistry
Package libxml-2.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `libxml-2.0.pc'
to the PKG_CONFIG_PATH environment variable
Package 'libxml-2.0', required by 'xkbregistry', not found

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

diff --git a/debian/control b/debian/control
index 3bc8bf0..27a6f54 100644
--- a/debian/control
+++ b/debian/control
@@ -183,6 +183,7 @@ Pre-Depends: ${misc:Pre-Depends}
 Depends:
  libxkbcommon-dev (= ${binary:Version}),
  libxkbregistry0 (= ${binary:Version}),
+ libxml2-dev,
  ${shlibs:Depends},
  ${misc:Depends}
 Description: library to query available RMLVO - development files
-- 
2.29.2

>From 916af9f7828fba99b54cada57f2c600919f80881 Mon Sep 17 00:00:00 2001
From: Simon McVittie <smcv@debian.org>
Date: Thu, 26 Nov 2020 10:50:38 +0000
Subject: [PATCH 2/2] Add a superficial compile/link/run test for each -dev
 package

This can be used to check that each -dev package is self-contained.

Signed-off-by: Simon McVittie <smcv@debian.org>
---
 debian/tests/control              | 11 +++++++++
 debian/tests/libxkbcommon-dev     | 36 +++++++++++++++++++++++++++++
 debian/tests/libxkbcommon-x11-dev | 37 ++++++++++++++++++++++++++++++
 debian/tests/libxkbregistry-dev   | 38 +++++++++++++++++++++++++++++++
 4 files changed, 122 insertions(+)
 create mode 100644 debian/tests/control
 create mode 100644 debian/tests/libxkbcommon-dev
 create mode 100644 debian/tests/libxkbcommon-x11-dev
 create mode 100644 debian/tests/libxkbregistry-dev

diff --git a/debian/tests/control b/debian/tests/control
new file mode 100644
index 0000000..fb0588f
--- /dev/null
+++ b/debian/tests/control
@@ -0,0 +1,11 @@
+Tests: libxkbcommon-dev
+Restrictions: allow-stderr, superficial
+Depends: build-essential, pkg-config, libxkbcommon-dev
+
+Tests: libxkbcommon-x11-dev
+Restrictions: allow-stderr, superficial
+Depends: build-essential, pkg-config, libxkbcommon-x11-dev
+
+Tests: libxkbregistry-dev
+Restrictions: allow-stderr, superficial
+Depends: build-essential, pkg-config, libxkbregistry-dev
diff --git a/debian/tests/libxkbcommon-dev b/debian/tests/libxkbcommon-dev
new file mode 100644
index 0000000..14fc4a5
--- /dev/null
+++ b/debian/tests/libxkbcommon-dev
@@ -0,0 +1,36 @@
+#!/bin/sh
+# Copyright 2020 Collabora Ltd.
+# Copyright 2020 Simon McVittie
+# SPDX-License-Identifier: MIT
+
+set -eux
+
+if [ -n "${DEB_HOST_GNU_TYPE:-}" ]; then
+    CROSS_COMPILE="$DEB_HOST_GNU_TYPE-"
+    CC="${CROSS_COMPILE}gcc"
+    PKG_CONFIG="${CROSS_COMPILE}pkg-config"
+else
+    CROSS_COMPILE=
+    CC=cc
+    PKG_CONFIG=pkg-config
+fi
+
+cd "$AUTOPKGTEST_TMP"
+
+cat > trivial.c <<EOF
+#undef NDEBUG
+#include <assert.h>
+
+#include <xkbcommon/xkbcommon.h>
+
+int main (void)
+{
+    assert(xkb_keysym_from_name("A", XKB_KEYSYM_NO_FLAGS) == XKB_KEY_A);
+    return 0;
+}
+EOF
+
+# Deliberately word-splitting pkg-config's output:
+# shellcheck disable=SC2046
+"${CC}" -otrivial trivial.c $("${PKG_CONFIG}" --cflags --libs xkbcommon)
+./trivial
diff --git a/debian/tests/libxkbcommon-x11-dev b/debian/tests/libxkbcommon-x11-dev
new file mode 100644
index 0000000..68e6a93
--- /dev/null
+++ b/debian/tests/libxkbcommon-x11-dev
@@ -0,0 +1,37 @@
+#!/bin/sh
+# Copyright 2020 Collabora Ltd.
+# Copyright 2020 Simon McVittie
+# SPDX-License-Identifier: MIT
+
+set -eux
+
+if [ -n "${DEB_HOST_GNU_TYPE:-}" ]; then
+    CROSS_COMPILE="$DEB_HOST_GNU_TYPE-"
+    CC="${CROSS_COMPILE}gcc"
+    PKG_CONFIG="${CROSS_COMPILE}pkg-config"
+else
+    CROSS_COMPILE=
+    CC=cc
+    PKG_CONFIG=pkg-config
+fi
+
+cd "$AUTOPKGTEST_TMP"
+
+cat > trivial.c <<EOF
+#undef NDEBUG
+#include <assert.h>
+
+#include <xkbcommon/xkbcommon-x11.h>
+
+int main (void)
+{
+    int32_t (*func) (xcb_connection_t *) = xkb_x11_get_core_keyboard_device_id;
+    assert(func);
+    return 0;
+}
+EOF
+
+# Deliberately word-splitting pkg-config's output:
+# shellcheck disable=SC2046
+"${CC}" -otrivial trivial.c $("${PKG_CONFIG}" --cflags --libs xkbcommon-x11)
+./trivial
diff --git a/debian/tests/libxkbregistry-dev b/debian/tests/libxkbregistry-dev
new file mode 100644
index 0000000..f4ef176
--- /dev/null
+++ b/debian/tests/libxkbregistry-dev
@@ -0,0 +1,38 @@
+#!/bin/sh
+# Copyright 2020 Collabora Ltd.
+# Copyright 2020 Simon McVittie
+# SPDX-License-Identifier: MIT
+
+set -eux
+
+if [ -n "${DEB_HOST_GNU_TYPE:-}" ]; then
+    CROSS_COMPILE="$DEB_HOST_GNU_TYPE-"
+    CC="${CROSS_COMPILE}gcc"
+    PKG_CONFIG="${CROSS_COMPILE}pkg-config"
+else
+    CROSS_COMPILE=
+    CC=cc
+    PKG_CONFIG=pkg-config
+fi
+
+cd "$AUTOPKGTEST_TMP"
+
+cat > trivial.c <<EOF
+#undef NDEBUG
+#include <assert.h>
+
+#include <xkbcommon/xkbregistry.h>
+
+int main (void)
+{
+    struct rxkb_context *ctx = rxkb_context_new(RXKB_CONTEXT_NO_FLAGS);
+    assert(ctx);
+    rxkb_context_unref(ctx);
+    return 0;
+}
+EOF
+
+# Deliberately word-splitting pkg-config's output:
+# shellcheck disable=SC2046
+"${CC}" -otrivial trivial.c $("${PKG_CONFIG}" --cflags --libs xkbregistry)
+./trivial
-- 
2.29.2


Reply to: