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

Bug#813904: marked as done (lintian: Check if upstream/metadata files are well formed)



Your message dated Fri, 19 Feb 2016 19:20:40 +0000
with message-id <E1aWqbY-0008Lt-3U@franck.debian.org>
and subject line Bug#813904: fixed in lintian 2.5.41
has caused the Debian Bug report #813904,
regarding lintian: Check if upstream/metadata files are well formed
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact owner@bugs.debian.org
immediately.)


-- 
813904: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=813904
Debian Bug Tracking System
Contact owner@bugs.debian.org with problems
--- Begin Message ---
Package: lintian
Version: 2.5.40.2
Tags: patch

The Debian Med project is using the upstream/metadata YAML files to
store bibliographical references and other stuff, and would like a
lintian check to verify that the files are well formed.  Here is  a
draft patch for doing so.

Is this the correct approach?  This is my first lintian check written
from scratch, so I am a bit unsure about the details.

>From abd573bb63691af164095aa1af64d09d6fa547ff Mon Sep 17 00:00:00 2001
From: Petter Reinholdtsen <pere@hungry.com>
Date: Sat, 6 Feb 2016 15:50:09 +0100
Subject: [PATCH] Add draft lintian check for debian/upstream/metadata.

---
 checks/upstream-metadata.desc | 11 +++++++++
 checks/upstream-metadata.pm   | 57 +++++++++++++++++++++++++++++++++++++++++++
 profiles/debian/main.profile  |  3 ++-
 3 files changed, 70 insertions(+), 1 deletion(-)
 create mode 100644 checks/upstream-metadata.desc
 create mode 100644 checks/upstream-metadata.pm

diff --git a/checks/upstream-metadata.desc b/checks/upstream-metadata.desc
new file mode 100644
index 0000000..2947d9b
--- /dev/null
+++ b/checks/upstream-metadata.desc
@@ -0,0 +1,11 @@
+Check-Script: upstream-metadata
+Author: Petter Reinholdtsen <pere@hungry.com>
+Type: source
+Needs-Info: unpacked, diffstat, file-info, md5sums
+Info: This script checks the <tt>upstream/metadata</tt> file for problems.
+
+Tag: upstream-metadata-yaml-invalid
+Severity: normal
+Certainty: certain
+Info: The DEP 12 metadata file is not well formed.  The formatting
+ need to be adjusted to match the YAML specification.
diff --git a/checks/upstream-metadata.pm b/checks/upstream-metadata.pm
new file mode 100644
index 0000000..98b183c
--- /dev/null
+++ b/checks/upstream-metadata.pm
@@ -0,0 +1,57 @@
+# upstream-metadata -- lintian check script -*- perl -*-
+
+# Copyright © 2016 Petter Reinholdtsen
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, you can find it on the World Wide
+# Web at http://www.gnu.org/copyleft/gpl.html, or write to the Free
+# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
+# MA 02110-1301, USA.
+
+package Lintian::upstream_metadata;
+
+use strict;
+use warnings;
+
+use Lintian::Data;
+use Lintian::Tags qw(tag);
+
+use YAML;
+use Data::Dumper;
+
+sub run {
+    my (undef, undef, $info) = @_;
+    my $droot = $info->index_resolved_path('debian/');
+    return if not $droot;
+    my $dudir = $droot->resolve_path('upstream');
+    return if not $dudir;
+    my $yamlfile = $dudir->resolve_path('metadata') if $dudir;
+    my $path = $yamlfile->fs_path();
+    if ( -f $path ) {
+        # Handle invalid files, the library will die() when it find them.
+        my $yaml;
+        eval '$yaml = YAML::LoadFile($path);';
+        if (! $yaml) {
+            tag('upstream-metadata-yaml-invalid');
+        }
+    }
+    return;
+}
+
+1;
+
+# Local Variables:
+# indent-tabs-mode: nil
+# cperl-indent-level: 4
+# End:
+# vim: syntax=perl sw=4 sts=4 sr et
diff --git a/profiles/debian/main.profile b/profiles/debian/main.profile
index 92adb0d..6476de2 100644
--- a/profiles/debian/main.profile
+++ b/profiles/debian/main.profile
@@ -8,6 +8,7 @@ Enable-Tags-From-Check: apache2, application-not-library, automake, binaries,
  group-checks, huge-usr-share, infofiles, init.d, java, lintian, manpages,
  md5sums, menu-format, menus, nmu, obsolete-sites, ocaml, patch-systems, phppear,
  po-debconf, rules, scripts, shared-libs, source-copyright, standards-version,
- symlinks, systemd, testsuite, usrmerge, version-substvars, watch-file
+ symlinks, systemd, testsuite, upstream-metadata, usrmerge, version-substvars,
+ watch-file
 Disable-Tags: hardening-no-stackprotector
 
-- 
2.1.4

--
Happy hacking
Petter Reinholdtsen

--- End Message ---
--- Begin Message ---
Source: lintian
Source-Version: 2.5.41

We believe that the bug you reported is fixed in the latest version of
lintian, which is due to be installed in the Debian FTP archive.

A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to 813904@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Niels Thykier <niels@thykier.net> (supplier of updated lintian package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmaster@ftp-master.debian.org)


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Format: 1.8
Date: Fri, 19 Feb 2016 18:35:36 +0000
Source: lintian
Binary: lintian
Architecture: source
Version: 2.5.41
Distribution: unstable
Urgency: medium
Maintainer: Debian Lintian Maintainers <lintian-maint@debian.org>
Changed-By: Niels Thykier <niels@thykier.net>
Description:
 lintian    - Debian package checker
Closes: 661003 672297 683059 738187 763270 798900 809440 812723 813013 813904 814041
Changes:
 lintian (2.5.41) unstable; urgency=medium
 .
   * Summary of tag changes:
     + Added:
       - insane-line-length-in-source-file
       - source-contains-prebuilt-pandoc-documentation
       - upstream-metadata-is-not-a-file
       - upstream-metadata-yaml-invalid
     + Removed:
       - package-contains-broken-symlink
 .
   * checks/apache2.desc:
     + [JW] Remove spurious check name abbreviation.
   * checks/binaries.pm:
     + [NT] Update match for detecting numpy linking.
   * checks/cruft.{desc,pm}:
     + [BR] Filter some simple comments for long line in source-is-missing
       (Closes: #798900).
     + [BR] Detect pandoc docs avoiding source-is-missing warning.
     + [BR] Fix other source-is-missing FP. (Closes: #813013).
   * checks/fields.pm:
     + [NT] Emit "no-homepage-field" only for source packages.
   * checks/files.pm:
     + [JW] Treat packages without Multi-Arch field as if they had
       "Multi-Arch: no".  Thanks to Bas Couwenberg for the bug report.
   * checks/scripts.desc:
     + [JW] Fix typos.
   * checks/symlinks.{desc,pm}:
     + [NT] Retire package-contains-broken-symlink tag.  It was too much
       effort compared to the gain.  (Closes: #672297, #683059, #763270,
       #812723, #661003, #738187)
   * checks/testsuite.{desc,pm}:
     + [JW, NT] Apply patch from Christian Seiler to accept DEP-8 tests
       being symlinks to existing files in the source package.  Thanks
       to Raphaël Hertzog for suggesting it.  (Closes: #809440)
   * checks/upstream-metadata.{desc,pm}:
     + [NT] Apply patch from Petter Reinholdtsen to check that the
       upstream metadata file is valid YAML if present.  (Closes: #813904)
 .
   * commands/lab-tool.pm:
     + [NT] New utility to handle most laboratory operations.
   * commands/lintian:
     + [NT] New location for "frontend/lintian".
     + [NT] Refactored to use "dplint" to compute the include dirs.
     + [NT] Remove -S, -R and -r, which are now supported in the new
       lintian-lab-tool command.
 .
   * data/spelling/corrections:
     + [JW] Fix some corrections.
     + [JW] Add more corrections.
   * data/standards-version/release-dates:
     + [NT] Add 3.9.7.  Thanks to Alf Gaida for the reminder.
       (Closes: #814041)
 .
   * debian/control:
     + [JW] Switch from libyaml-perl to libyaml-libyaml-perl in
       Build-Depends and Suggests. (Lintian has been using the latter
       package since 2.5.31.)
     + [NT] Add dependency on libyaml-libyaml-perl for the new
       upstream-metadata check.
     + [NT] Bump Standards-Versions to 3.9.7 - no changes required.
   * debian/{lintian.links,manpages,rules}:
     + [NT] Update to install the new lab-tool command.
 .
   * frontend/lintian:
     + [NT] Move the code to "commands/lintian" and leave a symlink to
       dplint to replace it.
 .
   * helper/coll/objdump-info-helper:
     + [NT] Avoid collecting unused information.
 .
   * lib/Lintian/Path.pm:
     + [NT] Remove the _file_info cache field to avoid paying
       for all "file(1)" info twice.
   * lib/Lintian/Collect/Binary.pm:
     + [NT] Remove unnecessary values on members in the
       objdump_info table.
   * lib/Lintian/*.pm:
     + [JW] Fix typos.
 .
   * man/lintian-lab-tool.pod:
     + [NT] New file.
 .
   * private/generate-lintian-pod:
     + [JW] Fix formatting pathnames followed by punctuation characters.
Checksums-Sha1:
 dd706dcb9087a4a9e6c3490f4434bd5627293119 2789 lintian_2.5.41.dsc
 ff1b79e3d4be3e99aac25b5ee623f62b97cba790 1291336 lintian_2.5.41.tar.xz
Checksums-Sha256:
 2e0e908fe727e1abb07b690000fba5c451f99937e79afe3872ff6e7393ea848c 2789 lintian_2.5.41.dsc
 5007f314482e09849b7476f7e684c2ffad8c3c9ab6b7296b1a813a2f5bed440e 1291336 lintian_2.5.41.tar.xz
Files:
 0f89b1049d5dd7189be904b252bca62a 2789 devel optional lintian_2.5.41.dsc
 5d34a2d0e099f1bbd9b9d2f2adf98f9f 1291336 devel optional lintian_2.5.41.tar.xz

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iQIcBAEBCAAGBQJWx2XKAAoJEAVLu599gGRCA+kP/jKfWoj5uAryevfFus+FB9j9
Ebwd8YlHFjbsulR8+gJKwYYHo0jjMhUMFcZ4vmKmbGKaasF9Eg8kvSCCVoOQ/CAs
4GgfmzsVk9UasAh44NESJ5zvPYQFEmQT4Kbu7VYlRB9T1ljffqPQOgE4L2vszlRM
m1RmTqRuZWTOxQGAuNAPO95S+5RN6XyzFFOkxzjkC3v5mk4OV16BOWJV9FgC0cwE
1p8Vz3+O9MZ5Xz6ImQDWs120A9d+rm1B9aT6X0+i/l0qnGstJ27Hbx6e6kn45f4a
9ERPLaCxMu5dATYrNmAEtvt2UFHGW/THHNUZTDpOPxtSsOCVmB8xzNF9W+0JpgtG
ynsBoTITiSUQ8t+FW2ON0VQ6mZ/40f0Gg01xtwACGqwhWV3xmIwvP7un4xKXuWvg
oNOWyLQGr2e65aJb3Pe2cz4DZCRBrlcfaxB0WEXkoKwah+qBvhPwQQttPlKsHssw
tzO9jF0NAlxaVkiZPL6/e8RwFuBdnKgxLdft3+lsEuPAtEBGoEIPjIruypQ+I5Pm
/lRS1pJ4jCiuGJYP8ECHqy72UqfWbhtRk+jVsyR6j+Mv4003mxr83B04NFTXHttH
jxRBnjwsFfUY5b37cvprCdfCQWsQLsvntsjf4YlC2pUzYAU8azGtNPGqI10uNKi1
ep8o/afGuRF/lPA+bzrv
=QpTT
-----END PGP SIGNATURE-----

--- End Message ---

Reply to: