Bug#881491: lintian: update gir checks for gobject-introspection/1.54.1-3 mini-policy
Package: lintian
Version: 2.5.59
Severity: wishlist
Tags: patch
X-Debbugs-Cc: debian-gtk-gnome@lists.debian.org
I've just uploaded gobject-introspection/1.54.1-3, with GIR mini-policy
updates aimed at reducing false positives from Lintian. The mini-policy
now recommends that when multiple GIR typelibs are bundled in a single
package (like gir1.2-gtk-3.0 containing Gtk-3.0, Gdk-3.0 and GdkX11-3.0),
that package should have Provides entries for those typelibs' canonical
package names (in this case gir1.2-gdk-3.0 and gir1.2-gdkx11-3.0).
This gives Lintian enough information to avoid some unnecessary warnings
when the attached patches are applied.
Additionally, patch 0001 silences a false-positive when packages ship
files other than GIR XML in /usr/share/gir-1.0 (gobject-introspection will
probably be the only package to do this, but it seemed more correct to
make this change rather than using an override).
Thanks,
smcv
>From 72fa7ee6c470b1c6051eb4f36342ff97b3550f91 Mon Sep 17 00:00:00 2001
From: Simon McVittie <smcv@debian.org>
Date: Thu, 2 Nov 2017 14:50:04 +0000
Subject: [PATCH 1/4] gir: Only treat *.gir files in usr/share/gir-1.0 as GIR
gir-1.2.rnc, a RELAX NG schema, is in this directory but is not itself
a GIR file.
Signed-off-by: Simon McVittie <smcv@debian.org>
---
checks/gir.pm | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/checks/gir.pm b/checks/gir.pm
index 59d7e4099..b64d19577 100644
--- a/checks/gir.pm
+++ b/checks/gir.pm
@@ -69,7 +69,10 @@ sub _run_binary {
$madir = '${DEB_HOST_MULTIARCH}' unless defined $madir;
if (my $xmldir = $info->index_resolved_path('usr/share/gir-1.0/')) {
- push @girs, $xmldir->children;
+ foreach my $child ($xmldir->children) {
+ next unless $child =~ m/\.gir$/;
+ push @girs, $child;
+ }
}
if (my $dir = $info->index_resolved_path('usr/lib/girepository-1.0/')) {
--
2.15.0
>From 4b5b78db2b0334d1e5f9baae9dca41bd10dbe403 Mon Sep 17 00:00:00 2001
From: Simon McVittie <smcv@debian.org>
Date: Sat, 11 Nov 2017 14:04:20 +0000
Subject: [PATCH 2/4] gir: Allow a Provides on the canonical name for typelib
packages
It's OK for closely related typelibs to be grouped together, as was done
for packages like GLib, GTK+ and Tracker, as long as they are expected
to bump introspection ABI version at the same time. The new mini-policy
version in gobject-introspection/1.54.1-3 recommends that they have
a Provides on all the package names that would have been used if they
were separated (for example gir1.2-gtk-3.0 Provides gir1.2-gdk-3.0 and
gir1.2-gdkx11-3.0). If this is done, we can detect it and suppress the
typelib-package-name-does-not-match tag.
Signed-off-by: Simon McVittie <smcv@debian.org>
---
checks/gir.desc | 15 ++++++++++-----
checks/gir.pm | 3 ++-
2 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/checks/gir.desc b/checks/gir.desc
index 611b4ac54..b154d6a88 100644
--- a/checks/gir.desc
+++ b/checks/gir.desc
@@ -48,11 +48,16 @@ Certainty: possible
Info: GObject-Introspection binary typelibs (<tt>Foo-23.typelib</tt>)
should normally be made available in a package named gir1.2-foo-23.
.
- Please ignore and override this tag if the typelib is deliberately shipped
- in a package whose name does not match the typelib's machine-readable name.
- For example, <tt>gir1.2-glib-2.0</tt> is named for the <tt>GLib-2.0</tt>
- typelib, but also contains the <tt>GObject-2.0</tt> and <tt>Gio-2.0</tt>
- typelibs; this is unconventional, but is allowed.
+ If multiple typelibs are shipped in the same package, then that package
+ should have versioned <tt>Provides</tt> for the names that would have been
+ used for separate packages. This arrangement should only be used if the
+ included typelibs' versions are expected to remain the same at all times.
+ .
+ For example, <tt>gir1.2-gtk-3.0</tt> is named for the <tt>Gtk-3.0</tt>
+ typelib, but also contains the <tt>Gdk-3.0</tt> and <tt>GdkX11-3.0</tt>
+ typelibs. It should have versioned <tt>Provides</tt> entries for
+ <tt>gir1.2-gdk-3.0 (= ${binary:Version})</tt>
+ and <tt>gir1.2-gdkx11-3.0 (= ${binary:Version})</tt> to indicate this.
Ref: /usr/share/doc/gobject-introspection/policy.txt
Tag: typelib-section-not-introspection
diff --git a/checks/gir.pm b/checks/gir.pm
index b64d19577..5001ea0b8 100644
--- a/checks/gir.pm
+++ b/checks/gir.pm
@@ -121,7 +121,8 @@ sub _run_binary {
foreach my $typelib (@typelibs) {
my $expected = 'gir1.2-' . lc($typelib->basename);
$expected =~ s/\.typelib$//;
- if ($pkg ne $expected) {
+ if ($pkg ne $expected
+ and not $info->relation('provides')->implies($expected)) {
tag('typelib-package-name-does-not-match', $typelib, $expected);
}
}
--
2.15.0
>From 965fa362140c573ff0184ee7aa93b92fde3b685f Mon Sep 17 00:00:00 2001
From: Simon McVittie <smcv@debian.org>
Date: Sat, 11 Nov 2017 14:01:03 +0000
Subject: [PATCH 3/4] gir: -dev can Depend on a typelib that Provides the
canonical name
If gir1.2-foo-1.0 bundles typelibs for both Foo-1.0 and FooBar-1.0
(as seen in gir1.2-glib-2.0 and gir1.2-gtk-3.0), and the -dev package
containing the GIR XML for Foo-1.0 and FooBar-1.0 depends on
gir1.2-foo-1.0, then it is unnecessary to depend on gir1.2-foobar-1.0
as well.
Signed-off-by: Simon McVittie <smcv@debian.org>
---
checks/gir.desc | 21 +++++++++++++--------
checks/gir.pm | 12 +++++++++++-
2 files changed, 24 insertions(+), 9 deletions(-)
diff --git a/checks/gir.desc b/checks/gir.desc
index b154d6a88..2c5980af7 100644
--- a/checks/gir.desc
+++ b/checks/gir.desc
@@ -32,14 +32,19 @@ Info: Development packages that contain GObject-Introspection XML files
(for example <tt>gir1.2-foo-23 (= ${binary:Version})</tt> when using
debhelper).
.
- Please ignore and override this tag if the typelib is shipped in a package
- whose name does not match the typelib's machine-readable name, and the
- development package correctly depends on that package instead. For example,
- <tt>gir1.2-glib-2.0</tt> is named for the <tt>GLib-2.0</tt> typelib, but
- also contains the <tt>GObject-2.0</tt> and <tt>Gio-2.0</tt> typelibs, so
- it is correct that <tt>libglib2.0-dev</tt> depends on
- <tt>gir1.2-glib-2.0</tt> but not on <tt>gir1.2-gobject-2.0</tt> or
- <tt>gir1.2-gio-2.0</tt>.
+ If multiple typelibs are shipped in the same package, then that package
+ should have versioned <tt>Provides</tt> for the names that would have been
+ used for separate packages. In this case, Lintian does not emit this tag
+ when a group of binary packages from the same source is checked together.
+ .
+ For example, <tt>libgtk-3-dev</tt> contains <tt>Gtk-3.0.gir</tt>,
+ <tt>Gdk-3.0.gir</tt> and <tt>GdkX11-3.0.gir</tt>.
+ <tt>gir1.2-gtk-3.0</tt> contains all three corresponding typelibs,
+ so it is sufficient for <tt>libgtk-3-dev</tt> to depend on
+ <tt>gir1.2-gtk-3.0</tt>. Giving <tt>gir1.2-gtk-3.0</tt> <tt>Provides</tt>
+ entries for <tt>gir1.2-gdk-3.0 (= ${binary:Version})</tt>
+ and <tt>gir1.2-gdkx11-3.0 (= ${binary:Version})</tt> signals this
+ situation to Lintian.
Ref: /usr/share/doc/gobject-introspection/policy.txt
Tag: typelib-package-name-does-not-match
diff --git a/checks/gir.pm b/checks/gir.pm
index 5001ea0b8..90d4ae134 100644
--- a/checks/gir.pm
+++ b/checks/gir.pm
@@ -109,10 +109,20 @@ sub _run_binary {
}
}
- foreach my $gir (@girs) {
+ GIR: foreach my $gir (@girs) {
my $expected = 'gir1.2-' . lc($gir->basename);
$expected =~ s/\.gir$//;
my $version = $info->field('version');
+
+ foreach my $bin ($group->get_binary_processables) {
+ next unless $bin->pkg_name =~ m/^gir1\.2-/;
+ my $other = $bin->pkg_name.' (= '.$bin->info->field('version').')';
+ if ( $bin->info->relation('provides')->implies($expected)
+ and $info->relation('strong')->implies($other)) {
+ next GIR;
+ }
+ }
+
if (not $info->relation('strong')->implies("$expected (= $version)")) {
tag('gir-missing-typelib-dependency', $gir, $expected);
}
--
2.15.0
>From 7c12b7ea6526f5c412a599dafbd05bb00e1d70e9 Mon Sep 17 00:00:00 2001
From: Simon McVittie <smcv@debian.org>
Date: Sat, 11 Nov 2017 14:11:01 +0000
Subject: [PATCH 4/4] t/tests/gir: Add a test-case for bundling multiple
related typelibs
Signed-off-by: Simon McVittie <smcv@debian.org>
---
t/tests/gir/debian/debian/control.in | 1 +
t/tests/gir/debian/debian/gir1.2-good-42.install | 1 +
t/tests/gir/debian/debian/libgood-42-dev.install | 1 +
t/tests/gir/debian/usr/lib/girepository-1.0/GoodExtras-42.typelib | 1 +
t/tests/gir/debian/usr/share/gir-1.0/GoodExtras-42.gir | 1 +
t/tests/gir/tags | 1 +
6 files changed, 6 insertions(+)
create mode 100644 t/tests/gir/debian/usr/lib/girepository-1.0/GoodExtras-42.typelib
create mode 100644 t/tests/gir/debian/usr/share/gir-1.0/GoodExtras-42.gir
diff --git a/t/tests/gir/debian/debian/control.in b/t/tests/gir/debian/debian/control.in
index 5e3b19237..4c1816727 100644
--- a/t/tests/gir/debian/debian/control.in
+++ b/t/tests/gir/debian/debian/control.in
@@ -20,6 +20,7 @@ Description: {$description}
Package: gir1.2-good-42
Section: introspection
Architecture: any
+Provides: gir1.2-goodextras-42 (= $\{binary:Version\})
Depends: $\{gir:Depends\}, $\{shlibs:Depends\}, $\{misc:Depends\}, libgood-42-0
Description: {$description} - GIR
This is a test package designed to exercise some feature or tag of
diff --git a/t/tests/gir/debian/debian/gir1.2-good-42.install b/t/tests/gir/debian/debian/gir1.2-good-42.install
index 5f80ac46e..5f1692f20 100644
--- a/t/tests/gir/debian/debian/gir1.2-good-42.install
+++ b/t/tests/gir/debian/debian/gir1.2-good-42.install
@@ -1 +1,2 @@
usr/lib/girepository-1.0/Good-42.typelib
+usr/lib/girepository-1.0/GoodExtras-42.typelib
diff --git a/t/tests/gir/debian/debian/libgood-42-dev.install b/t/tests/gir/debian/debian/libgood-42-dev.install
index ae668960b..1bc5a2c48 100644
--- a/t/tests/gir/debian/debian/libgood-42-dev.install
+++ b/t/tests/gir/debian/debian/libgood-42-dev.install
@@ -1,2 +1,3 @@
usr/share/gir-1.0/Good-42.gir
+usr/share/gir-1.0/GoodExtras-42.gir
usr/lib/libgood-42-dev-dummy
diff --git a/t/tests/gir/debian/usr/lib/girepository-1.0/GoodExtras-42.typelib b/t/tests/gir/debian/usr/lib/girepository-1.0/GoodExtras-42.typelib
new file mode 100644
index 000000000..64fba428e
--- /dev/null
+++ b/t/tests/gir/debian/usr/lib/girepository-1.0/GoodExtras-42.typelib
@@ -0,0 +1 @@
+not really a typelib
diff --git a/t/tests/gir/debian/usr/share/gir-1.0/GoodExtras-42.gir b/t/tests/gir/debian/usr/share/gir-1.0/GoodExtras-42.gir
new file mode 100644
index 000000000..59e267dd4
--- /dev/null
+++ b/t/tests/gir/debian/usr/share/gir-1.0/GoodExtras-42.gir
@@ -0,0 +1 @@
+not really GIR
diff --git a/t/tests/gir/tags b/t/tests/gir/tags
index 4350bd613..d358220e9 100644
--- a/t/tests/gir/tags
+++ b/t/tests/gir/tags
@@ -1,6 +1,7 @@
E: gir1.2-bad: typelib-in-arch-all-package usr/lib/girepository-1.0/Bad-23.typelib
I: gir1.2-bad: typelib-not-in-multiarch-directory usr/lib/girepository-1.0/Bad-23.typelib usr/lib/${DEB_HOST_MULTIARCH}/girepository-1.0
I: gir1.2-good-42: typelib-not-in-multiarch-directory usr/lib/girepository-1.0/Good-42.typelib usr/lib/MULTIARCH/girepository-1.0
+I: gir1.2-good-42: typelib-not-in-multiarch-directory usr/lib/girepository-1.0/GoodExtras-42.typelib usr/lib/MULTIARCH/girepository-1.0
W: gir source: typelib-missing-gir-depends gir1.2-bad
W: gir1.2-bad: gir-in-arch-all-package usr/share/gir-1.0/Bad-23.gir
W: gir1.2-bad: gir-missing-typelib-dependency usr/share/gir-1.0/Bad-23.gir gir1.2-bad-23
--
2.15.0
Reply to: