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

Bug#528001: Bug#566820: lintian: Warn about missing debian/source/format, advise switch to new 3.0 source formats



tag 566820 + patch
thanks

Hi,

On Tue, 02 Mar 2010, Russ Allbery wrote:
> > Do you want a patch for this? If yes, should it be a new check file or
> > do you want it integrated in one of the existing check file?
> 
> At first glance, asking people to declare the source format explicitly
> seems like a good idea.  I'm more reluctant to have Lintian recommend
> switching to 3.0.  Based on the debian-devel discussion, I'm not sure the
> idea has aged enough to make people comfortable with it.  But if they
> don't have any declared source format at present, I'm certainly fine with
> Lintian suggesting they consider it.
> 
> I think having a new check script that checks files in debian/source would
> be a good idea.  I'm not sure what to call it.  source-control, maybe?
> That could be confused with something that tests VCS usage, though.

Ok, I went for "debian-source-dir". In the process, I found other oddities
that I fixed so you really have 5 patches to apply.

I kept the pedantic tag using-old-source-format but you can comment it
if you prefer.

> >> It might also be a good idea to have "unknown-source-format" when
> >> debian/source/format contains something else than "1.0", "2.0", "3.0
> >> (quilt)", "3.0 (native)", "3.0 (git)", "3.0 (bzr)". This one should
> >> result in an error.
> 
> Yes, please.

Also done.

> If you feel energetic, there's also #528001, and it would be nice to warn
> about unrecognized files in debian/source to catch people who have
> misspelled the control file name.

I added the check for unrecognized files in debian/source but the rest
I won't do (at least not now).

The list of debian/source/ files recognized is now longer... here's the
description I used:

N: 
N:    The source package contains a file in debian/source/ that lintian
N:    doesn't know about. Currently the following files are recognized:
N:    
N:     * format
N:     * include-binaries
N:     * lintian-overrides
N:     * options
N:     * patch-header
N:    
N:    This tag is emitted in case you mistyped the name of one of the above
N:    files. If that's not the case and if the file can be legitimately be
N:    expected in source packages, please file a bug against lintian asking
N:    for the file to be recognized.
N:    
N:    Severity: important, Certainty: possible

Cheers,
-- 
Raphaël Hertzog

Like what I do? Sponsor me: http://ouaza.com/wp/2010/01/05/5-years-of-freexian/
My Debian goals: http://ouaza.com/wp/2010/01/09/debian-related-goals-for-2010/
>From a2f4384f5d4cbcf536b6a896c9c9a6189f3eb5d9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rapha=C3=ABl=20Hertzog?= <hertzog@debian.org>
Date: Wed, 3 Mar 2010 20:04:34 +0100
Subject: [PATCH 1/5] Simplify collection/debfiles to copy the debian directory entirely
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Despite the comment in the source code, the collector has always collected
the full debian directory and several scripts now depend on this behaviour:
* patch-systems use files below debian/patches/
* po-debconf use files below debian/po/
* debian-source-dir will use files below debian/source/

The line “next if -d $file” should have been “next if -d
"unpacked/debian/$file"” for the script to have its intended behaviour.
---
 collection/debfiles |   13 ++-----------
 1 files changed, 2 insertions(+), 11 deletions(-)

diff --git a/collection/debfiles b/collection/debfiles
index a7664d9..6493741 100755
--- a/collection/debfiles
+++ b/collection/debfiles
@@ -35,14 +35,5 @@ if (-e "debfiles") {
 	or fail("cannot rm old debfiles directory");
 }
 
-mkdir('debfiles', 0777) or fail("cannot mkdir debfiles: $!");
-
-# Don't copy the whole directory, just all files in it.
-opendir(DEBIAN, 'unpacked/debian')
-	or fail("cannot open unpacked/debian/ directory: $!");
-while (my $file=readdir(DEBIAN)) {
-	next if -d $file;
-	copy_dir("unpacked/debian/$file", 'debfiles/')
-		or fail("cannot copy unpacked/debian/$file: $!");
-}
-closedir(DEBIAN);
+# Copy the whole debian directory
+copy_dir("unpacked/debian", "debfiles");
-- 
1.7.0

>From 32662c68108c143e4c6644afb7a5dac9bfe9f147 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rapha=C3=ABl=20Hertzog?= <hertzog@debian.org>
Date: Wed, 3 Mar 2010 20:26:23 +0100
Subject: [PATCH 2/5] New check script debian-source-dir

This script is meant to contain all checks made on debian/source/* files.
This initial implementation only covers debian/source/format.
---
 checks/debian-source-dir      |   61 +++++++++++++++++++++++++++++++++++++++++
 checks/debian-source-dir.desc |   43 +++++++++++++++++++++++++++++
 2 files changed, 104 insertions(+), 0 deletions(-)
 create mode 100644 checks/debian-source-dir
 create mode 100644 checks/debian-source-dir.desc

diff --git a/checks/debian-source-dir b/checks/debian-source-dir
new file mode 100644
index 0000000..8c4281d
--- /dev/null
+++ b/checks/debian-source-dir
@@ -0,0 +1,61 @@
+# debian/source directory content -- lintian check script -*- perl -*-
+
+# Copyright (C) 2010 by Raphaël Hertzog
+#
+# 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::debian_source_dir;
+use strict;
+
+use Lintian::Data;
+use Lintian::Tags qw(tag);
+
+our %KNOWN_FORMATS = (
+    "1.0" => 1,
+    "2.0" => 1,
+    "3.0 (quilt)" => 1,
+    "3.0 (native)" => 1,
+    "3.0 (git)" => 1,
+    "3.0 (bzr)" => 1,
+);
+
+sub run {
+
+my $pkg = shift;
+my $type = shift;
+my $info = shift;
+
+if (-e "debfiles/source/format") {
+    open(FORMAT, "<", "debfiles/source/format") or
+	fail("cannot read debian/source/format: $!");
+    my $format = <FORMAT>;
+    chomp $format;
+    tag "unknown-source-format", $format unless $KNOWN_FORMATS{$format};
+    tag "using-old-source-format" if $format eq "1.0";
+} else {
+    tag "missing-debian-source-format";
+}
+
+}
+
+1;
+
+# Local Variables:
+# indent-tabs-mode: t
+# cperl-indent-level: 4
+# End:
+# vim: syntax=perl sw=4 ts=8 noet shiftround
diff --git a/checks/debian-source-dir.desc b/checks/debian-source-dir.desc
new file mode 100644
index 0000000..0399012
--- /dev/null
+++ b/checks/debian-source-dir.desc
@@ -0,0 +1,43 @@
+Check-Script: debian-source-dir
+Author: Raphaël Hertzog <hertzog@debian.org>
+Abbrev: dsd
+Type: source
+Info: This script looks for mistakes in debian/source/* files.
+Needs-Info: debfiles
+
+Tag: missing-debian-source-format
+Severity: normal
+Certainty: certain
+Info: With the introduction of new source formats, it's now recommended to
+ explicitly select the desired source format in debian/source/format.
+ .
+ If you don't have a good reason to stick with the old format,
+ you should switch to "3.0 (quilt)" (for packages with a separate
+ upstream tarball) or to "3.0 (native)" (for Debian native packages).
+ .
+ If you plan to keep using the old format, you should still create
+ that file and put "1.0" in it. In that case, you are invited to get in
+ touch with debian-dpkg@lists.debian.org to discuss the (technical) reasons
+ why the new formats do not suit you.
+Ref: dpkg-source(1), http://wiki.debian.org/Projects/DebSrc3.0
+
+Tag: unknown-source-format
+Severity: serious
+Certainty: certain
+Info: debian/source/format contains an unknown source format. The
+ formats officially supported by Debian are "3.0 (quilt)", "3.0 (native)"
+ and "1.0". dpkg-source additionnaly supports "2.0", "3.0 (git)" and
+ "3.0 (bzr)".
+Ref: dpkg-source(1)
+
+Tag: using-old-source-format
+Severity: pedantic
+Certainty: certain
+Info: The source package is still using the old source format "1.0" while
+ "3.0 (quilt)" and "3.0 (native)" are the recommended formats for use
+ within Debian.
+ .
+ See http://wiki.debian.org/Projects/DebSrc3.0 for basic information about
+ updating packages to use the new source formats.
+Ref: dpkg-source(1)
+
-- 
1.7.0

>From f2aae4190496649f6254eb9d8f1eb1e619f695a6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rapha=C3=ABl=20Hertzog?= <hertzog@debian.org>
Date: Wed, 3 Mar 2010 20:43:47 +0100
Subject: [PATCH 3/5] Fix description of unsupported-source-format

The check has been modified to allow "3.0 (quilt|native)" but the
description was not updated accordingly.
---
 checks/fields.desc |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/checks/fields.desc b/checks/fields.desc
index 663e66c..1fd2bee 100644
--- a/checks/fields.desc
+++ b/checks/fields.desc
@@ -9,10 +9,9 @@ Info: This script checks the syntax of the fields in package control files,
 Tag: unsupported-source-format
 Severity: serious
 Certainty: certain
-Info: This package uses a different source package format than 1.0.  At
- present, only <tt>Format: 1.0</tt> packages are permitted by the Debian
- archive software.  Newer package formats are supported by dpkg, but they
- should not yet be used for upload to Debian.
+Info: This package uses a different source package format than "1.0",
+ "3.0 (quilt)" or "3.0 (native)". Other packages formats are supported by
+ dpkg-source, but they are not allowed in the Debian archive.
 
 Tag: no-package-name
 Severity: serious
-- 
1.7.0

>From 25adfa59910115b98d79dbc24f2d96063f0f120f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rapha=C3=ABl=20Hertzog?= <hertzog@debian.org>
Date: Wed, 3 Mar 2010 20:47:09 +0100
Subject: [PATCH 4/5] Define source format to be "3.0 (native)"

This makes lintian lintian-clean again after the addition of
the new checks on debian/source/format.
---
 debian/source/format |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
 create mode 100644 debian/source/format

diff --git a/debian/source/format b/debian/source/format
new file mode 100644
index 0000000..89ae9db
--- /dev/null
+++ b/debian/source/format
@@ -0,0 +1 @@
+3.0 (native)
-- 
1.7.0

>From b3fd4cd82e16ced2f245d0aea2414833b9257f7b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rapha=C3=ABl=20Hertzog?= <hertzog@debian.org>
Date: Wed, 3 Mar 2010 21:30:23 +0100
Subject: [PATCH 5/5] New tag unknown-file-in-debian-source

The new tag is issued for unknown/unrecognized files in debian/source/.
---
 checks/debian-source-dir      |   19 +++++++++++++++++++
 checks/debian-source-dir.desc |   16 ++++++++++++++++
 2 files changed, 35 insertions(+), 0 deletions(-)

diff --git a/checks/debian-source-dir b/checks/debian-source-dir
index 8c4281d..c07b837 100644
--- a/checks/debian-source-dir
+++ b/checks/debian-source-dir
@@ -33,6 +33,14 @@ our %KNOWN_FORMATS = (
     "3.0 (bzr)" => 1,
 );
 
+our %KNOWN_FILES = (
+    "format" => 1,
+    "include-binaries" => 1,
+    "lintian-overrides" => 1,
+    "options" => 1,
+    "patch-header" => 1,
+);
+
 sub run {
 
 my $pkg = shift;
@@ -50,6 +58,17 @@ if (-e "debfiles/source/format") {
     tag "missing-debian-source-format";
 }
 
+if (-d "debfiles/source") {
+    opendir(DEBSRC, "debfiles/source") or fail("cannot opendir debian/source/: $!");
+    my $file;
+    while ($file = readdir(DEBSRC)) {
+	next if $file eq "." or $file eq "..";
+	tag "unknown-file-in-debian-source", $file
+	    unless $KNOWN_FILES{$file};
+    }
+    closedir(DEBSRC);
+}
+
 }
 
 1;
diff --git a/checks/debian-source-dir.desc b/checks/debian-source-dir.desc
index 0399012..7e4f029 100644
--- a/checks/debian-source-dir.desc
+++ b/checks/debian-source-dir.desc
@@ -41,3 +41,19 @@ Info: The source package is still using the old source format "1.0" while
  updating packages to use the new source formats.
 Ref: dpkg-source(1)
 
+Tag: unknown-file-in-debian-source
+Severity: important
+Certainty: possible
+Info: The source package contains a file in debian/source/ that lintian
+ doesn't know about. Currently the following files are recognized:
+ .
+  * format
+  * include-binaries
+  * lintian-overrides
+  * options
+  * patch-header
+ .
+ This tag is emitted in case you mistyped the name of one of the above
+ files. If that's not the case and if the file can be legitimately be
+ expected in source packages, please file a bug against lintian asking
+ for the file to be recognized.
-- 
1.7.0


Reply to: