Bug#695345: Please add a check for gobject-introspection packages

2016-09-21 Thread Simon McVittie
Patch version 2 attached, now passes `debian/rules runtests`.

On Wed, 21 Sep 2016 at 18:45:00 +, Niels Thykier wrote:
> In checks/gir.desc:
> +Reference: file:///usr/share/doc/gobject-introspection/policy.txt
>  ^
> 
> The field is "Ref" (consistent error)

Fixed in v2, and I removed file:// as Jakub requested.

> Can give undef warnings if someone was "evil" enough to make the paths a
> file or a symlink.  Trivial work-around is to change the path end with a
> slash (e.g. 'usr/share/gir-1.0/').

Fixed as suggested in v2.

I also hardened it against missing fields (debs::fields-general-missing),
and adjusted the expected result for tests::fields-wrong-section because
typelib-missing-gir-depends is now reported for that test's package
gir1.2-fields-wrong-section-0.1 (this check correctly guesses that it
was meant to be GIR but lacks ${gir:Depends}).

S
>From db1c11b68bea95eec09b3d9398ff7b6ec8774925 Mon Sep 17 00:00:00 2001
From: Simon McVittie 
Date: Wed, 21 Sep 2016 21:49:57 +0100
Subject: [PATCH] Add checks for GObject-Introspection

---
 checks/gir.desc|  89 ++
 checks/gir.pm  | 135 +
 profiles/debian/main.profile   |   2 +-
 t/tests/gir/debian/Makefile|   7 ++
 t/tests/gir/debian/debian/control.in   |  81 +
 t/tests/gir/debian/debian/gir1.2-bad.install   |   2 +
 t/tests/gir/debian/debian/gir1.2-good-42.install   |   1 +
 .../gir/debian/debian/gir1.2-perfect-42.install|   1 +
 t/tests/gir/debian/debian/libgood-42-0.install |   1 +
 t/tests/gir/debian/debian/libgood-42-dev.install   |   2 +
 t/tests/gir/debian/debian/libperfect-42-0.install  |   1 +
 .../gir/debian/debian/libperfect-42-dev.install|   2 +
 .../debian/usr/lib/girepository-1.0/Bad-23.typelib |   1 +
 .../usr/lib/girepository-1.0/Good-42.typelib   |   1 +
 t/tests/gir/debian/usr/lib/libgood-42-0-dummy  |   0
 t/tests/gir/debian/usr/lib/libgood-42-dev-dummy|   0
 t/tests/gir/debian/usr/share/gir-1.0/Bad-23.gir|   1 +
 t/tests/gir/debian/usr/share/gir-1.0/Good-42.gir   |   1 +
 .../gir/debian/usr/share/gir-1.0/Perfect-42.gir|   1 +
 t/tests/gir/desc   |  12 ++
 t/tests/gir/post_test  |   1 +
 t/tests/gir/tags   |   9 ++
 22 files changed, 350 insertions(+), 1 deletion(-)
 create mode 100644 checks/gir.desc
 create mode 100644 checks/gir.pm
 create mode 100644 t/tests/gir/debian/Makefile
 create mode 100644 t/tests/gir/debian/debian/control.in
 create mode 100644 t/tests/gir/debian/debian/gir1.2-bad.install
 create mode 100644 t/tests/gir/debian/debian/gir1.2-good-42.install
 create mode 100644 t/tests/gir/debian/debian/gir1.2-perfect-42.install
 create mode 100644 t/tests/gir/debian/debian/libgood-42-0.install
 create mode 100644 t/tests/gir/debian/debian/libgood-42-dev.install
 create mode 100644 t/tests/gir/debian/debian/libperfect-42-0.install
 create mode 100644 t/tests/gir/debian/debian/libperfect-42-dev.install
 create mode 100644 t/tests/gir/debian/usr/lib/girepository-1.0/Bad-23.typelib
 create mode 100644 t/tests/gir/debian/usr/lib/girepository-1.0/Good-42.typelib
 create mode 100644 t/tests/gir/debian/usr/lib/libgood-42-0-dummy
 create mode 100644 t/tests/gir/debian/usr/lib/libgood-42-dev-dummy
 create mode 100644 t/tests/gir/debian/usr/share/gir-1.0/Bad-23.gir
 create mode 100644 t/tests/gir/debian/usr/share/gir-1.0/Good-42.gir
 create mode 100644 t/tests/gir/debian/usr/share/gir-1.0/Perfect-42.gir
 create mode 100644 t/tests/gir/desc
 create mode 100644 t/tests/gir/post_test
 create mode 100644 t/tests/gir/tags

diff --git a/checks/gir.desc b/checks/gir.desc
new file mode 100644
index 000..611b4ac
--- /dev/null
+++ b/checks/gir.desc
@@ -0,0 +1,89 @@
+Check-Script: gir
+Author: Simon McVittie 
+Type: binary, source
+Info: Checks for GObject-Introspection mini-policy compliance
+Needs-Info: unpacked, bin-pkg-control
+
+Tag: gir-section-not-libdevel
+Severity: normal
+Certainty: certain
+Info: GObject-Introspection XML files
+ (/usr/share/gir-1.0/Foo-23.gir) must be made available in
+ a development package in the libdevel section of the archive.
+ This is normally the same libfoo-dev package that contains
+ other development files.
+Ref: /usr/share/doc/gobject-introspection/policy.txt
+
+Tag: gir-in-arch-all-package
+Severity: normal
+Certainty: certain
+Info: GObject-Introspection XML files
+ (/usr/share/gir-1.0/Foo-23.gir) must be made available in
+ an architecture-dependent package of the same source.
+Ref: /usr/share/doc/gobject-introspection/policy.txt
+
+Tag: gir-missing-typelib-dependency
+Severity: normal
+Certainty: possible
+Info: Development packages that contain GObject-Introspection XML files
+ (/usr/share/gir-1.0/Foo-23.gir) must depend on the package
+ containing the corresponding binary typelib, which 

Bug#695345: Please add a check for gobject-introspection packages

2016-09-21 Thread Jakub Wilk

* Niels Thykier , 2016-09-21, 18:45:

In checks/gir.desc:
+Reference: file:///usr/share/doc/gobject-introspection/policy.txt
^

The field is "Ref" (consistent error)


Also, our reference parser[*] knows about absolute pathnames, but not about 
file URLs, so let's make it:

s,file://,,


[*] See _format_reference in lib/Lintian/Tag/Info.pm.

--
Jakub Wilk



Bug#695345: Please add a check for gobject-introspection packages

2016-09-21 Thread Niels Thykier
Simon McVittie:
> After getting this wrong in Flatpak, I have attached a proposed patch
> for a new "gir" family of checks.
> 
> [...]
> 
> S
> 

Thanks for creating a patch for this. :)

At first glance, I only have a few minor tweaks/recommendations. :)


In checks/gir.desc:
+Reference: file:///usr/share/doc/gobject-introspection/policy.txt
 ^

The field is "Ref" (consistent error)

checks/gir.pm:
+if (my $xmldir = $info->index_resolved_path('usr/share/gir-1.0')) {
+push @girs, $xmldir->children;
+}
+
+if (my $dir = $info->index_resolved_path('usr/lib/girepository-1.0')) {
+push @typelibs, $dir->children;

Can give undef warnings if someone was "evil" enough to make the paths a
file or a symlink.  Trivial work-around is to change the path end with a
slash (e.g. 'usr/share/gir-1.0/'). This makes index_resolved_path return
undef if the path is not a directory.

Thanks,
~Niels



Bug#695345: Please add a check for gobject-introspection packages

2016-09-21 Thread Michael Biebl
Am 21.09.2016 um 20:00 schrieb Simon McVittie:
> After getting this wrong in Flatpak, I have attached a proposed patch
> for a new "gir" family of checks.


Nice co-incidence. I've just uploaded a new version of
gobject-introspection with a small update to policy.txt, mentioning that
multiarch paths are nowadays supported and preferred. And then I thought
to myself that having a lintian check for that would be great :-)

Michael




-- 
Why is it that all of the instruments seeking intelligent life in the
universe are pointed away from Earth?



signature.asc
Description: OpenPGP digital signature


Bug#695345: Please add a check for gobject-introspection packages

2016-09-21 Thread Simon McVittie
After getting this wrong in Flatpak, I have attached a proposed patch
for a new "gir" family of checks.

On Fri, 07 Dec 2012 at 12:10:54 +0100, Michael Biebl wrote:
> 1/ Warn if the gir1.2-foo-X.Y package is not in section "introspection".

W: gir1.2-bad: typelib-section-not-introspection 
usr/lib/girepository-1.0/Bad-23.typelib misc

(This is done for any package that contains a public typelib)

> 2/ Warn if a package installs a .typelib file in the system path without
> using a separate gir1.2 package.

W: gir1.2-bad: typelib-package-name-does-not-match 
usr/lib/girepository-1.0/Bad-23.typelib gir1.2-bad-23

> 3/ Warn if the gir1.2-foo-X.Y package has no ${gir:Depends}

W: gir source: typelib-missing-gir-depends gir1.2-bad

> 4/ Warn if the -dev package has no
> Depends: gir1.2-foo-X.Y (= ${binary:Version}). This one is probably
> tricky for src packages which build multiple -dev packages.

W: gir1.2-bad: gir-missing-typelib-dependency usr/share/gir-1.0/Bad-23.gir 
gir1.2-bad-23

I made this check assume that the correct dependency is based on the
standard naming convention, rather than inspecting the other packages
from the same source and looking for the one that contains the typelib.
Packages that don't follow the standard naming convention (mostly those
that combine multiple typelibs into one package, like GLib) can override
the check, unless someone particularly wants to rewrite this logic.

The new checks also assert that GIR XML and typelibs are both in
architecture-dependent packages and GIR XML is in Section: libdevel,
and emit an "info"-level tag for typelibs that are in the pre-multiarch
directory.

S
>From 0353c27e0eafa9eabca8d8a0e7e356d21e6efa6a Mon Sep 17 00:00:00 2001
From: Simon McVittie 
Date: Wed, 21 Sep 2016 18:35:21 +0100
Subject: [PATCH] Add checks for GObject-Introspection

---
 checks/gir.desc|  89 ++
 checks/gir.pm  | 135 +
 profiles/debian/main.profile   |   2 +-
 t/tests/gir/debian/Makefile|   7 ++
 t/tests/gir/debian/debian/control.in   |  81 +
 t/tests/gir/debian/debian/gir1.2-bad.install   |   2 +
 t/tests/gir/debian/debian/gir1.2-good-42.install   |   1 +
 .../gir/debian/debian/gir1.2-perfect-42.install|   1 +
 t/tests/gir/debian/debian/libgood-42-0.install |   1 +
 t/tests/gir/debian/debian/libgood-42-dev.install   |   2 +
 t/tests/gir/debian/debian/libperfect-42-0.install  |   1 +
 .../gir/debian/debian/libperfect-42-dev.install|   2 +
 .../debian/usr/lib/girepository-1.0/Bad-23.typelib |   1 +
 .../usr/lib/girepository-1.0/Good-42.typelib   |   1 +
 t/tests/gir/debian/usr/lib/libgood-42-0-dummy  |   0
 t/tests/gir/debian/usr/lib/libgood-42-dev-dummy|   0
 t/tests/gir/debian/usr/share/gir-1.0/Bad-23.gir|   1 +
 t/tests/gir/debian/usr/share/gir-1.0/Good-42.gir   |   1 +
 .../gir/debian/usr/share/gir-1.0/Perfect-42.gir|   1 +
 t/tests/gir/desc   |  12 ++
 t/tests/gir/post_test  |   1 +
 t/tests/gir/tags   |   9 ++
 22 files changed, 350 insertions(+), 1 deletion(-)
 create mode 100644 checks/gir.desc
 create mode 100644 checks/gir.pm
 create mode 100644 t/tests/gir/debian/Makefile
 create mode 100644 t/tests/gir/debian/debian/control.in
 create mode 100644 t/tests/gir/debian/debian/gir1.2-bad.install
 create mode 100644 t/tests/gir/debian/debian/gir1.2-good-42.install
 create mode 100644 t/tests/gir/debian/debian/gir1.2-perfect-42.install
 create mode 100644 t/tests/gir/debian/debian/libgood-42-0.install
 create mode 100644 t/tests/gir/debian/debian/libgood-42-dev.install
 create mode 100644 t/tests/gir/debian/debian/libperfect-42-0.install
 create mode 100644 t/tests/gir/debian/debian/libperfect-42-dev.install
 create mode 100644 t/tests/gir/debian/usr/lib/girepository-1.0/Bad-23.typelib
 create mode 100644 t/tests/gir/debian/usr/lib/girepository-1.0/Good-42.typelib
 create mode 100644 t/tests/gir/debian/usr/lib/libgood-42-0-dummy
 create mode 100644 t/tests/gir/debian/usr/lib/libgood-42-dev-dummy
 create mode 100644 t/tests/gir/debian/usr/share/gir-1.0/Bad-23.gir
 create mode 100644 t/tests/gir/debian/usr/share/gir-1.0/Good-42.gir
 create mode 100644 t/tests/gir/debian/usr/share/gir-1.0/Perfect-42.gir
 create mode 100644 t/tests/gir/desc
 create mode 100644 t/tests/gir/post_test
 create mode 100644 t/tests/gir/tags

diff --git a/checks/gir.desc b/checks/gir.desc
new file mode 100644
index 000..64e70e7
--- /dev/null
+++ b/checks/gir.desc
@@ -0,0 +1,89 @@
+Check-Script: gir
+Author: Simon McVittie 
+Type: binary, source
+Info: Checks for GObject-Introspection mini-policy compliance
+Needs-Info: unpacked, bin-pkg-control
+
+Tag: gir-section-not-libdevel
+Severity: normal
+Certainty: certain
+Info: GObject-Introspection XML files
+ (/usr/share/gir-1.0/Foo-23.gir) must be mad

Bug#695345: Please add a check for gobject-introspection packages

2016-04-21 Thread Laurent Bigonville

On Fri, 07 Dec 2012 12:10:54 +0100 Michael Biebl  wrote:

> Hi,
>
> packages shipping gobject-introspection files should follow the mini
> policy outlined at [1].
>
> If they install the introspection files into the system paths, the
> .typelib file should go into a gir1.2-foo-X.Y package.
> The .gir file should be moved into a -dev package.

There are some packages in the archive which install the .gir file in 
the gir1.2-foo-X.Y package (yes this is confusing) instead of the -dev 
one. This should also be tested IMHO.


Also the naming convention for the gir1.2-foo-X.Y should be checked 
based on the name of the .typelib file shipped in it.


Cheers,

Laurent Bigonville



Bug#695345: Please add a check for gobject-introspection packages

2013-09-21 Thread Niels Thykier
On 2012-12-07 12:10, Michael Biebl wrote:
> Package: lintian
> Version: 2.5.10.2
> Severity: wishlist
> 
> Hi,
> 

Hi,

Sorry, progress has been a bit slow in this bug.

> packages shipping gobject-introspection files should follow the mini
> policy outlined at [1].
> 
> If they install the introspection files into the system paths, the
> .typelib file should go into a gir1.2-foo-X.Y package.
> The .gir file should be moved into a -dev package.
> 
> There are some simple checks that lintian could do:
> 1/ Warn if the gir1.2-foo-X.Y package is not in section "introspection".
> This section in the archive has been created explicitly for
> gobject-introspection files.

I have just commited a fix for this entry.

> 2/ Warn if a package installs a .typelib file in the system path without
> using a separate gir1.2 package.
> This is usually an indication that the introspection files should either
> be package-private or be split according to [1]
> 3/ Warn if the gir1.2-foo-X.Y package has no ${gir:Depends}
> 4/ Warn if the -dev package has no
> Depends: gir1.2-foo-X.Y (= ${binary:Version}). This one is probably
> tricky for src packages which build multiple -dev packages.
> 
> Cheers,
> Michael
> 
> [1]
> http://anonscm.debian.org/viewvc/pkg-gnome/desktop/unstable/gobject-introspection/debian/policy.txt?view=markup
> 
> [...]

The rest are still left unfixed for now.
  If you (know someone who) have time to spare and know Perl, you can
now also prototype these checks outside Lintian and then send them back
as/when they mature.  I know it is not the most awesome solution, but I
suspect it could beat waiting for us to do them.

~Niels


-- 
To UNSUBSCRIBE, email to debian-lint-maint-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
Archive: http://lists.debian.org/523e05ce@thykier.net



Bug#695345: Please add a check for gobject-introspection packages

2012-12-07 Thread Michael Biebl
Package: lintian
Version: 2.5.10.2
Severity: wishlist

Hi,

packages shipping gobject-introspection files should follow the mini
policy outlined at [1].

If they install the introspection files into the system paths, the
.typelib file should go into a gir1.2-foo-X.Y package.
The .gir file should be moved into a -dev package.

There are some simple checks that lintian could do:
1/ Warn if the gir1.2-foo-X.Y package is not in section "introspection".
This section in the archive has been created explicitly for
gobject-introspection files.
2/ Warn if a package installs a .typelib file in the system path without
using a separate gir1.2 package.
This is usually an indication that the introspection files should either
be package-private or be split according to [1]
3/ Warn if the gir1.2-foo-X.Y package has no ${gir:Depends}
4/ Warn if the -dev package has no
Depends: gir1.2-foo-X.Y (= ${binary:Version}). This one is probably
tricky for src packages which build multiple -dev packages.

Cheers,
Michael

[1]
http://anonscm.debian.org/viewvc/pkg-gnome/desktop/unstable/gobject-introspection/debian/policy.txt?view=markup


-- System Information:
Debian Release: wheezy/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (200, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 3.2.0-4-amd64 (SMP w/4 CPU cores)
Locale: LANG=de_DE.utf8, LC_CTYPE=de_DE.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages lintian depends on:
ii  binutils   2.22-7.1
ii  bzip2  1.0.6-4
ii  diffstat   1.55-3
ii  file   5.11-2
ii  gettext0.18.1.1-9
ii  hardening-includes 2.2
ii  intltool-debian0.35.0+20060710.1
ii  libapt-pkg-perl0.1.26+b1
ii  libarchive-zip-perl1.30-6
ii  libc-bin   2.13-37
ii  libclass-accessor-perl 0.34-1
ii  libclone-perl  0.31-1+b2
ii  libdpkg-perl   1.16.9
ii  libemail-valid-perl0.190-1
ii  libipc-run-perl0.92-1
ii  libparse-debianchangelog-perl  1.2.0-1
ii  libtimedate-perl   1.2000-1
ii  liburi-perl1.60-1
ii  locales2.13-37
ii  man-db 2.6.3-2
ii  patchutils 0.3.2-1.1
ii  perl [libdigest-sha-perl]  5.14.2-15

lintian recommends no packages.

Versions of packages lintian suggests:
pn  binutils-multiarch 
ii  dpkg-dev   1.16.9
ii  libhtml-parser-perl3.69-2
pn  libperlio-gzip-perl
ii  libtext-template-perl  1.45-2
ii  man-db 2.6.3-2
ii  xz-utils [lzma]5.1.1alpha+20120614-2

-- no debconf information


-- 
To UNSUBSCRIBE, email to debian-lint-maint-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
Archive: 
http://lists.debian.org/20121207111054.16385.19760.report...@pluto.milchstrasse.xx