Bug#881491: lintian: update gir checks for gobject-introspection/1.54.1-3 mini-policy

2018-04-04 Thread Chris Lamb
tags 881491 + pending
thanks

Hey,

Awesome stuff Simon. Applied in Git, pending upload:

  
https://anonscm.debian.org/git/lintian/lintian.git/commit/?id=fe02a5111809c41190372c3fd7519f24c4d57221


Regards,

-- 
  ,''`.
 : :'  : Chris Lamb
 `. `'`  la...@debian.org / chris-lamb.co.uk
   `-



Bug#881491: lintian: update gir checks for gobject-introspection/1.54.1-3 mini-policy

2018-04-03 Thread Simon McVittie
On Sun, 12 Nov 2017 at 12:35:40 +, Simon McVittie wrote:
> gobject-introspection/1.54.1-3 [contains] GIR mini-policy
> updates aimed at reducing false positives from Lintian.
...
> This gives Lintian enough information to avoid some unnecessary warnings
> when the attached patches are applied.

On Sun, 12 Nov 2017 at 13:29:05 +, Simon McVittie wrote:
> Looking at the archive's Lintian warnings, we also need to specify what
> to do about the rare typelibs that contain underscores (like v_sim)

I've rebased these patches (no changes) and pushed them to:

https://salsa.debian.org/smcv/lintian.git -b gir-881491

Reviews welcome. They still pass tests against current Lintian, after I
re-wrap an (unrelated) over-long line in d/changelog that trips a coding
style check.

The mini-policy change that mandates the same thing checked by the last
commit was released in gobject-introspection/1.54.1-4 and has been in
buster since late December.

Most (all?) GNOME packages already comply with the new mini-policy, so
applying these patches would fix many of their false-positives.

Thanks,
smcv



Bug#881491: lintian: update gir checks for gobject-introspection/1.54.1-3 mini-policy

2017-11-12 Thread Simon McVittie
On Sun, 12 Nov 2017 at 12:35:40 +, Simon McVittie wrote:
> I've just uploaded gobject-introspection/1.54.1-3, with GIR mini-policy
> updates aimed at reducing false positives from Lintian.

Looking at the archive's Lintian warnings, we also need to specify what
to do about the rare typelibs that contain underscores (like v_sim) -
current Lintian gives an impossible recommendation, since underscores
aren't allowed in package names. I've chosen to replace underscores
with hyphen/minus. See attached patch, corresponding to a policy.txt
change committed to gobject-introspection svn but not yet released.

smcv
>From 41444673f26a4a54bf163f25e04c05a3581ebd36 Mon Sep 17 00:00:00 2001
From: Simon McVittie 
Date: Sun, 12 Nov 2017 13:22:27 +
Subject: [PATCH] gir: Replace underscore in typelib name with hyphen in
 package name

v_sim-3.7.gir in the v-sim package would otherwise produce an
invalid package name.

Signed-off-by: Simon McVittie 
---
 checks/gir.pm | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/checks/gir.pm b/checks/gir.pm
index 90d4ae134..eb4ab5d6e 100644
--- a/checks/gir.pm
+++ b/checks/gir.pm
@@ -112,6 +112,7 @@ sub _run_binary {
   GIR: foreach my $gir (@girs) {
 my $expected = 'gir1.2-' . lc($gir->basename);
 $expected =~ s/\.gir$//;
+$expected =~ tr/_/-/;
 my $version = $info->field('version');
 
 foreach my $bin ($group->get_binary_processables) {
@@ -131,6 +132,7 @@ sub _run_binary {
 foreach my $typelib (@typelibs) {
 my $expected = 'gir1.2-' . lc($typelib->basename);
 $expected =~ s/\.typelib$//;
+$expected =~ tr/_/-/;
 if ($pkg ne $expected
 and not $info->relation('provides')->implies($expected)) {
 tag('typelib-package-name-does-not-match', $typelib, $expected);
-- 
2.15.0



Bug#881491: lintian: update gir checks for gobject-introspection/1.54.1-3 mini-policy

2017-11-12 Thread Simon McVittie
Package: lintian
Version: 2.5.59
Severity: wishlist
Tags: patch
X-Debbugs-Cc: debian-gtk-gn...@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 
Date: Thu, 2 Nov 2017 14:50:04 +
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 
---
 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 
Date: Sat, 11 Nov 2017 14:04:20 +
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 
---
 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 (Foo-23.typelib)
  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, gir1.2-glib-2.0 is named for the GLib-2.0
- typelib, but also contains the GObject-2.0 and Gio-2.0
- typelibs; this is unconventional, but is allowed.
+ If multiple typelibs are shipped in the same package, then that package
+ should have versioned Provides 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, gir1.2-gtk-3.0 is named for the Gtk-3.0
+ typelib, but also contains the Gdk-3.0 and GdkX11-3.0
+ typelibs. It should have versioned Provides entries for
+ gir1.2-gdk-3.0 (= ${binary:Version})
+ and gir1.2-gdkx11-3.0 (= ${binary:Version}) 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 
Date: Sat, 11 Nov 2017 14:01:03 +
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