Package: libgcab-dev
Version: 1.2-3
Severity: important
Tags: patch

Without libglib2.0-dev installed, invoking
`pkg-config --cflags --libs libgcab-1.0` will fail. See attached patch
0001 for the obvious fix.

Please consider adding a superficial autopkgtest: this is easy to do
for -dev packages, and proves that the development library can be used
successfully. See attached patch 0002. I've been adding these to GNOME
team libraries, and started writing one for gcab before I realised it
wasn't a GNOME-team-maintained library :-)

(A more involved autopkgtest using gcab-self-test requires upstream
changes, which I'll propose separately.)

    smcv
>From 51c955c128c969c3f9245a71ce466933a5a0734f Mon Sep 17 00:00:00 2001
From: Simon McVittie <s...@debian.org>
Date: Mon, 2 Sep 2019 09:54:13 +0100
Subject: [PATCH 1/3] libgcab-dev: Add missing dependency on libglib2.0-dev

Without libglib2.0-dev installed, invoking
`pkg-config --cflags --libs libgcab-1.0` will fail.
---
 debian/control | 1 +
 1 file changed, 1 insertion(+)

diff --git a/debian/control b/debian/control
index 78f7daa..eb012c9 100644
--- a/debian/control
+++ b/debian/control
@@ -47,6 +47,7 @@ Multi-Arch: same
 Section: libdevel
 Depends: gir1.2-gcab-1.0 (= ${binary:Version}),
          libgcab-1.0-0 (= ${binary:Version}),
+         libglib2.0-dev,
          ${misc:Depends}
 Suggests: libgcab-doc
 Description: Microsoft Cabinet file manipulation library - development files
-- 
2.23.0

>From 652c561e45a7bf9fd51c58d718d962e5e19f5976 Mon Sep 17 00:00:00 2001
From: Simon McVittie <s...@debian.org>
Date: Mon, 2 Sep 2019 09:04:27 +0100
Subject: [PATCH 2/3] Add a superficial autopkgtest for libgcab-dev

This checks that the -dev package is usable, and in particular detected
the missing dependency fixed by the previous commit.
---
 debian/tests/control     |  5 +++++
 debian/tests/libgcab-dev | 30 ++++++++++++++++++++++++++++++
 2 files changed, 35 insertions(+)
 create mode 100644 debian/tests/control
 create mode 100755 debian/tests/libgcab-dev

diff --git a/debian/tests/control b/debian/tests/control
new file mode 100644
index 0000000..93d2696
--- /dev/null
+++ b/debian/tests/control
@@ -0,0 +1,5 @@
+Tests: libgcab-dev
+Depends: build-essential,
+         libgcab-dev,
+         pkg-config,
+Restrictions: allow-stderr superficial
diff --git a/debian/tests/libgcab-dev b/debian/tests/libgcab-dev
new file mode 100755
index 0000000..93b2a68
--- /dev/null
+++ b/debian/tests/libgcab-dev
@@ -0,0 +1,30 @@
+#!/bin/sh
+# autopkgtest check: Build and run a program against gcab, to verify that the
+# headers and pkg-config file are installed correctly
+# (C) 2012 Canonical Ltd.
+# (C) 2018-2019 Simon McVittie
+# Authors: Martin Pitt, Simon McVittie
+
+set -eux
+
+WORKDIR="$(mktemp -d)"
+export XDG_RUNTIME_DIR="$WORKDIR"
+trap 'rm -rf "$WORKDIR"' 0 INT QUIT ABRT PIPE TERM
+cd "$WORKDIR"
+cat <<EOF > test.c
+#include <libgcab.h>
+
+int main(void)
+{
+    g_assert_cmpuint (GCAB_TYPE_FILE, !=, G_TYPE_INVALID);
+    return 0;
+}
+EOF
+
+# Deliberately word-splitting pkg-config's output:
+# shellcheck disable=SC2046
+gcc -o gcab-test test.c $(pkg-config --cflags --libs libgcab-1.0)
+echo "build: OK"
+[ -x gcab-test ]
+./gcab-test
+echo "run: OK"
-- 
2.23.0

Reply via email to